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.

25856 lines
688KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item zeros, z
  1075. Set numerator/zeros coefficients.
  1076. @item poles, p
  1077. Set denominator/poles coefficients.
  1078. @item gains, k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item format, f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. digital transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @item sp
  1096. S-plane zeros/poles
  1097. @end table
  1098. @item process, r
  1099. Set kind of processing.
  1100. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1101. @item precision, e
  1102. Set filtering precision.
  1103. @table @samp
  1104. @item dbl
  1105. double-precision floating-point (default)
  1106. @item flt
  1107. single-precision floating-point
  1108. @item i32
  1109. 32-bit integers
  1110. @item i16
  1111. 16-bit integers
  1112. @end table
  1113. @item normalize, n
  1114. Normalize filter coefficients, by default is enabled.
  1115. Enabling it will normalize magnitude response at DC to 0dB.
  1116. @item mix
  1117. How much to use filtered signal in output. Default is 1.
  1118. Range is between 0 and 1.
  1119. @item response
  1120. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1121. By default it is disabled.
  1122. @item channel
  1123. Set for which IR channel to display frequency response. By default is first channel
  1124. displayed. This option is used only when @var{response} is enabled.
  1125. @item size
  1126. Set video stream size. This option is used only when @var{response} is enabled.
  1127. @end table
  1128. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1129. order.
  1130. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1131. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1132. imaginary unit.
  1133. Different coefficients and gains can be provided for every channel, in such case
  1134. use '|' to separate coefficients or gains. Last provided coefficients will be
  1135. used for all remaining channels.
  1136. @subsection Examples
  1137. @itemize
  1138. @item
  1139. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1140. @example
  1141. 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
  1142. @end example
  1143. @item
  1144. Same as above but in @code{zp} format:
  1145. @example
  1146. 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
  1147. @end example
  1148. @end itemize
  1149. @section alimiter
  1150. The limiter prevents an input signal from rising over a desired threshold.
  1151. This limiter uses lookahead technology to prevent your signal from distorting.
  1152. It means that there is a small delay after the signal is processed. Keep in mind
  1153. that the delay it produces is the attack time you set.
  1154. The filter accepts the following options:
  1155. @table @option
  1156. @item level_in
  1157. Set input gain. Default is 1.
  1158. @item level_out
  1159. Set output gain. Default is 1.
  1160. @item limit
  1161. Don't let signals above this level pass the limiter. Default is 1.
  1162. @item attack
  1163. The limiter will reach its attenuation level in this amount of time in
  1164. milliseconds. Default is 5 milliseconds.
  1165. @item release
  1166. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1167. Default is 50 milliseconds.
  1168. @item asc
  1169. When gain reduction is always needed ASC takes care of releasing to an
  1170. average reduction level rather than reaching a reduction of 0 in the release
  1171. time.
  1172. @item asc_level
  1173. Select how much the release time is affected by ASC, 0 means nearly no changes
  1174. in release time while 1 produces higher release times.
  1175. @item level
  1176. Auto level output signal. Default is enabled.
  1177. This normalizes audio back to 0dB if enabled.
  1178. @end table
  1179. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1180. with @ref{aresample} before applying this filter.
  1181. @section allpass
  1182. Apply a two-pole all-pass filter with central frequency (in Hz)
  1183. @var{frequency}, and filter-width @var{width}.
  1184. An all-pass filter changes the audio's frequency to phase relationship
  1185. without changing its frequency to amplitude relationship.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item frequency, f
  1189. Set frequency in Hz.
  1190. @item width_type, t
  1191. Set method to specify band-width of filter.
  1192. @table @option
  1193. @item h
  1194. Hz
  1195. @item q
  1196. Q-Factor
  1197. @item o
  1198. octave
  1199. @item s
  1200. slope
  1201. @item k
  1202. kHz
  1203. @end table
  1204. @item width, w
  1205. Specify the band-width of a filter in width_type units.
  1206. @item mix, m
  1207. How much to use filtered signal in output. Default is 1.
  1208. Range is between 0 and 1.
  1209. @item channels, c
  1210. Specify which channels to filter, by default all available are filtered.
  1211. @item normalize, n
  1212. Normalize biquad coefficients, by default is disabled.
  1213. Enabling it will normalize magnitude response at DC to 0dB.
  1214. @item order, o
  1215. Set the filter order, can be 1 or 2. Default is 2.
  1216. @end table
  1217. @subsection Commands
  1218. This filter supports the following commands:
  1219. @table @option
  1220. @item frequency, f
  1221. Change allpass frequency.
  1222. Syntax for the command is : "@var{frequency}"
  1223. @item width_type, t
  1224. Change allpass width_type.
  1225. Syntax for the command is : "@var{width_type}"
  1226. @item width, w
  1227. Change allpass width.
  1228. Syntax for the command is : "@var{width}"
  1229. @item mix, m
  1230. Change allpass mix.
  1231. Syntax for the command is : "@var{mix}"
  1232. @end table
  1233. @section aloop
  1234. Loop audio samples.
  1235. The filter accepts the following options:
  1236. @table @option
  1237. @item loop
  1238. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1239. Default is 0.
  1240. @item size
  1241. Set maximal number of samples. Default is 0.
  1242. @item start
  1243. Set first sample of loop. Default is 0.
  1244. @end table
  1245. @anchor{amerge}
  1246. @section amerge
  1247. Merge two or more audio streams into a single multi-channel stream.
  1248. The filter accepts the following options:
  1249. @table @option
  1250. @item inputs
  1251. Set the number of inputs. Default is 2.
  1252. @end table
  1253. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1254. the channel layout of the output will be set accordingly and the channels
  1255. will be reordered as necessary. If the channel layouts of the inputs are not
  1256. disjoint, the output will have all the channels of the first input then all
  1257. the channels of the second input, in that order, and the channel layout of
  1258. the output will be the default value corresponding to the total number of
  1259. channels.
  1260. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1261. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1262. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1263. first input, b1 is the first channel of the second input).
  1264. On the other hand, if both input are in stereo, the output channels will be
  1265. in the default order: a1, a2, b1, b2, and the channel layout will be
  1266. arbitrarily set to 4.0, which may or may not be the expected value.
  1267. All inputs must have the same sample rate, and format.
  1268. If inputs do not have the same duration, the output will stop with the
  1269. shortest.
  1270. @subsection Examples
  1271. @itemize
  1272. @item
  1273. Merge two mono files into a stereo stream:
  1274. @example
  1275. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1276. @end example
  1277. @item
  1278. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1279. @example
  1280. 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
  1281. @end example
  1282. @end itemize
  1283. @section amix
  1284. Mixes multiple audio inputs into a single output.
  1285. Note that this filter only supports float samples (the @var{amerge}
  1286. and @var{pan} audio filters support many formats). If the @var{amix}
  1287. input has integer samples then @ref{aresample} will be automatically
  1288. inserted to perform the conversion to float samples.
  1289. For example
  1290. @example
  1291. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1292. @end example
  1293. will mix 3 input audio streams to a single output with the same duration as the
  1294. first input and a dropout transition time of 3 seconds.
  1295. It accepts the following parameters:
  1296. @table @option
  1297. @item inputs
  1298. The number of inputs. If unspecified, it defaults to 2.
  1299. @item duration
  1300. How to determine the end-of-stream.
  1301. @table @option
  1302. @item longest
  1303. The duration of the longest input. (default)
  1304. @item shortest
  1305. The duration of the shortest input.
  1306. @item first
  1307. The duration of the first input.
  1308. @end table
  1309. @item dropout_transition
  1310. The transition time, in seconds, for volume renormalization when an input
  1311. stream ends. The default value is 2 seconds.
  1312. @item weights
  1313. Specify weight of each input audio stream as sequence.
  1314. Each weight is separated by space. By default all inputs have same weight.
  1315. @end table
  1316. @subsection Commands
  1317. This filter supports the following commands:
  1318. @table @option
  1319. @item weights
  1320. Syntax is same as option with same name.
  1321. @end table
  1322. @section amultiply
  1323. Multiply first audio stream with second audio stream and store result
  1324. in output audio stream. Multiplication is done by multiplying each
  1325. sample from first stream with sample at same position from second stream.
  1326. With this element-wise multiplication one can create amplitude fades and
  1327. amplitude modulations.
  1328. @section anequalizer
  1329. High-order parametric multiband equalizer for each channel.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item params
  1333. This option string is in format:
  1334. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1335. Each equalizer band is separated by '|'.
  1336. @table @option
  1337. @item chn
  1338. Set channel number to which equalization will be applied.
  1339. If input doesn't have that channel the entry is ignored.
  1340. @item f
  1341. Set central frequency for band.
  1342. If input doesn't have that frequency the entry is ignored.
  1343. @item w
  1344. Set band width in hertz.
  1345. @item g
  1346. Set band gain in dB.
  1347. @item t
  1348. Set filter type for band, optional, can be:
  1349. @table @samp
  1350. @item 0
  1351. Butterworth, this is default.
  1352. @item 1
  1353. Chebyshev type 1.
  1354. @item 2
  1355. Chebyshev type 2.
  1356. @end table
  1357. @end table
  1358. @item curves
  1359. With this option activated frequency response of anequalizer is displayed
  1360. in video stream.
  1361. @item size
  1362. Set video stream size. Only useful if curves option is activated.
  1363. @item mgain
  1364. Set max gain that will be displayed. Only useful if curves option is activated.
  1365. Setting this to a reasonable value makes it possible to display gain which is derived from
  1366. neighbour bands which are too close to each other and thus produce higher gain
  1367. when both are activated.
  1368. @item fscale
  1369. Set frequency scale used to draw frequency response in video output.
  1370. Can be linear or logarithmic. Default is logarithmic.
  1371. @item colors
  1372. Set color for each channel curve which is going to be displayed in video stream.
  1373. This is list of color names separated by space or by '|'.
  1374. Unrecognised or missing colors will be replaced by white color.
  1375. @end table
  1376. @subsection Examples
  1377. @itemize
  1378. @item
  1379. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1380. for first 2 channels using Chebyshev type 1 filter:
  1381. @example
  1382. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1383. @end example
  1384. @end itemize
  1385. @subsection Commands
  1386. This filter supports the following commands:
  1387. @table @option
  1388. @item change
  1389. Alter existing filter parameters.
  1390. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1391. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1392. error is returned.
  1393. @var{freq} set new frequency parameter.
  1394. @var{width} set new width parameter in herz.
  1395. @var{gain} set new gain parameter in dB.
  1396. Full filter invocation with asendcmd may look like this:
  1397. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1398. @end table
  1399. @section anlmdn
  1400. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1401. Each sample is adjusted by looking for other samples with similar contexts. This
  1402. context similarity is defined by comparing their surrounding patches of size
  1403. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1404. The filter accepts the following options:
  1405. @table @option
  1406. @item s
  1407. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1408. @item p
  1409. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1410. Default value is 2 milliseconds.
  1411. @item r
  1412. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1413. Default value is 6 milliseconds.
  1414. @item o
  1415. Set the output mode.
  1416. It accepts the following values:
  1417. @table @option
  1418. @item i
  1419. Pass input unchanged.
  1420. @item o
  1421. Pass noise filtered out.
  1422. @item n
  1423. Pass only noise.
  1424. Default value is @var{o}.
  1425. @end table
  1426. @item m
  1427. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1428. @end table
  1429. @subsection Commands
  1430. This filter supports the following commands:
  1431. @table @option
  1432. @item s
  1433. Change denoise strength. Argument is single float number.
  1434. Syntax for the command is : "@var{s}"
  1435. @item o
  1436. Change output mode.
  1437. Syntax for the command is : "i", "o" or "n" string.
  1438. @end table
  1439. @section anlms
  1440. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1441. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1442. relate to producing the least mean square of the error signal (difference between the desired,
  1443. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1444. A description of the accepted options follows.
  1445. @table @option
  1446. @item order
  1447. Set filter order.
  1448. @item mu
  1449. Set filter mu.
  1450. @item eps
  1451. Set the filter eps.
  1452. @item leakage
  1453. Set the filter leakage.
  1454. @item out_mode
  1455. It accepts the following values:
  1456. @table @option
  1457. @item i
  1458. Pass the 1st input.
  1459. @item d
  1460. Pass the 2nd input.
  1461. @item o
  1462. Pass filtered samples.
  1463. @item n
  1464. Pass difference between desired and filtered samples.
  1465. Default value is @var{o}.
  1466. @end table
  1467. @end table
  1468. @subsection Examples
  1469. @itemize
  1470. @item
  1471. One of many usages of this filter is noise reduction, input audio is filtered
  1472. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1473. @example
  1474. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1475. @end example
  1476. @end itemize
  1477. @subsection Commands
  1478. This filter supports the same commands as options, excluding option @code{order}.
  1479. @section anull
  1480. Pass the audio source unchanged to the output.
  1481. @section apad
  1482. Pad the end of an audio stream with silence.
  1483. This can be used together with @command{ffmpeg} @option{-shortest} to
  1484. extend audio streams to the same length as the video stream.
  1485. A description of the accepted options follows.
  1486. @table @option
  1487. @item packet_size
  1488. Set silence packet size. Default value is 4096.
  1489. @item pad_len
  1490. Set the number of samples of silence to add to the end. After the
  1491. value is reached, the stream is terminated. This option is mutually
  1492. exclusive with @option{whole_len}.
  1493. @item whole_len
  1494. Set the minimum total number of samples in the output audio stream. If
  1495. the value is longer than the input audio length, silence is added to
  1496. the end, until the value is reached. This option is mutually exclusive
  1497. with @option{pad_len}.
  1498. @item pad_dur
  1499. Specify the duration of samples of silence to add. See
  1500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1501. for the accepted syntax. Used only if set to non-zero value.
  1502. @item whole_dur
  1503. Specify the minimum total duration in the output audio stream. See
  1504. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1505. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1506. the input audio length, silence is added to the end, until the value is reached.
  1507. This option is mutually exclusive with @option{pad_dur}
  1508. @end table
  1509. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1510. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1511. the input stream indefinitely.
  1512. @subsection Examples
  1513. @itemize
  1514. @item
  1515. Add 1024 samples of silence to the end of the input:
  1516. @example
  1517. apad=pad_len=1024
  1518. @end example
  1519. @item
  1520. Make sure the audio output will contain at least 10000 samples, pad
  1521. the input with silence if required:
  1522. @example
  1523. apad=whole_len=10000
  1524. @end example
  1525. @item
  1526. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1527. video stream will always result the shortest and will be converted
  1528. until the end in the output file when using the @option{shortest}
  1529. option:
  1530. @example
  1531. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1532. @end example
  1533. @end itemize
  1534. @section aphaser
  1535. Add a phasing effect to the input audio.
  1536. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1537. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1538. A description of the accepted parameters follows.
  1539. @table @option
  1540. @item in_gain
  1541. Set input gain. Default is 0.4.
  1542. @item out_gain
  1543. Set output gain. Default is 0.74
  1544. @item delay
  1545. Set delay in milliseconds. Default is 3.0.
  1546. @item decay
  1547. Set decay. Default is 0.4.
  1548. @item speed
  1549. Set modulation speed in Hz. Default is 0.5.
  1550. @item type
  1551. Set modulation type. Default is triangular.
  1552. It accepts the following values:
  1553. @table @samp
  1554. @item triangular, t
  1555. @item sinusoidal, s
  1556. @end table
  1557. @end table
  1558. @section apulsator
  1559. Audio pulsator is something between an autopanner and a tremolo.
  1560. But it can produce funny stereo effects as well. Pulsator changes the volume
  1561. of the left and right channel based on a LFO (low frequency oscillator) with
  1562. different waveforms and shifted phases.
  1563. This filter have the ability to define an offset between left and right
  1564. channel. An offset of 0 means that both LFO shapes match each other.
  1565. The left and right channel are altered equally - a conventional tremolo.
  1566. An offset of 50% means that the shape of the right channel is exactly shifted
  1567. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1568. an autopanner. At 1 both curves match again. Every setting in between moves the
  1569. phase shift gapless between all stages and produces some "bypassing" sounds with
  1570. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1571. the 0.5) the faster the signal passes from the left to the right speaker.
  1572. The filter accepts the following options:
  1573. @table @option
  1574. @item level_in
  1575. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1576. @item level_out
  1577. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1578. @item mode
  1579. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1580. sawup or sawdown. Default is sine.
  1581. @item amount
  1582. Set modulation. Define how much of original signal is affected by the LFO.
  1583. @item offset_l
  1584. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1585. @item offset_r
  1586. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1587. @item width
  1588. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1589. @item timing
  1590. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1591. @item bpm
  1592. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1593. is set to bpm.
  1594. @item ms
  1595. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1596. is set to ms.
  1597. @item hz
  1598. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1599. if timing is set to hz.
  1600. @end table
  1601. @anchor{aresample}
  1602. @section aresample
  1603. Resample the input audio to the specified parameters, using the
  1604. libswresample library. If none are specified then the filter will
  1605. automatically convert between its input and output.
  1606. This filter is also able to stretch/squeeze the audio data to make it match
  1607. the timestamps or to inject silence / cut out audio to make it match the
  1608. timestamps, do a combination of both or do neither.
  1609. The filter accepts the syntax
  1610. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1611. expresses a sample rate and @var{resampler_options} is a list of
  1612. @var{key}=@var{value} pairs, separated by ":". See the
  1613. @ref{Resampler Options,,"Resampler Options" section in the
  1614. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1615. for the complete list of supported options.
  1616. @subsection Examples
  1617. @itemize
  1618. @item
  1619. Resample the input audio to 44100Hz:
  1620. @example
  1621. aresample=44100
  1622. @end example
  1623. @item
  1624. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1625. samples per second compensation:
  1626. @example
  1627. aresample=async=1000
  1628. @end example
  1629. @end itemize
  1630. @section areverse
  1631. Reverse an audio clip.
  1632. Warning: This filter requires memory to buffer the entire clip, so trimming
  1633. is suggested.
  1634. @subsection Examples
  1635. @itemize
  1636. @item
  1637. Take the first 5 seconds of a clip, and reverse it.
  1638. @example
  1639. atrim=end=5,areverse
  1640. @end example
  1641. @end itemize
  1642. @section arnndn
  1643. Reduce noise from speech using Recurrent Neural Networks.
  1644. This filter accepts the following options:
  1645. @table @option
  1646. @item model, m
  1647. Set train model file to load. This option is always required.
  1648. @end table
  1649. @section asetnsamples
  1650. Set the number of samples per each output audio frame.
  1651. The last output packet may contain a different number of samples, as
  1652. the filter will flush all the remaining samples when the input audio
  1653. signals its end.
  1654. The filter accepts the following options:
  1655. @table @option
  1656. @item nb_out_samples, n
  1657. Set the number of frames per each output audio frame. The number is
  1658. intended as the number of samples @emph{per each channel}.
  1659. Default value is 1024.
  1660. @item pad, p
  1661. If set to 1, the filter will pad the last audio frame with zeroes, so
  1662. that the last frame will contain the same number of samples as the
  1663. previous ones. Default value is 1.
  1664. @end table
  1665. For example, to set the number of per-frame samples to 1234 and
  1666. disable padding for the last frame, use:
  1667. @example
  1668. asetnsamples=n=1234:p=0
  1669. @end example
  1670. @section asetrate
  1671. Set the sample rate without altering the PCM data.
  1672. This will result in a change of speed and pitch.
  1673. The filter accepts the following options:
  1674. @table @option
  1675. @item sample_rate, r
  1676. Set the output sample rate. Default is 44100 Hz.
  1677. @end table
  1678. @section ashowinfo
  1679. Show a line containing various information for each input audio frame.
  1680. The input audio is not modified.
  1681. The shown line contains a sequence of key/value pairs of the form
  1682. @var{key}:@var{value}.
  1683. The following values are shown in the output:
  1684. @table @option
  1685. @item n
  1686. The (sequential) number of the input frame, starting from 0.
  1687. @item pts
  1688. The presentation timestamp of the input frame, in time base units; the time base
  1689. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1690. @item pts_time
  1691. The presentation timestamp of the input frame in seconds.
  1692. @item pos
  1693. position of the frame in the input stream, -1 if this information in
  1694. unavailable and/or meaningless (for example in case of synthetic audio)
  1695. @item fmt
  1696. The sample format.
  1697. @item chlayout
  1698. The channel layout.
  1699. @item rate
  1700. The sample rate for the audio frame.
  1701. @item nb_samples
  1702. The number of samples (per channel) in the frame.
  1703. @item checksum
  1704. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1705. audio, the data is treated as if all the planes were concatenated.
  1706. @item plane_checksums
  1707. A list of Adler-32 checksums for each data plane.
  1708. @end table
  1709. @section asoftclip
  1710. Apply audio soft clipping.
  1711. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1712. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1713. This filter accepts the following options:
  1714. @table @option
  1715. @item type
  1716. Set type of soft-clipping.
  1717. It accepts the following values:
  1718. @table @option
  1719. @item tanh
  1720. @item atan
  1721. @item cubic
  1722. @item exp
  1723. @item alg
  1724. @item quintic
  1725. @item sin
  1726. @end table
  1727. @item param
  1728. Set additional parameter which controls sigmoid function.
  1729. @end table
  1730. @subsection Commands
  1731. This filter supports the all above options as @ref{commands}.
  1732. @section asr
  1733. Automatic Speech Recognition
  1734. This filter uses PocketSphinx for speech recognition. To enable
  1735. compilation of this filter, you need to configure FFmpeg with
  1736. @code{--enable-pocketsphinx}.
  1737. It accepts the following options:
  1738. @table @option
  1739. @item rate
  1740. Set sampling rate of input audio. Defaults is @code{16000}.
  1741. This need to match speech models, otherwise one will get poor results.
  1742. @item hmm
  1743. Set dictionary containing acoustic model files.
  1744. @item dict
  1745. Set pronunciation dictionary.
  1746. @item lm
  1747. Set language model file.
  1748. @item lmctl
  1749. Set language model set.
  1750. @item lmname
  1751. Set which language model to use.
  1752. @item logfn
  1753. Set output for log messages.
  1754. @end table
  1755. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1756. @anchor{astats}
  1757. @section astats
  1758. Display time domain statistical information about the audio channels.
  1759. Statistics are calculated and displayed for each audio channel and,
  1760. where applicable, an overall figure is also given.
  1761. It accepts the following option:
  1762. @table @option
  1763. @item length
  1764. Short window length in seconds, used for peak and trough RMS measurement.
  1765. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1766. @item metadata
  1767. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1768. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1769. disabled.
  1770. Available keys for each channel are:
  1771. DC_offset
  1772. Min_level
  1773. Max_level
  1774. Min_difference
  1775. Max_difference
  1776. Mean_difference
  1777. RMS_difference
  1778. Peak_level
  1779. RMS_peak
  1780. RMS_trough
  1781. Crest_factor
  1782. Flat_factor
  1783. Peak_count
  1784. Noise_floor
  1785. Noise_floor_count
  1786. Bit_depth
  1787. Dynamic_range
  1788. Zero_crossings
  1789. Zero_crossings_rate
  1790. Number_of_NaNs
  1791. Number_of_Infs
  1792. Number_of_denormals
  1793. and for Overall:
  1794. DC_offset
  1795. Min_level
  1796. Max_level
  1797. Min_difference
  1798. Max_difference
  1799. Mean_difference
  1800. RMS_difference
  1801. Peak_level
  1802. RMS_level
  1803. RMS_peak
  1804. RMS_trough
  1805. Flat_factor
  1806. Peak_count
  1807. Noise_floor
  1808. Noise_floor_count
  1809. Bit_depth
  1810. Number_of_samples
  1811. Number_of_NaNs
  1812. Number_of_Infs
  1813. Number_of_denormals
  1814. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1815. this @code{lavfi.astats.Overall.Peak_count}.
  1816. For description what each key means read below.
  1817. @item reset
  1818. Set number of frame after which stats are going to be recalculated.
  1819. Default is disabled.
  1820. @item measure_perchannel
  1821. Select the entries which need to be measured per channel. The metadata keys can
  1822. be used as flags, default is @option{all} which measures everything.
  1823. @option{none} disables all per channel measurement.
  1824. @item measure_overall
  1825. Select the entries which need to be measured overall. The metadata keys can
  1826. be used as flags, default is @option{all} which measures everything.
  1827. @option{none} disables all overall measurement.
  1828. @end table
  1829. A description of each shown parameter follows:
  1830. @table @option
  1831. @item DC offset
  1832. Mean amplitude displacement from zero.
  1833. @item Min level
  1834. Minimal sample level.
  1835. @item Max level
  1836. Maximal sample level.
  1837. @item Min difference
  1838. Minimal difference between two consecutive samples.
  1839. @item Max difference
  1840. Maximal difference between two consecutive samples.
  1841. @item Mean difference
  1842. Mean difference between two consecutive samples.
  1843. The average of each difference between two consecutive samples.
  1844. @item RMS difference
  1845. Root Mean Square difference between two consecutive samples.
  1846. @item Peak level dB
  1847. @item RMS level dB
  1848. Standard peak and RMS level measured in dBFS.
  1849. @item RMS peak dB
  1850. @item RMS trough dB
  1851. Peak and trough values for RMS level measured over a short window.
  1852. @item Crest factor
  1853. Standard ratio of peak to RMS level (note: not in dB).
  1854. @item Flat factor
  1855. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1856. (i.e. either @var{Min level} or @var{Max level}).
  1857. @item Peak count
  1858. Number of occasions (not the number of samples) that the signal attained either
  1859. @var{Min level} or @var{Max level}.
  1860. @item Noise floor dB
  1861. Minimum local peak measured in dBFS over a short window.
  1862. @item Noise floor count
  1863. Number of occasions (not the number of samples) that the signal attained
  1864. @var{Noise floor}.
  1865. @item Bit depth
  1866. Overall bit depth of audio. Number of bits used for each sample.
  1867. @item Dynamic range
  1868. Measured dynamic range of audio in dB.
  1869. @item Zero crossings
  1870. Number of points where the waveform crosses the zero level axis.
  1871. @item Zero crossings rate
  1872. Rate of Zero crossings and number of audio samples.
  1873. @end table
  1874. @section asubboost
  1875. Boost subwoofer frequencies.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item dry
  1879. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1880. Default value is 0.5.
  1881. @item wet
  1882. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1883. Default value is 0.8.
  1884. @item decay
  1885. Set delay line decay gain value. Allowed range is from 0 to 1.
  1886. Default value is 0.7.
  1887. @item feedback
  1888. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1889. Default value is 0.5.
  1890. @item cutoff
  1891. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1892. Default value is 100.
  1893. @item slope
  1894. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1895. Default value is 0.5.
  1896. @item delay
  1897. Set delay. Allowed range is from 1 to 100.
  1898. Default value is 20.
  1899. @end table
  1900. @subsection Commands
  1901. This filter supports the all above options as @ref{commands}.
  1902. @section atempo
  1903. Adjust audio tempo.
  1904. The filter accepts exactly one parameter, the audio tempo. If not
  1905. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1906. be in the [0.5, 100.0] range.
  1907. Note that tempo greater than 2 will skip some samples rather than
  1908. blend them in. If for any reason this is a concern it is always
  1909. possible to daisy-chain several instances of atempo to achieve the
  1910. desired product tempo.
  1911. @subsection Examples
  1912. @itemize
  1913. @item
  1914. Slow down audio to 80% tempo:
  1915. @example
  1916. atempo=0.8
  1917. @end example
  1918. @item
  1919. To speed up audio to 300% tempo:
  1920. @example
  1921. atempo=3
  1922. @end example
  1923. @item
  1924. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1925. @example
  1926. atempo=sqrt(3),atempo=sqrt(3)
  1927. @end example
  1928. @end itemize
  1929. @subsection Commands
  1930. This filter supports the following commands:
  1931. @table @option
  1932. @item tempo
  1933. Change filter tempo scale factor.
  1934. Syntax for the command is : "@var{tempo}"
  1935. @end table
  1936. @section atrim
  1937. Trim the input so that the output contains one continuous subpart of the input.
  1938. It accepts the following parameters:
  1939. @table @option
  1940. @item start
  1941. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1942. sample with the timestamp @var{start} will be the first sample in the output.
  1943. @item end
  1944. Specify time of the first audio sample that will be dropped, i.e. the
  1945. audio sample immediately preceding the one with the timestamp @var{end} will be
  1946. the last sample in the output.
  1947. @item start_pts
  1948. Same as @var{start}, except this option sets the start timestamp in samples
  1949. instead of seconds.
  1950. @item end_pts
  1951. Same as @var{end}, except this option sets the end timestamp in samples instead
  1952. of seconds.
  1953. @item duration
  1954. The maximum duration of the output in seconds.
  1955. @item start_sample
  1956. The number of the first sample that should be output.
  1957. @item end_sample
  1958. The number of the first sample that should be dropped.
  1959. @end table
  1960. @option{start}, @option{end}, and @option{duration} are expressed as time
  1961. duration specifications; see
  1962. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1963. Note that the first two sets of the start/end options and the @option{duration}
  1964. option look at the frame timestamp, while the _sample options simply count the
  1965. samples that pass through the filter. So start/end_pts and start/end_sample will
  1966. give different results when the timestamps are wrong, inexact or do not start at
  1967. zero. Also note that this filter does not modify the timestamps. If you wish
  1968. to have the output timestamps start at zero, insert the asetpts filter after the
  1969. atrim filter.
  1970. If multiple start or end options are set, this filter tries to be greedy and
  1971. keep all samples that match at least one of the specified constraints. To keep
  1972. only the part that matches all the constraints at once, chain multiple atrim
  1973. filters.
  1974. The defaults are such that all the input is kept. So it is possible to set e.g.
  1975. just the end values to keep everything before the specified time.
  1976. Examples:
  1977. @itemize
  1978. @item
  1979. Drop everything except the second minute of input:
  1980. @example
  1981. ffmpeg -i INPUT -af atrim=60:120
  1982. @end example
  1983. @item
  1984. Keep only the first 1000 samples:
  1985. @example
  1986. ffmpeg -i INPUT -af atrim=end_sample=1000
  1987. @end example
  1988. @end itemize
  1989. @section axcorrelate
  1990. Calculate normalized cross-correlation between two input audio streams.
  1991. Resulted samples are always between -1 and 1 inclusive.
  1992. If result is 1 it means two input samples are highly correlated in that selected segment.
  1993. Result 0 means they are not correlated at all.
  1994. If result is -1 it means two input samples are out of phase, which means they cancel each
  1995. other.
  1996. The filter accepts the following options:
  1997. @table @option
  1998. @item size
  1999. Set size of segment over which cross-correlation is calculated.
  2000. Default is 256. Allowed range is from 2 to 131072.
  2001. @item algo
  2002. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2003. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2004. are always zero and thus need much less calculations to make.
  2005. This is generally not true, but is valid for typical audio streams.
  2006. @end table
  2007. @subsection Examples
  2008. @itemize
  2009. @item
  2010. Calculate correlation between channels in stereo audio stream:
  2011. @example
  2012. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2013. @end example
  2014. @end itemize
  2015. @section bandpass
  2016. Apply a two-pole Butterworth band-pass filter with central
  2017. frequency @var{frequency}, and (3dB-point) band-width width.
  2018. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2019. instead of the default: constant 0dB peak gain.
  2020. The filter roll off at 6dB per octave (20dB per decade).
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item frequency, f
  2024. Set the filter's central frequency. Default is @code{3000}.
  2025. @item csg
  2026. Constant skirt gain if set to 1. Defaults to 0.
  2027. @item width_type, t
  2028. Set method to specify band-width of filter.
  2029. @table @option
  2030. @item h
  2031. Hz
  2032. @item q
  2033. Q-Factor
  2034. @item o
  2035. octave
  2036. @item s
  2037. slope
  2038. @item k
  2039. kHz
  2040. @end table
  2041. @item width, w
  2042. Specify the band-width of a filter in width_type units.
  2043. @item mix, m
  2044. How much to use filtered signal in output. Default is 1.
  2045. Range is between 0 and 1.
  2046. @item channels, c
  2047. Specify which channels to filter, by default all available are filtered.
  2048. @item normalize, n
  2049. Normalize biquad coefficients, by default is disabled.
  2050. Enabling it will normalize magnitude response at DC to 0dB.
  2051. @end table
  2052. @subsection Commands
  2053. This filter supports the following commands:
  2054. @table @option
  2055. @item frequency, f
  2056. Change bandpass frequency.
  2057. Syntax for the command is : "@var{frequency}"
  2058. @item width_type, t
  2059. Change bandpass width_type.
  2060. Syntax for the command is : "@var{width_type}"
  2061. @item width, w
  2062. Change bandpass width.
  2063. Syntax for the command is : "@var{width}"
  2064. @item mix, m
  2065. Change bandpass mix.
  2066. Syntax for the command is : "@var{mix}"
  2067. @end table
  2068. @section bandreject
  2069. Apply a two-pole Butterworth band-reject filter with central
  2070. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2071. The filter roll off at 6dB per octave (20dB per decade).
  2072. The filter accepts the following options:
  2073. @table @option
  2074. @item frequency, f
  2075. Set the filter's central frequency. Default is @code{3000}.
  2076. @item width_type, t
  2077. Set method to specify band-width of filter.
  2078. @table @option
  2079. @item h
  2080. Hz
  2081. @item q
  2082. Q-Factor
  2083. @item o
  2084. octave
  2085. @item s
  2086. slope
  2087. @item k
  2088. kHz
  2089. @end table
  2090. @item width, w
  2091. Specify the band-width of a filter in width_type units.
  2092. @item mix, m
  2093. How much to use filtered signal in output. Default is 1.
  2094. Range is between 0 and 1.
  2095. @item channels, c
  2096. Specify which channels to filter, by default all available are filtered.
  2097. @item normalize, n
  2098. Normalize biquad coefficients, by default is disabled.
  2099. Enabling it will normalize magnitude response at DC to 0dB.
  2100. @end table
  2101. @subsection Commands
  2102. This filter supports the following commands:
  2103. @table @option
  2104. @item frequency, f
  2105. Change bandreject frequency.
  2106. Syntax for the command is : "@var{frequency}"
  2107. @item width_type, t
  2108. Change bandreject width_type.
  2109. Syntax for the command is : "@var{width_type}"
  2110. @item width, w
  2111. Change bandreject width.
  2112. Syntax for the command is : "@var{width}"
  2113. @item mix, m
  2114. Change bandreject mix.
  2115. Syntax for the command is : "@var{mix}"
  2116. @end table
  2117. @section bass, lowshelf
  2118. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2119. shelving filter with a response similar to that of a standard
  2120. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item gain, g
  2124. Give the gain at 0 Hz. Its useful range is about -20
  2125. (for a large cut) to +20 (for a large boost).
  2126. Beware of clipping when using a positive gain.
  2127. @item frequency, f
  2128. Set the filter's central frequency and so can be used
  2129. to extend or reduce the frequency range to be boosted or cut.
  2130. The default value is @code{100} Hz.
  2131. @item width_type, t
  2132. Set method to specify band-width of filter.
  2133. @table @option
  2134. @item h
  2135. Hz
  2136. @item q
  2137. Q-Factor
  2138. @item o
  2139. octave
  2140. @item s
  2141. slope
  2142. @item k
  2143. kHz
  2144. @end table
  2145. @item width, w
  2146. Determine how steep is the filter's shelf transition.
  2147. @item mix, m
  2148. How much to use filtered signal in output. Default is 1.
  2149. Range is between 0 and 1.
  2150. @item channels, c
  2151. Specify which channels to filter, by default all available are filtered.
  2152. @item normalize, n
  2153. Normalize biquad coefficients, by default is disabled.
  2154. Enabling it will normalize magnitude response at DC to 0dB.
  2155. @end table
  2156. @subsection Commands
  2157. This filter supports the following commands:
  2158. @table @option
  2159. @item frequency, f
  2160. Change bass frequency.
  2161. Syntax for the command is : "@var{frequency}"
  2162. @item width_type, t
  2163. Change bass width_type.
  2164. Syntax for the command is : "@var{width_type}"
  2165. @item width, w
  2166. Change bass width.
  2167. Syntax for the command is : "@var{width}"
  2168. @item gain, g
  2169. Change bass gain.
  2170. Syntax for the command is : "@var{gain}"
  2171. @item mix, m
  2172. Change bass mix.
  2173. Syntax for the command is : "@var{mix}"
  2174. @end table
  2175. @section biquad
  2176. Apply a biquad IIR filter with the given coefficients.
  2177. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2178. are the numerator and denominator coefficients respectively.
  2179. and @var{channels}, @var{c} specify which channels to filter, by default all
  2180. available are filtered.
  2181. @subsection Commands
  2182. This filter supports the following commands:
  2183. @table @option
  2184. @item a0
  2185. @item a1
  2186. @item a2
  2187. @item b0
  2188. @item b1
  2189. @item b2
  2190. Change biquad parameter.
  2191. Syntax for the command is : "@var{value}"
  2192. @item mix, m
  2193. How much to use filtered signal in output. Default is 1.
  2194. Range is between 0 and 1.
  2195. @item channels, c
  2196. Specify which channels to filter, by default all available are filtered.
  2197. @item normalize, n
  2198. Normalize biquad coefficients, by default is disabled.
  2199. Enabling it will normalize magnitude response at DC to 0dB.
  2200. @end table
  2201. @section bs2b
  2202. Bauer stereo to binaural transformation, which improves headphone listening of
  2203. stereo audio records.
  2204. To enable compilation of this filter you need to configure FFmpeg with
  2205. @code{--enable-libbs2b}.
  2206. It accepts the following parameters:
  2207. @table @option
  2208. @item profile
  2209. Pre-defined crossfeed level.
  2210. @table @option
  2211. @item default
  2212. Default level (fcut=700, feed=50).
  2213. @item cmoy
  2214. Chu Moy circuit (fcut=700, feed=60).
  2215. @item jmeier
  2216. Jan Meier circuit (fcut=650, feed=95).
  2217. @end table
  2218. @item fcut
  2219. Cut frequency (in Hz).
  2220. @item feed
  2221. Feed level (in Hz).
  2222. @end table
  2223. @section channelmap
  2224. Remap input channels to new locations.
  2225. It accepts the following parameters:
  2226. @table @option
  2227. @item map
  2228. Map channels from input to output. The argument is a '|'-separated list of
  2229. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2230. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2231. channel (e.g. FL for front left) or its index in the input channel layout.
  2232. @var{out_channel} is the name of the output channel or its index in the output
  2233. channel layout. If @var{out_channel} is not given then it is implicitly an
  2234. index, starting with zero and increasing by one for each mapping.
  2235. @item channel_layout
  2236. The channel layout of the output stream.
  2237. @end table
  2238. If no mapping is present, the filter will implicitly map input channels to
  2239. output channels, preserving indices.
  2240. @subsection Examples
  2241. @itemize
  2242. @item
  2243. For example, assuming a 5.1+downmix input MOV file,
  2244. @example
  2245. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2246. @end example
  2247. will create an output WAV file tagged as stereo from the downmix channels of
  2248. the input.
  2249. @item
  2250. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2251. @example
  2252. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2253. @end example
  2254. @end itemize
  2255. @section channelsplit
  2256. Split each channel from an input audio stream into a separate output stream.
  2257. It accepts the following parameters:
  2258. @table @option
  2259. @item channel_layout
  2260. The channel layout of the input stream. The default is "stereo".
  2261. @item channels
  2262. A channel layout describing the channels to be extracted as separate output streams
  2263. or "all" to extract each input channel as a separate stream. The default is "all".
  2264. Choosing channels not present in channel layout in the input will result in an error.
  2265. @end table
  2266. @subsection Examples
  2267. @itemize
  2268. @item
  2269. For example, assuming a stereo input MP3 file,
  2270. @example
  2271. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2272. @end example
  2273. will create an output Matroska file with two audio streams, one containing only
  2274. the left channel and the other the right channel.
  2275. @item
  2276. Split a 5.1 WAV file into per-channel files:
  2277. @example
  2278. ffmpeg -i in.wav -filter_complex
  2279. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2280. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2281. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2282. side_right.wav
  2283. @end example
  2284. @item
  2285. Extract only LFE from a 5.1 WAV file:
  2286. @example
  2287. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2288. -map '[LFE]' lfe.wav
  2289. @end example
  2290. @end itemize
  2291. @section chorus
  2292. Add a chorus effect to the audio.
  2293. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2294. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2295. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2296. The modulation depth defines the range the modulated delay is played before or after
  2297. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2298. sound tuned around the original one, like in a chorus where some vocals are slightly
  2299. off key.
  2300. It accepts the following parameters:
  2301. @table @option
  2302. @item in_gain
  2303. Set input gain. Default is 0.4.
  2304. @item out_gain
  2305. Set output gain. Default is 0.4.
  2306. @item delays
  2307. Set delays. A typical delay is around 40ms to 60ms.
  2308. @item decays
  2309. Set decays.
  2310. @item speeds
  2311. Set speeds.
  2312. @item depths
  2313. Set depths.
  2314. @end table
  2315. @subsection Examples
  2316. @itemize
  2317. @item
  2318. A single delay:
  2319. @example
  2320. chorus=0.7:0.9:55:0.4:0.25:2
  2321. @end example
  2322. @item
  2323. Two delays:
  2324. @example
  2325. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2326. @end example
  2327. @item
  2328. Fuller sounding chorus with three delays:
  2329. @example
  2330. 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
  2331. @end example
  2332. @end itemize
  2333. @section compand
  2334. Compress or expand the audio's dynamic range.
  2335. It accepts the following parameters:
  2336. @table @option
  2337. @item attacks
  2338. @item decays
  2339. A list of times in seconds for each channel over which the instantaneous level
  2340. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2341. increase of volume and @var{decays} refers to decrease of volume. For most
  2342. situations, the attack time (response to the audio getting louder) should be
  2343. shorter than the decay time, because the human ear is more sensitive to sudden
  2344. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2345. a typical value for decay is 0.8 seconds.
  2346. If specified number of attacks & decays is lower than number of channels, the last
  2347. set attack/decay will be used for all remaining channels.
  2348. @item points
  2349. A list of points for the transfer function, specified in dB relative to the
  2350. maximum possible signal amplitude. Each key points list must be defined using
  2351. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2352. @code{x0/y0 x1/y1 x2/y2 ....}
  2353. The input values must be in strictly increasing order but the transfer function
  2354. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2355. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2356. function are @code{-70/-70|-60/-20|1/0}.
  2357. @item soft-knee
  2358. Set the curve radius in dB for all joints. It defaults to 0.01.
  2359. @item gain
  2360. Set the additional gain in dB to be applied at all points on the transfer
  2361. function. This allows for easy adjustment of the overall gain.
  2362. It defaults to 0.
  2363. @item volume
  2364. Set an initial volume, in dB, to be assumed for each channel when filtering
  2365. starts. This permits the user to supply a nominal level initially, so that, for
  2366. example, a very large gain is not applied to initial signal levels before the
  2367. companding has begun to operate. A typical value for audio which is initially
  2368. quiet is -90 dB. It defaults to 0.
  2369. @item delay
  2370. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2371. delayed before being fed to the volume adjuster. Specifying a delay
  2372. approximately equal to the attack/decay times allows the filter to effectively
  2373. operate in predictive rather than reactive mode. It defaults to 0.
  2374. @end table
  2375. @subsection Examples
  2376. @itemize
  2377. @item
  2378. Make music with both quiet and loud passages suitable for listening to in a
  2379. noisy environment:
  2380. @example
  2381. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2382. @end example
  2383. Another example for audio with whisper and explosion parts:
  2384. @example
  2385. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2386. @end example
  2387. @item
  2388. A noise gate for when the noise is at a lower level than the signal:
  2389. @example
  2390. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2391. @end example
  2392. @item
  2393. Here is another noise gate, this time for when the noise is at a higher level
  2394. than the signal (making it, in some ways, similar to squelch):
  2395. @example
  2396. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2397. @end example
  2398. @item
  2399. 2:1 compression starting at -6dB:
  2400. @example
  2401. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2402. @end example
  2403. @item
  2404. 2:1 compression starting at -9dB:
  2405. @example
  2406. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2407. @end example
  2408. @item
  2409. 2:1 compression starting at -12dB:
  2410. @example
  2411. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2412. @end example
  2413. @item
  2414. 2:1 compression starting at -18dB:
  2415. @example
  2416. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2417. @end example
  2418. @item
  2419. 3:1 compression starting at -15dB:
  2420. @example
  2421. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2422. @end example
  2423. @item
  2424. Compressor/Gate:
  2425. @example
  2426. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2427. @end example
  2428. @item
  2429. Expander:
  2430. @example
  2431. 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
  2432. @end example
  2433. @item
  2434. Hard limiter at -6dB:
  2435. @example
  2436. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2437. @end example
  2438. @item
  2439. Hard limiter at -12dB:
  2440. @example
  2441. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2442. @end example
  2443. @item
  2444. Hard noise gate at -35 dB:
  2445. @example
  2446. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2447. @end example
  2448. @item
  2449. Soft limiter:
  2450. @example
  2451. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2452. @end example
  2453. @end itemize
  2454. @section compensationdelay
  2455. Compensation Delay Line is a metric based delay to compensate differing
  2456. positions of microphones or speakers.
  2457. For example, you have recorded guitar with two microphones placed in
  2458. different locations. Because the front of sound wave has fixed speed in
  2459. normal conditions, the phasing of microphones can vary and depends on
  2460. their location and interposition. The best sound mix can be achieved when
  2461. these microphones are in phase (synchronized). Note that a distance of
  2462. ~30 cm between microphones makes one microphone capture the signal in
  2463. antiphase to the other microphone. That makes the final mix sound moody.
  2464. This filter helps to solve phasing problems by adding different delays
  2465. to each microphone track and make them synchronized.
  2466. The best result can be reached when you take one track as base and
  2467. synchronize other tracks one by one with it.
  2468. Remember that synchronization/delay tolerance depends on sample rate, too.
  2469. Higher sample rates will give more tolerance.
  2470. The filter accepts the following parameters:
  2471. @table @option
  2472. @item mm
  2473. Set millimeters distance. This is compensation distance for fine tuning.
  2474. Default is 0.
  2475. @item cm
  2476. Set cm distance. This is compensation distance for tightening distance setup.
  2477. Default is 0.
  2478. @item m
  2479. Set meters distance. This is compensation distance for hard distance setup.
  2480. Default is 0.
  2481. @item dry
  2482. Set dry amount. Amount of unprocessed (dry) signal.
  2483. Default is 0.
  2484. @item wet
  2485. Set wet amount. Amount of processed (wet) signal.
  2486. Default is 1.
  2487. @item temp
  2488. Set temperature in degrees Celsius. This is the temperature of the environment.
  2489. Default is 20.
  2490. @end table
  2491. @section crossfeed
  2492. Apply headphone crossfeed filter.
  2493. Crossfeed is the process of blending the left and right channels of stereo
  2494. audio recording.
  2495. It is mainly used to reduce extreme stereo separation of low frequencies.
  2496. The intent is to produce more speaker like sound to the listener.
  2497. The filter accepts the following options:
  2498. @table @option
  2499. @item strength
  2500. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2501. This sets gain of low shelf filter for side part of stereo image.
  2502. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2503. @item range
  2504. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2505. This sets cut off frequency of low shelf filter. Default is cut off near
  2506. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2507. @item slope
  2508. Set curve slope of low shelf filter. Default is 0.5.
  2509. Allowed range is from 0.01 to 1.
  2510. @item level_in
  2511. Set input gain. Default is 0.9.
  2512. @item level_out
  2513. Set output gain. Default is 1.
  2514. @end table
  2515. @subsection Commands
  2516. This filter supports the all above options as @ref{commands}.
  2517. @section crystalizer
  2518. Simple algorithm to expand audio dynamic range.
  2519. The filter accepts the following options:
  2520. @table @option
  2521. @item i
  2522. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2523. (unchanged sound) to 10.0 (maximum effect).
  2524. @item c
  2525. Enable clipping. By default is enabled.
  2526. @end table
  2527. @subsection Commands
  2528. This filter supports the all above options as @ref{commands}.
  2529. @section dcshift
  2530. Apply a DC shift to the audio.
  2531. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2532. in the recording chain) from the audio. The effect of a DC offset is reduced
  2533. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2534. a signal has a DC offset.
  2535. @table @option
  2536. @item shift
  2537. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2538. the audio.
  2539. @item limitergain
  2540. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2541. used to prevent clipping.
  2542. @end table
  2543. @section deesser
  2544. Apply de-essing to the audio samples.
  2545. @table @option
  2546. @item i
  2547. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2548. Default is 0.
  2549. @item m
  2550. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2551. Default is 0.5.
  2552. @item f
  2553. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2554. Default is 0.5.
  2555. @item s
  2556. Set the output mode.
  2557. It accepts the following values:
  2558. @table @option
  2559. @item i
  2560. Pass input unchanged.
  2561. @item o
  2562. Pass ess filtered out.
  2563. @item e
  2564. Pass only ess.
  2565. Default value is @var{o}.
  2566. @end table
  2567. @end table
  2568. @section drmeter
  2569. Measure audio dynamic range.
  2570. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2571. is found in transition material. And anything less that 8 have very poor dynamics
  2572. and is very compressed.
  2573. The filter accepts the following options:
  2574. @table @option
  2575. @item length
  2576. Set window length in seconds used to split audio into segments of equal length.
  2577. Default is 3 seconds.
  2578. @end table
  2579. @section dynaudnorm
  2580. Dynamic Audio Normalizer.
  2581. This filter applies a certain amount of gain to the input audio in order
  2582. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2583. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2584. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2585. This allows for applying extra gain to the "quiet" sections of the audio
  2586. while avoiding distortions or clipping the "loud" sections. In other words:
  2587. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2588. sections, in the sense that the volume of each section is brought to the
  2589. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2590. this goal *without* applying "dynamic range compressing". It will retain 100%
  2591. of the dynamic range *within* each section of the audio file.
  2592. @table @option
  2593. @item framelen, f
  2594. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2595. Default is 500 milliseconds.
  2596. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2597. referred to as frames. This is required, because a peak magnitude has no
  2598. meaning for just a single sample value. Instead, we need to determine the
  2599. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2600. normalizer would simply use the peak magnitude of the complete file, the
  2601. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2602. frame. The length of a frame is specified in milliseconds. By default, the
  2603. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2604. been found to give good results with most files.
  2605. Note that the exact frame length, in number of samples, will be determined
  2606. automatically, based on the sampling rate of the individual input audio file.
  2607. @item gausssize, g
  2608. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2609. number. Default is 31.
  2610. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2611. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2612. is specified in frames, centered around the current frame. For the sake of
  2613. simplicity, this must be an odd number. Consequently, the default value of 31
  2614. takes into account the current frame, as well as the 15 preceding frames and
  2615. the 15 subsequent frames. Using a larger window results in a stronger
  2616. smoothing effect and thus in less gain variation, i.e. slower gain
  2617. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2618. effect and thus in more gain variation, i.e. faster gain adaptation.
  2619. In other words, the more you increase this value, the more the Dynamic Audio
  2620. Normalizer will behave like a "traditional" normalization filter. On the
  2621. contrary, the more you decrease this value, the more the Dynamic Audio
  2622. Normalizer will behave like a dynamic range compressor.
  2623. @item peak, p
  2624. Set the target peak value. This specifies the highest permissible magnitude
  2625. level for the normalized audio input. This filter will try to approach the
  2626. target peak magnitude as closely as possible, but at the same time it also
  2627. makes sure that the normalized signal will never exceed the peak magnitude.
  2628. A frame's maximum local gain factor is imposed directly by the target peak
  2629. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2630. It is not recommended to go above this value.
  2631. @item maxgain, m
  2632. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2633. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2634. factor for each input frame, i.e. the maximum gain factor that does not
  2635. result in clipping or distortion. The maximum gain factor is determined by
  2636. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2637. additionally bounds the frame's maximum gain factor by a predetermined
  2638. (global) maximum gain factor. This is done in order to avoid excessive gain
  2639. factors in "silent" or almost silent frames. By default, the maximum gain
  2640. factor is 10.0, For most inputs the default value should be sufficient and
  2641. it usually is not recommended to increase this value. Though, for input
  2642. with an extremely low overall volume level, it may be necessary to allow even
  2643. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2644. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2645. Instead, a "sigmoid" threshold function will be applied. This way, the
  2646. gain factors will smoothly approach the threshold value, but never exceed that
  2647. value.
  2648. @item targetrms, r
  2649. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2650. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2651. This means that the maximum local gain factor for each frame is defined
  2652. (only) by the frame's highest magnitude sample. This way, the samples can
  2653. be amplified as much as possible without exceeding the maximum signal
  2654. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2655. Normalizer can also take into account the frame's root mean square,
  2656. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2657. determine the power of a time-varying signal. It is therefore considered
  2658. that the RMS is a better approximation of the "perceived loudness" than
  2659. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2660. frames to a constant RMS value, a uniform "perceived loudness" can be
  2661. established. If a target RMS value has been specified, a frame's local gain
  2662. factor is defined as the factor that would result in exactly that RMS value.
  2663. Note, however, that the maximum local gain factor is still restricted by the
  2664. frame's highest magnitude sample, in order to prevent clipping.
  2665. @item coupling, n
  2666. Enable channels coupling. By default is enabled.
  2667. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2668. amount. This means the same gain factor will be applied to all channels, i.e.
  2669. the maximum possible gain factor is determined by the "loudest" channel.
  2670. However, in some recordings, it may happen that the volume of the different
  2671. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2672. In this case, this option can be used to disable the channel coupling. This way,
  2673. the gain factor will be determined independently for each channel, depending
  2674. only on the individual channel's highest magnitude sample. This allows for
  2675. harmonizing the volume of the different channels.
  2676. @item correctdc, c
  2677. Enable DC bias correction. By default is disabled.
  2678. An audio signal (in the time domain) is a sequence of sample values.
  2679. In the Dynamic Audio Normalizer these sample values are represented in the
  2680. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2681. audio signal, or "waveform", should be centered around the zero point.
  2682. That means if we calculate the mean value of all samples in a file, or in a
  2683. single frame, then the result should be 0.0 or at least very close to that
  2684. value. If, however, there is a significant deviation of the mean value from
  2685. 0.0, in either positive or negative direction, this is referred to as a
  2686. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2687. Audio Normalizer provides optional DC bias correction.
  2688. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2689. the mean value, or "DC correction" offset, of each input frame and subtract
  2690. that value from all of the frame's sample values which ensures those samples
  2691. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2692. boundaries, the DC correction offset values will be interpolated smoothly
  2693. between neighbouring frames.
  2694. @item altboundary, b
  2695. Enable alternative boundary mode. By default is disabled.
  2696. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2697. around each frame. This includes the preceding frames as well as the
  2698. subsequent frames. However, for the "boundary" frames, located at the very
  2699. beginning and at the very end of the audio file, not all neighbouring
  2700. frames are available. In particular, for the first few frames in the audio
  2701. file, the preceding frames are not known. And, similarly, for the last few
  2702. frames in the audio file, the subsequent frames are not known. Thus, the
  2703. question arises which gain factors should be assumed for the missing frames
  2704. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2705. to deal with this situation. The default boundary mode assumes a gain factor
  2706. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2707. "fade out" at the beginning and at the end of the input, respectively.
  2708. @item compress, s
  2709. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2710. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2711. compression. This means that signal peaks will not be pruned and thus the
  2712. full dynamic range will be retained within each local neighbourhood. However,
  2713. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2714. normalization algorithm with a more "traditional" compression.
  2715. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2716. (thresholding) function. If (and only if) the compression feature is enabled,
  2717. all input frames will be processed by a soft knee thresholding function prior
  2718. to the actual normalization process. Put simply, the thresholding function is
  2719. going to prune all samples whose magnitude exceeds a certain threshold value.
  2720. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2721. value. Instead, the threshold value will be adjusted for each individual
  2722. frame.
  2723. In general, smaller parameters result in stronger compression, and vice versa.
  2724. Values below 3.0 are not recommended, because audible distortion may appear.
  2725. @item threshold, t
  2726. Set the target threshold value. This specifies the lowest permissible
  2727. magnitude level for the audio input which will be normalized.
  2728. If input frame volume is above this value frame will be normalized.
  2729. Otherwise frame may not be normalized at all. The default value is set
  2730. to 0, which means all input frames will be normalized.
  2731. This option is mostly useful if digital noise is not wanted to be amplified.
  2732. @end table
  2733. @subsection Commands
  2734. This filter supports the all above options as @ref{commands}.
  2735. @section earwax
  2736. Make audio easier to listen to on headphones.
  2737. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2738. so that when listened to on headphones the stereo image is moved from
  2739. inside your head (standard for headphones) to outside and in front of
  2740. the listener (standard for speakers).
  2741. Ported from SoX.
  2742. @section equalizer
  2743. Apply a two-pole peaking equalisation (EQ) filter. With this
  2744. filter, the signal-level at and around a selected frequency can
  2745. be increased or decreased, whilst (unlike bandpass and bandreject
  2746. filters) that at all other frequencies is unchanged.
  2747. In order to produce complex equalisation curves, this filter can
  2748. be given several times, each with a different central frequency.
  2749. The filter accepts the following options:
  2750. @table @option
  2751. @item frequency, f
  2752. Set the filter's central frequency in Hz.
  2753. @item width_type, t
  2754. Set method to specify band-width of filter.
  2755. @table @option
  2756. @item h
  2757. Hz
  2758. @item q
  2759. Q-Factor
  2760. @item o
  2761. octave
  2762. @item s
  2763. slope
  2764. @item k
  2765. kHz
  2766. @end table
  2767. @item width, w
  2768. Specify the band-width of a filter in width_type units.
  2769. @item gain, g
  2770. Set the required gain or attenuation in dB.
  2771. Beware of clipping when using a positive gain.
  2772. @item mix, m
  2773. How much to use filtered signal in output. Default is 1.
  2774. Range is between 0 and 1.
  2775. @item channels, c
  2776. Specify which channels to filter, by default all available are filtered.
  2777. @item normalize, n
  2778. Normalize biquad coefficients, by default is disabled.
  2779. Enabling it will normalize magnitude response at DC to 0dB.
  2780. @end table
  2781. @subsection Examples
  2782. @itemize
  2783. @item
  2784. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2785. @example
  2786. equalizer=f=1000:t=h:width=200:g=-10
  2787. @end example
  2788. @item
  2789. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2790. @example
  2791. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2792. @end example
  2793. @end itemize
  2794. @subsection Commands
  2795. This filter supports the following commands:
  2796. @table @option
  2797. @item frequency, f
  2798. Change equalizer frequency.
  2799. Syntax for the command is : "@var{frequency}"
  2800. @item width_type, t
  2801. Change equalizer width_type.
  2802. Syntax for the command is : "@var{width_type}"
  2803. @item width, w
  2804. Change equalizer width.
  2805. Syntax for the command is : "@var{width}"
  2806. @item gain, g
  2807. Change equalizer gain.
  2808. Syntax for the command is : "@var{gain}"
  2809. @item mix, m
  2810. Change equalizer mix.
  2811. Syntax for the command is : "@var{mix}"
  2812. @end table
  2813. @section extrastereo
  2814. Linearly increases the difference between left and right channels which
  2815. adds some sort of "live" effect to playback.
  2816. The filter accepts the following options:
  2817. @table @option
  2818. @item m
  2819. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2820. (average of both channels), with 1.0 sound will be unchanged, with
  2821. -1.0 left and right channels will be swapped.
  2822. @item c
  2823. Enable clipping. By default is enabled.
  2824. @end table
  2825. @subsection Commands
  2826. This filter supports the all above options as @ref{commands}.
  2827. @section firequalizer
  2828. Apply FIR Equalization using arbitrary frequency response.
  2829. The filter accepts the following option:
  2830. @table @option
  2831. @item gain
  2832. Set gain curve equation (in dB). The expression can contain variables:
  2833. @table @option
  2834. @item f
  2835. the evaluated frequency
  2836. @item sr
  2837. sample rate
  2838. @item ch
  2839. channel number, set to 0 when multichannels evaluation is disabled
  2840. @item chid
  2841. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2842. multichannels evaluation is disabled
  2843. @item chs
  2844. number of channels
  2845. @item chlayout
  2846. channel_layout, see libavutil/channel_layout.h
  2847. @end table
  2848. and functions:
  2849. @table @option
  2850. @item gain_interpolate(f)
  2851. interpolate gain on frequency f based on gain_entry
  2852. @item cubic_interpolate(f)
  2853. same as gain_interpolate, but smoother
  2854. @end table
  2855. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2856. @item gain_entry
  2857. Set gain entry for gain_interpolate function. The expression can
  2858. contain functions:
  2859. @table @option
  2860. @item entry(f, g)
  2861. store gain entry at frequency f with value g
  2862. @end table
  2863. This option is also available as command.
  2864. @item delay
  2865. Set filter delay in seconds. Higher value means more accurate.
  2866. Default is @code{0.01}.
  2867. @item accuracy
  2868. Set filter accuracy in Hz. Lower value means more accurate.
  2869. Default is @code{5}.
  2870. @item wfunc
  2871. Set window function. Acceptable values are:
  2872. @table @option
  2873. @item rectangular
  2874. rectangular window, useful when gain curve is already smooth
  2875. @item hann
  2876. hann window (default)
  2877. @item hamming
  2878. hamming window
  2879. @item blackman
  2880. blackman window
  2881. @item nuttall3
  2882. 3-terms continuous 1st derivative nuttall window
  2883. @item mnuttall3
  2884. minimum 3-terms discontinuous nuttall window
  2885. @item nuttall
  2886. 4-terms continuous 1st derivative nuttall window
  2887. @item bnuttall
  2888. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2889. @item bharris
  2890. blackman-harris window
  2891. @item tukey
  2892. tukey window
  2893. @end table
  2894. @item fixed
  2895. If enabled, use fixed number of audio samples. This improves speed when
  2896. filtering with large delay. Default is disabled.
  2897. @item multi
  2898. Enable multichannels evaluation on gain. Default is disabled.
  2899. @item zero_phase
  2900. Enable zero phase mode by subtracting timestamp to compensate delay.
  2901. Default is disabled.
  2902. @item scale
  2903. Set scale used by gain. Acceptable values are:
  2904. @table @option
  2905. @item linlin
  2906. linear frequency, linear gain
  2907. @item linlog
  2908. linear frequency, logarithmic (in dB) gain (default)
  2909. @item loglin
  2910. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2911. @item loglog
  2912. logarithmic frequency, logarithmic gain
  2913. @end table
  2914. @item dumpfile
  2915. Set file for dumping, suitable for gnuplot.
  2916. @item dumpscale
  2917. Set scale for dumpfile. Acceptable values are same with scale option.
  2918. Default is linlog.
  2919. @item fft2
  2920. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2921. Default is disabled.
  2922. @item min_phase
  2923. Enable minimum phase impulse response. Default is disabled.
  2924. @end table
  2925. @subsection Examples
  2926. @itemize
  2927. @item
  2928. lowpass at 1000 Hz:
  2929. @example
  2930. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2931. @end example
  2932. @item
  2933. lowpass at 1000 Hz with gain_entry:
  2934. @example
  2935. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2936. @end example
  2937. @item
  2938. custom equalization:
  2939. @example
  2940. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2941. @end example
  2942. @item
  2943. higher delay with zero phase to compensate delay:
  2944. @example
  2945. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2946. @end example
  2947. @item
  2948. lowpass on left channel, highpass on right channel:
  2949. @example
  2950. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2951. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2952. @end example
  2953. @end itemize
  2954. @section flanger
  2955. Apply a flanging effect to the audio.
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item delay
  2959. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2960. @item depth
  2961. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2962. @item regen
  2963. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2964. Default value is 0.
  2965. @item width
  2966. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2967. Default value is 71.
  2968. @item speed
  2969. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2970. @item shape
  2971. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2972. Default value is @var{sinusoidal}.
  2973. @item phase
  2974. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2975. Default value is 25.
  2976. @item interp
  2977. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2978. Default is @var{linear}.
  2979. @end table
  2980. @section haas
  2981. Apply Haas effect to audio.
  2982. Note that this makes most sense to apply on mono signals.
  2983. With this filter applied to mono signals it give some directionality and
  2984. stretches its stereo image.
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item level_in
  2988. Set input level. By default is @var{1}, or 0dB
  2989. @item level_out
  2990. Set output level. By default is @var{1}, or 0dB.
  2991. @item side_gain
  2992. Set gain applied to side part of signal. By default is @var{1}.
  2993. @item middle_source
  2994. Set kind of middle source. Can be one of the following:
  2995. @table @samp
  2996. @item left
  2997. Pick left channel.
  2998. @item right
  2999. Pick right channel.
  3000. @item mid
  3001. Pick middle part signal of stereo image.
  3002. @item side
  3003. Pick side part signal of stereo image.
  3004. @end table
  3005. @item middle_phase
  3006. Change middle phase. By default is disabled.
  3007. @item left_delay
  3008. Set left channel delay. By default is @var{2.05} milliseconds.
  3009. @item left_balance
  3010. Set left channel balance. By default is @var{-1}.
  3011. @item left_gain
  3012. Set left channel gain. By default is @var{1}.
  3013. @item left_phase
  3014. Change left phase. By default is disabled.
  3015. @item right_delay
  3016. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3017. @item right_balance
  3018. Set right channel balance. By default is @var{1}.
  3019. @item right_gain
  3020. Set right channel gain. By default is @var{1}.
  3021. @item right_phase
  3022. Change right phase. By default is enabled.
  3023. @end table
  3024. @section hdcd
  3025. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3026. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3027. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3028. of HDCD, and detects the Transient Filter flag.
  3029. @example
  3030. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3031. @end example
  3032. When using the filter with wav, note the default encoding for wav is 16-bit,
  3033. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3034. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3035. @example
  3036. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3037. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3038. @end example
  3039. The filter accepts the following options:
  3040. @table @option
  3041. @item disable_autoconvert
  3042. Disable any automatic format conversion or resampling in the filter graph.
  3043. @item process_stereo
  3044. Process the stereo channels together. If target_gain does not match between
  3045. channels, consider it invalid and use the last valid target_gain.
  3046. @item cdt_ms
  3047. Set the code detect timer period in ms.
  3048. @item force_pe
  3049. Always extend peaks above -3dBFS even if PE isn't signaled.
  3050. @item analyze_mode
  3051. Replace audio with a solid tone and adjust the amplitude to signal some
  3052. specific aspect of the decoding process. The output file can be loaded in
  3053. an audio editor alongside the original to aid analysis.
  3054. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3055. Modes are:
  3056. @table @samp
  3057. @item 0, off
  3058. Disabled
  3059. @item 1, lle
  3060. Gain adjustment level at each sample
  3061. @item 2, pe
  3062. Samples where peak extend occurs
  3063. @item 3, cdt
  3064. Samples where the code detect timer is active
  3065. @item 4, tgm
  3066. Samples where the target gain does not match between channels
  3067. @end table
  3068. @end table
  3069. @section headphone
  3070. Apply head-related transfer functions (HRTFs) to create virtual
  3071. loudspeakers around the user for binaural listening via headphones.
  3072. The HRIRs are provided via additional streams, for each channel
  3073. one stereo input stream is needed.
  3074. The filter accepts the following options:
  3075. @table @option
  3076. @item map
  3077. Set mapping of input streams for convolution.
  3078. The argument is a '|'-separated list of channel names in order as they
  3079. are given as additional stream inputs for filter.
  3080. This also specify number of input streams. Number of input streams
  3081. must be not less than number of channels in first stream plus one.
  3082. @item gain
  3083. Set gain applied to audio. Value is in dB. Default is 0.
  3084. @item type
  3085. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3086. processing audio in time domain which is slow.
  3087. @var{freq} is processing audio in frequency domain which is fast.
  3088. Default is @var{freq}.
  3089. @item lfe
  3090. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3091. @item size
  3092. Set size of frame in number of samples which will be processed at once.
  3093. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3094. @item hrir
  3095. Set format of hrir stream.
  3096. Default value is @var{stereo}. Alternative value is @var{multich}.
  3097. If value is set to @var{stereo}, number of additional streams should
  3098. be greater or equal to number of input channels in first input stream.
  3099. Also each additional stream should have stereo number of channels.
  3100. If value is set to @var{multich}, number of additional streams should
  3101. be exactly one. Also number of input channels of additional stream
  3102. should be equal or greater than twice number of channels of first input
  3103. stream.
  3104. @end table
  3105. @subsection Examples
  3106. @itemize
  3107. @item
  3108. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3109. each amovie filter use stereo file with IR coefficients as input.
  3110. The files give coefficients for each position of virtual loudspeaker:
  3111. @example
  3112. ffmpeg -i input.wav
  3113. -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"
  3114. output.wav
  3115. @end example
  3116. @item
  3117. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3118. but now in @var{multich} @var{hrir} format.
  3119. @example
  3120. 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"
  3121. output.wav
  3122. @end example
  3123. @end itemize
  3124. @section highpass
  3125. Apply a high-pass filter with 3dB point frequency.
  3126. The filter can be either single-pole, or double-pole (the default).
  3127. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3128. The filter accepts the following options:
  3129. @table @option
  3130. @item frequency, f
  3131. Set frequency in Hz. Default is 3000.
  3132. @item poles, p
  3133. Set number of poles. Default is 2.
  3134. @item width_type, t
  3135. Set method to specify band-width of filter.
  3136. @table @option
  3137. @item h
  3138. Hz
  3139. @item q
  3140. Q-Factor
  3141. @item o
  3142. octave
  3143. @item s
  3144. slope
  3145. @item k
  3146. kHz
  3147. @end table
  3148. @item width, w
  3149. Specify the band-width of a filter in width_type units.
  3150. Applies only to double-pole filter.
  3151. The default is 0.707q and gives a Butterworth response.
  3152. @item mix, m
  3153. How much to use filtered signal in output. Default is 1.
  3154. Range is between 0 and 1.
  3155. @item channels, c
  3156. Specify which channels to filter, by default all available are filtered.
  3157. @item normalize, n
  3158. Normalize biquad coefficients, by default is disabled.
  3159. Enabling it will normalize magnitude response at DC to 0dB.
  3160. @end table
  3161. @subsection Commands
  3162. This filter supports the following commands:
  3163. @table @option
  3164. @item frequency, f
  3165. Change highpass frequency.
  3166. Syntax for the command is : "@var{frequency}"
  3167. @item width_type, t
  3168. Change highpass width_type.
  3169. Syntax for the command is : "@var{width_type}"
  3170. @item width, w
  3171. Change highpass width.
  3172. Syntax for the command is : "@var{width}"
  3173. @item mix, m
  3174. Change highpass mix.
  3175. Syntax for the command is : "@var{mix}"
  3176. @end table
  3177. @section join
  3178. Join multiple input streams into one multi-channel stream.
  3179. It accepts the following parameters:
  3180. @table @option
  3181. @item inputs
  3182. The number of input streams. It defaults to 2.
  3183. @item channel_layout
  3184. The desired output channel layout. It defaults to stereo.
  3185. @item map
  3186. Map channels from inputs to output. The argument is a '|'-separated list of
  3187. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3188. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3189. can be either the name of the input channel (e.g. FL for front left) or its
  3190. index in the specified input stream. @var{out_channel} is the name of the output
  3191. channel.
  3192. @end table
  3193. The filter will attempt to guess the mappings when they are not specified
  3194. explicitly. It does so by first trying to find an unused matching input channel
  3195. and if that fails it picks the first unused input channel.
  3196. Join 3 inputs (with properly set channel layouts):
  3197. @example
  3198. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3199. @end example
  3200. Build a 5.1 output from 6 single-channel streams:
  3201. @example
  3202. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3203. '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'
  3204. out
  3205. @end example
  3206. @section ladspa
  3207. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3208. To enable compilation of this filter you need to configure FFmpeg with
  3209. @code{--enable-ladspa}.
  3210. @table @option
  3211. @item file, f
  3212. Specifies the name of LADSPA plugin library to load. If the environment
  3213. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3214. each one of the directories specified by the colon separated list in
  3215. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3216. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3217. @file{/usr/lib/ladspa/}.
  3218. @item plugin, p
  3219. Specifies the plugin within the library. Some libraries contain only
  3220. one plugin, but others contain many of them. If this is not set filter
  3221. will list all available plugins within the specified library.
  3222. @item controls, c
  3223. Set the '|' separated list of controls which are zero or more floating point
  3224. values that determine the behavior of the loaded plugin (for example delay,
  3225. threshold or gain).
  3226. Controls need to be defined using the following syntax:
  3227. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3228. @var{valuei} is the value set on the @var{i}-th control.
  3229. Alternatively they can be also defined using the following syntax:
  3230. @var{value0}|@var{value1}|@var{value2}|..., where
  3231. @var{valuei} is the value set on the @var{i}-th control.
  3232. If @option{controls} is set to @code{help}, all available controls and
  3233. their valid ranges are printed.
  3234. @item sample_rate, s
  3235. Specify the sample rate, default to 44100. Only used if plugin have
  3236. zero inputs.
  3237. @item nb_samples, n
  3238. Set the number of samples per channel per each output frame, default
  3239. is 1024. Only used if plugin have zero inputs.
  3240. @item duration, d
  3241. Set the minimum duration of the sourced audio. See
  3242. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3243. for the accepted syntax.
  3244. Note that the resulting duration may be greater than the specified duration,
  3245. as the generated audio is always cut at the end of a complete frame.
  3246. If not specified, or the expressed duration is negative, the audio is
  3247. supposed to be generated forever.
  3248. Only used if plugin have zero inputs.
  3249. @item latency, l
  3250. Enable latency compensation, by default is disabled.
  3251. Only used if plugin have inputs.
  3252. @end table
  3253. @subsection Examples
  3254. @itemize
  3255. @item
  3256. List all available plugins within amp (LADSPA example plugin) library:
  3257. @example
  3258. ladspa=file=amp
  3259. @end example
  3260. @item
  3261. List all available controls and their valid ranges for @code{vcf_notch}
  3262. plugin from @code{VCF} library:
  3263. @example
  3264. ladspa=f=vcf:p=vcf_notch:c=help
  3265. @end example
  3266. @item
  3267. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3268. plugin library:
  3269. @example
  3270. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3271. @end example
  3272. @item
  3273. Add reverberation to the audio using TAP-plugins
  3274. (Tom's Audio Processing plugins):
  3275. @example
  3276. ladspa=file=tap_reverb:tap_reverb
  3277. @end example
  3278. @item
  3279. Generate white noise, with 0.2 amplitude:
  3280. @example
  3281. ladspa=file=cmt:noise_source_white:c=c0=.2
  3282. @end example
  3283. @item
  3284. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3285. @code{C* Audio Plugin Suite} (CAPS) library:
  3286. @example
  3287. ladspa=file=caps:Click:c=c1=20'
  3288. @end example
  3289. @item
  3290. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3291. @example
  3292. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3293. @end example
  3294. @item
  3295. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3296. @code{SWH Plugins} collection:
  3297. @example
  3298. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3299. @end example
  3300. @item
  3301. Attenuate low frequencies using Multiband EQ from Steve Harris
  3302. @code{SWH Plugins} collection:
  3303. @example
  3304. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3305. @end example
  3306. @item
  3307. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3308. (CAPS) library:
  3309. @example
  3310. ladspa=caps:Narrower
  3311. @end example
  3312. @item
  3313. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3314. @example
  3315. ladspa=caps:White:.2
  3316. @end example
  3317. @item
  3318. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3319. @example
  3320. ladspa=caps:Fractal:c=c1=1
  3321. @end example
  3322. @item
  3323. Dynamic volume normalization using @code{VLevel} plugin:
  3324. @example
  3325. ladspa=vlevel-ladspa:vlevel_mono
  3326. @end example
  3327. @end itemize
  3328. @subsection Commands
  3329. This filter supports the following commands:
  3330. @table @option
  3331. @item cN
  3332. Modify the @var{N}-th control value.
  3333. If the specified value is not valid, it is ignored and prior one is kept.
  3334. @end table
  3335. @section loudnorm
  3336. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3337. Support for both single pass (livestreams, files) and double pass (files) modes.
  3338. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3339. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3340. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3341. The filter accepts the following options:
  3342. @table @option
  3343. @item I, i
  3344. Set integrated loudness target.
  3345. Range is -70.0 - -5.0. Default value is -24.0.
  3346. @item LRA, lra
  3347. Set loudness range target.
  3348. Range is 1.0 - 20.0. Default value is 7.0.
  3349. @item TP, tp
  3350. Set maximum true peak.
  3351. Range is -9.0 - +0.0. Default value is -2.0.
  3352. @item measured_I, measured_i
  3353. Measured IL of input file.
  3354. Range is -99.0 - +0.0.
  3355. @item measured_LRA, measured_lra
  3356. Measured LRA of input file.
  3357. Range is 0.0 - 99.0.
  3358. @item measured_TP, measured_tp
  3359. Measured true peak of input file.
  3360. Range is -99.0 - +99.0.
  3361. @item measured_thresh
  3362. Measured threshold of input file.
  3363. Range is -99.0 - +0.0.
  3364. @item offset
  3365. Set offset gain. Gain is applied before the true-peak limiter.
  3366. Range is -99.0 - +99.0. Default is +0.0.
  3367. @item linear
  3368. Normalize by linearly scaling the source audio.
  3369. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3370. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3371. be lower than source LRA and the change in integrated loudness shouldn't
  3372. result in a true peak which exceeds the target TP. If any of these
  3373. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3374. Options are @code{true} or @code{false}. Default is @code{true}.
  3375. @item dual_mono
  3376. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3377. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3378. If set to @code{true}, this option will compensate for this effect.
  3379. Multi-channel input files are not affected by this option.
  3380. Options are true or false. Default is false.
  3381. @item print_format
  3382. Set print format for stats. Options are summary, json, or none.
  3383. Default value is none.
  3384. @end table
  3385. @section lowpass
  3386. Apply a low-pass filter with 3dB point frequency.
  3387. The filter can be either single-pole or double-pole (the default).
  3388. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3389. The filter accepts the following options:
  3390. @table @option
  3391. @item frequency, f
  3392. Set frequency in Hz. Default is 500.
  3393. @item poles, p
  3394. Set number of poles. Default is 2.
  3395. @item width_type, t
  3396. Set method to specify band-width of filter.
  3397. @table @option
  3398. @item h
  3399. Hz
  3400. @item q
  3401. Q-Factor
  3402. @item o
  3403. octave
  3404. @item s
  3405. slope
  3406. @item k
  3407. kHz
  3408. @end table
  3409. @item width, w
  3410. Specify the band-width of a filter in width_type units.
  3411. Applies only to double-pole filter.
  3412. The default is 0.707q and gives a Butterworth response.
  3413. @item mix, m
  3414. How much to use filtered signal in output. Default is 1.
  3415. Range is between 0 and 1.
  3416. @item channels, c
  3417. Specify which channels to filter, by default all available are filtered.
  3418. @item normalize, n
  3419. Normalize biquad coefficients, by default is disabled.
  3420. Enabling it will normalize magnitude response at DC to 0dB.
  3421. @end table
  3422. @subsection Examples
  3423. @itemize
  3424. @item
  3425. Lowpass only LFE channel, it LFE is not present it does nothing:
  3426. @example
  3427. lowpass=c=LFE
  3428. @end example
  3429. @end itemize
  3430. @subsection Commands
  3431. This filter supports the following commands:
  3432. @table @option
  3433. @item frequency, f
  3434. Change lowpass frequency.
  3435. Syntax for the command is : "@var{frequency}"
  3436. @item width_type, t
  3437. Change lowpass width_type.
  3438. Syntax for the command is : "@var{width_type}"
  3439. @item width, w
  3440. Change lowpass width.
  3441. Syntax for the command is : "@var{width}"
  3442. @item mix, m
  3443. Change lowpass mix.
  3444. Syntax for the command is : "@var{mix}"
  3445. @end table
  3446. @section lv2
  3447. Load a LV2 (LADSPA Version 2) plugin.
  3448. To enable compilation of this filter you need to configure FFmpeg with
  3449. @code{--enable-lv2}.
  3450. @table @option
  3451. @item plugin, p
  3452. Specifies the plugin URI. You may need to escape ':'.
  3453. @item controls, c
  3454. Set the '|' separated list of controls which are zero or more floating point
  3455. values that determine the behavior of the loaded plugin (for example delay,
  3456. threshold or gain).
  3457. If @option{controls} is set to @code{help}, all available controls and
  3458. their valid ranges are printed.
  3459. @item sample_rate, s
  3460. Specify the sample rate, default to 44100. Only used if plugin have
  3461. zero inputs.
  3462. @item nb_samples, n
  3463. Set the number of samples per channel per each output frame, default
  3464. is 1024. Only used if plugin have zero inputs.
  3465. @item duration, d
  3466. Set the minimum duration of the sourced audio. See
  3467. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3468. for the accepted syntax.
  3469. Note that the resulting duration may be greater than the specified duration,
  3470. as the generated audio is always cut at the end of a complete frame.
  3471. If not specified, or the expressed duration is negative, the audio is
  3472. supposed to be generated forever.
  3473. Only used if plugin have zero inputs.
  3474. @end table
  3475. @subsection Examples
  3476. @itemize
  3477. @item
  3478. Apply bass enhancer plugin from Calf:
  3479. @example
  3480. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3481. @end example
  3482. @item
  3483. Apply vinyl plugin from Calf:
  3484. @example
  3485. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3486. @end example
  3487. @item
  3488. Apply bit crusher plugin from ArtyFX:
  3489. @example
  3490. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3491. @end example
  3492. @end itemize
  3493. @section mcompand
  3494. Multiband Compress or expand the audio's dynamic range.
  3495. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3496. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3497. response when absent compander action.
  3498. It accepts the following parameters:
  3499. @table @option
  3500. @item args
  3501. This option syntax is:
  3502. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3503. For explanation of each item refer to compand filter documentation.
  3504. @end table
  3505. @anchor{pan}
  3506. @section pan
  3507. Mix channels with specific gain levels. The filter accepts the output
  3508. channel layout followed by a set of channels definitions.
  3509. This filter is also designed to efficiently remap the channels of an audio
  3510. stream.
  3511. The filter accepts parameters of the form:
  3512. "@var{l}|@var{outdef}|@var{outdef}|..."
  3513. @table @option
  3514. @item l
  3515. output channel layout or number of channels
  3516. @item outdef
  3517. output channel specification, of the form:
  3518. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3519. @item out_name
  3520. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3521. number (c0, c1, etc.)
  3522. @item gain
  3523. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3524. @item in_name
  3525. input channel to use, see out_name for details; it is not possible to mix
  3526. named and numbered input channels
  3527. @end table
  3528. If the `=' in a channel specification is replaced by `<', then the gains for
  3529. that specification will be renormalized so that the total is 1, thus
  3530. avoiding clipping noise.
  3531. @subsection Mixing examples
  3532. For example, if you want to down-mix from stereo to mono, but with a bigger
  3533. factor for the left channel:
  3534. @example
  3535. pan=1c|c0=0.9*c0+0.1*c1
  3536. @end example
  3537. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3538. 7-channels surround:
  3539. @example
  3540. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3541. @end example
  3542. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3543. that should be preferred (see "-ac" option) unless you have very specific
  3544. needs.
  3545. @subsection Remapping examples
  3546. The channel remapping will be effective if, and only if:
  3547. @itemize
  3548. @item gain coefficients are zeroes or ones,
  3549. @item only one input per channel output,
  3550. @end itemize
  3551. If all these conditions are satisfied, the filter will notify the user ("Pure
  3552. channel mapping detected"), and use an optimized and lossless method to do the
  3553. remapping.
  3554. For example, if you have a 5.1 source and want a stereo audio stream by
  3555. dropping the extra channels:
  3556. @example
  3557. pan="stereo| c0=FL | c1=FR"
  3558. @end example
  3559. Given the same source, you can also switch front left and front right channels
  3560. and keep the input channel layout:
  3561. @example
  3562. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3563. @end example
  3564. If the input is a stereo audio stream, you can mute the front left channel (and
  3565. still keep the stereo channel layout) with:
  3566. @example
  3567. pan="stereo|c1=c1"
  3568. @end example
  3569. Still with a stereo audio stream input, you can copy the right channel in both
  3570. front left and right:
  3571. @example
  3572. pan="stereo| c0=FR | c1=FR"
  3573. @end example
  3574. @section replaygain
  3575. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3576. outputs it unchanged.
  3577. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3578. @section resample
  3579. Convert the audio sample format, sample rate and channel layout. It is
  3580. not meant to be used directly.
  3581. @section rubberband
  3582. Apply time-stretching and pitch-shifting with librubberband.
  3583. To enable compilation of this filter, you need to configure FFmpeg with
  3584. @code{--enable-librubberband}.
  3585. The filter accepts the following options:
  3586. @table @option
  3587. @item tempo
  3588. Set tempo scale factor.
  3589. @item pitch
  3590. Set pitch scale factor.
  3591. @item transients
  3592. Set transients detector.
  3593. Possible values are:
  3594. @table @var
  3595. @item crisp
  3596. @item mixed
  3597. @item smooth
  3598. @end table
  3599. @item detector
  3600. Set detector.
  3601. Possible values are:
  3602. @table @var
  3603. @item compound
  3604. @item percussive
  3605. @item soft
  3606. @end table
  3607. @item phase
  3608. Set phase.
  3609. Possible values are:
  3610. @table @var
  3611. @item laminar
  3612. @item independent
  3613. @end table
  3614. @item window
  3615. Set processing window size.
  3616. Possible values are:
  3617. @table @var
  3618. @item standard
  3619. @item short
  3620. @item long
  3621. @end table
  3622. @item smoothing
  3623. Set smoothing.
  3624. Possible values are:
  3625. @table @var
  3626. @item off
  3627. @item on
  3628. @end table
  3629. @item formant
  3630. Enable formant preservation when shift pitching.
  3631. Possible values are:
  3632. @table @var
  3633. @item shifted
  3634. @item preserved
  3635. @end table
  3636. @item pitchq
  3637. Set pitch quality.
  3638. Possible values are:
  3639. @table @var
  3640. @item quality
  3641. @item speed
  3642. @item consistency
  3643. @end table
  3644. @item channels
  3645. Set channels.
  3646. Possible values are:
  3647. @table @var
  3648. @item apart
  3649. @item together
  3650. @end table
  3651. @end table
  3652. @subsection Commands
  3653. This filter supports the following commands:
  3654. @table @option
  3655. @item tempo
  3656. Change filter tempo scale factor.
  3657. Syntax for the command is : "@var{tempo}"
  3658. @item pitch
  3659. Change filter pitch scale factor.
  3660. Syntax for the command is : "@var{pitch}"
  3661. @end table
  3662. @section sidechaincompress
  3663. This filter acts like normal compressor but has the ability to compress
  3664. detected signal using second input signal.
  3665. It needs two input streams and returns one output stream.
  3666. First input stream will be processed depending on second stream signal.
  3667. The filtered signal then can be filtered with other filters in later stages of
  3668. processing. See @ref{pan} and @ref{amerge} filter.
  3669. The filter accepts the following options:
  3670. @table @option
  3671. @item level_in
  3672. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3673. @item mode
  3674. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3675. Default is @code{downward}.
  3676. @item threshold
  3677. If a signal of second stream raises above this level it will affect the gain
  3678. reduction of first stream.
  3679. By default is 0.125. Range is between 0.00097563 and 1.
  3680. @item ratio
  3681. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3682. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3683. Default is 2. Range is between 1 and 20.
  3684. @item attack
  3685. Amount of milliseconds the signal has to rise above the threshold before gain
  3686. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3687. @item release
  3688. Amount of milliseconds the signal has to fall below the threshold before
  3689. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3690. @item makeup
  3691. Set the amount by how much signal will be amplified after processing.
  3692. Default is 1. Range is from 1 to 64.
  3693. @item knee
  3694. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3695. Default is 2.82843. Range is between 1 and 8.
  3696. @item link
  3697. Choose if the @code{average} level between all channels of side-chain stream
  3698. or the louder(@code{maximum}) channel of side-chain stream affects the
  3699. reduction. Default is @code{average}.
  3700. @item detection
  3701. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3702. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3703. @item level_sc
  3704. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3705. @item mix
  3706. How much to use compressed signal in output. Default is 1.
  3707. Range is between 0 and 1.
  3708. @end table
  3709. @subsection Commands
  3710. This filter supports the all above options as @ref{commands}.
  3711. @subsection Examples
  3712. @itemize
  3713. @item
  3714. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3715. depending on the signal of 2nd input and later compressed signal to be
  3716. merged with 2nd input:
  3717. @example
  3718. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3719. @end example
  3720. @end itemize
  3721. @section sidechaingate
  3722. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3723. filter the detected signal before sending it to the gain reduction stage.
  3724. Normally a gate uses the full range signal to detect a level above the
  3725. threshold.
  3726. For example: If you cut all lower frequencies from your sidechain signal
  3727. the gate will decrease the volume of your track only if not enough highs
  3728. appear. With this technique you are able to reduce the resonation of a
  3729. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3730. guitar.
  3731. It needs two input streams and returns one output stream.
  3732. First input stream will be processed depending on second stream signal.
  3733. The filter accepts the following options:
  3734. @table @option
  3735. @item level_in
  3736. Set input level before filtering.
  3737. Default is 1. Allowed range is from 0.015625 to 64.
  3738. @item mode
  3739. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3740. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3741. will be amplified, expanding dynamic range in upward direction.
  3742. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3743. @item range
  3744. Set the level of gain reduction when the signal is below the threshold.
  3745. Default is 0.06125. Allowed range is from 0 to 1.
  3746. Setting this to 0 disables reduction and then filter behaves like expander.
  3747. @item threshold
  3748. If a signal rises above this level the gain reduction is released.
  3749. Default is 0.125. Allowed range is from 0 to 1.
  3750. @item ratio
  3751. Set a ratio about which the signal is reduced.
  3752. Default is 2. Allowed range is from 1 to 9000.
  3753. @item attack
  3754. Amount of milliseconds the signal has to rise above the threshold before gain
  3755. reduction stops.
  3756. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3757. @item release
  3758. Amount of milliseconds the signal has to fall below the threshold before the
  3759. reduction is increased again. Default is 250 milliseconds.
  3760. Allowed range is from 0.01 to 9000.
  3761. @item makeup
  3762. Set amount of amplification of signal after processing.
  3763. Default is 1. Allowed range is from 1 to 64.
  3764. @item knee
  3765. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3766. Default is 2.828427125. Allowed range is from 1 to 8.
  3767. @item detection
  3768. Choose if exact signal should be taken for detection or an RMS like one.
  3769. Default is rms. Can be peak or rms.
  3770. @item link
  3771. Choose if the average level between all channels or the louder channel affects
  3772. the reduction.
  3773. Default is average. Can be average or maximum.
  3774. @item level_sc
  3775. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3776. @end table
  3777. @section silencedetect
  3778. Detect silence in an audio stream.
  3779. This filter logs a message when it detects that the input audio volume is less
  3780. or equal to a noise tolerance value for a duration greater or equal to the
  3781. minimum detected noise duration.
  3782. The printed times and duration are expressed in seconds. The
  3783. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3784. is set on the first frame whose timestamp equals or exceeds the detection
  3785. duration and it contains the timestamp of the first frame of the silence.
  3786. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3787. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3788. keys are set on the first frame after the silence. If @option{mono} is
  3789. enabled, and each channel is evaluated separately, the @code{.X}
  3790. suffixed keys are used, and @code{X} corresponds to the channel number.
  3791. The filter accepts the following options:
  3792. @table @option
  3793. @item noise, n
  3794. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3795. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3796. @item duration, d
  3797. Set silence duration until notification (default is 2 seconds). See
  3798. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3799. for the accepted syntax.
  3800. @item mono, m
  3801. Process each channel separately, instead of combined. By default is disabled.
  3802. @end table
  3803. @subsection Examples
  3804. @itemize
  3805. @item
  3806. Detect 5 seconds of silence with -50dB noise tolerance:
  3807. @example
  3808. silencedetect=n=-50dB:d=5
  3809. @end example
  3810. @item
  3811. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3812. tolerance in @file{silence.mp3}:
  3813. @example
  3814. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3815. @end example
  3816. @end itemize
  3817. @section silenceremove
  3818. Remove silence from the beginning, middle or end of the audio.
  3819. The filter accepts the following options:
  3820. @table @option
  3821. @item start_periods
  3822. This value is used to indicate if audio should be trimmed at beginning of
  3823. the audio. A value of zero indicates no silence should be trimmed from the
  3824. beginning. When specifying a non-zero value, it trims audio up until it
  3825. finds non-silence. Normally, when trimming silence from beginning of audio
  3826. the @var{start_periods} will be @code{1} but it can be increased to higher
  3827. values to trim all audio up to specific count of non-silence periods.
  3828. Default value is @code{0}.
  3829. @item start_duration
  3830. Specify the amount of time that non-silence must be detected before it stops
  3831. trimming audio. By increasing the duration, bursts of noises can be treated
  3832. as silence and trimmed off. Default value is @code{0}.
  3833. @item start_threshold
  3834. This indicates what sample value should be treated as silence. For digital
  3835. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3836. you may wish to increase the value to account for background noise.
  3837. Can be specified in dB (in case "dB" is appended to the specified value)
  3838. or amplitude ratio. Default value is @code{0}.
  3839. @item start_silence
  3840. Specify max duration of silence at beginning that will be kept after
  3841. trimming. Default is 0, which is equal to trimming all samples detected
  3842. as silence.
  3843. @item start_mode
  3844. Specify mode of detection of silence end in start of multi-channel audio.
  3845. Can be @var{any} or @var{all}. Default is @var{any}.
  3846. With @var{any}, any sample that is detected as non-silence will cause
  3847. stopped trimming of silence.
  3848. With @var{all}, only if all channels are detected as non-silence will cause
  3849. stopped trimming of silence.
  3850. @item stop_periods
  3851. Set the count for trimming silence from the end of audio.
  3852. To remove silence from the middle of a file, specify a @var{stop_periods}
  3853. that is negative. This value is then treated as a positive value and is
  3854. used to indicate the effect should restart processing as specified by
  3855. @var{start_periods}, making it suitable for removing periods of silence
  3856. in the middle of the audio.
  3857. Default value is @code{0}.
  3858. @item stop_duration
  3859. Specify a duration of silence that must exist before audio is not copied any
  3860. more. By specifying a higher duration, silence that is wanted can be left in
  3861. the audio.
  3862. Default value is @code{0}.
  3863. @item stop_threshold
  3864. This is the same as @option{start_threshold} but for trimming silence from
  3865. the end of audio.
  3866. Can be specified in dB (in case "dB" is appended to the specified value)
  3867. or amplitude ratio. Default value is @code{0}.
  3868. @item stop_silence
  3869. Specify max duration of silence at end that will be kept after
  3870. trimming. Default is 0, which is equal to trimming all samples detected
  3871. as silence.
  3872. @item stop_mode
  3873. Specify mode of detection of silence start in end of multi-channel audio.
  3874. Can be @var{any} or @var{all}. Default is @var{any}.
  3875. With @var{any}, any sample that is detected as non-silence will cause
  3876. stopped trimming of silence.
  3877. With @var{all}, only if all channels are detected as non-silence will cause
  3878. stopped trimming of silence.
  3879. @item detection
  3880. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3881. and works better with digital silence which is exactly 0.
  3882. Default value is @code{rms}.
  3883. @item window
  3884. Set duration in number of seconds used to calculate size of window in number
  3885. of samples for detecting silence.
  3886. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3887. @end table
  3888. @subsection Examples
  3889. @itemize
  3890. @item
  3891. The following example shows how this filter can be used to start a recording
  3892. that does not contain the delay at the start which usually occurs between
  3893. pressing the record button and the start of the performance:
  3894. @example
  3895. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3896. @end example
  3897. @item
  3898. Trim all silence encountered from beginning to end where there is more than 1
  3899. second of silence in audio:
  3900. @example
  3901. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3902. @end example
  3903. @item
  3904. Trim all digital silence samples, using peak detection, from beginning to end
  3905. where there is more than 0 samples of digital silence in audio and digital
  3906. silence is detected in all channels at same positions in stream:
  3907. @example
  3908. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3909. @end example
  3910. @end itemize
  3911. @section sofalizer
  3912. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3913. loudspeakers around the user for binaural listening via headphones (audio
  3914. formats up to 9 channels supported).
  3915. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3916. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3917. Austrian Academy of Sciences.
  3918. To enable compilation of this filter you need to configure FFmpeg with
  3919. @code{--enable-libmysofa}.
  3920. The filter accepts the following options:
  3921. @table @option
  3922. @item sofa
  3923. Set the SOFA file used for rendering.
  3924. @item gain
  3925. Set gain applied to audio. Value is in dB. Default is 0.
  3926. @item rotation
  3927. Set rotation of virtual loudspeakers in deg. Default is 0.
  3928. @item elevation
  3929. Set elevation of virtual speakers in deg. Default is 0.
  3930. @item radius
  3931. Set distance in meters between loudspeakers and the listener with near-field
  3932. HRTFs. Default is 1.
  3933. @item type
  3934. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3935. processing audio in time domain which is slow.
  3936. @var{freq} is processing audio in frequency domain which is fast.
  3937. Default is @var{freq}.
  3938. @item speakers
  3939. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3940. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3941. Each virtual loudspeaker is described with short channel name following with
  3942. azimuth and elevation in degrees.
  3943. Each virtual loudspeaker description is separated by '|'.
  3944. For example to override front left and front right channel positions use:
  3945. 'speakers=FL 45 15|FR 345 15'.
  3946. Descriptions with unrecognised channel names are ignored.
  3947. @item lfegain
  3948. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3949. @item framesize
  3950. Set custom frame size in number of samples. Default is 1024.
  3951. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3952. is set to @var{freq}.
  3953. @item normalize
  3954. Should all IRs be normalized upon importing SOFA file.
  3955. By default is enabled.
  3956. @item interpolate
  3957. Should nearest IRs be interpolated with neighbor IRs if exact position
  3958. does not match. By default is disabled.
  3959. @item minphase
  3960. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3961. @item anglestep
  3962. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3963. @item radstep
  3964. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3965. @end table
  3966. @subsection Examples
  3967. @itemize
  3968. @item
  3969. Using ClubFritz6 sofa file:
  3970. @example
  3971. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3972. @end example
  3973. @item
  3974. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3975. @example
  3976. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3977. @end example
  3978. @item
  3979. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3980. and also with custom gain:
  3981. @example
  3982. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3983. @end example
  3984. @end itemize
  3985. @section stereotools
  3986. This filter has some handy utilities to manage stereo signals, for converting
  3987. M/S stereo recordings to L/R signal while having control over the parameters
  3988. or spreading the stereo image of master track.
  3989. The filter accepts the following options:
  3990. @table @option
  3991. @item level_in
  3992. Set input level before filtering for both channels. Defaults is 1.
  3993. Allowed range is from 0.015625 to 64.
  3994. @item level_out
  3995. Set output level after filtering for both channels. Defaults is 1.
  3996. Allowed range is from 0.015625 to 64.
  3997. @item balance_in
  3998. Set input balance between both channels. Default is 0.
  3999. Allowed range is from -1 to 1.
  4000. @item balance_out
  4001. Set output balance between both channels. Default is 0.
  4002. Allowed range is from -1 to 1.
  4003. @item softclip
  4004. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4005. clipping. Disabled by default.
  4006. @item mutel
  4007. Mute the left channel. Disabled by default.
  4008. @item muter
  4009. Mute the right channel. Disabled by default.
  4010. @item phasel
  4011. Change the phase of the left channel. Disabled by default.
  4012. @item phaser
  4013. Change the phase of the right channel. Disabled by default.
  4014. @item mode
  4015. Set stereo mode. Available values are:
  4016. @table @samp
  4017. @item lr>lr
  4018. Left/Right to Left/Right, this is default.
  4019. @item lr>ms
  4020. Left/Right to Mid/Side.
  4021. @item ms>lr
  4022. Mid/Side to Left/Right.
  4023. @item lr>ll
  4024. Left/Right to Left/Left.
  4025. @item lr>rr
  4026. Left/Right to Right/Right.
  4027. @item lr>l+r
  4028. Left/Right to Left + Right.
  4029. @item lr>rl
  4030. Left/Right to Right/Left.
  4031. @item ms>ll
  4032. Mid/Side to Left/Left.
  4033. @item ms>rr
  4034. Mid/Side to Right/Right.
  4035. @end table
  4036. @item slev
  4037. Set level of side signal. Default is 1.
  4038. Allowed range is from 0.015625 to 64.
  4039. @item sbal
  4040. Set balance of side signal. Default is 0.
  4041. Allowed range is from -1 to 1.
  4042. @item mlev
  4043. Set level of the middle signal. Default is 1.
  4044. Allowed range is from 0.015625 to 64.
  4045. @item mpan
  4046. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4047. @item base
  4048. Set stereo base between mono and inversed channels. Default is 0.
  4049. Allowed range is from -1 to 1.
  4050. @item delay
  4051. Set delay in milliseconds how much to delay left from right channel and
  4052. vice versa. Default is 0. Allowed range is from -20 to 20.
  4053. @item sclevel
  4054. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4055. @item phase
  4056. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4057. @item bmode_in, bmode_out
  4058. Set balance mode for balance_in/balance_out option.
  4059. Can be one of the following:
  4060. @table @samp
  4061. @item balance
  4062. Classic balance mode. Attenuate one channel at time.
  4063. Gain is raised up to 1.
  4064. @item amplitude
  4065. Similar as classic mode above but gain is raised up to 2.
  4066. @item power
  4067. Equal power distribution, from -6dB to +6dB range.
  4068. @end table
  4069. @end table
  4070. @subsection Examples
  4071. @itemize
  4072. @item
  4073. Apply karaoke like effect:
  4074. @example
  4075. stereotools=mlev=0.015625
  4076. @end example
  4077. @item
  4078. Convert M/S signal to L/R:
  4079. @example
  4080. "stereotools=mode=ms>lr"
  4081. @end example
  4082. @end itemize
  4083. @section stereowiden
  4084. This filter enhance the stereo effect by suppressing signal common to both
  4085. channels and by delaying the signal of left into right and vice versa,
  4086. thereby widening the stereo effect.
  4087. The filter accepts the following options:
  4088. @table @option
  4089. @item delay
  4090. Time in milliseconds of the delay of left signal into right and vice versa.
  4091. Default is 20 milliseconds.
  4092. @item feedback
  4093. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4094. effect of left signal in right output and vice versa which gives widening
  4095. effect. Default is 0.3.
  4096. @item crossfeed
  4097. Cross feed of left into right with inverted phase. This helps in suppressing
  4098. the mono. If the value is 1 it will cancel all the signal common to both
  4099. channels. Default is 0.3.
  4100. @item drymix
  4101. Set level of input signal of original channel. Default is 0.8.
  4102. @end table
  4103. @subsection Commands
  4104. This filter supports the all above options except @code{delay} as @ref{commands}.
  4105. @section superequalizer
  4106. Apply 18 band equalizer.
  4107. The filter accepts the following options:
  4108. @table @option
  4109. @item 1b
  4110. Set 65Hz band gain.
  4111. @item 2b
  4112. Set 92Hz band gain.
  4113. @item 3b
  4114. Set 131Hz band gain.
  4115. @item 4b
  4116. Set 185Hz band gain.
  4117. @item 5b
  4118. Set 262Hz band gain.
  4119. @item 6b
  4120. Set 370Hz band gain.
  4121. @item 7b
  4122. Set 523Hz band gain.
  4123. @item 8b
  4124. Set 740Hz band gain.
  4125. @item 9b
  4126. Set 1047Hz band gain.
  4127. @item 10b
  4128. Set 1480Hz band gain.
  4129. @item 11b
  4130. Set 2093Hz band gain.
  4131. @item 12b
  4132. Set 2960Hz band gain.
  4133. @item 13b
  4134. Set 4186Hz band gain.
  4135. @item 14b
  4136. Set 5920Hz band gain.
  4137. @item 15b
  4138. Set 8372Hz band gain.
  4139. @item 16b
  4140. Set 11840Hz band gain.
  4141. @item 17b
  4142. Set 16744Hz band gain.
  4143. @item 18b
  4144. Set 20000Hz band gain.
  4145. @end table
  4146. @section surround
  4147. Apply audio surround upmix filter.
  4148. This filter allows to produce multichannel output from audio stream.
  4149. The filter accepts the following options:
  4150. @table @option
  4151. @item chl_out
  4152. Set output channel layout. By default, this is @var{5.1}.
  4153. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4154. for the required syntax.
  4155. @item chl_in
  4156. Set input channel layout. By default, this is @var{stereo}.
  4157. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4158. for the required syntax.
  4159. @item level_in
  4160. Set input volume level. By default, this is @var{1}.
  4161. @item level_out
  4162. Set output volume level. By default, this is @var{1}.
  4163. @item lfe
  4164. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4165. @item lfe_low
  4166. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4167. @item lfe_high
  4168. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4169. @item lfe_mode
  4170. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4171. In @var{add} mode, LFE channel is created from input audio and added to output.
  4172. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4173. also all non-LFE output channels are subtracted with output LFE channel.
  4174. @item angle
  4175. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4176. Default is @var{90}.
  4177. @item fc_in
  4178. Set front center input volume. By default, this is @var{1}.
  4179. @item fc_out
  4180. Set front center output volume. By default, this is @var{1}.
  4181. @item fl_in
  4182. Set front left input volume. By default, this is @var{1}.
  4183. @item fl_out
  4184. Set front left output volume. By default, this is @var{1}.
  4185. @item fr_in
  4186. Set front right input volume. By default, this is @var{1}.
  4187. @item fr_out
  4188. Set front right output volume. By default, this is @var{1}.
  4189. @item sl_in
  4190. Set side left input volume. By default, this is @var{1}.
  4191. @item sl_out
  4192. Set side left output volume. By default, this is @var{1}.
  4193. @item sr_in
  4194. Set side right input volume. By default, this is @var{1}.
  4195. @item sr_out
  4196. Set side right output volume. By default, this is @var{1}.
  4197. @item bl_in
  4198. Set back left input volume. By default, this is @var{1}.
  4199. @item bl_out
  4200. Set back left output volume. By default, this is @var{1}.
  4201. @item br_in
  4202. Set back right input volume. By default, this is @var{1}.
  4203. @item br_out
  4204. Set back right output volume. By default, this is @var{1}.
  4205. @item bc_in
  4206. Set back center input volume. By default, this is @var{1}.
  4207. @item bc_out
  4208. Set back center output volume. By default, this is @var{1}.
  4209. @item lfe_in
  4210. Set LFE input volume. By default, this is @var{1}.
  4211. @item lfe_out
  4212. Set LFE output volume. By default, this is @var{1}.
  4213. @item allx
  4214. Set spread usage of stereo image across X axis for all channels.
  4215. @item ally
  4216. Set spread usage of stereo image across Y axis for all channels.
  4217. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4218. Set spread usage of stereo image across X axis for each channel.
  4219. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4220. Set spread usage of stereo image across Y axis for each channel.
  4221. @item win_size
  4222. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4223. @item win_func
  4224. Set window function.
  4225. It accepts the following values:
  4226. @table @samp
  4227. @item rect
  4228. @item bartlett
  4229. @item hann, hanning
  4230. @item hamming
  4231. @item blackman
  4232. @item welch
  4233. @item flattop
  4234. @item bharris
  4235. @item bnuttall
  4236. @item bhann
  4237. @item sine
  4238. @item nuttall
  4239. @item lanczos
  4240. @item gauss
  4241. @item tukey
  4242. @item dolph
  4243. @item cauchy
  4244. @item parzen
  4245. @item poisson
  4246. @item bohman
  4247. @end table
  4248. Default is @code{hann}.
  4249. @item overlap
  4250. Set window overlap. If set to 1, the recommended overlap for selected
  4251. window function will be picked. Default is @code{0.5}.
  4252. @end table
  4253. @section treble, highshelf
  4254. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4255. shelving filter with a response similar to that of a standard
  4256. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4257. The filter accepts the following options:
  4258. @table @option
  4259. @item gain, g
  4260. Give the gain at whichever is the lower of ~22 kHz and the
  4261. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4262. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4263. @item frequency, f
  4264. Set the filter's central frequency and so can be used
  4265. to extend or reduce the frequency range to be boosted or cut.
  4266. The default value is @code{3000} Hz.
  4267. @item width_type, t
  4268. Set method to specify band-width of filter.
  4269. @table @option
  4270. @item h
  4271. Hz
  4272. @item q
  4273. Q-Factor
  4274. @item o
  4275. octave
  4276. @item s
  4277. slope
  4278. @item k
  4279. kHz
  4280. @end table
  4281. @item width, w
  4282. Determine how steep is the filter's shelf transition.
  4283. @item mix, m
  4284. How much to use filtered signal in output. Default is 1.
  4285. Range is between 0 and 1.
  4286. @item channels, c
  4287. Specify which channels to filter, by default all available are filtered.
  4288. @item normalize, n
  4289. Normalize biquad coefficients, by default is disabled.
  4290. Enabling it will normalize magnitude response at DC to 0dB.
  4291. @end table
  4292. @subsection Commands
  4293. This filter supports the following commands:
  4294. @table @option
  4295. @item frequency, f
  4296. Change treble frequency.
  4297. Syntax for the command is : "@var{frequency}"
  4298. @item width_type, t
  4299. Change treble width_type.
  4300. Syntax for the command is : "@var{width_type}"
  4301. @item width, w
  4302. Change treble width.
  4303. Syntax for the command is : "@var{width}"
  4304. @item gain, g
  4305. Change treble gain.
  4306. Syntax for the command is : "@var{gain}"
  4307. @item mix, m
  4308. Change treble mix.
  4309. Syntax for the command is : "@var{mix}"
  4310. @end table
  4311. @section tremolo
  4312. Sinusoidal amplitude modulation.
  4313. The filter accepts the following options:
  4314. @table @option
  4315. @item f
  4316. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4317. (20 Hz or lower) will result in a tremolo effect.
  4318. This filter may also be used as a ring modulator by specifying
  4319. a modulation frequency higher than 20 Hz.
  4320. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4321. @item d
  4322. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4323. Default value is 0.5.
  4324. @end table
  4325. @section vibrato
  4326. Sinusoidal phase modulation.
  4327. The filter accepts the following options:
  4328. @table @option
  4329. @item f
  4330. Modulation frequency in Hertz.
  4331. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4332. @item d
  4333. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4334. Default value is 0.5.
  4335. @end table
  4336. @section volume
  4337. Adjust the input audio volume.
  4338. It accepts the following parameters:
  4339. @table @option
  4340. @item volume
  4341. Set audio volume expression.
  4342. Output values are clipped to the maximum value.
  4343. The output audio volume is given by the relation:
  4344. @example
  4345. @var{output_volume} = @var{volume} * @var{input_volume}
  4346. @end example
  4347. The default value for @var{volume} is "1.0".
  4348. @item precision
  4349. This parameter represents the mathematical precision.
  4350. It determines which input sample formats will be allowed, which affects the
  4351. precision of the volume scaling.
  4352. @table @option
  4353. @item fixed
  4354. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4355. @item float
  4356. 32-bit floating-point; this limits input sample format to FLT. (default)
  4357. @item double
  4358. 64-bit floating-point; this limits input sample format to DBL.
  4359. @end table
  4360. @item replaygain
  4361. Choose the behaviour on encountering ReplayGain side data in input frames.
  4362. @table @option
  4363. @item drop
  4364. Remove ReplayGain side data, ignoring its contents (the default).
  4365. @item ignore
  4366. Ignore ReplayGain side data, but leave it in the frame.
  4367. @item track
  4368. Prefer the track gain, if present.
  4369. @item album
  4370. Prefer the album gain, if present.
  4371. @end table
  4372. @item replaygain_preamp
  4373. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4374. Default value for @var{replaygain_preamp} is 0.0.
  4375. @item replaygain_noclip
  4376. Prevent clipping by limiting the gain applied.
  4377. Default value for @var{replaygain_noclip} is 1.
  4378. @item eval
  4379. Set when the volume expression is evaluated.
  4380. It accepts the following values:
  4381. @table @samp
  4382. @item once
  4383. only evaluate expression once during the filter initialization, or
  4384. when the @samp{volume} command is sent
  4385. @item frame
  4386. evaluate expression for each incoming frame
  4387. @end table
  4388. Default value is @samp{once}.
  4389. @end table
  4390. The volume expression can contain the following parameters.
  4391. @table @option
  4392. @item n
  4393. frame number (starting at zero)
  4394. @item nb_channels
  4395. number of channels
  4396. @item nb_consumed_samples
  4397. number of samples consumed by the filter
  4398. @item nb_samples
  4399. number of samples in the current frame
  4400. @item pos
  4401. original frame position in the file
  4402. @item pts
  4403. frame PTS
  4404. @item sample_rate
  4405. sample rate
  4406. @item startpts
  4407. PTS at start of stream
  4408. @item startt
  4409. time at start of stream
  4410. @item t
  4411. frame time
  4412. @item tb
  4413. timestamp timebase
  4414. @item volume
  4415. last set volume value
  4416. @end table
  4417. Note that when @option{eval} is set to @samp{once} only the
  4418. @var{sample_rate} and @var{tb} variables are available, all other
  4419. variables will evaluate to NAN.
  4420. @subsection Commands
  4421. This filter supports the following commands:
  4422. @table @option
  4423. @item volume
  4424. Modify the volume expression.
  4425. The command accepts the same syntax of the corresponding option.
  4426. If the specified expression is not valid, it is kept at its current
  4427. value.
  4428. @end table
  4429. @subsection Examples
  4430. @itemize
  4431. @item
  4432. Halve the input audio volume:
  4433. @example
  4434. volume=volume=0.5
  4435. volume=volume=1/2
  4436. volume=volume=-6.0206dB
  4437. @end example
  4438. In all the above example the named key for @option{volume} can be
  4439. omitted, for example like in:
  4440. @example
  4441. volume=0.5
  4442. @end example
  4443. @item
  4444. Increase input audio power by 6 decibels using fixed-point precision:
  4445. @example
  4446. volume=volume=6dB:precision=fixed
  4447. @end example
  4448. @item
  4449. Fade volume after time 10 with an annihilation period of 5 seconds:
  4450. @example
  4451. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4452. @end example
  4453. @end itemize
  4454. @section volumedetect
  4455. Detect the volume of the input video.
  4456. The filter has no parameters. The input is not modified. Statistics about
  4457. the volume will be printed in the log when the input stream end is reached.
  4458. In particular it will show the mean volume (root mean square), maximum
  4459. volume (on a per-sample basis), and the beginning of a histogram of the
  4460. registered volume values (from the maximum value to a cumulated 1/1000 of
  4461. the samples).
  4462. All volumes are in decibels relative to the maximum PCM value.
  4463. @subsection Examples
  4464. Here is an excerpt of the output:
  4465. @example
  4466. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4467. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4468. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4469. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4470. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4471. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4472. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4473. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4474. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4475. @end example
  4476. It means that:
  4477. @itemize
  4478. @item
  4479. The mean square energy is approximately -27 dB, or 10^-2.7.
  4480. @item
  4481. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4482. @item
  4483. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4484. @end itemize
  4485. In other words, raising the volume by +4 dB does not cause any clipping,
  4486. raising it by +5 dB causes clipping for 6 samples, etc.
  4487. @c man end AUDIO FILTERS
  4488. @chapter Audio Sources
  4489. @c man begin AUDIO SOURCES
  4490. Below is a description of the currently available audio sources.
  4491. @section abuffer
  4492. Buffer audio frames, and make them available to the filter chain.
  4493. This source is mainly intended for a programmatic use, in particular
  4494. through the interface defined in @file{libavfilter/buffersrc.h}.
  4495. It accepts the following parameters:
  4496. @table @option
  4497. @item time_base
  4498. The timebase which will be used for timestamps of submitted frames. It must be
  4499. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4500. @item sample_rate
  4501. The sample rate of the incoming audio buffers.
  4502. @item sample_fmt
  4503. The sample format of the incoming audio buffers.
  4504. Either a sample format name or its corresponding integer representation from
  4505. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4506. @item channel_layout
  4507. The channel layout of the incoming audio buffers.
  4508. Either a channel layout name from channel_layout_map in
  4509. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4510. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4511. @item channels
  4512. The number of channels of the incoming audio buffers.
  4513. If both @var{channels} and @var{channel_layout} are specified, then they
  4514. must be consistent.
  4515. @end table
  4516. @subsection Examples
  4517. @example
  4518. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4519. @end example
  4520. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4521. Since the sample format with name "s16p" corresponds to the number
  4522. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4523. equivalent to:
  4524. @example
  4525. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4526. @end example
  4527. @section aevalsrc
  4528. Generate an audio signal specified by an expression.
  4529. This source accepts in input one or more expressions (one for each
  4530. channel), which are evaluated and used to generate a corresponding
  4531. audio signal.
  4532. This source accepts the following options:
  4533. @table @option
  4534. @item exprs
  4535. Set the '|'-separated expressions list for each separate channel. In case the
  4536. @option{channel_layout} option is not specified, the selected channel layout
  4537. depends on the number of provided expressions. Otherwise the last
  4538. specified expression is applied to the remaining output channels.
  4539. @item channel_layout, c
  4540. Set the channel layout. The number of channels in the specified layout
  4541. must be equal to the number of specified expressions.
  4542. @item duration, d
  4543. Set the minimum duration of the sourced audio. See
  4544. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4545. for the accepted syntax.
  4546. Note that the resulting duration may be greater than the specified
  4547. duration, as the generated audio is always cut at the end of a
  4548. complete frame.
  4549. If not specified, or the expressed duration is negative, the audio is
  4550. supposed to be generated forever.
  4551. @item nb_samples, n
  4552. Set the number of samples per channel per each output frame,
  4553. default to 1024.
  4554. @item sample_rate, s
  4555. Specify the sample rate, default to 44100.
  4556. @end table
  4557. Each expression in @var{exprs} can contain the following constants:
  4558. @table @option
  4559. @item n
  4560. number of the evaluated sample, starting from 0
  4561. @item t
  4562. time of the evaluated sample expressed in seconds, starting from 0
  4563. @item s
  4564. sample rate
  4565. @end table
  4566. @subsection Examples
  4567. @itemize
  4568. @item
  4569. Generate silence:
  4570. @example
  4571. aevalsrc=0
  4572. @end example
  4573. @item
  4574. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4575. 8000 Hz:
  4576. @example
  4577. aevalsrc="sin(440*2*PI*t):s=8000"
  4578. @end example
  4579. @item
  4580. Generate a two channels signal, specify the channel layout (Front
  4581. Center + Back Center) explicitly:
  4582. @example
  4583. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4584. @end example
  4585. @item
  4586. Generate white noise:
  4587. @example
  4588. aevalsrc="-2+random(0)"
  4589. @end example
  4590. @item
  4591. Generate an amplitude modulated signal:
  4592. @example
  4593. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4594. @end example
  4595. @item
  4596. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4597. @example
  4598. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4599. @end example
  4600. @end itemize
  4601. @section afirsrc
  4602. Generate a FIR coefficients using frequency sampling method.
  4603. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4604. The filter accepts the following options:
  4605. @table @option
  4606. @item taps, t
  4607. Set number of filter coefficents in output audio stream.
  4608. Default value is 1025.
  4609. @item frequency, f
  4610. Set frequency points from where magnitude and phase are set.
  4611. This must be in non decreasing order, and first element must be 0, while last element
  4612. must be 1. Elements are separated by white spaces.
  4613. @item magnitude, m
  4614. Set magnitude value for every frequency point set by @option{frequency}.
  4615. Number of values must be same as number of frequency points.
  4616. Values are separated by white spaces.
  4617. @item phase, p
  4618. Set phase value for every frequency point set by @option{frequency}.
  4619. Number of values must be same as number of frequency points.
  4620. Values are separated by white spaces.
  4621. @item sample_rate, r
  4622. Set sample rate, default is 44100.
  4623. @item nb_samples, n
  4624. Set number of samples per each frame. Default is 1024.
  4625. @item win_func, w
  4626. Set window function. Default is blackman.
  4627. @end table
  4628. @section anullsrc
  4629. The null audio source, return unprocessed audio frames. It is mainly useful
  4630. as a template and to be employed in analysis / debugging tools, or as
  4631. the source for filters which ignore the input data (for example the sox
  4632. synth filter).
  4633. This source accepts the following options:
  4634. @table @option
  4635. @item channel_layout, cl
  4636. Specifies the channel layout, and can be either an integer or a string
  4637. representing a channel layout. The default value of @var{channel_layout}
  4638. is "stereo".
  4639. Check the channel_layout_map definition in
  4640. @file{libavutil/channel_layout.c} for the mapping between strings and
  4641. channel layout values.
  4642. @item sample_rate, r
  4643. Specifies the sample rate, and defaults to 44100.
  4644. @item nb_samples, n
  4645. Set the number of samples per requested frames.
  4646. @end table
  4647. @subsection Examples
  4648. @itemize
  4649. @item
  4650. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4651. @example
  4652. anullsrc=r=48000:cl=4
  4653. @end example
  4654. @item
  4655. Do the same operation with a more obvious syntax:
  4656. @example
  4657. anullsrc=r=48000:cl=mono
  4658. @end example
  4659. @end itemize
  4660. All the parameters need to be explicitly defined.
  4661. @section flite
  4662. Synthesize a voice utterance using the libflite library.
  4663. To enable compilation of this filter you need to configure FFmpeg with
  4664. @code{--enable-libflite}.
  4665. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4666. The filter accepts the following options:
  4667. @table @option
  4668. @item list_voices
  4669. If set to 1, list the names of the available voices and exit
  4670. immediately. Default value is 0.
  4671. @item nb_samples, n
  4672. Set the maximum number of samples per frame. Default value is 512.
  4673. @item textfile
  4674. Set the filename containing the text to speak.
  4675. @item text
  4676. Set the text to speak.
  4677. @item voice, v
  4678. Set the voice to use for the speech synthesis. Default value is
  4679. @code{kal}. See also the @var{list_voices} option.
  4680. @end table
  4681. @subsection Examples
  4682. @itemize
  4683. @item
  4684. Read from file @file{speech.txt}, and synthesize the text using the
  4685. standard flite voice:
  4686. @example
  4687. flite=textfile=speech.txt
  4688. @end example
  4689. @item
  4690. Read the specified text selecting the @code{slt} voice:
  4691. @example
  4692. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4693. @end example
  4694. @item
  4695. Input text to ffmpeg:
  4696. @example
  4697. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4698. @end example
  4699. @item
  4700. Make @file{ffplay} speak the specified text, using @code{flite} and
  4701. the @code{lavfi} device:
  4702. @example
  4703. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4704. @end example
  4705. @end itemize
  4706. For more information about libflite, check:
  4707. @url{http://www.festvox.org/flite/}
  4708. @section anoisesrc
  4709. Generate a noise audio signal.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item sample_rate, r
  4713. Specify the sample rate. Default value is 48000 Hz.
  4714. @item amplitude, a
  4715. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4716. is 1.0.
  4717. @item duration, d
  4718. Specify the duration of the generated audio stream. Not specifying this option
  4719. results in noise with an infinite length.
  4720. @item color, colour, c
  4721. Specify the color of noise. Available noise colors are white, pink, brown,
  4722. blue, violet and velvet. Default color is white.
  4723. @item seed, s
  4724. Specify a value used to seed the PRNG.
  4725. @item nb_samples, n
  4726. Set the number of samples per each output frame, default is 1024.
  4727. @end table
  4728. @subsection Examples
  4729. @itemize
  4730. @item
  4731. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4732. @example
  4733. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4734. @end example
  4735. @end itemize
  4736. @section hilbert
  4737. Generate odd-tap Hilbert transform FIR coefficients.
  4738. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4739. the signal by 90 degrees.
  4740. This is used in many matrix coding schemes and for analytic signal generation.
  4741. The process is often written as a multiplication by i (or j), the imaginary unit.
  4742. The filter accepts the following options:
  4743. @table @option
  4744. @item sample_rate, s
  4745. Set sample rate, default is 44100.
  4746. @item taps, t
  4747. Set length of FIR filter, default is 22051.
  4748. @item nb_samples, n
  4749. Set number of samples per each frame.
  4750. @item win_func, w
  4751. Set window function to be used when generating FIR coefficients.
  4752. @end table
  4753. @section sinc
  4754. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4755. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4756. The filter accepts the following options:
  4757. @table @option
  4758. @item sample_rate, r
  4759. Set sample rate, default is 44100.
  4760. @item nb_samples, n
  4761. Set number of samples per each frame. Default is 1024.
  4762. @item hp
  4763. Set high-pass frequency. Default is 0.
  4764. @item lp
  4765. Set low-pass frequency. Default is 0.
  4766. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4767. is higher than 0 then filter will create band-pass filter coefficients,
  4768. otherwise band-reject filter coefficients.
  4769. @item phase
  4770. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4771. @item beta
  4772. Set Kaiser window beta.
  4773. @item att
  4774. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4775. @item round
  4776. Enable rounding, by default is disabled.
  4777. @item hptaps
  4778. Set number of taps for high-pass filter.
  4779. @item lptaps
  4780. Set number of taps for low-pass filter.
  4781. @end table
  4782. @section sine
  4783. Generate an audio signal made of a sine wave with amplitude 1/8.
  4784. The audio signal is bit-exact.
  4785. The filter accepts the following options:
  4786. @table @option
  4787. @item frequency, f
  4788. Set the carrier frequency. Default is 440 Hz.
  4789. @item beep_factor, b
  4790. Enable a periodic beep every second with frequency @var{beep_factor} times
  4791. the carrier frequency. Default is 0, meaning the beep is disabled.
  4792. @item sample_rate, r
  4793. Specify the sample rate, default is 44100.
  4794. @item duration, d
  4795. Specify the duration of the generated audio stream.
  4796. @item samples_per_frame
  4797. Set the number of samples per output frame.
  4798. The expression can contain the following constants:
  4799. @table @option
  4800. @item n
  4801. The (sequential) number of the output audio frame, starting from 0.
  4802. @item pts
  4803. The PTS (Presentation TimeStamp) of the output audio frame,
  4804. expressed in @var{TB} units.
  4805. @item t
  4806. The PTS of the output audio frame, expressed in seconds.
  4807. @item TB
  4808. The timebase of the output audio frames.
  4809. @end table
  4810. Default is @code{1024}.
  4811. @end table
  4812. @subsection Examples
  4813. @itemize
  4814. @item
  4815. Generate a simple 440 Hz sine wave:
  4816. @example
  4817. sine
  4818. @end example
  4819. @item
  4820. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4821. @example
  4822. sine=220:4:d=5
  4823. sine=f=220:b=4:d=5
  4824. sine=frequency=220:beep_factor=4:duration=5
  4825. @end example
  4826. @item
  4827. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4828. pattern:
  4829. @example
  4830. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4831. @end example
  4832. @end itemize
  4833. @c man end AUDIO SOURCES
  4834. @chapter Audio Sinks
  4835. @c man begin AUDIO SINKS
  4836. Below is a description of the currently available audio sinks.
  4837. @section abuffersink
  4838. Buffer audio frames, and make them available to the end of filter chain.
  4839. This sink is mainly intended for programmatic use, in particular
  4840. through the interface defined in @file{libavfilter/buffersink.h}
  4841. or the options system.
  4842. It accepts a pointer to an AVABufferSinkContext structure, which
  4843. defines the incoming buffers' formats, to be passed as the opaque
  4844. parameter to @code{avfilter_init_filter} for initialization.
  4845. @section anullsink
  4846. Null audio sink; do absolutely nothing with the input audio. It is
  4847. mainly useful as a template and for use in analysis / debugging
  4848. tools.
  4849. @c man end AUDIO SINKS
  4850. @chapter Video Filters
  4851. @c man begin VIDEO FILTERS
  4852. When you configure your FFmpeg build, you can disable any of the
  4853. existing filters using @code{--disable-filters}.
  4854. The configure output will show the video filters included in your
  4855. build.
  4856. Below is a description of the currently available video filters.
  4857. @section addroi
  4858. Mark a region of interest in a video frame.
  4859. The frame data is passed through unchanged, but metadata is attached
  4860. to the frame indicating regions of interest which can affect the
  4861. behaviour of later encoding. Multiple regions can be marked by
  4862. applying the filter multiple times.
  4863. @table @option
  4864. @item x
  4865. Region distance in pixels from the left edge of the frame.
  4866. @item y
  4867. Region distance in pixels from the top edge of the frame.
  4868. @item w
  4869. Region width in pixels.
  4870. @item h
  4871. Region height in pixels.
  4872. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4873. and may contain the following variables:
  4874. @table @option
  4875. @item iw
  4876. Width of the input frame.
  4877. @item ih
  4878. Height of the input frame.
  4879. @end table
  4880. @item qoffset
  4881. Quantisation offset to apply within the region.
  4882. This must be a real value in the range -1 to +1. A value of zero
  4883. indicates no quality change. A negative value asks for better quality
  4884. (less quantisation), while a positive value asks for worse quality
  4885. (greater quantisation).
  4886. The range is calibrated so that the extreme values indicate the
  4887. largest possible offset - if the rest of the frame is encoded with the
  4888. worst possible quality, an offset of -1 indicates that this region
  4889. should be encoded with the best possible quality anyway. Intermediate
  4890. values are then interpolated in some codec-dependent way.
  4891. For example, in 10-bit H.264 the quantisation parameter varies between
  4892. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4893. this region should be encoded with a QP around one-tenth of the full
  4894. range better than the rest of the frame. So, if most of the frame
  4895. were to be encoded with a QP of around 30, this region would get a QP
  4896. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4897. An extreme value of -1 would indicate that this region should be
  4898. encoded with the best possible quality regardless of the treatment of
  4899. the rest of the frame - that is, should be encoded at a QP of -12.
  4900. @item clear
  4901. If set to true, remove any existing regions of interest marked on the
  4902. frame before adding the new one.
  4903. @end table
  4904. @subsection Examples
  4905. @itemize
  4906. @item
  4907. Mark the centre quarter of the frame as interesting.
  4908. @example
  4909. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4910. @end example
  4911. @item
  4912. Mark the 100-pixel-wide region on the left edge of the frame as very
  4913. uninteresting (to be encoded at much lower quality than the rest of
  4914. the frame).
  4915. @example
  4916. addroi=0:0:100:ih:+1/5
  4917. @end example
  4918. @end itemize
  4919. @section alphaextract
  4920. Extract the alpha component from the input as a grayscale video. This
  4921. is especially useful with the @var{alphamerge} filter.
  4922. @section alphamerge
  4923. Add or replace the alpha component of the primary input with the
  4924. grayscale value of a second input. This is intended for use with
  4925. @var{alphaextract} to allow the transmission or storage of frame
  4926. sequences that have alpha in a format that doesn't support an alpha
  4927. channel.
  4928. For example, to reconstruct full frames from a normal YUV-encoded video
  4929. and a separate video created with @var{alphaextract}, you might use:
  4930. @example
  4931. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4932. @end example
  4933. Since this filter is designed for reconstruction, it operates on frame
  4934. sequences without considering timestamps, and terminates when either
  4935. input reaches end of stream. This will cause problems if your encoding
  4936. pipeline drops frames. If you're trying to apply an image as an
  4937. overlay to a video stream, consider the @var{overlay} filter instead.
  4938. @section amplify
  4939. Amplify differences between current pixel and pixels of adjacent frames in
  4940. same pixel location.
  4941. This filter accepts the following options:
  4942. @table @option
  4943. @item radius
  4944. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4945. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4946. @item factor
  4947. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4948. @item threshold
  4949. Set threshold for difference amplification. Any difference greater or equal to
  4950. this value will not alter source pixel. Default is 10.
  4951. Allowed range is from 0 to 65535.
  4952. @item tolerance
  4953. Set tolerance for difference amplification. Any difference lower to
  4954. this value will not alter source pixel. Default is 0.
  4955. Allowed range is from 0 to 65535.
  4956. @item low
  4957. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4958. This option controls maximum possible value that will decrease source pixel value.
  4959. @item high
  4960. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4961. This option controls maximum possible value that will increase source pixel value.
  4962. @item planes
  4963. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4964. @end table
  4965. @subsection Commands
  4966. This filter supports the following @ref{commands} that corresponds to option of same name:
  4967. @table @option
  4968. @item factor
  4969. @item threshold
  4970. @item tolerance
  4971. @item low
  4972. @item high
  4973. @item planes
  4974. @end table
  4975. @section ass
  4976. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4977. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4978. Substation Alpha) subtitles files.
  4979. This filter accepts the following option in addition to the common options from
  4980. the @ref{subtitles} filter:
  4981. @table @option
  4982. @item shaping
  4983. Set the shaping engine
  4984. Available values are:
  4985. @table @samp
  4986. @item auto
  4987. The default libass shaping engine, which is the best available.
  4988. @item simple
  4989. Fast, font-agnostic shaper that can do only substitutions
  4990. @item complex
  4991. Slower shaper using OpenType for substitutions and positioning
  4992. @end table
  4993. The default is @code{auto}.
  4994. @end table
  4995. @section atadenoise
  4996. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4997. The filter accepts the following options:
  4998. @table @option
  4999. @item 0a
  5000. Set threshold A for 1st plane. Default is 0.02.
  5001. Valid range is 0 to 0.3.
  5002. @item 0b
  5003. Set threshold B for 1st plane. Default is 0.04.
  5004. Valid range is 0 to 5.
  5005. @item 1a
  5006. Set threshold A for 2nd plane. Default is 0.02.
  5007. Valid range is 0 to 0.3.
  5008. @item 1b
  5009. Set threshold B for 2nd plane. Default is 0.04.
  5010. Valid range is 0 to 5.
  5011. @item 2a
  5012. Set threshold A for 3rd plane. Default is 0.02.
  5013. Valid range is 0 to 0.3.
  5014. @item 2b
  5015. Set threshold B for 3rd plane. Default is 0.04.
  5016. Valid range is 0 to 5.
  5017. Threshold A is designed to react on abrupt changes in the input signal and
  5018. threshold B is designed to react on continuous changes in the input signal.
  5019. @item s
  5020. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5021. number in range [5, 129].
  5022. @item p
  5023. Set what planes of frame filter will use for averaging. Default is all.
  5024. @item a
  5025. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5026. Alternatively can be set to @code{s} serial.
  5027. Parallel can be faster then serial, while other way around is never true.
  5028. Parallel will abort early on first change being greater then thresholds, while serial
  5029. will continue processing other side of frames if they are equal or bellow thresholds.
  5030. @end table
  5031. @subsection Commands
  5032. This filter supports same @ref{commands} as options except option @code{s}.
  5033. The command accepts the same syntax of the corresponding option.
  5034. @section avgblur
  5035. Apply average blur filter.
  5036. The filter accepts the following options:
  5037. @table @option
  5038. @item sizeX
  5039. Set horizontal radius size.
  5040. @item planes
  5041. Set which planes to filter. By default all planes are filtered.
  5042. @item sizeY
  5043. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5044. Default is @code{0}.
  5045. @end table
  5046. @subsection Commands
  5047. This filter supports same commands as options.
  5048. The command accepts the same syntax of the corresponding option.
  5049. If the specified expression is not valid, it is kept at its current
  5050. value.
  5051. @section bbox
  5052. Compute the bounding box for the non-black pixels in the input frame
  5053. luminance plane.
  5054. This filter computes the bounding box containing all the pixels with a
  5055. luminance value greater than the minimum allowed value.
  5056. The parameters describing the bounding box are printed on the filter
  5057. log.
  5058. The filter accepts the following option:
  5059. @table @option
  5060. @item min_val
  5061. Set the minimal luminance value. Default is @code{16}.
  5062. @end table
  5063. @section bilateral
  5064. Apply bilateral filter, spatial smoothing while preserving edges.
  5065. The filter accepts the following options:
  5066. @table @option
  5067. @item sigmaS
  5068. Set sigma of gaussian function to calculate spatial weight.
  5069. Allowed range is 0 to 512. Default is 0.1.
  5070. @item sigmaR
  5071. Set sigma of gaussian function to calculate range weight.
  5072. Allowed range is 0 to 1. Default is 0.1.
  5073. @item planes
  5074. Set planes to filter. Default is first only.
  5075. @end table
  5076. @section bitplanenoise
  5077. Show and measure bit plane noise.
  5078. The filter accepts the following options:
  5079. @table @option
  5080. @item bitplane
  5081. Set which plane to analyze. Default is @code{1}.
  5082. @item filter
  5083. Filter out noisy pixels from @code{bitplane} set above.
  5084. Default is disabled.
  5085. @end table
  5086. @section blackdetect
  5087. Detect video intervals that are (almost) completely black. Can be
  5088. useful to detect chapter transitions, commercials, or invalid
  5089. recordings.
  5090. The filter outputs its detection analysis to both the log as well as
  5091. frame metadata. If a black segment of at least the specified minimum
  5092. duration is found, a line with the start and end timestamps as well
  5093. as duration is printed to the log with level @code{info}. In addition,
  5094. a log line with level @code{debug} is printed per frame showing the
  5095. black amount detected for that frame.
  5096. The filter also attaches metadata to the first frame of a black
  5097. segment with key @code{lavfi.black_start} and to the first frame
  5098. after the black segment ends with key @code{lavfi.black_end}. The
  5099. value is the frame's timestamp. This metadata is added regardless
  5100. of the minimum duration specified.
  5101. The filter accepts the following options:
  5102. @table @option
  5103. @item black_min_duration, d
  5104. Set the minimum detected black duration expressed in seconds. It must
  5105. be a non-negative floating point number.
  5106. Default value is 2.0.
  5107. @item picture_black_ratio_th, pic_th
  5108. Set the threshold for considering a picture "black".
  5109. Express the minimum value for the ratio:
  5110. @example
  5111. @var{nb_black_pixels} / @var{nb_pixels}
  5112. @end example
  5113. for which a picture is considered black.
  5114. Default value is 0.98.
  5115. @item pixel_black_th, pix_th
  5116. Set the threshold for considering a pixel "black".
  5117. The threshold expresses the maximum pixel luminance value for which a
  5118. pixel is considered "black". The provided value is scaled according to
  5119. the following equation:
  5120. @example
  5121. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5122. @end example
  5123. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5124. the input video format, the range is [0-255] for YUV full-range
  5125. formats and [16-235] for YUV non full-range formats.
  5126. Default value is 0.10.
  5127. @end table
  5128. The following example sets the maximum pixel threshold to the minimum
  5129. value, and detects only black intervals of 2 or more seconds:
  5130. @example
  5131. blackdetect=d=2:pix_th=0.00
  5132. @end example
  5133. @section blackframe
  5134. Detect frames that are (almost) completely black. Can be useful to
  5135. detect chapter transitions or commercials. Output lines consist of
  5136. the frame number of the detected frame, the percentage of blackness,
  5137. the position in the file if known or -1 and the timestamp in seconds.
  5138. In order to display the output lines, you need to set the loglevel at
  5139. least to the AV_LOG_INFO value.
  5140. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5141. The value represents the percentage of pixels in the picture that
  5142. are below the threshold value.
  5143. It accepts the following parameters:
  5144. @table @option
  5145. @item amount
  5146. The percentage of the pixels that have to be below the threshold; it defaults to
  5147. @code{98}.
  5148. @item threshold, thresh
  5149. The threshold below which a pixel value is considered black; it defaults to
  5150. @code{32}.
  5151. @end table
  5152. @anchor{blend}
  5153. @section blend
  5154. Blend two video frames into each other.
  5155. The @code{blend} filter takes two input streams and outputs one
  5156. stream, the first input is the "top" layer and second input is
  5157. "bottom" layer. By default, the output terminates when the longest input terminates.
  5158. The @code{tblend} (time blend) filter takes two consecutive frames
  5159. from one single stream, and outputs the result obtained by blending
  5160. the new frame on top of the old frame.
  5161. A description of the accepted options follows.
  5162. @table @option
  5163. @item c0_mode
  5164. @item c1_mode
  5165. @item c2_mode
  5166. @item c3_mode
  5167. @item all_mode
  5168. Set blend mode for specific pixel component or all pixel components in case
  5169. of @var{all_mode}. Default value is @code{normal}.
  5170. Available values for component modes are:
  5171. @table @samp
  5172. @item addition
  5173. @item grainmerge
  5174. @item and
  5175. @item average
  5176. @item burn
  5177. @item darken
  5178. @item difference
  5179. @item grainextract
  5180. @item divide
  5181. @item dodge
  5182. @item freeze
  5183. @item exclusion
  5184. @item extremity
  5185. @item glow
  5186. @item hardlight
  5187. @item hardmix
  5188. @item heat
  5189. @item lighten
  5190. @item linearlight
  5191. @item multiply
  5192. @item multiply128
  5193. @item negation
  5194. @item normal
  5195. @item or
  5196. @item overlay
  5197. @item phoenix
  5198. @item pinlight
  5199. @item reflect
  5200. @item screen
  5201. @item softlight
  5202. @item subtract
  5203. @item vividlight
  5204. @item xor
  5205. @end table
  5206. @item c0_opacity
  5207. @item c1_opacity
  5208. @item c2_opacity
  5209. @item c3_opacity
  5210. @item all_opacity
  5211. Set blend opacity for specific pixel component or all pixel components in case
  5212. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5213. @item c0_expr
  5214. @item c1_expr
  5215. @item c2_expr
  5216. @item c3_expr
  5217. @item all_expr
  5218. Set blend expression for specific pixel component or all pixel components in case
  5219. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5220. The expressions can use the following variables:
  5221. @table @option
  5222. @item N
  5223. The sequential number of the filtered frame, starting from @code{0}.
  5224. @item X
  5225. @item Y
  5226. the coordinates of the current sample
  5227. @item W
  5228. @item H
  5229. the width and height of currently filtered plane
  5230. @item SW
  5231. @item SH
  5232. Width and height scale for the plane being filtered. It is the
  5233. ratio between the dimensions of the current plane to the luma plane,
  5234. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5235. the luma plane and @code{0.5,0.5} for the chroma planes.
  5236. @item T
  5237. Time of the current frame, expressed in seconds.
  5238. @item TOP, A
  5239. Value of pixel component at current location for first video frame (top layer).
  5240. @item BOTTOM, B
  5241. Value of pixel component at current location for second video frame (bottom layer).
  5242. @end table
  5243. @end table
  5244. The @code{blend} filter also supports the @ref{framesync} options.
  5245. @subsection Examples
  5246. @itemize
  5247. @item
  5248. Apply transition from bottom layer to top layer in first 10 seconds:
  5249. @example
  5250. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5251. @end example
  5252. @item
  5253. Apply linear horizontal transition from top layer to bottom layer:
  5254. @example
  5255. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5256. @end example
  5257. @item
  5258. Apply 1x1 checkerboard effect:
  5259. @example
  5260. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5261. @end example
  5262. @item
  5263. Apply uncover left effect:
  5264. @example
  5265. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5266. @end example
  5267. @item
  5268. Apply uncover down effect:
  5269. @example
  5270. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5271. @end example
  5272. @item
  5273. Apply uncover up-left effect:
  5274. @example
  5275. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5276. @end example
  5277. @item
  5278. Split diagonally video and shows top and bottom layer on each side:
  5279. @example
  5280. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5281. @end example
  5282. @item
  5283. Display differences between the current and the previous frame:
  5284. @example
  5285. tblend=all_mode=grainextract
  5286. @end example
  5287. @end itemize
  5288. @section bm3d
  5289. Denoise frames using Block-Matching 3D algorithm.
  5290. The filter accepts the following options.
  5291. @table @option
  5292. @item sigma
  5293. Set denoising strength. Default value is 1.
  5294. Allowed range is from 0 to 999.9.
  5295. The denoising algorithm is very sensitive to sigma, so adjust it
  5296. according to the source.
  5297. @item block
  5298. Set local patch size. This sets dimensions in 2D.
  5299. @item bstep
  5300. Set sliding step for processing blocks. Default value is 4.
  5301. Allowed range is from 1 to 64.
  5302. Smaller values allows processing more reference blocks and is slower.
  5303. @item group
  5304. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5305. When set to 1, no block matching is done. Larger values allows more blocks
  5306. in single group.
  5307. Allowed range is from 1 to 256.
  5308. @item range
  5309. Set radius for search block matching. Default is 9.
  5310. Allowed range is from 1 to INT32_MAX.
  5311. @item mstep
  5312. Set step between two search locations for block matching. Default is 1.
  5313. Allowed range is from 1 to 64. Smaller is slower.
  5314. @item thmse
  5315. Set threshold of mean square error for block matching. Valid range is 0 to
  5316. INT32_MAX.
  5317. @item hdthr
  5318. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5319. Larger values results in stronger hard-thresholding filtering in frequency
  5320. domain.
  5321. @item estim
  5322. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5323. Default is @code{basic}.
  5324. @item ref
  5325. If enabled, filter will use 2nd stream for block matching.
  5326. Default is disabled for @code{basic} value of @var{estim} option,
  5327. and always enabled if value of @var{estim} is @code{final}.
  5328. @item planes
  5329. Set planes to filter. Default is all available except alpha.
  5330. @end table
  5331. @subsection Examples
  5332. @itemize
  5333. @item
  5334. Basic filtering with bm3d:
  5335. @example
  5336. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5337. @end example
  5338. @item
  5339. Same as above, but filtering only luma:
  5340. @example
  5341. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5342. @end example
  5343. @item
  5344. Same as above, but with both estimation modes:
  5345. @example
  5346. 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
  5347. @end example
  5348. @item
  5349. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5350. @example
  5351. 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
  5352. @end example
  5353. @end itemize
  5354. @section boxblur
  5355. Apply a boxblur algorithm to the input video.
  5356. It accepts the following parameters:
  5357. @table @option
  5358. @item luma_radius, lr
  5359. @item luma_power, lp
  5360. @item chroma_radius, cr
  5361. @item chroma_power, cp
  5362. @item alpha_radius, ar
  5363. @item alpha_power, ap
  5364. @end table
  5365. A description of the accepted options follows.
  5366. @table @option
  5367. @item luma_radius, lr
  5368. @item chroma_radius, cr
  5369. @item alpha_radius, ar
  5370. Set an expression for the box radius in pixels used for blurring the
  5371. corresponding input plane.
  5372. The radius value must be a non-negative number, and must not be
  5373. greater than the value of the expression @code{min(w,h)/2} for the
  5374. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5375. planes.
  5376. Default value for @option{luma_radius} is "2". If not specified,
  5377. @option{chroma_radius} and @option{alpha_radius} default to the
  5378. corresponding value set for @option{luma_radius}.
  5379. The expressions can contain the following constants:
  5380. @table @option
  5381. @item w
  5382. @item h
  5383. The input width and height in pixels.
  5384. @item cw
  5385. @item ch
  5386. The input chroma image width and height in pixels.
  5387. @item hsub
  5388. @item vsub
  5389. The horizontal and vertical chroma subsample values. For example, for the
  5390. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5391. @end table
  5392. @item luma_power, lp
  5393. @item chroma_power, cp
  5394. @item alpha_power, ap
  5395. Specify how many times the boxblur filter is applied to the
  5396. corresponding plane.
  5397. Default value for @option{luma_power} is 2. If not specified,
  5398. @option{chroma_power} and @option{alpha_power} default to the
  5399. corresponding value set for @option{luma_power}.
  5400. A value of 0 will disable the effect.
  5401. @end table
  5402. @subsection Examples
  5403. @itemize
  5404. @item
  5405. Apply a boxblur filter with the luma, chroma, and alpha radii
  5406. set to 2:
  5407. @example
  5408. boxblur=luma_radius=2:luma_power=1
  5409. boxblur=2:1
  5410. @end example
  5411. @item
  5412. Set the luma radius to 2, and alpha and chroma radius to 0:
  5413. @example
  5414. boxblur=2:1:cr=0:ar=0
  5415. @end example
  5416. @item
  5417. Set the luma and chroma radii to a fraction of the video dimension:
  5418. @example
  5419. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5420. @end example
  5421. @end itemize
  5422. @section bwdif
  5423. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5424. Deinterlacing Filter").
  5425. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5426. interpolation algorithms.
  5427. It accepts the following parameters:
  5428. @table @option
  5429. @item mode
  5430. The interlacing mode to adopt. It accepts one of the following values:
  5431. @table @option
  5432. @item 0, send_frame
  5433. Output one frame for each frame.
  5434. @item 1, send_field
  5435. Output one frame for each field.
  5436. @end table
  5437. The default value is @code{send_field}.
  5438. @item parity
  5439. The picture field parity assumed for the input interlaced video. It accepts one
  5440. of the following values:
  5441. @table @option
  5442. @item 0, tff
  5443. Assume the top field is first.
  5444. @item 1, bff
  5445. Assume the bottom field is first.
  5446. @item -1, auto
  5447. Enable automatic detection of field parity.
  5448. @end table
  5449. The default value is @code{auto}.
  5450. If the interlacing is unknown or the decoder does not export this information,
  5451. top field first will be assumed.
  5452. @item deint
  5453. Specify which frames to deinterlace. Accepts one of the following
  5454. values:
  5455. @table @option
  5456. @item 0, all
  5457. Deinterlace all frames.
  5458. @item 1, interlaced
  5459. Only deinterlace frames marked as interlaced.
  5460. @end table
  5461. The default value is @code{all}.
  5462. @end table
  5463. @section cas
  5464. Apply Contrast Adaptive Sharpen filter to video stream.
  5465. The filter accepts the following options:
  5466. @table @option
  5467. @item strength
  5468. Set the sharpening strength. Default value is 0.
  5469. @item planes
  5470. Set planes to filter. Default value is to filter all
  5471. planes except alpha plane.
  5472. @end table
  5473. @section chromahold
  5474. Remove all color information for all colors except for certain one.
  5475. The filter accepts the following options:
  5476. @table @option
  5477. @item color
  5478. The color which will not be replaced with neutral chroma.
  5479. @item similarity
  5480. Similarity percentage with the above color.
  5481. 0.01 matches only the exact key color, while 1.0 matches everything.
  5482. @item blend
  5483. Blend percentage.
  5484. 0.0 makes pixels either fully gray, or not gray at all.
  5485. Higher values result in more preserved color.
  5486. @item yuv
  5487. Signals that the color passed is already in YUV instead of RGB.
  5488. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5489. This can be used to pass exact YUV values as hexadecimal numbers.
  5490. @end table
  5491. @subsection Commands
  5492. This filter supports same @ref{commands} as options.
  5493. The command accepts the same syntax of the corresponding option.
  5494. If the specified expression is not valid, it is kept at its current
  5495. value.
  5496. @section chromakey
  5497. YUV colorspace color/chroma keying.
  5498. The filter accepts the following options:
  5499. @table @option
  5500. @item color
  5501. The color which will be replaced with transparency.
  5502. @item similarity
  5503. Similarity percentage with the key color.
  5504. 0.01 matches only the exact key color, while 1.0 matches everything.
  5505. @item blend
  5506. Blend percentage.
  5507. 0.0 makes pixels either fully transparent, or not transparent at all.
  5508. Higher values result in semi-transparent pixels, with a higher transparency
  5509. the more similar the pixels color is to the key color.
  5510. @item yuv
  5511. Signals that the color passed is already in YUV instead of RGB.
  5512. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5513. This can be used to pass exact YUV values as hexadecimal numbers.
  5514. @end table
  5515. @subsection Commands
  5516. This filter supports same @ref{commands} as options.
  5517. The command accepts the same syntax of the corresponding option.
  5518. If the specified expression is not valid, it is kept at its current
  5519. value.
  5520. @subsection Examples
  5521. @itemize
  5522. @item
  5523. Make every green pixel in the input image transparent:
  5524. @example
  5525. ffmpeg -i input.png -vf chromakey=green out.png
  5526. @end example
  5527. @item
  5528. Overlay a greenscreen-video on top of a static black background.
  5529. @example
  5530. 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
  5531. @end example
  5532. @end itemize
  5533. @section chromanr
  5534. Reduce chrominance noise.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item thres
  5538. Set threshold for averaging chrominance values.
  5539. Sum of absolute difference of U and V pixel components or current
  5540. pixel and neighbour pixels lower than this threshold will be used in
  5541. averaging. Luma component is left unchanged and is copied to output.
  5542. Default value is 30. Allowed range is from 1 to 200.
  5543. @item sizew
  5544. Set horizontal radius of rectangle used for averaging.
  5545. Allowed range is from 1 to 100. Default value is 5.
  5546. @item sizeh
  5547. Set vertical radius of rectangle used for averaging.
  5548. Allowed range is from 1 to 100. Default value is 5.
  5549. @item stepw
  5550. Set horizontal step when averaging. Default value is 1.
  5551. Allowed range is from 1 to 50.
  5552. Mostly useful to speed-up filtering.
  5553. @item steph
  5554. Set vertical step when averaging. Default value is 1.
  5555. Allowed range is from 1 to 50.
  5556. Mostly useful to speed-up filtering.
  5557. @end table
  5558. @subsection Commands
  5559. This filter supports same @ref{commands} as options.
  5560. The command accepts the same syntax of the corresponding option.
  5561. @section chromashift
  5562. Shift chroma pixels horizontally and/or vertically.
  5563. The filter accepts the following options:
  5564. @table @option
  5565. @item cbh
  5566. Set amount to shift chroma-blue horizontally.
  5567. @item cbv
  5568. Set amount to shift chroma-blue vertically.
  5569. @item crh
  5570. Set amount to shift chroma-red horizontally.
  5571. @item crv
  5572. Set amount to shift chroma-red vertically.
  5573. @item edge
  5574. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5575. @end table
  5576. @subsection Commands
  5577. This filter supports the all above options as @ref{commands}.
  5578. @section ciescope
  5579. Display CIE color diagram with pixels overlaid onto it.
  5580. The filter accepts the following options:
  5581. @table @option
  5582. @item system
  5583. Set color system.
  5584. @table @samp
  5585. @item ntsc, 470m
  5586. @item ebu, 470bg
  5587. @item smpte
  5588. @item 240m
  5589. @item apple
  5590. @item widergb
  5591. @item cie1931
  5592. @item rec709, hdtv
  5593. @item uhdtv, rec2020
  5594. @item dcip3
  5595. @end table
  5596. @item cie
  5597. Set CIE system.
  5598. @table @samp
  5599. @item xyy
  5600. @item ucs
  5601. @item luv
  5602. @end table
  5603. @item gamuts
  5604. Set what gamuts to draw.
  5605. See @code{system} option for available values.
  5606. @item size, s
  5607. Set ciescope size, by default set to 512.
  5608. @item intensity, i
  5609. Set intensity used to map input pixel values to CIE diagram.
  5610. @item contrast
  5611. Set contrast used to draw tongue colors that are out of active color system gamut.
  5612. @item corrgamma
  5613. Correct gamma displayed on scope, by default enabled.
  5614. @item showwhite
  5615. Show white point on CIE diagram, by default disabled.
  5616. @item gamma
  5617. Set input gamma. Used only with XYZ input color space.
  5618. @end table
  5619. @section codecview
  5620. Visualize information exported by some codecs.
  5621. Some codecs can export information through frames using side-data or other
  5622. means. For example, some MPEG based codecs export motion vectors through the
  5623. @var{export_mvs} flag in the codec @option{flags2} option.
  5624. The filter accepts the following option:
  5625. @table @option
  5626. @item mv
  5627. Set motion vectors to visualize.
  5628. Available flags for @var{mv} are:
  5629. @table @samp
  5630. @item pf
  5631. forward predicted MVs of P-frames
  5632. @item bf
  5633. forward predicted MVs of B-frames
  5634. @item bb
  5635. backward predicted MVs of B-frames
  5636. @end table
  5637. @item qp
  5638. Display quantization parameters using the chroma planes.
  5639. @item mv_type, mvt
  5640. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5641. Available flags for @var{mv_type} are:
  5642. @table @samp
  5643. @item fp
  5644. forward predicted MVs
  5645. @item bp
  5646. backward predicted MVs
  5647. @end table
  5648. @item frame_type, ft
  5649. Set frame type to visualize motion vectors of.
  5650. Available flags for @var{frame_type} are:
  5651. @table @samp
  5652. @item if
  5653. intra-coded frames (I-frames)
  5654. @item pf
  5655. predicted frames (P-frames)
  5656. @item bf
  5657. bi-directionally predicted frames (B-frames)
  5658. @end table
  5659. @end table
  5660. @subsection Examples
  5661. @itemize
  5662. @item
  5663. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5664. @example
  5665. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5666. @end example
  5667. @item
  5668. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5669. @example
  5670. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5671. @end example
  5672. @end itemize
  5673. @section colorbalance
  5674. Modify intensity of primary colors (red, green and blue) of input frames.
  5675. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5676. regions for the red-cyan, green-magenta or blue-yellow balance.
  5677. A positive adjustment value shifts the balance towards the primary color, a negative
  5678. value towards the complementary color.
  5679. The filter accepts the following options:
  5680. @table @option
  5681. @item rs
  5682. @item gs
  5683. @item bs
  5684. Adjust red, green and blue shadows (darkest pixels).
  5685. @item rm
  5686. @item gm
  5687. @item bm
  5688. Adjust red, green and blue midtones (medium pixels).
  5689. @item rh
  5690. @item gh
  5691. @item bh
  5692. Adjust red, green and blue highlights (brightest pixels).
  5693. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5694. @item pl
  5695. Preserve lightness when changing color balance. Default is disabled.
  5696. @end table
  5697. @subsection Examples
  5698. @itemize
  5699. @item
  5700. Add red color cast to shadows:
  5701. @example
  5702. colorbalance=rs=.3
  5703. @end example
  5704. @end itemize
  5705. @subsection Commands
  5706. This filter supports the all above options as @ref{commands}.
  5707. @section colorchannelmixer
  5708. Adjust video input frames by re-mixing color channels.
  5709. This filter modifies a color channel by adding the values associated to
  5710. the other channels of the same pixels. For example if the value to
  5711. modify is red, the output value will be:
  5712. @example
  5713. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5714. @end example
  5715. The filter accepts the following options:
  5716. @table @option
  5717. @item rr
  5718. @item rg
  5719. @item rb
  5720. @item ra
  5721. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5722. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5723. @item gr
  5724. @item gg
  5725. @item gb
  5726. @item ga
  5727. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5728. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5729. @item br
  5730. @item bg
  5731. @item bb
  5732. @item ba
  5733. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5734. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5735. @item ar
  5736. @item ag
  5737. @item ab
  5738. @item aa
  5739. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5740. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5741. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5742. @end table
  5743. @subsection Examples
  5744. @itemize
  5745. @item
  5746. Convert source to grayscale:
  5747. @example
  5748. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5749. @end example
  5750. @item
  5751. Simulate sepia tones:
  5752. @example
  5753. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5754. @end example
  5755. @end itemize
  5756. @subsection Commands
  5757. This filter supports the all above options as @ref{commands}.
  5758. @section colorkey
  5759. RGB colorspace color keying.
  5760. The filter accepts the following options:
  5761. @table @option
  5762. @item color
  5763. The color which will be replaced with transparency.
  5764. @item similarity
  5765. Similarity percentage with the key color.
  5766. 0.01 matches only the exact key color, while 1.0 matches everything.
  5767. @item blend
  5768. Blend percentage.
  5769. 0.0 makes pixels either fully transparent, or not transparent at all.
  5770. Higher values result in semi-transparent pixels, with a higher transparency
  5771. the more similar the pixels color is to the key color.
  5772. @end table
  5773. @subsection Examples
  5774. @itemize
  5775. @item
  5776. Make every green pixel in the input image transparent:
  5777. @example
  5778. ffmpeg -i input.png -vf colorkey=green out.png
  5779. @end example
  5780. @item
  5781. Overlay a greenscreen-video on top of a static background image.
  5782. @example
  5783. 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
  5784. @end example
  5785. @end itemize
  5786. @subsection Commands
  5787. This filter supports same @ref{commands} as options.
  5788. The command accepts the same syntax of the corresponding option.
  5789. If the specified expression is not valid, it is kept at its current
  5790. value.
  5791. @section colorhold
  5792. Remove all color information for all RGB colors except for certain one.
  5793. The filter accepts the following options:
  5794. @table @option
  5795. @item color
  5796. The color which will not be replaced with neutral gray.
  5797. @item similarity
  5798. Similarity percentage with the above color.
  5799. 0.01 matches only the exact key color, while 1.0 matches everything.
  5800. @item blend
  5801. Blend percentage. 0.0 makes pixels fully gray.
  5802. Higher values result in more preserved color.
  5803. @end table
  5804. @subsection Commands
  5805. This filter supports same @ref{commands} as options.
  5806. The command accepts the same syntax of the corresponding option.
  5807. If the specified expression is not valid, it is kept at its current
  5808. value.
  5809. @section colorlevels
  5810. Adjust video input frames using levels.
  5811. The filter accepts the following options:
  5812. @table @option
  5813. @item rimin
  5814. @item gimin
  5815. @item bimin
  5816. @item aimin
  5817. Adjust red, green, blue and alpha input black point.
  5818. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5819. @item rimax
  5820. @item gimax
  5821. @item bimax
  5822. @item aimax
  5823. Adjust red, green, blue and alpha input white point.
  5824. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5825. Input levels are used to lighten highlights (bright tones), darken shadows
  5826. (dark tones), change the balance of bright and dark tones.
  5827. @item romin
  5828. @item gomin
  5829. @item bomin
  5830. @item aomin
  5831. Adjust red, green, blue and alpha output black point.
  5832. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5833. @item romax
  5834. @item gomax
  5835. @item bomax
  5836. @item aomax
  5837. Adjust red, green, blue and alpha output white point.
  5838. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5839. Output levels allows manual selection of a constrained output level range.
  5840. @end table
  5841. @subsection Examples
  5842. @itemize
  5843. @item
  5844. Make video output darker:
  5845. @example
  5846. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5847. @end example
  5848. @item
  5849. Increase contrast:
  5850. @example
  5851. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5852. @end example
  5853. @item
  5854. Make video output lighter:
  5855. @example
  5856. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5857. @end example
  5858. @item
  5859. Increase brightness:
  5860. @example
  5861. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5862. @end example
  5863. @end itemize
  5864. @subsection Commands
  5865. This filter supports the all above options as @ref{commands}.
  5866. @section colormatrix
  5867. Convert color matrix.
  5868. The filter accepts the following options:
  5869. @table @option
  5870. @item src
  5871. @item dst
  5872. Specify the source and destination color matrix. Both values must be
  5873. specified.
  5874. The accepted values are:
  5875. @table @samp
  5876. @item bt709
  5877. BT.709
  5878. @item fcc
  5879. FCC
  5880. @item bt601
  5881. BT.601
  5882. @item bt470
  5883. BT.470
  5884. @item bt470bg
  5885. BT.470BG
  5886. @item smpte170m
  5887. SMPTE-170M
  5888. @item smpte240m
  5889. SMPTE-240M
  5890. @item bt2020
  5891. BT.2020
  5892. @end table
  5893. @end table
  5894. For example to convert from BT.601 to SMPTE-240M, use the command:
  5895. @example
  5896. colormatrix=bt601:smpte240m
  5897. @end example
  5898. @section colorspace
  5899. Convert colorspace, transfer characteristics or color primaries.
  5900. Input video needs to have an even size.
  5901. The filter accepts the following options:
  5902. @table @option
  5903. @anchor{all}
  5904. @item all
  5905. Specify all color properties at once.
  5906. The accepted values are:
  5907. @table @samp
  5908. @item bt470m
  5909. BT.470M
  5910. @item bt470bg
  5911. BT.470BG
  5912. @item bt601-6-525
  5913. BT.601-6 525
  5914. @item bt601-6-625
  5915. BT.601-6 625
  5916. @item bt709
  5917. BT.709
  5918. @item smpte170m
  5919. SMPTE-170M
  5920. @item smpte240m
  5921. SMPTE-240M
  5922. @item bt2020
  5923. BT.2020
  5924. @end table
  5925. @anchor{space}
  5926. @item space
  5927. Specify output colorspace.
  5928. The accepted values are:
  5929. @table @samp
  5930. @item bt709
  5931. BT.709
  5932. @item fcc
  5933. FCC
  5934. @item bt470bg
  5935. BT.470BG or BT.601-6 625
  5936. @item smpte170m
  5937. SMPTE-170M or BT.601-6 525
  5938. @item smpte240m
  5939. SMPTE-240M
  5940. @item ycgco
  5941. YCgCo
  5942. @item bt2020ncl
  5943. BT.2020 with non-constant luminance
  5944. @end table
  5945. @anchor{trc}
  5946. @item trc
  5947. Specify output transfer characteristics.
  5948. The accepted values are:
  5949. @table @samp
  5950. @item bt709
  5951. BT.709
  5952. @item bt470m
  5953. BT.470M
  5954. @item bt470bg
  5955. BT.470BG
  5956. @item gamma22
  5957. Constant gamma of 2.2
  5958. @item gamma28
  5959. Constant gamma of 2.8
  5960. @item smpte170m
  5961. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5962. @item smpte240m
  5963. SMPTE-240M
  5964. @item srgb
  5965. SRGB
  5966. @item iec61966-2-1
  5967. iec61966-2-1
  5968. @item iec61966-2-4
  5969. iec61966-2-4
  5970. @item xvycc
  5971. xvycc
  5972. @item bt2020-10
  5973. BT.2020 for 10-bits content
  5974. @item bt2020-12
  5975. BT.2020 for 12-bits content
  5976. @end table
  5977. @anchor{primaries}
  5978. @item primaries
  5979. Specify output color primaries.
  5980. The accepted values are:
  5981. @table @samp
  5982. @item bt709
  5983. BT.709
  5984. @item bt470m
  5985. BT.470M
  5986. @item bt470bg
  5987. BT.470BG or BT.601-6 625
  5988. @item smpte170m
  5989. SMPTE-170M or BT.601-6 525
  5990. @item smpte240m
  5991. SMPTE-240M
  5992. @item film
  5993. film
  5994. @item smpte431
  5995. SMPTE-431
  5996. @item smpte432
  5997. SMPTE-432
  5998. @item bt2020
  5999. BT.2020
  6000. @item jedec-p22
  6001. JEDEC P22 phosphors
  6002. @end table
  6003. @anchor{range}
  6004. @item range
  6005. Specify output color range.
  6006. The accepted values are:
  6007. @table @samp
  6008. @item tv
  6009. TV (restricted) range
  6010. @item mpeg
  6011. MPEG (restricted) range
  6012. @item pc
  6013. PC (full) range
  6014. @item jpeg
  6015. JPEG (full) range
  6016. @end table
  6017. @item format
  6018. Specify output color format.
  6019. The accepted values are:
  6020. @table @samp
  6021. @item yuv420p
  6022. YUV 4:2:0 planar 8-bits
  6023. @item yuv420p10
  6024. YUV 4:2:0 planar 10-bits
  6025. @item yuv420p12
  6026. YUV 4:2:0 planar 12-bits
  6027. @item yuv422p
  6028. YUV 4:2:2 planar 8-bits
  6029. @item yuv422p10
  6030. YUV 4:2:2 planar 10-bits
  6031. @item yuv422p12
  6032. YUV 4:2:2 planar 12-bits
  6033. @item yuv444p
  6034. YUV 4:4:4 planar 8-bits
  6035. @item yuv444p10
  6036. YUV 4:4:4 planar 10-bits
  6037. @item yuv444p12
  6038. YUV 4:4:4 planar 12-bits
  6039. @end table
  6040. @item fast
  6041. Do a fast conversion, which skips gamma/primary correction. This will take
  6042. significantly less CPU, but will be mathematically incorrect. To get output
  6043. compatible with that produced by the colormatrix filter, use fast=1.
  6044. @item dither
  6045. Specify dithering mode.
  6046. The accepted values are:
  6047. @table @samp
  6048. @item none
  6049. No dithering
  6050. @item fsb
  6051. Floyd-Steinberg dithering
  6052. @end table
  6053. @item wpadapt
  6054. Whitepoint adaptation mode.
  6055. The accepted values are:
  6056. @table @samp
  6057. @item bradford
  6058. Bradford whitepoint adaptation
  6059. @item vonkries
  6060. von Kries whitepoint adaptation
  6061. @item identity
  6062. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6063. @end table
  6064. @item iall
  6065. Override all input properties at once. Same accepted values as @ref{all}.
  6066. @item ispace
  6067. Override input colorspace. Same accepted values as @ref{space}.
  6068. @item iprimaries
  6069. Override input color primaries. Same accepted values as @ref{primaries}.
  6070. @item itrc
  6071. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6072. @item irange
  6073. Override input color range. Same accepted values as @ref{range}.
  6074. @end table
  6075. The filter converts the transfer characteristics, color space and color
  6076. primaries to the specified user values. The output value, if not specified,
  6077. is set to a default value based on the "all" property. If that property is
  6078. also not specified, the filter will log an error. The output color range and
  6079. format default to the same value as the input color range and format. The
  6080. input transfer characteristics, color space, color primaries and color range
  6081. should be set on the input data. If any of these are missing, the filter will
  6082. log an error and no conversion will take place.
  6083. For example to convert the input to SMPTE-240M, use the command:
  6084. @example
  6085. colorspace=smpte240m
  6086. @end example
  6087. @section convolution
  6088. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6089. The filter accepts the following options:
  6090. @table @option
  6091. @item 0m
  6092. @item 1m
  6093. @item 2m
  6094. @item 3m
  6095. Set matrix for each plane.
  6096. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6097. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6098. @item 0rdiv
  6099. @item 1rdiv
  6100. @item 2rdiv
  6101. @item 3rdiv
  6102. Set multiplier for calculated value for each plane.
  6103. If unset or 0, it will be sum of all matrix elements.
  6104. @item 0bias
  6105. @item 1bias
  6106. @item 2bias
  6107. @item 3bias
  6108. Set bias for each plane. This value is added to the result of the multiplication.
  6109. Useful for making the overall image brighter or darker. Default is 0.0.
  6110. @item 0mode
  6111. @item 1mode
  6112. @item 2mode
  6113. @item 3mode
  6114. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6115. Default is @var{square}.
  6116. @end table
  6117. @subsection Examples
  6118. @itemize
  6119. @item
  6120. Apply sharpen:
  6121. @example
  6122. 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"
  6123. @end example
  6124. @item
  6125. Apply blur:
  6126. @example
  6127. 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"
  6128. @end example
  6129. @item
  6130. Apply edge enhance:
  6131. @example
  6132. 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"
  6133. @end example
  6134. @item
  6135. Apply edge detect:
  6136. @example
  6137. 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"
  6138. @end example
  6139. @item
  6140. Apply laplacian edge detector which includes diagonals:
  6141. @example
  6142. 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"
  6143. @end example
  6144. @item
  6145. Apply emboss:
  6146. @example
  6147. 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"
  6148. @end example
  6149. @end itemize
  6150. @section convolve
  6151. Apply 2D convolution of video stream in frequency domain using second stream
  6152. as impulse.
  6153. The filter accepts the following options:
  6154. @table @option
  6155. @item planes
  6156. Set which planes to process.
  6157. @item impulse
  6158. Set which impulse video frames will be processed, can be @var{first}
  6159. or @var{all}. Default is @var{all}.
  6160. @end table
  6161. The @code{convolve} filter also supports the @ref{framesync} options.
  6162. @section copy
  6163. Copy the input video source unchanged to the output. This is mainly useful for
  6164. testing purposes.
  6165. @anchor{coreimage}
  6166. @section coreimage
  6167. Video filtering on GPU using Apple's CoreImage API on OSX.
  6168. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6169. processed by video hardware. However, software-based OpenGL implementations
  6170. exist which means there is no guarantee for hardware processing. It depends on
  6171. the respective OSX.
  6172. There are many filters and image generators provided by Apple that come with a
  6173. large variety of options. The filter has to be referenced by its name along
  6174. with its options.
  6175. The coreimage filter accepts the following options:
  6176. @table @option
  6177. @item list_filters
  6178. List all available filters and generators along with all their respective
  6179. options as well as possible minimum and maximum values along with the default
  6180. values.
  6181. @example
  6182. list_filters=true
  6183. @end example
  6184. @item filter
  6185. Specify all filters by their respective name and options.
  6186. Use @var{list_filters} to determine all valid filter names and options.
  6187. Numerical options are specified by a float value and are automatically clamped
  6188. to their respective value range. Vector and color options have to be specified
  6189. by a list of space separated float values. Character escaping has to be done.
  6190. A special option name @code{default} is available to use default options for a
  6191. filter.
  6192. It is required to specify either @code{default} or at least one of the filter options.
  6193. All omitted options are used with their default values.
  6194. The syntax of the filter string is as follows:
  6195. @example
  6196. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6197. @end example
  6198. @item output_rect
  6199. Specify a rectangle where the output of the filter chain is copied into the
  6200. input image. It is given by a list of space separated float values:
  6201. @example
  6202. output_rect=x\ y\ width\ height
  6203. @end example
  6204. If not given, the output rectangle equals the dimensions of the input image.
  6205. The output rectangle is automatically cropped at the borders of the input
  6206. image. Negative values are valid for each component.
  6207. @example
  6208. output_rect=25\ 25\ 100\ 100
  6209. @end example
  6210. @end table
  6211. Several filters can be chained for successive processing without GPU-HOST
  6212. transfers allowing for fast processing of complex filter chains.
  6213. Currently, only filters with zero (generators) or exactly one (filters) input
  6214. image and one output image are supported. Also, transition filters are not yet
  6215. usable as intended.
  6216. Some filters generate output images with additional padding depending on the
  6217. respective filter kernel. The padding is automatically removed to ensure the
  6218. filter output has the same size as the input image.
  6219. For image generators, the size of the output image is determined by the
  6220. previous output image of the filter chain or the input image of the whole
  6221. filterchain, respectively. The generators do not use the pixel information of
  6222. this image to generate their output. However, the generated output is
  6223. blended onto this image, resulting in partial or complete coverage of the
  6224. output image.
  6225. The @ref{coreimagesrc} video source can be used for generating input images
  6226. which are directly fed into the filter chain. By using it, providing input
  6227. images by another video source or an input video is not required.
  6228. @subsection Examples
  6229. @itemize
  6230. @item
  6231. List all filters available:
  6232. @example
  6233. coreimage=list_filters=true
  6234. @end example
  6235. @item
  6236. Use the CIBoxBlur filter with default options to blur an image:
  6237. @example
  6238. coreimage=filter=CIBoxBlur@@default
  6239. @end example
  6240. @item
  6241. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6242. its center at 100x100 and a radius of 50 pixels:
  6243. @example
  6244. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6245. @end example
  6246. @item
  6247. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6248. given as complete and escaped command-line for Apple's standard bash shell:
  6249. @example
  6250. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6251. @end example
  6252. @end itemize
  6253. @section cover_rect
  6254. Cover a rectangular object
  6255. It accepts the following options:
  6256. @table @option
  6257. @item cover
  6258. Filepath of the optional cover image, needs to be in yuv420.
  6259. @item mode
  6260. Set covering mode.
  6261. It accepts the following values:
  6262. @table @samp
  6263. @item cover
  6264. cover it by the supplied image
  6265. @item blur
  6266. cover it by interpolating the surrounding pixels
  6267. @end table
  6268. Default value is @var{blur}.
  6269. @end table
  6270. @subsection Examples
  6271. @itemize
  6272. @item
  6273. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6274. @example
  6275. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6276. @end example
  6277. @end itemize
  6278. @section crop
  6279. Crop the input video to given dimensions.
  6280. It accepts the following parameters:
  6281. @table @option
  6282. @item w, out_w
  6283. The width of the output video. It defaults to @code{iw}.
  6284. This expression is evaluated only once during the filter
  6285. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6286. @item h, out_h
  6287. The height of the output video. It defaults to @code{ih}.
  6288. This expression is evaluated only once during the filter
  6289. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6290. @item x
  6291. The horizontal position, in the input video, of the left edge of the output
  6292. video. It defaults to @code{(in_w-out_w)/2}.
  6293. This expression is evaluated per-frame.
  6294. @item y
  6295. The vertical position, in the input video, of the top edge of the output video.
  6296. It defaults to @code{(in_h-out_h)/2}.
  6297. This expression is evaluated per-frame.
  6298. @item keep_aspect
  6299. If set to 1 will force the output display aspect ratio
  6300. to be the same of the input, by changing the output sample aspect
  6301. ratio. It defaults to 0.
  6302. @item exact
  6303. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6304. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6305. It defaults to 0.
  6306. @end table
  6307. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6308. expressions containing the following constants:
  6309. @table @option
  6310. @item x
  6311. @item y
  6312. The computed values for @var{x} and @var{y}. They are evaluated for
  6313. each new frame.
  6314. @item in_w
  6315. @item in_h
  6316. The input width and height.
  6317. @item iw
  6318. @item ih
  6319. These are the same as @var{in_w} and @var{in_h}.
  6320. @item out_w
  6321. @item out_h
  6322. The output (cropped) width and height.
  6323. @item ow
  6324. @item oh
  6325. These are the same as @var{out_w} and @var{out_h}.
  6326. @item a
  6327. same as @var{iw} / @var{ih}
  6328. @item sar
  6329. input sample aspect ratio
  6330. @item dar
  6331. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6332. @item hsub
  6333. @item vsub
  6334. horizontal and vertical chroma subsample values. For example for the
  6335. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6336. @item n
  6337. The number of the input frame, starting from 0.
  6338. @item pos
  6339. the position in the file of the input frame, NAN if unknown
  6340. @item t
  6341. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6342. @end table
  6343. The expression for @var{out_w} may depend on the value of @var{out_h},
  6344. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6345. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6346. evaluated after @var{out_w} and @var{out_h}.
  6347. The @var{x} and @var{y} parameters specify the expressions for the
  6348. position of the top-left corner of the output (non-cropped) area. They
  6349. are evaluated for each frame. If the evaluated value is not valid, it
  6350. is approximated to the nearest valid value.
  6351. The expression for @var{x} may depend on @var{y}, and the expression
  6352. for @var{y} may depend on @var{x}.
  6353. @subsection Examples
  6354. @itemize
  6355. @item
  6356. Crop area with size 100x100 at position (12,34).
  6357. @example
  6358. crop=100:100:12:34
  6359. @end example
  6360. Using named options, the example above becomes:
  6361. @example
  6362. crop=w=100:h=100:x=12:y=34
  6363. @end example
  6364. @item
  6365. Crop the central input area with size 100x100:
  6366. @example
  6367. crop=100:100
  6368. @end example
  6369. @item
  6370. Crop the central input area with size 2/3 of the input video:
  6371. @example
  6372. crop=2/3*in_w:2/3*in_h
  6373. @end example
  6374. @item
  6375. Crop the input video central square:
  6376. @example
  6377. crop=out_w=in_h
  6378. crop=in_h
  6379. @end example
  6380. @item
  6381. Delimit the rectangle with the top-left corner placed at position
  6382. 100:100 and the right-bottom corner corresponding to the right-bottom
  6383. corner of the input image.
  6384. @example
  6385. crop=in_w-100:in_h-100:100:100
  6386. @end example
  6387. @item
  6388. Crop 10 pixels from the left and right borders, and 20 pixels from
  6389. the top and bottom borders
  6390. @example
  6391. crop=in_w-2*10:in_h-2*20
  6392. @end example
  6393. @item
  6394. Keep only the bottom right quarter of the input image:
  6395. @example
  6396. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6397. @end example
  6398. @item
  6399. Crop height for getting Greek harmony:
  6400. @example
  6401. crop=in_w:1/PHI*in_w
  6402. @end example
  6403. @item
  6404. Apply trembling effect:
  6405. @example
  6406. 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)
  6407. @end example
  6408. @item
  6409. Apply erratic camera effect depending on timestamp:
  6410. @example
  6411. 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)"
  6412. @end example
  6413. @item
  6414. Set x depending on the value of y:
  6415. @example
  6416. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6417. @end example
  6418. @end itemize
  6419. @subsection Commands
  6420. This filter supports the following commands:
  6421. @table @option
  6422. @item w, out_w
  6423. @item h, out_h
  6424. @item x
  6425. @item y
  6426. Set width/height of the output video and the horizontal/vertical position
  6427. in the input video.
  6428. The command accepts the same syntax of the corresponding option.
  6429. If the specified expression is not valid, it is kept at its current
  6430. value.
  6431. @end table
  6432. @section cropdetect
  6433. Auto-detect the crop size.
  6434. It calculates the necessary cropping parameters and prints the
  6435. recommended parameters via the logging system. The detected dimensions
  6436. correspond to the non-black area of the input video.
  6437. It accepts the following parameters:
  6438. @table @option
  6439. @item limit
  6440. Set higher black value threshold, which can be optionally specified
  6441. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6442. value greater to the set value is considered non-black. It defaults to 24.
  6443. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6444. on the bitdepth of the pixel format.
  6445. @item round
  6446. The value which the width/height should be divisible by. It defaults to
  6447. 16. The offset is automatically adjusted to center the video. Use 2 to
  6448. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6449. encoding to most video codecs.
  6450. @item reset_count, reset
  6451. Set the counter that determines after how many frames cropdetect will
  6452. reset the previously detected largest video area and start over to
  6453. detect the current optimal crop area. Default value is 0.
  6454. This can be useful when channel logos distort the video area. 0
  6455. indicates 'never reset', and returns the largest area encountered during
  6456. playback.
  6457. @end table
  6458. @anchor{cue}
  6459. @section cue
  6460. Delay video filtering until a given wallclock timestamp. The filter first
  6461. passes on @option{preroll} amount of frames, then it buffers at most
  6462. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6463. it forwards the buffered frames and also any subsequent frames coming in its
  6464. input.
  6465. The filter can be used synchronize the output of multiple ffmpeg processes for
  6466. realtime output devices like decklink. By putting the delay in the filtering
  6467. chain and pre-buffering frames the process can pass on data to output almost
  6468. immediately after the target wallclock timestamp is reached.
  6469. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6470. some use cases.
  6471. @table @option
  6472. @item cue
  6473. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6474. @item preroll
  6475. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6476. @item buffer
  6477. The maximum duration of content to buffer before waiting for the cue expressed
  6478. in seconds. Default is 0.
  6479. @end table
  6480. @anchor{curves}
  6481. @section curves
  6482. Apply color adjustments using curves.
  6483. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6484. component (red, green and blue) has its values defined by @var{N} key points
  6485. tied from each other using a smooth curve. The x-axis represents the pixel
  6486. values from the input frame, and the y-axis the new pixel values to be set for
  6487. the output frame.
  6488. By default, a component curve is defined by the two points @var{(0;0)} and
  6489. @var{(1;1)}. This creates a straight line where each original pixel value is
  6490. "adjusted" to its own value, which means no change to the image.
  6491. The filter allows you to redefine these two points and add some more. A new
  6492. curve (using a natural cubic spline interpolation) will be define to pass
  6493. smoothly through all these new coordinates. The new defined points needs to be
  6494. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6495. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6496. the vector spaces, the values will be clipped accordingly.
  6497. The filter accepts the following options:
  6498. @table @option
  6499. @item preset
  6500. Select one of the available color presets. This option can be used in addition
  6501. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6502. options takes priority on the preset values.
  6503. Available presets are:
  6504. @table @samp
  6505. @item none
  6506. @item color_negative
  6507. @item cross_process
  6508. @item darker
  6509. @item increase_contrast
  6510. @item lighter
  6511. @item linear_contrast
  6512. @item medium_contrast
  6513. @item negative
  6514. @item strong_contrast
  6515. @item vintage
  6516. @end table
  6517. Default is @code{none}.
  6518. @item master, m
  6519. Set the master key points. These points will define a second pass mapping. It
  6520. is sometimes called a "luminance" or "value" mapping. It can be used with
  6521. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6522. post-processing LUT.
  6523. @item red, r
  6524. Set the key points for the red component.
  6525. @item green, g
  6526. Set the key points for the green component.
  6527. @item blue, b
  6528. Set the key points for the blue component.
  6529. @item all
  6530. Set the key points for all components (not including master).
  6531. Can be used in addition to the other key points component
  6532. options. In this case, the unset component(s) will fallback on this
  6533. @option{all} setting.
  6534. @item psfile
  6535. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6536. @item plot
  6537. Save Gnuplot script of the curves in specified file.
  6538. @end table
  6539. To avoid some filtergraph syntax conflicts, each key points list need to be
  6540. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6541. @subsection Examples
  6542. @itemize
  6543. @item
  6544. Increase slightly the middle level of blue:
  6545. @example
  6546. curves=blue='0/0 0.5/0.58 1/1'
  6547. @end example
  6548. @item
  6549. Vintage effect:
  6550. @example
  6551. 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'
  6552. @end example
  6553. Here we obtain the following coordinates for each components:
  6554. @table @var
  6555. @item red
  6556. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6557. @item green
  6558. @code{(0;0) (0.50;0.48) (1;1)}
  6559. @item blue
  6560. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6561. @end table
  6562. @item
  6563. The previous example can also be achieved with the associated built-in preset:
  6564. @example
  6565. curves=preset=vintage
  6566. @end example
  6567. @item
  6568. Or simply:
  6569. @example
  6570. curves=vintage
  6571. @end example
  6572. @item
  6573. Use a Photoshop preset and redefine the points of the green component:
  6574. @example
  6575. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6576. @end example
  6577. @item
  6578. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6579. and @command{gnuplot}:
  6580. @example
  6581. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6582. gnuplot -p /tmp/curves.plt
  6583. @end example
  6584. @end itemize
  6585. @section datascope
  6586. Video data analysis filter.
  6587. This filter shows hexadecimal pixel values of part of video.
  6588. The filter accepts the following options:
  6589. @table @option
  6590. @item size, s
  6591. Set output video size.
  6592. @item x
  6593. Set x offset from where to pick pixels.
  6594. @item y
  6595. Set y offset from where to pick pixels.
  6596. @item mode
  6597. Set scope mode, can be one of the following:
  6598. @table @samp
  6599. @item mono
  6600. Draw hexadecimal pixel values with white color on black background.
  6601. @item color
  6602. Draw hexadecimal pixel values with input video pixel color on black
  6603. background.
  6604. @item color2
  6605. Draw hexadecimal pixel values on color background picked from input video,
  6606. the text color is picked in such way so its always visible.
  6607. @end table
  6608. @item axis
  6609. Draw rows and columns numbers on left and top of video.
  6610. @item opacity
  6611. Set background opacity.
  6612. @item format
  6613. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6614. @end table
  6615. @section dblur
  6616. Apply Directional blur filter.
  6617. The filter accepts the following options:
  6618. @table @option
  6619. @item angle
  6620. Set angle of directional blur. Default is @code{45}.
  6621. @item radius
  6622. Set radius of directional blur. Default is @code{5}.
  6623. @item planes
  6624. Set which planes to filter. By default all planes are filtered.
  6625. @end table
  6626. @subsection Commands
  6627. This filter supports same @ref{commands} as options.
  6628. The command accepts the same syntax of the corresponding option.
  6629. If the specified expression is not valid, it is kept at its current
  6630. value.
  6631. @section dctdnoiz
  6632. Denoise frames using 2D DCT (frequency domain filtering).
  6633. This filter is not designed for real time.
  6634. The filter accepts the following options:
  6635. @table @option
  6636. @item sigma, s
  6637. Set the noise sigma constant.
  6638. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6639. coefficient (absolute value) below this threshold with be dropped.
  6640. If you need a more advanced filtering, see @option{expr}.
  6641. Default is @code{0}.
  6642. @item overlap
  6643. Set number overlapping pixels for each block. Since the filter can be slow, you
  6644. may want to reduce this value, at the cost of a less effective filter and the
  6645. risk of various artefacts.
  6646. If the overlapping value doesn't permit processing the whole input width or
  6647. height, a warning will be displayed and according borders won't be denoised.
  6648. Default value is @var{blocksize}-1, which is the best possible setting.
  6649. @item expr, e
  6650. Set the coefficient factor expression.
  6651. For each coefficient of a DCT block, this expression will be evaluated as a
  6652. multiplier value for the coefficient.
  6653. If this is option is set, the @option{sigma} option will be ignored.
  6654. The absolute value of the coefficient can be accessed through the @var{c}
  6655. variable.
  6656. @item n
  6657. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6658. @var{blocksize}, which is the width and height of the processed blocks.
  6659. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6660. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6661. on the speed processing. Also, a larger block size does not necessarily means a
  6662. better de-noising.
  6663. @end table
  6664. @subsection Examples
  6665. Apply a denoise with a @option{sigma} of @code{4.5}:
  6666. @example
  6667. dctdnoiz=4.5
  6668. @end example
  6669. The same operation can be achieved using the expression system:
  6670. @example
  6671. dctdnoiz=e='gte(c, 4.5*3)'
  6672. @end example
  6673. Violent denoise using a block size of @code{16x16}:
  6674. @example
  6675. dctdnoiz=15:n=4
  6676. @end example
  6677. @section deband
  6678. Remove banding artifacts from input video.
  6679. It works by replacing banded pixels with average value of referenced pixels.
  6680. The filter accepts the following options:
  6681. @table @option
  6682. @item 1thr
  6683. @item 2thr
  6684. @item 3thr
  6685. @item 4thr
  6686. Set banding detection threshold for each plane. Default is 0.02.
  6687. Valid range is 0.00003 to 0.5.
  6688. If difference between current pixel and reference pixel is less than threshold,
  6689. it will be considered as banded.
  6690. @item range, r
  6691. Banding detection range in pixels. Default is 16. If positive, random number
  6692. in range 0 to set value will be used. If negative, exact absolute value
  6693. will be used.
  6694. The range defines square of four pixels around current pixel.
  6695. @item direction, d
  6696. Set direction in radians from which four pixel will be compared. If positive,
  6697. random direction from 0 to set direction will be picked. If negative, exact of
  6698. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6699. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6700. column.
  6701. @item blur, b
  6702. If enabled, current pixel is compared with average value of all four
  6703. surrounding pixels. The default is enabled. If disabled current pixel is
  6704. compared with all four surrounding pixels. The pixel is considered banded
  6705. if only all four differences with surrounding pixels are less than threshold.
  6706. @item coupling, c
  6707. If enabled, current pixel is changed if and only if all pixel components are banded,
  6708. e.g. banding detection threshold is triggered for all color components.
  6709. The default is disabled.
  6710. @end table
  6711. @section deblock
  6712. Remove blocking artifacts from input video.
  6713. The filter accepts the following options:
  6714. @table @option
  6715. @item filter
  6716. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6717. This controls what kind of deblocking is applied.
  6718. @item block
  6719. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6720. @item alpha
  6721. @item beta
  6722. @item gamma
  6723. @item delta
  6724. Set blocking detection thresholds. Allowed range is 0 to 1.
  6725. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6726. Using higher threshold gives more deblocking strength.
  6727. Setting @var{alpha} controls threshold detection at exact edge of block.
  6728. Remaining options controls threshold detection near the edge. Each one for
  6729. below/above or left/right. Setting any of those to @var{0} disables
  6730. deblocking.
  6731. @item planes
  6732. Set planes to filter. Default is to filter all available planes.
  6733. @end table
  6734. @subsection Examples
  6735. @itemize
  6736. @item
  6737. Deblock using weak filter and block size of 4 pixels.
  6738. @example
  6739. deblock=filter=weak:block=4
  6740. @end example
  6741. @item
  6742. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6743. deblocking more edges.
  6744. @example
  6745. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6746. @end example
  6747. @item
  6748. Similar as above, but filter only first plane.
  6749. @example
  6750. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6751. @end example
  6752. @item
  6753. Similar as above, but filter only second and third plane.
  6754. @example
  6755. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6756. @end example
  6757. @end itemize
  6758. @anchor{decimate}
  6759. @section decimate
  6760. Drop duplicated frames at regular intervals.
  6761. The filter accepts the following options:
  6762. @table @option
  6763. @item cycle
  6764. Set the number of frames from which one will be dropped. Setting this to
  6765. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6766. Default is @code{5}.
  6767. @item dupthresh
  6768. Set the threshold for duplicate detection. If the difference metric for a frame
  6769. is less than or equal to this value, then it is declared as duplicate. Default
  6770. is @code{1.1}
  6771. @item scthresh
  6772. Set scene change threshold. Default is @code{15}.
  6773. @item blockx
  6774. @item blocky
  6775. Set the size of the x and y-axis blocks used during metric calculations.
  6776. Larger blocks give better noise suppression, but also give worse detection of
  6777. small movements. Must be a power of two. Default is @code{32}.
  6778. @item ppsrc
  6779. Mark main input as a pre-processed input and activate clean source input
  6780. stream. This allows the input to be pre-processed with various filters to help
  6781. the metrics calculation while keeping the frame selection lossless. When set to
  6782. @code{1}, the first stream is for the pre-processed input, and the second
  6783. stream is the clean source from where the kept frames are chosen. Default is
  6784. @code{0}.
  6785. @item chroma
  6786. Set whether or not chroma is considered in the metric calculations. Default is
  6787. @code{1}.
  6788. @end table
  6789. @section deconvolve
  6790. Apply 2D deconvolution of video stream in frequency domain using second stream
  6791. as impulse.
  6792. The filter accepts the following options:
  6793. @table @option
  6794. @item planes
  6795. Set which planes to process.
  6796. @item impulse
  6797. Set which impulse video frames will be processed, can be @var{first}
  6798. or @var{all}. Default is @var{all}.
  6799. @item noise
  6800. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6801. and height are not same and not power of 2 or if stream prior to convolving
  6802. had noise.
  6803. @end table
  6804. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6805. @section dedot
  6806. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6807. It accepts the following options:
  6808. @table @option
  6809. @item m
  6810. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6811. @var{rainbows} for cross-color reduction.
  6812. @item lt
  6813. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6814. @item tl
  6815. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6816. @item tc
  6817. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6818. @item ct
  6819. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6820. @end table
  6821. @section deflate
  6822. Apply deflate effect to the video.
  6823. This filter replaces the pixel by the local(3x3) average by taking into account
  6824. only values lower than the pixel.
  6825. It accepts the following options:
  6826. @table @option
  6827. @item threshold0
  6828. @item threshold1
  6829. @item threshold2
  6830. @item threshold3
  6831. Limit the maximum change for each plane, default is 65535.
  6832. If 0, plane will remain unchanged.
  6833. @end table
  6834. @subsection Commands
  6835. This filter supports the all above options as @ref{commands}.
  6836. @section deflicker
  6837. Remove temporal frame luminance variations.
  6838. It accepts the following options:
  6839. @table @option
  6840. @item size, s
  6841. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6842. @item mode, m
  6843. Set averaging mode to smooth temporal luminance variations.
  6844. Available values are:
  6845. @table @samp
  6846. @item am
  6847. Arithmetic mean
  6848. @item gm
  6849. Geometric mean
  6850. @item hm
  6851. Harmonic mean
  6852. @item qm
  6853. Quadratic mean
  6854. @item cm
  6855. Cubic mean
  6856. @item pm
  6857. Power mean
  6858. @item median
  6859. Median
  6860. @end table
  6861. @item bypass
  6862. Do not actually modify frame. Useful when one only wants metadata.
  6863. @end table
  6864. @section dejudder
  6865. Remove judder produced by partially interlaced telecined content.
  6866. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6867. source was partially telecined content then the output of @code{pullup,dejudder}
  6868. will have a variable frame rate. May change the recorded frame rate of the
  6869. container. Aside from that change, this filter will not affect constant frame
  6870. rate video.
  6871. The option available in this filter is:
  6872. @table @option
  6873. @item cycle
  6874. Specify the length of the window over which the judder repeats.
  6875. Accepts any integer greater than 1. Useful values are:
  6876. @table @samp
  6877. @item 4
  6878. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6879. @item 5
  6880. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6881. @item 20
  6882. If a mixture of the two.
  6883. @end table
  6884. The default is @samp{4}.
  6885. @end table
  6886. @section delogo
  6887. Suppress a TV station logo by a simple interpolation of the surrounding
  6888. pixels. Just set a rectangle covering the logo and watch it disappear
  6889. (and sometimes something even uglier appear - your mileage may vary).
  6890. It accepts the following parameters:
  6891. @table @option
  6892. @item x
  6893. @item y
  6894. Specify the top left corner coordinates of the logo. They must be
  6895. specified.
  6896. @item w
  6897. @item h
  6898. Specify the width and height of the logo to clear. They must be
  6899. specified.
  6900. @item band, t
  6901. Specify the thickness of the fuzzy edge of the rectangle (added to
  6902. @var{w} and @var{h}). The default value is 1. This option is
  6903. deprecated, setting higher values should no longer be necessary and
  6904. is not recommended.
  6905. @item show
  6906. When set to 1, a green rectangle is drawn on the screen to simplify
  6907. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6908. The default value is 0.
  6909. The rectangle is drawn on the outermost pixels which will be (partly)
  6910. replaced with interpolated values. The values of the next pixels
  6911. immediately outside this rectangle in each direction will be used to
  6912. compute the interpolated pixel values inside the rectangle.
  6913. @end table
  6914. @subsection Examples
  6915. @itemize
  6916. @item
  6917. Set a rectangle covering the area with top left corner coordinates 0,0
  6918. and size 100x77, and a band of size 10:
  6919. @example
  6920. delogo=x=0:y=0:w=100:h=77:band=10
  6921. @end example
  6922. @end itemize
  6923. @anchor{derain}
  6924. @section derain
  6925. Remove the rain in the input image/video by applying the derain methods based on
  6926. convolutional neural networks. Supported models:
  6927. @itemize
  6928. @item
  6929. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6930. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6931. @end itemize
  6932. Training as well as model generation scripts are provided in
  6933. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6934. Native model files (.model) can be generated from TensorFlow model
  6935. files (.pb) by using tools/python/convert.py
  6936. The filter accepts the following options:
  6937. @table @option
  6938. @item filter_type
  6939. Specify which filter to use. This option accepts the following values:
  6940. @table @samp
  6941. @item derain
  6942. Derain filter. To conduct derain filter, you need to use a derain model.
  6943. @item dehaze
  6944. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6945. @end table
  6946. Default value is @samp{derain}.
  6947. @item dnn_backend
  6948. Specify which DNN backend to use for model loading and execution. This option accepts
  6949. the following values:
  6950. @table @samp
  6951. @item native
  6952. Native implementation of DNN loading and execution.
  6953. @item tensorflow
  6954. TensorFlow backend. To enable this backend you
  6955. need to install the TensorFlow for C library (see
  6956. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6957. @code{--enable-libtensorflow}
  6958. @end table
  6959. Default value is @samp{native}.
  6960. @item model
  6961. Set path to model file specifying network architecture and its parameters.
  6962. Note that different backends use different file formats. TensorFlow and native
  6963. backend can load files for only its format.
  6964. @end table
  6965. It can also be finished with @ref{dnn_processing} filter.
  6966. @section deshake
  6967. Attempt to fix small changes in horizontal and/or vertical shift. This
  6968. filter helps remove camera shake from hand-holding a camera, bumping a
  6969. tripod, moving on a vehicle, etc.
  6970. The filter accepts the following options:
  6971. @table @option
  6972. @item x
  6973. @item y
  6974. @item w
  6975. @item h
  6976. Specify a rectangular area where to limit the search for motion
  6977. vectors.
  6978. If desired the search for motion vectors can be limited to a
  6979. rectangular area of the frame defined by its top left corner, width
  6980. and height. These parameters have the same meaning as the drawbox
  6981. filter which can be used to visualise the position of the bounding
  6982. box.
  6983. This is useful when simultaneous movement of subjects within the frame
  6984. might be confused for camera motion by the motion vector search.
  6985. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6986. then the full frame is used. This allows later options to be set
  6987. without specifying the bounding box for the motion vector search.
  6988. Default - search the whole frame.
  6989. @item rx
  6990. @item ry
  6991. Specify the maximum extent of movement in x and y directions in the
  6992. range 0-64 pixels. Default 16.
  6993. @item edge
  6994. Specify how to generate pixels to fill blanks at the edge of the
  6995. frame. Available values are:
  6996. @table @samp
  6997. @item blank, 0
  6998. Fill zeroes at blank locations
  6999. @item original, 1
  7000. Original image at blank locations
  7001. @item clamp, 2
  7002. Extruded edge value at blank locations
  7003. @item mirror, 3
  7004. Mirrored edge at blank locations
  7005. @end table
  7006. Default value is @samp{mirror}.
  7007. @item blocksize
  7008. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7009. default 8.
  7010. @item contrast
  7011. Specify the contrast threshold for blocks. Only blocks with more than
  7012. the specified contrast (difference between darkest and lightest
  7013. pixels) will be considered. Range 1-255, default 125.
  7014. @item search
  7015. Specify the search strategy. Available values are:
  7016. @table @samp
  7017. @item exhaustive, 0
  7018. Set exhaustive search
  7019. @item less, 1
  7020. Set less exhaustive search.
  7021. @end table
  7022. Default value is @samp{exhaustive}.
  7023. @item filename
  7024. If set then a detailed log of the motion search is written to the
  7025. specified file.
  7026. @end table
  7027. @section despill
  7028. Remove unwanted contamination of foreground colors, caused by reflected color of
  7029. greenscreen or bluescreen.
  7030. This filter accepts the following options:
  7031. @table @option
  7032. @item type
  7033. Set what type of despill to use.
  7034. @item mix
  7035. Set how spillmap will be generated.
  7036. @item expand
  7037. Set how much to get rid of still remaining spill.
  7038. @item red
  7039. Controls amount of red in spill area.
  7040. @item green
  7041. Controls amount of green in spill area.
  7042. Should be -1 for greenscreen.
  7043. @item blue
  7044. Controls amount of blue in spill area.
  7045. Should be -1 for bluescreen.
  7046. @item brightness
  7047. Controls brightness of spill area, preserving colors.
  7048. @item alpha
  7049. Modify alpha from generated spillmap.
  7050. @end table
  7051. @section detelecine
  7052. Apply an exact inverse of the telecine operation. It requires a predefined
  7053. pattern specified using the pattern option which must be the same as that passed
  7054. to the telecine filter.
  7055. This filter accepts the following options:
  7056. @table @option
  7057. @item first_field
  7058. @table @samp
  7059. @item top, t
  7060. top field first
  7061. @item bottom, b
  7062. bottom field first
  7063. The default value is @code{top}.
  7064. @end table
  7065. @item pattern
  7066. A string of numbers representing the pulldown pattern you wish to apply.
  7067. The default value is @code{23}.
  7068. @item start_frame
  7069. A number representing position of the first frame with respect to the telecine
  7070. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7071. @end table
  7072. @section dilation
  7073. Apply dilation effect to the video.
  7074. This filter replaces the pixel by the local(3x3) maximum.
  7075. It accepts the following options:
  7076. @table @option
  7077. @item threshold0
  7078. @item threshold1
  7079. @item threshold2
  7080. @item threshold3
  7081. Limit the maximum change for each plane, default is 65535.
  7082. If 0, plane will remain unchanged.
  7083. @item coordinates
  7084. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7085. pixels are used.
  7086. Flags to local 3x3 coordinates maps like this:
  7087. 1 2 3
  7088. 4 5
  7089. 6 7 8
  7090. @end table
  7091. @subsection Commands
  7092. This filter supports the all above options as @ref{commands}.
  7093. @section displace
  7094. Displace pixels as indicated by second and third input stream.
  7095. It takes three input streams and outputs one stream, the first input is the
  7096. source, and second and third input are displacement maps.
  7097. The second input specifies how much to displace pixels along the
  7098. x-axis, while the third input specifies how much to displace pixels
  7099. along the y-axis.
  7100. If one of displacement map streams terminates, last frame from that
  7101. displacement map will be used.
  7102. Note that once generated, displacements maps can be reused over and over again.
  7103. A description of the accepted options follows.
  7104. @table @option
  7105. @item edge
  7106. Set displace behavior for pixels that are out of range.
  7107. Available values are:
  7108. @table @samp
  7109. @item blank
  7110. Missing pixels are replaced by black pixels.
  7111. @item smear
  7112. Adjacent pixels will spread out to replace missing pixels.
  7113. @item wrap
  7114. Out of range pixels are wrapped so they point to pixels of other side.
  7115. @item mirror
  7116. Out of range pixels will be replaced with mirrored pixels.
  7117. @end table
  7118. Default is @samp{smear}.
  7119. @end table
  7120. @subsection Examples
  7121. @itemize
  7122. @item
  7123. Add ripple effect to rgb input of video size hd720:
  7124. @example
  7125. 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
  7126. @end example
  7127. @item
  7128. Add wave effect to rgb input of video size hd720:
  7129. @example
  7130. 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
  7131. @end example
  7132. @end itemize
  7133. @anchor{dnn_processing}
  7134. @section dnn_processing
  7135. Do image processing with deep neural networks. It works together with another filter
  7136. which converts the pixel format of the Frame to what the dnn network requires.
  7137. The filter accepts the following options:
  7138. @table @option
  7139. @item dnn_backend
  7140. Specify which DNN backend to use for model loading and execution. This option accepts
  7141. the following values:
  7142. @table @samp
  7143. @item native
  7144. Native implementation of DNN loading and execution.
  7145. @item tensorflow
  7146. TensorFlow backend. To enable this backend you
  7147. need to install the TensorFlow for C library (see
  7148. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7149. @code{--enable-libtensorflow}
  7150. @item openvino
  7151. OpenVINO backend. To enable this backend you
  7152. need to build and install the OpenVINO for C library (see
  7153. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7154. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7155. be needed if the header files and libraries are not installed into system path)
  7156. @end table
  7157. Default value is @samp{native}.
  7158. @item model
  7159. Set path to model file specifying network architecture and its parameters.
  7160. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7161. backend can load files for only its format.
  7162. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7163. @item input
  7164. Set the input name of the dnn network.
  7165. @item output
  7166. Set the output name of the dnn network.
  7167. @end table
  7168. @subsection Examples
  7169. @itemize
  7170. @item
  7171. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7172. @example
  7173. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7174. @end example
  7175. @item
  7176. Halve the pixel value of the frame with format gray32f:
  7177. @example
  7178. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7179. @end example
  7180. @item
  7181. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7182. @example
  7183. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7184. @end example
  7185. @item
  7186. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7187. @example
  7188. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7189. @end example
  7190. @end itemize
  7191. @section drawbox
  7192. Draw a colored box on the input image.
  7193. It accepts the following parameters:
  7194. @table @option
  7195. @item x
  7196. @item y
  7197. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7198. @item width, w
  7199. @item height, h
  7200. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7201. the input width and height. It defaults to 0.
  7202. @item color, c
  7203. Specify the color of the box to write. For the general syntax of this option,
  7204. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7205. value @code{invert} is used, the box edge color is the same as the
  7206. video with inverted luma.
  7207. @item thickness, t
  7208. The expression which sets the thickness of the box edge.
  7209. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7210. See below for the list of accepted constants.
  7211. @item replace
  7212. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7213. will overwrite the video's color and alpha pixels.
  7214. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7215. @end table
  7216. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7217. following constants:
  7218. @table @option
  7219. @item dar
  7220. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7221. @item hsub
  7222. @item vsub
  7223. horizontal and vertical chroma subsample values. For example for the
  7224. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7225. @item in_h, ih
  7226. @item in_w, iw
  7227. The input width and height.
  7228. @item sar
  7229. The input sample aspect ratio.
  7230. @item x
  7231. @item y
  7232. The x and y offset coordinates where the box is drawn.
  7233. @item w
  7234. @item h
  7235. The width and height of the drawn box.
  7236. @item t
  7237. The thickness of the drawn box.
  7238. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7239. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7240. @end table
  7241. @subsection Examples
  7242. @itemize
  7243. @item
  7244. Draw a black box around the edge of the input image:
  7245. @example
  7246. drawbox
  7247. @end example
  7248. @item
  7249. Draw a box with color red and an opacity of 50%:
  7250. @example
  7251. drawbox=10:20:200:60:red@@0.5
  7252. @end example
  7253. The previous example can be specified as:
  7254. @example
  7255. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7256. @end example
  7257. @item
  7258. Fill the box with pink color:
  7259. @example
  7260. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7261. @end example
  7262. @item
  7263. Draw a 2-pixel red 2.40:1 mask:
  7264. @example
  7265. 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
  7266. @end example
  7267. @end itemize
  7268. @subsection Commands
  7269. This filter supports same commands as options.
  7270. The command accepts the same syntax of the corresponding option.
  7271. If the specified expression is not valid, it is kept at its current
  7272. value.
  7273. @anchor{drawgraph}
  7274. @section drawgraph
  7275. Draw a graph using input video metadata.
  7276. It accepts the following parameters:
  7277. @table @option
  7278. @item m1
  7279. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7280. @item fg1
  7281. Set 1st foreground color expression.
  7282. @item m2
  7283. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7284. @item fg2
  7285. Set 2nd foreground color expression.
  7286. @item m3
  7287. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7288. @item fg3
  7289. Set 3rd foreground color expression.
  7290. @item m4
  7291. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7292. @item fg4
  7293. Set 4th foreground color expression.
  7294. @item min
  7295. Set minimal value of metadata value.
  7296. @item max
  7297. Set maximal value of metadata value.
  7298. @item bg
  7299. Set graph background color. Default is white.
  7300. @item mode
  7301. Set graph mode.
  7302. Available values for mode is:
  7303. @table @samp
  7304. @item bar
  7305. @item dot
  7306. @item line
  7307. @end table
  7308. Default is @code{line}.
  7309. @item slide
  7310. Set slide mode.
  7311. Available values for slide is:
  7312. @table @samp
  7313. @item frame
  7314. Draw new frame when right border is reached.
  7315. @item replace
  7316. Replace old columns with new ones.
  7317. @item scroll
  7318. Scroll from right to left.
  7319. @item rscroll
  7320. Scroll from left to right.
  7321. @item picture
  7322. Draw single picture.
  7323. @end table
  7324. Default is @code{frame}.
  7325. @item size
  7326. Set size of graph video. For the syntax of this option, check the
  7327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7328. The default value is @code{900x256}.
  7329. @item rate, r
  7330. Set the output frame rate. Default value is @code{25}.
  7331. The foreground color expressions can use the following variables:
  7332. @table @option
  7333. @item MIN
  7334. Minimal value of metadata value.
  7335. @item MAX
  7336. Maximal value of metadata value.
  7337. @item VAL
  7338. Current metadata key value.
  7339. @end table
  7340. The color is defined as 0xAABBGGRR.
  7341. @end table
  7342. Example using metadata from @ref{signalstats} filter:
  7343. @example
  7344. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7345. @end example
  7346. Example using metadata from @ref{ebur128} filter:
  7347. @example
  7348. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7349. @end example
  7350. @section drawgrid
  7351. Draw a grid on the input image.
  7352. It accepts the following parameters:
  7353. @table @option
  7354. @item x
  7355. @item y
  7356. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7357. @item width, w
  7358. @item height, h
  7359. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7360. input width and height, respectively, minus @code{thickness}, so image gets
  7361. framed. Default to 0.
  7362. @item color, c
  7363. Specify the color of the grid. For the general syntax of this option,
  7364. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7365. value @code{invert} is used, the grid color is the same as the
  7366. video with inverted luma.
  7367. @item thickness, t
  7368. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7369. See below for the list of accepted constants.
  7370. @item replace
  7371. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7372. will overwrite the video's color and alpha pixels.
  7373. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7374. @end table
  7375. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7376. following constants:
  7377. @table @option
  7378. @item dar
  7379. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7380. @item hsub
  7381. @item vsub
  7382. horizontal and vertical chroma subsample values. For example for the
  7383. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7384. @item in_h, ih
  7385. @item in_w, iw
  7386. The input grid cell width and height.
  7387. @item sar
  7388. The input sample aspect ratio.
  7389. @item x
  7390. @item y
  7391. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7392. @item w
  7393. @item h
  7394. The width and height of the drawn cell.
  7395. @item t
  7396. The thickness of the drawn cell.
  7397. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7398. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7399. @end table
  7400. @subsection Examples
  7401. @itemize
  7402. @item
  7403. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7404. @example
  7405. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7406. @end example
  7407. @item
  7408. Draw a white 3x3 grid with an opacity of 50%:
  7409. @example
  7410. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7411. @end example
  7412. @end itemize
  7413. @subsection Commands
  7414. This filter supports same commands as options.
  7415. The command accepts the same syntax of the corresponding option.
  7416. If the specified expression is not valid, it is kept at its current
  7417. value.
  7418. @anchor{drawtext}
  7419. @section drawtext
  7420. Draw a text string or text from a specified file on top of a video, using the
  7421. libfreetype library.
  7422. To enable compilation of this filter, you need to configure FFmpeg with
  7423. @code{--enable-libfreetype}.
  7424. To enable default font fallback and the @var{font} option you need to
  7425. configure FFmpeg with @code{--enable-libfontconfig}.
  7426. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7427. @code{--enable-libfribidi}.
  7428. @subsection Syntax
  7429. It accepts the following parameters:
  7430. @table @option
  7431. @item box
  7432. Used to draw a box around text using the background color.
  7433. The value must be either 1 (enable) or 0 (disable).
  7434. The default value of @var{box} is 0.
  7435. @item boxborderw
  7436. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7437. The default value of @var{boxborderw} is 0.
  7438. @item boxcolor
  7439. The color to be used for drawing box around text. For the syntax of this
  7440. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7441. The default value of @var{boxcolor} is "white".
  7442. @item line_spacing
  7443. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7444. The default value of @var{line_spacing} is 0.
  7445. @item borderw
  7446. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7447. The default value of @var{borderw} is 0.
  7448. @item bordercolor
  7449. Set the color to be used for drawing border around text. For the syntax of this
  7450. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7451. The default value of @var{bordercolor} is "black".
  7452. @item expansion
  7453. Select how the @var{text} is expanded. Can be either @code{none},
  7454. @code{strftime} (deprecated) or
  7455. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7456. below for details.
  7457. @item basetime
  7458. Set a start time for the count. Value is in microseconds. Only applied
  7459. in the deprecated strftime expansion mode. To emulate in normal expansion
  7460. mode use the @code{pts} function, supplying the start time (in seconds)
  7461. as the second argument.
  7462. @item fix_bounds
  7463. If true, check and fix text coords to avoid clipping.
  7464. @item fontcolor
  7465. The color to be used for drawing fonts. For the syntax of this option, check
  7466. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7467. The default value of @var{fontcolor} is "black".
  7468. @item fontcolor_expr
  7469. String which is expanded the same way as @var{text} to obtain dynamic
  7470. @var{fontcolor} value. By default this option has empty value and is not
  7471. processed. When this option is set, it overrides @var{fontcolor} option.
  7472. @item font
  7473. The font family to be used for drawing text. By default Sans.
  7474. @item fontfile
  7475. The font file to be used for drawing text. The path must be included.
  7476. This parameter is mandatory if the fontconfig support is disabled.
  7477. @item alpha
  7478. Draw the text applying alpha blending. The value can
  7479. be a number between 0.0 and 1.0.
  7480. The expression accepts the same variables @var{x, y} as well.
  7481. The default value is 1.
  7482. Please see @var{fontcolor_expr}.
  7483. @item fontsize
  7484. The font size to be used for drawing text.
  7485. The default value of @var{fontsize} is 16.
  7486. @item text_shaping
  7487. If set to 1, attempt to shape the text (for example, reverse the order of
  7488. right-to-left text and join Arabic characters) before drawing it.
  7489. Otherwise, just draw the text exactly as given.
  7490. By default 1 (if supported).
  7491. @item ft_load_flags
  7492. The flags to be used for loading the fonts.
  7493. The flags map the corresponding flags supported by libfreetype, and are
  7494. a combination of the following values:
  7495. @table @var
  7496. @item default
  7497. @item no_scale
  7498. @item no_hinting
  7499. @item render
  7500. @item no_bitmap
  7501. @item vertical_layout
  7502. @item force_autohint
  7503. @item crop_bitmap
  7504. @item pedantic
  7505. @item ignore_global_advance_width
  7506. @item no_recurse
  7507. @item ignore_transform
  7508. @item monochrome
  7509. @item linear_design
  7510. @item no_autohint
  7511. @end table
  7512. Default value is "default".
  7513. For more information consult the documentation for the FT_LOAD_*
  7514. libfreetype flags.
  7515. @item shadowcolor
  7516. The color to be used for drawing a shadow behind the drawn text. For the
  7517. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7518. ffmpeg-utils manual,ffmpeg-utils}.
  7519. The default value of @var{shadowcolor} is "black".
  7520. @item shadowx
  7521. @item shadowy
  7522. The x and y offsets for the text shadow position with respect to the
  7523. position of the text. They can be either positive or negative
  7524. values. The default value for both is "0".
  7525. @item start_number
  7526. The starting frame number for the n/frame_num variable. The default value
  7527. is "0".
  7528. @item tabsize
  7529. The size in number of spaces to use for rendering the tab.
  7530. Default value is 4.
  7531. @item timecode
  7532. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7533. format. It can be used with or without text parameter. @var{timecode_rate}
  7534. option must be specified.
  7535. @item timecode_rate, rate, r
  7536. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7537. integer. Minimum value is "1".
  7538. Drop-frame timecode is supported for frame rates 30 & 60.
  7539. @item tc24hmax
  7540. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7541. Default is 0 (disabled).
  7542. @item text
  7543. The text string to be drawn. The text must be a sequence of UTF-8
  7544. encoded characters.
  7545. This parameter is mandatory if no file is specified with the parameter
  7546. @var{textfile}.
  7547. @item textfile
  7548. A text file containing text to be drawn. The text must be a sequence
  7549. of UTF-8 encoded characters.
  7550. This parameter is mandatory if no text string is specified with the
  7551. parameter @var{text}.
  7552. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7553. @item reload
  7554. If set to 1, the @var{textfile} will be reloaded before each frame.
  7555. Be sure to update it atomically, or it may be read partially, or even fail.
  7556. @item x
  7557. @item y
  7558. The expressions which specify the offsets where text will be drawn
  7559. within the video frame. They are relative to the top/left border of the
  7560. output image.
  7561. The default value of @var{x} and @var{y} is "0".
  7562. See below for the list of accepted constants and functions.
  7563. @end table
  7564. The parameters for @var{x} and @var{y} are expressions containing the
  7565. following constants and functions:
  7566. @table @option
  7567. @item dar
  7568. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7569. @item hsub
  7570. @item vsub
  7571. horizontal and vertical chroma subsample values. For example for the
  7572. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7573. @item line_h, lh
  7574. the height of each text line
  7575. @item main_h, h, H
  7576. the input height
  7577. @item main_w, w, W
  7578. the input width
  7579. @item max_glyph_a, ascent
  7580. the maximum distance from the baseline to the highest/upper grid
  7581. coordinate used to place a glyph outline point, for all the rendered
  7582. glyphs.
  7583. It is a positive value, due to the grid's orientation with the Y axis
  7584. upwards.
  7585. @item max_glyph_d, descent
  7586. the maximum distance from the baseline to the lowest grid coordinate
  7587. used to place a glyph outline point, for all the rendered glyphs.
  7588. This is a negative value, due to the grid's orientation, with the Y axis
  7589. upwards.
  7590. @item max_glyph_h
  7591. maximum glyph height, that is the maximum height for all the glyphs
  7592. contained in the rendered text, it is equivalent to @var{ascent} -
  7593. @var{descent}.
  7594. @item max_glyph_w
  7595. maximum glyph width, that is the maximum width for all the glyphs
  7596. contained in the rendered text
  7597. @item n
  7598. the number of input frame, starting from 0
  7599. @item rand(min, max)
  7600. return a random number included between @var{min} and @var{max}
  7601. @item sar
  7602. The input sample aspect ratio.
  7603. @item t
  7604. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7605. @item text_h, th
  7606. the height of the rendered text
  7607. @item text_w, tw
  7608. the width of the rendered text
  7609. @item x
  7610. @item y
  7611. the x and y offset coordinates where the text is drawn.
  7612. These parameters allow the @var{x} and @var{y} expressions to refer
  7613. to each other, so you can for example specify @code{y=x/dar}.
  7614. @item pict_type
  7615. A one character description of the current frame's picture type.
  7616. @item pkt_pos
  7617. The current packet's position in the input file or stream
  7618. (in bytes, from the start of the input). A value of -1 indicates
  7619. this info is not available.
  7620. @item pkt_duration
  7621. The current packet's duration, in seconds.
  7622. @item pkt_size
  7623. The current packet's size (in bytes).
  7624. @end table
  7625. @anchor{drawtext_expansion}
  7626. @subsection Text expansion
  7627. If @option{expansion} is set to @code{strftime},
  7628. the filter recognizes strftime() sequences in the provided text and
  7629. expands them accordingly. Check the documentation of strftime(). This
  7630. feature is deprecated.
  7631. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7632. If @option{expansion} is set to @code{normal} (which is the default),
  7633. the following expansion mechanism is used.
  7634. The backslash character @samp{\}, followed by any character, always expands to
  7635. the second character.
  7636. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7637. braces is a function name, possibly followed by arguments separated by ':'.
  7638. If the arguments contain special characters or delimiters (':' or '@}'),
  7639. they should be escaped.
  7640. Note that they probably must also be escaped as the value for the
  7641. @option{text} option in the filter argument string and as the filter
  7642. argument in the filtergraph description, and possibly also for the shell,
  7643. that makes up to four levels of escaping; using a text file avoids these
  7644. problems.
  7645. The following functions are available:
  7646. @table @command
  7647. @item expr, e
  7648. The expression evaluation result.
  7649. It must take one argument specifying the expression to be evaluated,
  7650. which accepts the same constants and functions as the @var{x} and
  7651. @var{y} values. Note that not all constants should be used, for
  7652. example the text size is not known when evaluating the expression, so
  7653. the constants @var{text_w} and @var{text_h} will have an undefined
  7654. value.
  7655. @item expr_int_format, eif
  7656. Evaluate the expression's value and output as formatted integer.
  7657. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7658. The second argument specifies the output format. Allowed values are @samp{x},
  7659. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7660. @code{printf} function.
  7661. The third parameter is optional and sets the number of positions taken by the output.
  7662. It can be used to add padding with zeros from the left.
  7663. @item gmtime
  7664. The time at which the filter is running, expressed in UTC.
  7665. It can accept an argument: a strftime() format string.
  7666. @item localtime
  7667. The time at which the filter is running, expressed in the local time zone.
  7668. It can accept an argument: a strftime() format string.
  7669. @item metadata
  7670. Frame metadata. Takes one or two arguments.
  7671. The first argument is mandatory and specifies the metadata key.
  7672. The second argument is optional and specifies a default value, used when the
  7673. metadata key is not found or empty.
  7674. Available metadata can be identified by inspecting entries
  7675. starting with TAG included within each frame section
  7676. printed by running @code{ffprobe -show_frames}.
  7677. String metadata generated in filters leading to
  7678. the drawtext filter are also available.
  7679. @item n, frame_num
  7680. The frame number, starting from 0.
  7681. @item pict_type
  7682. A one character description of the current picture type.
  7683. @item pts
  7684. The timestamp of the current frame.
  7685. It can take up to three arguments.
  7686. The first argument is the format of the timestamp; it defaults to @code{flt}
  7687. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7688. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7689. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7690. @code{localtime} stands for the timestamp of the frame formatted as
  7691. local time zone time.
  7692. The second argument is an offset added to the timestamp.
  7693. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7694. supplied to present the hour part of the formatted timestamp in 24h format
  7695. (00-23).
  7696. If the format is set to @code{localtime} or @code{gmtime},
  7697. a third argument may be supplied: a strftime() format string.
  7698. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7699. @end table
  7700. @subsection Commands
  7701. This filter supports altering parameters via commands:
  7702. @table @option
  7703. @item reinit
  7704. Alter existing filter parameters.
  7705. Syntax for the argument is the same as for filter invocation, e.g.
  7706. @example
  7707. fontsize=56:fontcolor=green:text='Hello World'
  7708. @end example
  7709. Full filter invocation with sendcmd would look like this:
  7710. @example
  7711. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7712. @end example
  7713. @end table
  7714. If the entire argument can't be parsed or applied as valid values then the filter will
  7715. continue with its existing parameters.
  7716. @subsection Examples
  7717. @itemize
  7718. @item
  7719. Draw "Test Text" with font FreeSerif, using the default values for the
  7720. optional parameters.
  7721. @example
  7722. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7723. @end example
  7724. @item
  7725. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7726. and y=50 (counting from the top-left corner of the screen), text is
  7727. yellow with a red box around it. Both the text and the box have an
  7728. opacity of 20%.
  7729. @example
  7730. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7731. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7732. @end example
  7733. Note that the double quotes are not necessary if spaces are not used
  7734. within the parameter list.
  7735. @item
  7736. Show the text at the center of the video frame:
  7737. @example
  7738. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7739. @end example
  7740. @item
  7741. Show the text at a random position, switching to a new position every 30 seconds:
  7742. @example
  7743. 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)"
  7744. @end example
  7745. @item
  7746. Show a text line sliding from right to left in the last row of the video
  7747. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7748. with no newlines.
  7749. @example
  7750. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7751. @end example
  7752. @item
  7753. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7754. @example
  7755. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7756. @end example
  7757. @item
  7758. Draw a single green letter "g", at the center of the input video.
  7759. The glyph baseline is placed at half screen height.
  7760. @example
  7761. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7762. @end example
  7763. @item
  7764. Show text for 1 second every 3 seconds:
  7765. @example
  7766. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7767. @end example
  7768. @item
  7769. Use fontconfig to set the font. Note that the colons need to be escaped.
  7770. @example
  7771. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7772. @end example
  7773. @item
  7774. Print the date of a real-time encoding (see strftime(3)):
  7775. @example
  7776. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7777. @end example
  7778. @item
  7779. Show text fading in and out (appearing/disappearing):
  7780. @example
  7781. #!/bin/sh
  7782. DS=1.0 # display start
  7783. DE=10.0 # display end
  7784. FID=1.5 # fade in duration
  7785. FOD=5 # fade out duration
  7786. 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 @}"
  7787. @end example
  7788. @item
  7789. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7790. and the @option{fontsize} value are included in the @option{y} offset.
  7791. @example
  7792. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7793. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7794. @end example
  7795. @item
  7796. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7797. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7798. must have option @option{-export_path_metadata 1} for the special metadata fields
  7799. to be available for filters.
  7800. @example
  7801. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7802. @end example
  7803. @end itemize
  7804. For more information about libfreetype, check:
  7805. @url{http://www.freetype.org/}.
  7806. For more information about fontconfig, check:
  7807. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7808. For more information about libfribidi, check:
  7809. @url{http://fribidi.org/}.
  7810. @section edgedetect
  7811. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7812. The filter accepts the following options:
  7813. @table @option
  7814. @item low
  7815. @item high
  7816. Set low and high threshold values used by the Canny thresholding
  7817. algorithm.
  7818. The high threshold selects the "strong" edge pixels, which are then
  7819. connected through 8-connectivity with the "weak" edge pixels selected
  7820. by the low threshold.
  7821. @var{low} and @var{high} threshold values must be chosen in the range
  7822. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7823. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7824. is @code{50/255}.
  7825. @item mode
  7826. Define the drawing mode.
  7827. @table @samp
  7828. @item wires
  7829. Draw white/gray wires on black background.
  7830. @item colormix
  7831. Mix the colors to create a paint/cartoon effect.
  7832. @item canny
  7833. Apply Canny edge detector on all selected planes.
  7834. @end table
  7835. Default value is @var{wires}.
  7836. @item planes
  7837. Select planes for filtering. By default all available planes are filtered.
  7838. @end table
  7839. @subsection Examples
  7840. @itemize
  7841. @item
  7842. Standard edge detection with custom values for the hysteresis thresholding:
  7843. @example
  7844. edgedetect=low=0.1:high=0.4
  7845. @end example
  7846. @item
  7847. Painting effect without thresholding:
  7848. @example
  7849. edgedetect=mode=colormix:high=0
  7850. @end example
  7851. @end itemize
  7852. @section elbg
  7853. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7854. For each input image, the filter will compute the optimal mapping from
  7855. the input to the output given the codebook length, that is the number
  7856. of distinct output colors.
  7857. This filter accepts the following options.
  7858. @table @option
  7859. @item codebook_length, l
  7860. Set codebook length. The value must be a positive integer, and
  7861. represents the number of distinct output colors. Default value is 256.
  7862. @item nb_steps, n
  7863. Set the maximum number of iterations to apply for computing the optimal
  7864. mapping. The higher the value the better the result and the higher the
  7865. computation time. Default value is 1.
  7866. @item seed, s
  7867. Set a random seed, must be an integer included between 0 and
  7868. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7869. will try to use a good random seed on a best effort basis.
  7870. @item pal8
  7871. Set pal8 output pixel format. This option does not work with codebook
  7872. length greater than 256.
  7873. @end table
  7874. @section entropy
  7875. Measure graylevel entropy in histogram of color channels of video frames.
  7876. It accepts the following parameters:
  7877. @table @option
  7878. @item mode
  7879. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7880. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7881. between neighbour histogram values.
  7882. @end table
  7883. @section eq
  7884. Set brightness, contrast, saturation and approximate gamma adjustment.
  7885. The filter accepts the following options:
  7886. @table @option
  7887. @item contrast
  7888. Set the contrast expression. The value must be a float value in range
  7889. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7890. @item brightness
  7891. Set the brightness expression. The value must be a float value in
  7892. range @code{-1.0} to @code{1.0}. The default value is "0".
  7893. @item saturation
  7894. Set the saturation expression. The value must be a float in
  7895. range @code{0.0} to @code{3.0}. The default value is "1".
  7896. @item gamma
  7897. Set the gamma expression. The value must be a float in range
  7898. @code{0.1} to @code{10.0}. The default value is "1".
  7899. @item gamma_r
  7900. Set the gamma expression for red. The value must be a float in
  7901. range @code{0.1} to @code{10.0}. The default value is "1".
  7902. @item gamma_g
  7903. Set the gamma expression for green. The value must be a float in range
  7904. @code{0.1} to @code{10.0}. The default value is "1".
  7905. @item gamma_b
  7906. Set the gamma expression for blue. The value must be a float in range
  7907. @code{0.1} to @code{10.0}. The default value is "1".
  7908. @item gamma_weight
  7909. Set the gamma weight expression. It can be used to reduce the effect
  7910. of a high gamma value on bright image areas, e.g. keep them from
  7911. getting overamplified and just plain white. The value must be a float
  7912. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7913. gamma correction all the way down while @code{1.0} leaves it at its
  7914. full strength. Default is "1".
  7915. @item eval
  7916. Set when the expressions for brightness, contrast, saturation and
  7917. gamma expressions are evaluated.
  7918. It accepts the following values:
  7919. @table @samp
  7920. @item init
  7921. only evaluate expressions once during the filter initialization or
  7922. when a command is processed
  7923. @item frame
  7924. evaluate expressions for each incoming frame
  7925. @end table
  7926. Default value is @samp{init}.
  7927. @end table
  7928. The expressions accept the following parameters:
  7929. @table @option
  7930. @item n
  7931. frame count of the input frame starting from 0
  7932. @item pos
  7933. byte position of the corresponding packet in the input file, NAN if
  7934. unspecified
  7935. @item r
  7936. frame rate of the input video, NAN if the input frame rate is unknown
  7937. @item t
  7938. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7939. @end table
  7940. @subsection Commands
  7941. The filter supports the following commands:
  7942. @table @option
  7943. @item contrast
  7944. Set the contrast expression.
  7945. @item brightness
  7946. Set the brightness expression.
  7947. @item saturation
  7948. Set the saturation expression.
  7949. @item gamma
  7950. Set the gamma expression.
  7951. @item gamma_r
  7952. Set the gamma_r expression.
  7953. @item gamma_g
  7954. Set gamma_g expression.
  7955. @item gamma_b
  7956. Set gamma_b expression.
  7957. @item gamma_weight
  7958. Set gamma_weight expression.
  7959. The command accepts the same syntax of the corresponding option.
  7960. If the specified expression is not valid, it is kept at its current
  7961. value.
  7962. @end table
  7963. @section erosion
  7964. Apply erosion effect to the video.
  7965. This filter replaces the pixel by the local(3x3) minimum.
  7966. It accepts the following options:
  7967. @table @option
  7968. @item threshold0
  7969. @item threshold1
  7970. @item threshold2
  7971. @item threshold3
  7972. Limit the maximum change for each plane, default is 65535.
  7973. If 0, plane will remain unchanged.
  7974. @item coordinates
  7975. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7976. pixels are used.
  7977. Flags to local 3x3 coordinates maps like this:
  7978. 1 2 3
  7979. 4 5
  7980. 6 7 8
  7981. @end table
  7982. @subsection Commands
  7983. This filter supports the all above options as @ref{commands}.
  7984. @section extractplanes
  7985. Extract color channel components from input video stream into
  7986. separate grayscale video streams.
  7987. The filter accepts the following option:
  7988. @table @option
  7989. @item planes
  7990. Set plane(s) to extract.
  7991. Available values for planes are:
  7992. @table @samp
  7993. @item y
  7994. @item u
  7995. @item v
  7996. @item a
  7997. @item r
  7998. @item g
  7999. @item b
  8000. @end table
  8001. Choosing planes not available in the input will result in an error.
  8002. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8003. with @code{y}, @code{u}, @code{v} planes at same time.
  8004. @end table
  8005. @subsection Examples
  8006. @itemize
  8007. @item
  8008. Extract luma, u and v color channel component from input video frame
  8009. into 3 grayscale outputs:
  8010. @example
  8011. 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
  8012. @end example
  8013. @end itemize
  8014. @section fade
  8015. Apply a fade-in/out effect to the input video.
  8016. It accepts the following parameters:
  8017. @table @option
  8018. @item type, t
  8019. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8020. effect.
  8021. Default is @code{in}.
  8022. @item start_frame, s
  8023. Specify the number of the frame to start applying the fade
  8024. effect at. Default is 0.
  8025. @item nb_frames, n
  8026. The number of frames that the fade effect lasts. At the end of the
  8027. fade-in effect, the output video will have the same intensity as the input video.
  8028. At the end of the fade-out transition, the output video will be filled with the
  8029. selected @option{color}.
  8030. Default is 25.
  8031. @item alpha
  8032. If set to 1, fade only alpha channel, if one exists on the input.
  8033. Default value is 0.
  8034. @item start_time, st
  8035. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8036. effect. If both start_frame and start_time are specified, the fade will start at
  8037. whichever comes last. Default is 0.
  8038. @item duration, d
  8039. The number of seconds for which the fade effect has to last. At the end of the
  8040. fade-in effect the output video will have the same intensity as the input video,
  8041. at the end of the fade-out transition the output video will be filled with the
  8042. selected @option{color}.
  8043. If both duration and nb_frames are specified, duration is used. Default is 0
  8044. (nb_frames is used by default).
  8045. @item color, c
  8046. Specify the color of the fade. Default is "black".
  8047. @end table
  8048. @subsection Examples
  8049. @itemize
  8050. @item
  8051. Fade in the first 30 frames of video:
  8052. @example
  8053. fade=in:0:30
  8054. @end example
  8055. The command above is equivalent to:
  8056. @example
  8057. fade=t=in:s=0:n=30
  8058. @end example
  8059. @item
  8060. Fade out the last 45 frames of a 200-frame video:
  8061. @example
  8062. fade=out:155:45
  8063. fade=type=out:start_frame=155:nb_frames=45
  8064. @end example
  8065. @item
  8066. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8067. @example
  8068. fade=in:0:25, fade=out:975:25
  8069. @end example
  8070. @item
  8071. Make the first 5 frames yellow, then fade in from frame 5-24:
  8072. @example
  8073. fade=in:5:20:color=yellow
  8074. @end example
  8075. @item
  8076. Fade in alpha over first 25 frames of video:
  8077. @example
  8078. fade=in:0:25:alpha=1
  8079. @end example
  8080. @item
  8081. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8082. @example
  8083. fade=t=in:st=5.5:d=0.5
  8084. @end example
  8085. @end itemize
  8086. @section fftdnoiz
  8087. Denoise frames using 3D FFT (frequency domain filtering).
  8088. The filter accepts the following options:
  8089. @table @option
  8090. @item sigma
  8091. Set the noise sigma constant. This sets denoising strength.
  8092. Default value is 1. Allowed range is from 0 to 30.
  8093. Using very high sigma with low overlap may give blocking artifacts.
  8094. @item amount
  8095. Set amount of denoising. By default all detected noise is reduced.
  8096. Default value is 1. Allowed range is from 0 to 1.
  8097. @item block
  8098. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8099. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8100. block size in pixels is 2^4 which is 16.
  8101. @item overlap
  8102. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8103. @item prev
  8104. Set number of previous frames to use for denoising. By default is set to 0.
  8105. @item next
  8106. Set number of next frames to to use for denoising. By default is set to 0.
  8107. @item planes
  8108. Set planes which will be filtered, by default are all available filtered
  8109. except alpha.
  8110. @end table
  8111. @section fftfilt
  8112. Apply arbitrary expressions to samples in frequency domain
  8113. @table @option
  8114. @item dc_Y
  8115. Adjust the dc value (gain) of the luma plane of the image. The filter
  8116. accepts an integer value in range @code{0} to @code{1000}. The default
  8117. value is set to @code{0}.
  8118. @item dc_U
  8119. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8120. filter accepts an integer value in range @code{0} to @code{1000}. The
  8121. default value is set to @code{0}.
  8122. @item dc_V
  8123. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8124. filter accepts an integer value in range @code{0} to @code{1000}. The
  8125. default value is set to @code{0}.
  8126. @item weight_Y
  8127. Set the frequency domain weight expression for the luma plane.
  8128. @item weight_U
  8129. Set the frequency domain weight expression for the 1st chroma plane.
  8130. @item weight_V
  8131. Set the frequency domain weight expression for the 2nd chroma plane.
  8132. @item eval
  8133. Set when the expressions are evaluated.
  8134. It accepts the following values:
  8135. @table @samp
  8136. @item init
  8137. Only evaluate expressions once during the filter initialization.
  8138. @item frame
  8139. Evaluate expressions for each incoming frame.
  8140. @end table
  8141. Default value is @samp{init}.
  8142. The filter accepts the following variables:
  8143. @item X
  8144. @item Y
  8145. The coordinates of the current sample.
  8146. @item W
  8147. @item H
  8148. The width and height of the image.
  8149. @item N
  8150. The number of input frame, starting from 0.
  8151. @end table
  8152. @subsection Examples
  8153. @itemize
  8154. @item
  8155. High-pass:
  8156. @example
  8157. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8158. @end example
  8159. @item
  8160. Low-pass:
  8161. @example
  8162. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8163. @end example
  8164. @item
  8165. Sharpen:
  8166. @example
  8167. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8168. @end example
  8169. @item
  8170. Blur:
  8171. @example
  8172. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8173. @end example
  8174. @end itemize
  8175. @section field
  8176. Extract a single field from an interlaced image using stride
  8177. arithmetic to avoid wasting CPU time. The output frames are marked as
  8178. non-interlaced.
  8179. The filter accepts the following options:
  8180. @table @option
  8181. @item type
  8182. Specify whether to extract the top (if the value is @code{0} or
  8183. @code{top}) or the bottom field (if the value is @code{1} or
  8184. @code{bottom}).
  8185. @end table
  8186. @section fieldhint
  8187. Create new frames by copying the top and bottom fields from surrounding frames
  8188. supplied as numbers by the hint file.
  8189. @table @option
  8190. @item hint
  8191. Set file containing hints: absolute/relative frame numbers.
  8192. There must be one line for each frame in a clip. Each line must contain two
  8193. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8194. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8195. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8196. for @code{relative} mode. First number tells from which frame to pick up top
  8197. field and second number tells from which frame to pick up bottom field.
  8198. If optionally followed by @code{+} output frame will be marked as interlaced,
  8199. else if followed by @code{-} output frame will be marked as progressive, else
  8200. it will be marked same as input frame.
  8201. If optionally followed by @code{t} output frame will use only top field, or in
  8202. case of @code{b} it will use only bottom field.
  8203. If line starts with @code{#} or @code{;} that line is skipped.
  8204. @item mode
  8205. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8206. @end table
  8207. Example of first several lines of @code{hint} file for @code{relative} mode:
  8208. @example
  8209. 0,0 - # first frame
  8210. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8211. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8212. 1,0 -
  8213. 0,0 -
  8214. 0,0 -
  8215. 1,0 -
  8216. 1,0 -
  8217. 1,0 -
  8218. 0,0 -
  8219. 0,0 -
  8220. 1,0 -
  8221. 1,0 -
  8222. 1,0 -
  8223. 0,0 -
  8224. @end example
  8225. @section fieldmatch
  8226. Field matching filter for inverse telecine. It is meant to reconstruct the
  8227. progressive frames from a telecined stream. The filter does not drop duplicated
  8228. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8229. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8230. The separation of the field matching and the decimation is notably motivated by
  8231. the possibility of inserting a de-interlacing filter fallback between the two.
  8232. If the source has mixed telecined and real interlaced content,
  8233. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8234. But these remaining combed frames will be marked as interlaced, and thus can be
  8235. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8236. In addition to the various configuration options, @code{fieldmatch} can take an
  8237. optional second stream, activated through the @option{ppsrc} option. If
  8238. enabled, the frames reconstruction will be based on the fields and frames from
  8239. this second stream. This allows the first input to be pre-processed in order to
  8240. help the various algorithms of the filter, while keeping the output lossless
  8241. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8242. or brightness/contrast adjustments can help.
  8243. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8244. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8245. which @code{fieldmatch} is based on. While the semantic and usage are very
  8246. close, some behaviour and options names can differ.
  8247. The @ref{decimate} filter currently only works for constant frame rate input.
  8248. If your input has mixed telecined (30fps) and progressive content with a lower
  8249. framerate like 24fps use the following filterchain to produce the necessary cfr
  8250. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8251. The filter accepts the following options:
  8252. @table @option
  8253. @item order
  8254. Specify the assumed field order of the input stream. Available values are:
  8255. @table @samp
  8256. @item auto
  8257. Auto detect parity (use FFmpeg's internal parity value).
  8258. @item bff
  8259. Assume bottom field first.
  8260. @item tff
  8261. Assume top field first.
  8262. @end table
  8263. Note that it is sometimes recommended not to trust the parity announced by the
  8264. stream.
  8265. Default value is @var{auto}.
  8266. @item mode
  8267. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8268. sense that it won't risk creating jerkiness due to duplicate frames when
  8269. possible, but if there are bad edits or blended fields it will end up
  8270. outputting combed frames when a good match might actually exist. On the other
  8271. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8272. but will almost always find a good frame if there is one. The other values are
  8273. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8274. jerkiness and creating duplicate frames versus finding good matches in sections
  8275. with bad edits, orphaned fields, blended fields, etc.
  8276. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8277. Available values are:
  8278. @table @samp
  8279. @item pc
  8280. 2-way matching (p/c)
  8281. @item pc_n
  8282. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8283. @item pc_u
  8284. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8285. @item pc_n_ub
  8286. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8287. still combed (p/c + n + u/b)
  8288. @item pcn
  8289. 3-way matching (p/c/n)
  8290. @item pcn_ub
  8291. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8292. detected as combed (p/c/n + u/b)
  8293. @end table
  8294. The parenthesis at the end indicate the matches that would be used for that
  8295. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8296. @var{top}).
  8297. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8298. the slowest.
  8299. Default value is @var{pc_n}.
  8300. @item ppsrc
  8301. Mark the main input stream as a pre-processed input, and enable the secondary
  8302. input stream as the clean source to pick the fields from. See the filter
  8303. introduction for more details. It is similar to the @option{clip2} feature from
  8304. VFM/TFM.
  8305. Default value is @code{0} (disabled).
  8306. @item field
  8307. Set the field to match from. It is recommended to set this to the same value as
  8308. @option{order} unless you experience matching failures with that setting. In
  8309. certain circumstances changing the field that is used to match from can have a
  8310. large impact on matching performance. Available values are:
  8311. @table @samp
  8312. @item auto
  8313. Automatic (same value as @option{order}).
  8314. @item bottom
  8315. Match from the bottom field.
  8316. @item top
  8317. Match from the top field.
  8318. @end table
  8319. Default value is @var{auto}.
  8320. @item mchroma
  8321. Set whether or not chroma is included during the match comparisons. In most
  8322. cases it is recommended to leave this enabled. You should set this to @code{0}
  8323. only if your clip has bad chroma problems such as heavy rainbowing or other
  8324. artifacts. Setting this to @code{0} could also be used to speed things up at
  8325. the cost of some accuracy.
  8326. Default value is @code{1}.
  8327. @item y0
  8328. @item y1
  8329. These define an exclusion band which excludes the lines between @option{y0} and
  8330. @option{y1} from being included in the field matching decision. An exclusion
  8331. band can be used to ignore subtitles, a logo, or other things that may
  8332. interfere with the matching. @option{y0} sets the starting scan line and
  8333. @option{y1} sets the ending line; all lines in between @option{y0} and
  8334. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8335. @option{y0} and @option{y1} to the same value will disable the feature.
  8336. @option{y0} and @option{y1} defaults to @code{0}.
  8337. @item scthresh
  8338. Set the scene change detection threshold as a percentage of maximum change on
  8339. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8340. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8341. @option{scthresh} is @code{[0.0, 100.0]}.
  8342. Default value is @code{12.0}.
  8343. @item combmatch
  8344. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8345. account the combed scores of matches when deciding what match to use as the
  8346. final match. Available values are:
  8347. @table @samp
  8348. @item none
  8349. No final matching based on combed scores.
  8350. @item sc
  8351. Combed scores are only used when a scene change is detected.
  8352. @item full
  8353. Use combed scores all the time.
  8354. @end table
  8355. Default is @var{sc}.
  8356. @item combdbg
  8357. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8358. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8359. Available values are:
  8360. @table @samp
  8361. @item none
  8362. No forced calculation.
  8363. @item pcn
  8364. Force p/c/n calculations.
  8365. @item pcnub
  8366. Force p/c/n/u/b calculations.
  8367. @end table
  8368. Default value is @var{none}.
  8369. @item cthresh
  8370. This is the area combing threshold used for combed frame detection. This
  8371. essentially controls how "strong" or "visible" combing must be to be detected.
  8372. Larger values mean combing must be more visible and smaller values mean combing
  8373. can be less visible or strong and still be detected. Valid settings are from
  8374. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8375. be detected as combed). This is basically a pixel difference value. A good
  8376. range is @code{[8, 12]}.
  8377. Default value is @code{9}.
  8378. @item chroma
  8379. Sets whether or not chroma is considered in the combed frame decision. Only
  8380. disable this if your source has chroma problems (rainbowing, etc.) that are
  8381. causing problems for the combed frame detection with chroma enabled. Actually,
  8382. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8383. where there is chroma only combing in the source.
  8384. Default value is @code{0}.
  8385. @item blockx
  8386. @item blocky
  8387. Respectively set the x-axis and y-axis size of the window used during combed
  8388. frame detection. This has to do with the size of the area in which
  8389. @option{combpel} pixels are required to be detected as combed for a frame to be
  8390. declared combed. See the @option{combpel} parameter description for more info.
  8391. Possible values are any number that is a power of 2 starting at 4 and going up
  8392. to 512.
  8393. Default value is @code{16}.
  8394. @item combpel
  8395. The number of combed pixels inside any of the @option{blocky} by
  8396. @option{blockx} size blocks on the frame for the frame to be detected as
  8397. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8398. setting controls "how much" combing there must be in any localized area (a
  8399. window defined by the @option{blockx} and @option{blocky} settings) on the
  8400. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8401. which point no frames will ever be detected as combed). This setting is known
  8402. as @option{MI} in TFM/VFM vocabulary.
  8403. Default value is @code{80}.
  8404. @end table
  8405. @anchor{p/c/n/u/b meaning}
  8406. @subsection p/c/n/u/b meaning
  8407. @subsubsection p/c/n
  8408. We assume the following telecined stream:
  8409. @example
  8410. Top fields: 1 2 2 3 4
  8411. Bottom fields: 1 2 3 4 4
  8412. @end example
  8413. The numbers correspond to the progressive frame the fields relate to. Here, the
  8414. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8415. When @code{fieldmatch} is configured to run a matching from bottom
  8416. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8417. @example
  8418. Input stream:
  8419. T 1 2 2 3 4
  8420. B 1 2 3 4 4 <-- matching reference
  8421. Matches: c c n n c
  8422. Output stream:
  8423. T 1 2 3 4 4
  8424. B 1 2 3 4 4
  8425. @end example
  8426. As a result of the field matching, we can see that some frames get duplicated.
  8427. To perform a complete inverse telecine, you need to rely on a decimation filter
  8428. after this operation. See for instance the @ref{decimate} filter.
  8429. The same operation now matching from top fields (@option{field}=@var{top})
  8430. looks like this:
  8431. @example
  8432. Input stream:
  8433. T 1 2 2 3 4 <-- matching reference
  8434. B 1 2 3 4 4
  8435. Matches: c c p p c
  8436. Output stream:
  8437. T 1 2 2 3 4
  8438. B 1 2 2 3 4
  8439. @end example
  8440. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8441. basically, they refer to the frame and field of the opposite parity:
  8442. @itemize
  8443. @item @var{p} matches the field of the opposite parity in the previous frame
  8444. @item @var{c} matches the field of the opposite parity in the current frame
  8445. @item @var{n} matches the field of the opposite parity in the next frame
  8446. @end itemize
  8447. @subsubsection u/b
  8448. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8449. from the opposite parity flag. In the following examples, we assume that we are
  8450. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8451. 'x' is placed above and below each matched fields.
  8452. With bottom matching (@option{field}=@var{bottom}):
  8453. @example
  8454. Match: c p n b u
  8455. x x x x x
  8456. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8457. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8458. x x x x x
  8459. Output frames:
  8460. 2 1 2 2 2
  8461. 2 2 2 1 3
  8462. @end example
  8463. With top matching (@option{field}=@var{top}):
  8464. @example
  8465. Match: c p n b u
  8466. x x x x x
  8467. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8468. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8469. x x x x x
  8470. Output frames:
  8471. 2 2 2 1 2
  8472. 2 1 3 2 2
  8473. @end example
  8474. @subsection Examples
  8475. Simple IVTC of a top field first telecined stream:
  8476. @example
  8477. fieldmatch=order=tff:combmatch=none, decimate
  8478. @end example
  8479. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8480. @example
  8481. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8482. @end example
  8483. @section fieldorder
  8484. Transform the field order of the input video.
  8485. It accepts the following parameters:
  8486. @table @option
  8487. @item order
  8488. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8489. for bottom field first.
  8490. @end table
  8491. The default value is @samp{tff}.
  8492. The transformation is done by shifting the picture content up or down
  8493. by one line, and filling the remaining line with appropriate picture content.
  8494. This method is consistent with most broadcast field order converters.
  8495. If the input video is not flagged as being interlaced, or it is already
  8496. flagged as being of the required output field order, then this filter does
  8497. not alter the incoming video.
  8498. It is very useful when converting to or from PAL DV material,
  8499. which is bottom field first.
  8500. For example:
  8501. @example
  8502. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8503. @end example
  8504. @section fifo, afifo
  8505. Buffer input images and send them when they are requested.
  8506. It is mainly useful when auto-inserted by the libavfilter
  8507. framework.
  8508. It does not take parameters.
  8509. @section fillborders
  8510. Fill borders of the input video, without changing video stream dimensions.
  8511. Sometimes video can have garbage at the four edges and you may not want to
  8512. crop video input to keep size multiple of some number.
  8513. This filter accepts the following options:
  8514. @table @option
  8515. @item left
  8516. Number of pixels to fill from left border.
  8517. @item right
  8518. Number of pixels to fill from right border.
  8519. @item top
  8520. Number of pixels to fill from top border.
  8521. @item bottom
  8522. Number of pixels to fill from bottom border.
  8523. @item mode
  8524. Set fill mode.
  8525. It accepts the following values:
  8526. @table @samp
  8527. @item smear
  8528. fill pixels using outermost pixels
  8529. @item mirror
  8530. fill pixels using mirroring
  8531. @item fixed
  8532. fill pixels with constant value
  8533. @end table
  8534. Default is @var{smear}.
  8535. @item color
  8536. Set color for pixels in fixed mode. Default is @var{black}.
  8537. @end table
  8538. @subsection Commands
  8539. This filter supports same @ref{commands} as options.
  8540. The command accepts the same syntax of the corresponding option.
  8541. If the specified expression is not valid, it is kept at its current
  8542. value.
  8543. @section find_rect
  8544. Find a rectangular object
  8545. It accepts the following options:
  8546. @table @option
  8547. @item object
  8548. Filepath of the object image, needs to be in gray8.
  8549. @item threshold
  8550. Detection threshold, default is 0.5.
  8551. @item mipmaps
  8552. Number of mipmaps, default is 3.
  8553. @item xmin, ymin, xmax, ymax
  8554. Specifies the rectangle in which to search.
  8555. @end table
  8556. @subsection Examples
  8557. @itemize
  8558. @item
  8559. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8560. @example
  8561. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8562. @end example
  8563. @end itemize
  8564. @section floodfill
  8565. Flood area with values of same pixel components with another values.
  8566. It accepts the following options:
  8567. @table @option
  8568. @item x
  8569. Set pixel x coordinate.
  8570. @item y
  8571. Set pixel y coordinate.
  8572. @item s0
  8573. Set source #0 component value.
  8574. @item s1
  8575. Set source #1 component value.
  8576. @item s2
  8577. Set source #2 component value.
  8578. @item s3
  8579. Set source #3 component value.
  8580. @item d0
  8581. Set destination #0 component value.
  8582. @item d1
  8583. Set destination #1 component value.
  8584. @item d2
  8585. Set destination #2 component value.
  8586. @item d3
  8587. Set destination #3 component value.
  8588. @end table
  8589. @anchor{format}
  8590. @section format
  8591. Convert the input video to one of the specified pixel formats.
  8592. Libavfilter will try to pick one that is suitable as input to
  8593. the next filter.
  8594. It accepts the following parameters:
  8595. @table @option
  8596. @item pix_fmts
  8597. A '|'-separated list of pixel format names, such as
  8598. "pix_fmts=yuv420p|monow|rgb24".
  8599. @end table
  8600. @subsection Examples
  8601. @itemize
  8602. @item
  8603. Convert the input video to the @var{yuv420p} format
  8604. @example
  8605. format=pix_fmts=yuv420p
  8606. @end example
  8607. Convert the input video to any of the formats in the list
  8608. @example
  8609. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8610. @end example
  8611. @end itemize
  8612. @anchor{fps}
  8613. @section fps
  8614. Convert the video to specified constant frame rate by duplicating or dropping
  8615. frames as necessary.
  8616. It accepts the following parameters:
  8617. @table @option
  8618. @item fps
  8619. The desired output frame rate. The default is @code{25}.
  8620. @item start_time
  8621. Assume the first PTS should be the given value, in seconds. This allows for
  8622. padding/trimming at the start of stream. By default, no assumption is made
  8623. about the first frame's expected PTS, so no padding or trimming is done.
  8624. For example, this could be set to 0 to pad the beginning with duplicates of
  8625. the first frame if a video stream starts after the audio stream or to trim any
  8626. frames with a negative PTS.
  8627. @item round
  8628. Timestamp (PTS) rounding method.
  8629. Possible values are:
  8630. @table @option
  8631. @item zero
  8632. round towards 0
  8633. @item inf
  8634. round away from 0
  8635. @item down
  8636. round towards -infinity
  8637. @item up
  8638. round towards +infinity
  8639. @item near
  8640. round to nearest
  8641. @end table
  8642. The default is @code{near}.
  8643. @item eof_action
  8644. Action performed when reading the last frame.
  8645. Possible values are:
  8646. @table @option
  8647. @item round
  8648. Use same timestamp rounding method as used for other frames.
  8649. @item pass
  8650. Pass through last frame if input duration has not been reached yet.
  8651. @end table
  8652. The default is @code{round}.
  8653. @end table
  8654. Alternatively, the options can be specified as a flat string:
  8655. @var{fps}[:@var{start_time}[:@var{round}]].
  8656. See also the @ref{setpts} filter.
  8657. @subsection Examples
  8658. @itemize
  8659. @item
  8660. A typical usage in order to set the fps to 25:
  8661. @example
  8662. fps=fps=25
  8663. @end example
  8664. @item
  8665. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8666. @example
  8667. fps=fps=film:round=near
  8668. @end example
  8669. @end itemize
  8670. @section framepack
  8671. Pack two different video streams into a stereoscopic video, setting proper
  8672. metadata on supported codecs. The two views should have the same size and
  8673. framerate and processing will stop when the shorter video ends. Please note
  8674. that you may conveniently adjust view properties with the @ref{scale} and
  8675. @ref{fps} filters.
  8676. It accepts the following parameters:
  8677. @table @option
  8678. @item format
  8679. The desired packing format. Supported values are:
  8680. @table @option
  8681. @item sbs
  8682. The views are next to each other (default).
  8683. @item tab
  8684. The views are on top of each other.
  8685. @item lines
  8686. The views are packed by line.
  8687. @item columns
  8688. The views are packed by column.
  8689. @item frameseq
  8690. The views are temporally interleaved.
  8691. @end table
  8692. @end table
  8693. Some examples:
  8694. @example
  8695. # Convert left and right views into a frame-sequential video
  8696. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8697. # Convert views into a side-by-side video with the same output resolution as the input
  8698. 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
  8699. @end example
  8700. @section framerate
  8701. Change the frame rate by interpolating new video output frames from the source
  8702. frames.
  8703. This filter is not designed to function correctly with interlaced media. If
  8704. you wish to change the frame rate of interlaced media then you are required
  8705. to deinterlace before this filter and re-interlace after this filter.
  8706. A description of the accepted options follows.
  8707. @table @option
  8708. @item fps
  8709. Specify the output frames per second. This option can also be specified
  8710. as a value alone. The default is @code{50}.
  8711. @item interp_start
  8712. Specify the start of a range where the output frame will be created as a
  8713. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8714. the default is @code{15}.
  8715. @item interp_end
  8716. Specify the end of a range where the output frame will be created as a
  8717. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8718. the default is @code{240}.
  8719. @item scene
  8720. Specify the level at which a scene change is detected as a value between
  8721. 0 and 100 to indicate a new scene; a low value reflects a low
  8722. probability for the current frame to introduce a new scene, while a higher
  8723. value means the current frame is more likely to be one.
  8724. The default is @code{8.2}.
  8725. @item flags
  8726. Specify flags influencing the filter process.
  8727. Available value for @var{flags} is:
  8728. @table @option
  8729. @item scene_change_detect, scd
  8730. Enable scene change detection using the value of the option @var{scene}.
  8731. This flag is enabled by default.
  8732. @end table
  8733. @end table
  8734. @section framestep
  8735. Select one frame every N-th frame.
  8736. This filter accepts the following option:
  8737. @table @option
  8738. @item step
  8739. Select frame after every @code{step} frames.
  8740. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8741. @end table
  8742. @section freezedetect
  8743. Detect frozen video.
  8744. This filter logs a message and sets frame metadata when it detects that the
  8745. input video has no significant change in content during a specified duration.
  8746. Video freeze detection calculates the mean average absolute difference of all
  8747. the components of video frames and compares it to a noise floor.
  8748. The printed times and duration are expressed in seconds. The
  8749. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8750. whose timestamp equals or exceeds the detection duration and it contains the
  8751. timestamp of the first frame of the freeze. The
  8752. @code{lavfi.freezedetect.freeze_duration} and
  8753. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8754. after the freeze.
  8755. The filter accepts the following options:
  8756. @table @option
  8757. @item noise, n
  8758. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8759. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8760. 0.001.
  8761. @item duration, d
  8762. Set freeze duration until notification (default is 2 seconds).
  8763. @end table
  8764. @section freezeframes
  8765. Freeze video frames.
  8766. This filter freezes video frames using frame from 2nd input.
  8767. The filter accepts the following options:
  8768. @table @option
  8769. @item first
  8770. Set number of first frame from which to start freeze.
  8771. @item last
  8772. Set number of last frame from which to end freeze.
  8773. @item replace
  8774. Set number of frame from 2nd input which will be used instead of replaced frames.
  8775. @end table
  8776. @anchor{frei0r}
  8777. @section frei0r
  8778. Apply a frei0r effect to the input video.
  8779. To enable the compilation of this filter, you need to install the frei0r
  8780. header and configure FFmpeg with @code{--enable-frei0r}.
  8781. It accepts the following parameters:
  8782. @table @option
  8783. @item filter_name
  8784. The name of the frei0r effect to load. If the environment variable
  8785. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8786. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8787. Otherwise, the standard frei0r paths are searched, in this order:
  8788. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8789. @file{/usr/lib/frei0r-1/}.
  8790. @item filter_params
  8791. A '|'-separated list of parameters to pass to the frei0r effect.
  8792. @end table
  8793. A frei0r effect parameter can be a boolean (its value is either
  8794. "y" or "n"), a double, a color (specified as
  8795. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8796. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8797. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8798. a position (specified as @var{X}/@var{Y}, where
  8799. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8800. The number and types of parameters depend on the loaded effect. If an
  8801. effect parameter is not specified, the default value is set.
  8802. @subsection Examples
  8803. @itemize
  8804. @item
  8805. Apply the distort0r effect, setting the first two double parameters:
  8806. @example
  8807. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8808. @end example
  8809. @item
  8810. Apply the colordistance effect, taking a color as the first parameter:
  8811. @example
  8812. frei0r=colordistance:0.2/0.3/0.4
  8813. frei0r=colordistance:violet
  8814. frei0r=colordistance:0x112233
  8815. @end example
  8816. @item
  8817. Apply the perspective effect, specifying the top left and top right image
  8818. positions:
  8819. @example
  8820. frei0r=perspective:0.2/0.2|0.8/0.2
  8821. @end example
  8822. @end itemize
  8823. For more information, see
  8824. @url{http://frei0r.dyne.org}
  8825. @section fspp
  8826. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8827. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8828. processing filter, one of them is performed once per block, not per pixel.
  8829. This allows for much higher speed.
  8830. The filter accepts the following options:
  8831. @table @option
  8832. @item quality
  8833. Set quality. This option defines the number of levels for averaging. It accepts
  8834. an integer in the range 4-5. Default value is @code{4}.
  8835. @item qp
  8836. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8837. If not set, the filter will use the QP from the video stream (if available).
  8838. @item strength
  8839. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8840. more details but also more artifacts, while higher values make the image smoother
  8841. but also blurrier. Default value is @code{0} − PSNR optimal.
  8842. @item use_bframe_qp
  8843. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8844. option may cause flicker since the B-Frames have often larger QP. Default is
  8845. @code{0} (not enabled).
  8846. @end table
  8847. @section gblur
  8848. Apply Gaussian blur filter.
  8849. The filter accepts the following options:
  8850. @table @option
  8851. @item sigma
  8852. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8853. @item steps
  8854. Set number of steps for Gaussian approximation. Default is @code{1}.
  8855. @item planes
  8856. Set which planes to filter. By default all planes are filtered.
  8857. @item sigmaV
  8858. Set vertical sigma, if negative it will be same as @code{sigma}.
  8859. Default is @code{-1}.
  8860. @end table
  8861. @subsection Commands
  8862. This filter supports same commands as options.
  8863. The command accepts the same syntax of the corresponding option.
  8864. If the specified expression is not valid, it is kept at its current
  8865. value.
  8866. @section geq
  8867. Apply generic equation to each pixel.
  8868. The filter accepts the following options:
  8869. @table @option
  8870. @item lum_expr, lum
  8871. Set the luminance expression.
  8872. @item cb_expr, cb
  8873. Set the chrominance blue expression.
  8874. @item cr_expr, cr
  8875. Set the chrominance red expression.
  8876. @item alpha_expr, a
  8877. Set the alpha expression.
  8878. @item red_expr, r
  8879. Set the red expression.
  8880. @item green_expr, g
  8881. Set the green expression.
  8882. @item blue_expr, b
  8883. Set the blue expression.
  8884. @end table
  8885. The colorspace is selected according to the specified options. If one
  8886. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8887. options is specified, the filter will automatically select a YCbCr
  8888. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8889. @option{blue_expr} options is specified, it will select an RGB
  8890. colorspace.
  8891. If one of the chrominance expression is not defined, it falls back on the other
  8892. one. If no alpha expression is specified it will evaluate to opaque value.
  8893. If none of chrominance expressions are specified, they will evaluate
  8894. to the luminance expression.
  8895. The expressions can use the following variables and functions:
  8896. @table @option
  8897. @item N
  8898. The sequential number of the filtered frame, starting from @code{0}.
  8899. @item X
  8900. @item Y
  8901. The coordinates of the current sample.
  8902. @item W
  8903. @item H
  8904. The width and height of the image.
  8905. @item SW
  8906. @item SH
  8907. Width and height scale depending on the currently filtered plane. It is the
  8908. ratio between the corresponding luma plane number of pixels and the current
  8909. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8910. @code{0.5,0.5} for chroma planes.
  8911. @item T
  8912. Time of the current frame, expressed in seconds.
  8913. @item p(x, y)
  8914. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8915. plane.
  8916. @item lum(x, y)
  8917. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8918. plane.
  8919. @item cb(x, y)
  8920. Return the value of the pixel at location (@var{x},@var{y}) of the
  8921. blue-difference chroma plane. Return 0 if there is no such plane.
  8922. @item cr(x, y)
  8923. Return the value of the pixel at location (@var{x},@var{y}) of the
  8924. red-difference chroma plane. Return 0 if there is no such plane.
  8925. @item r(x, y)
  8926. @item g(x, y)
  8927. @item b(x, y)
  8928. Return the value of the pixel at location (@var{x},@var{y}) of the
  8929. red/green/blue component. Return 0 if there is no such component.
  8930. @item alpha(x, y)
  8931. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8932. plane. Return 0 if there is no such plane.
  8933. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  8934. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8935. sums of samples within a rectangle. See the functions without the sum postfix.
  8936. @item interpolation
  8937. Set one of interpolation methods:
  8938. @table @option
  8939. @item nearest, n
  8940. @item bilinear, b
  8941. @end table
  8942. Default is bilinear.
  8943. @end table
  8944. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8945. automatically clipped to the closer edge.
  8946. Please note that this filter can use multiple threads in which case each slice
  8947. will have its own expression state. If you want to use only a single expression
  8948. state because your expressions depend on previous state then you should limit
  8949. the number of filter threads to 1.
  8950. @subsection Examples
  8951. @itemize
  8952. @item
  8953. Flip the image horizontally:
  8954. @example
  8955. geq=p(W-X\,Y)
  8956. @end example
  8957. @item
  8958. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8959. wavelength of 100 pixels:
  8960. @example
  8961. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8962. @end example
  8963. @item
  8964. Generate a fancy enigmatic moving light:
  8965. @example
  8966. 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
  8967. @end example
  8968. @item
  8969. Generate a quick emboss effect:
  8970. @example
  8971. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8972. @end example
  8973. @item
  8974. Modify RGB components depending on pixel position:
  8975. @example
  8976. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8977. @end example
  8978. @item
  8979. Create a radial gradient that is the same size as the input (also see
  8980. the @ref{vignette} filter):
  8981. @example
  8982. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8983. @end example
  8984. @end itemize
  8985. @section gradfun
  8986. Fix the banding artifacts that are sometimes introduced into nearly flat
  8987. regions by truncation to 8-bit color depth.
  8988. Interpolate the gradients that should go where the bands are, and
  8989. dither them.
  8990. It is designed for playback only. Do not use it prior to
  8991. lossy compression, because compression tends to lose the dither and
  8992. bring back the bands.
  8993. It accepts the following parameters:
  8994. @table @option
  8995. @item strength
  8996. The maximum amount by which the filter will change any one pixel. This is also
  8997. the threshold for detecting nearly flat regions. Acceptable values range from
  8998. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8999. valid range.
  9000. @item radius
  9001. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9002. gradients, but also prevents the filter from modifying the pixels near detailed
  9003. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9004. values will be clipped to the valid range.
  9005. @end table
  9006. Alternatively, the options can be specified as a flat string:
  9007. @var{strength}[:@var{radius}]
  9008. @subsection Examples
  9009. @itemize
  9010. @item
  9011. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9012. @example
  9013. gradfun=3.5:8
  9014. @end example
  9015. @item
  9016. Specify radius, omitting the strength (which will fall-back to the default
  9017. value):
  9018. @example
  9019. gradfun=radius=8
  9020. @end example
  9021. @end itemize
  9022. @anchor{graphmonitor}
  9023. @section graphmonitor
  9024. Show various filtergraph stats.
  9025. With this filter one can debug complete filtergraph.
  9026. Especially issues with links filling with queued frames.
  9027. The filter accepts the following options:
  9028. @table @option
  9029. @item size, s
  9030. Set video output size. Default is @var{hd720}.
  9031. @item opacity, o
  9032. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9033. @item mode, m
  9034. Set output mode, can be @var{fulll} or @var{compact}.
  9035. In @var{compact} mode only filters with some queued frames have displayed stats.
  9036. @item flags, f
  9037. Set flags which enable which stats are shown in video.
  9038. Available values for flags are:
  9039. @table @samp
  9040. @item queue
  9041. Display number of queued frames in each link.
  9042. @item frame_count_in
  9043. Display number of frames taken from filter.
  9044. @item frame_count_out
  9045. Display number of frames given out from filter.
  9046. @item pts
  9047. Display current filtered frame pts.
  9048. @item time
  9049. Display current filtered frame time.
  9050. @item timebase
  9051. Display time base for filter link.
  9052. @item format
  9053. Display used format for filter link.
  9054. @item size
  9055. Display video size or number of audio channels in case of audio used by filter link.
  9056. @item rate
  9057. Display video frame rate or sample rate in case of audio used by filter link.
  9058. @end table
  9059. @item rate, r
  9060. Set upper limit for video rate of output stream, Default value is @var{25}.
  9061. This guarantee that output video frame rate will not be higher than this value.
  9062. @end table
  9063. @section greyedge
  9064. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9065. and corrects the scene colors accordingly.
  9066. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9067. The filter accepts the following options:
  9068. @table @option
  9069. @item difford
  9070. The order of differentiation to be applied on the scene. Must be chosen in the range
  9071. [0,2] and default value is 1.
  9072. @item minknorm
  9073. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9074. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9075. max value instead of calculating Minkowski distance.
  9076. @item sigma
  9077. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9078. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9079. can't be equal to 0 if @var{difford} is greater than 0.
  9080. @end table
  9081. @subsection Examples
  9082. @itemize
  9083. @item
  9084. Grey Edge:
  9085. @example
  9086. greyedge=difford=1:minknorm=5:sigma=2
  9087. @end example
  9088. @item
  9089. Max Edge:
  9090. @example
  9091. greyedge=difford=1:minknorm=0:sigma=2
  9092. @end example
  9093. @end itemize
  9094. @anchor{haldclut}
  9095. @section haldclut
  9096. Apply a Hald CLUT to a video stream.
  9097. First input is the video stream to process, and second one is the Hald CLUT.
  9098. The Hald CLUT input can be a simple picture or a complete video stream.
  9099. The filter accepts the following options:
  9100. @table @option
  9101. @item shortest
  9102. Force termination when the shortest input terminates. Default is @code{0}.
  9103. @item repeatlast
  9104. Continue applying the last CLUT after the end of the stream. A value of
  9105. @code{0} disable the filter after the last frame of the CLUT is reached.
  9106. Default is @code{1}.
  9107. @end table
  9108. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9109. filters share the same internals).
  9110. This filter also supports the @ref{framesync} options.
  9111. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9112. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9113. @subsection Workflow examples
  9114. @subsubsection Hald CLUT video stream
  9115. Generate an identity Hald CLUT stream altered with various effects:
  9116. @example
  9117. 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
  9118. @end example
  9119. Note: make sure you use a lossless codec.
  9120. Then use it with @code{haldclut} to apply it on some random stream:
  9121. @example
  9122. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9123. @end example
  9124. The Hald CLUT will be applied to the 10 first seconds (duration of
  9125. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9126. to the remaining frames of the @code{mandelbrot} stream.
  9127. @subsubsection Hald CLUT with preview
  9128. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9129. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9130. biggest possible square starting at the top left of the picture. The remaining
  9131. padding pixels (bottom or right) will be ignored. This area can be used to add
  9132. a preview of the Hald CLUT.
  9133. Typically, the following generated Hald CLUT will be supported by the
  9134. @code{haldclut} filter:
  9135. @example
  9136. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9137. pad=iw+320 [padded_clut];
  9138. smptebars=s=320x256, split [a][b];
  9139. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9140. [main][b] overlay=W-320" -frames:v 1 clut.png
  9141. @end example
  9142. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9143. bars are displayed on the right-top, and below the same color bars processed by
  9144. the color changes.
  9145. Then, the effect of this Hald CLUT can be visualized with:
  9146. @example
  9147. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9148. @end example
  9149. @section hflip
  9150. Flip the input video horizontally.
  9151. For example, to horizontally flip the input video with @command{ffmpeg}:
  9152. @example
  9153. ffmpeg -i in.avi -vf "hflip" out.avi
  9154. @end example
  9155. @section histeq
  9156. This filter applies a global color histogram equalization on a
  9157. per-frame basis.
  9158. It can be used to correct video that has a compressed range of pixel
  9159. intensities. The filter redistributes the pixel intensities to
  9160. equalize their distribution across the intensity range. It may be
  9161. viewed as an "automatically adjusting contrast filter". This filter is
  9162. useful only for correcting degraded or poorly captured source
  9163. video.
  9164. The filter accepts the following options:
  9165. @table @option
  9166. @item strength
  9167. Determine the amount of equalization to be applied. As the strength
  9168. is reduced, the distribution of pixel intensities more-and-more
  9169. approaches that of the input frame. The value must be a float number
  9170. in the range [0,1] and defaults to 0.200.
  9171. @item intensity
  9172. Set the maximum intensity that can generated and scale the output
  9173. values appropriately. The strength should be set as desired and then
  9174. the intensity can be limited if needed to avoid washing-out. The value
  9175. must be a float number in the range [0,1] and defaults to 0.210.
  9176. @item antibanding
  9177. Set the antibanding level. If enabled the filter will randomly vary
  9178. the luminance of output pixels by a small amount to avoid banding of
  9179. the histogram. Possible values are @code{none}, @code{weak} or
  9180. @code{strong}. It defaults to @code{none}.
  9181. @end table
  9182. @anchor{histogram}
  9183. @section histogram
  9184. Compute and draw a color distribution histogram for the input video.
  9185. The computed histogram is a representation of the color component
  9186. distribution in an image.
  9187. Standard histogram displays the color components distribution in an image.
  9188. Displays color graph for each color component. Shows distribution of
  9189. the Y, U, V, A or R, G, B components, depending on input format, in the
  9190. current frame. Below each graph a color component scale meter is shown.
  9191. The filter accepts the following options:
  9192. @table @option
  9193. @item level_height
  9194. Set height of level. Default value is @code{200}.
  9195. Allowed range is [50, 2048].
  9196. @item scale_height
  9197. Set height of color scale. Default value is @code{12}.
  9198. Allowed range is [0, 40].
  9199. @item display_mode
  9200. Set display mode.
  9201. It accepts the following values:
  9202. @table @samp
  9203. @item stack
  9204. Per color component graphs are placed below each other.
  9205. @item parade
  9206. Per color component graphs are placed side by side.
  9207. @item overlay
  9208. Presents information identical to that in the @code{parade}, except
  9209. that the graphs representing color components are superimposed directly
  9210. over one another.
  9211. @end table
  9212. Default is @code{stack}.
  9213. @item levels_mode
  9214. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9215. Default is @code{linear}.
  9216. @item components
  9217. Set what color components to display.
  9218. Default is @code{7}.
  9219. @item fgopacity
  9220. Set foreground opacity. Default is @code{0.7}.
  9221. @item bgopacity
  9222. Set background opacity. Default is @code{0.5}.
  9223. @end table
  9224. @subsection Examples
  9225. @itemize
  9226. @item
  9227. Calculate and draw histogram:
  9228. @example
  9229. ffplay -i input -vf histogram
  9230. @end example
  9231. @end itemize
  9232. @anchor{hqdn3d}
  9233. @section hqdn3d
  9234. This is a high precision/quality 3d denoise filter. It aims to reduce
  9235. image noise, producing smooth images and making still images really
  9236. still. It should enhance compressibility.
  9237. It accepts the following optional parameters:
  9238. @table @option
  9239. @item luma_spatial
  9240. A non-negative floating point number which specifies spatial luma strength.
  9241. It defaults to 4.0.
  9242. @item chroma_spatial
  9243. A non-negative floating point number which specifies spatial chroma strength.
  9244. It defaults to 3.0*@var{luma_spatial}/4.0.
  9245. @item luma_tmp
  9246. A floating point number which specifies luma temporal strength. It defaults to
  9247. 6.0*@var{luma_spatial}/4.0.
  9248. @item chroma_tmp
  9249. A floating point number which specifies chroma temporal strength. It defaults to
  9250. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9251. @end table
  9252. @subsection Commands
  9253. This filter supports same @ref{commands} as options.
  9254. The command accepts the same syntax of the corresponding option.
  9255. If the specified expression is not valid, it is kept at its current
  9256. value.
  9257. @anchor{hwdownload}
  9258. @section hwdownload
  9259. Download hardware frames to system memory.
  9260. The input must be in hardware frames, and the output a non-hardware format.
  9261. Not all formats will be supported on the output - it may be necessary to insert
  9262. an additional @option{format} filter immediately following in the graph to get
  9263. the output in a supported format.
  9264. @section hwmap
  9265. Map hardware frames to system memory or to another device.
  9266. This filter has several different modes of operation; which one is used depends
  9267. on the input and output formats:
  9268. @itemize
  9269. @item
  9270. Hardware frame input, normal frame output
  9271. Map the input frames to system memory and pass them to the output. If the
  9272. original hardware frame is later required (for example, after overlaying
  9273. something else on part of it), the @option{hwmap} filter can be used again
  9274. in the next mode to retrieve it.
  9275. @item
  9276. Normal frame input, hardware frame output
  9277. If the input is actually a software-mapped hardware frame, then unmap it -
  9278. that is, return the original hardware frame.
  9279. Otherwise, a device must be provided. Create new hardware surfaces on that
  9280. device for the output, then map them back to the software format at the input
  9281. and give those frames to the preceding filter. This will then act like the
  9282. @option{hwupload} filter, but may be able to avoid an additional copy when
  9283. the input is already in a compatible format.
  9284. @item
  9285. Hardware frame input and output
  9286. A device must be supplied for the output, either directly or with the
  9287. @option{derive_device} option. The input and output devices must be of
  9288. different types and compatible - the exact meaning of this is
  9289. system-dependent, but typically it means that they must refer to the same
  9290. underlying hardware context (for example, refer to the same graphics card).
  9291. If the input frames were originally created on the output device, then unmap
  9292. to retrieve the original frames.
  9293. Otherwise, map the frames to the output device - create new hardware frames
  9294. on the output corresponding to the frames on the input.
  9295. @end itemize
  9296. The following additional parameters are accepted:
  9297. @table @option
  9298. @item mode
  9299. Set the frame mapping mode. Some combination of:
  9300. @table @var
  9301. @item read
  9302. The mapped frame should be readable.
  9303. @item write
  9304. The mapped frame should be writeable.
  9305. @item overwrite
  9306. The mapping will always overwrite the entire frame.
  9307. This may improve performance in some cases, as the original contents of the
  9308. frame need not be loaded.
  9309. @item direct
  9310. The mapping must not involve any copying.
  9311. Indirect mappings to copies of frames are created in some cases where either
  9312. direct mapping is not possible or it would have unexpected properties.
  9313. Setting this flag ensures that the mapping is direct and will fail if that is
  9314. not possible.
  9315. @end table
  9316. Defaults to @var{read+write} if not specified.
  9317. @item derive_device @var{type}
  9318. Rather than using the device supplied at initialisation, instead derive a new
  9319. device of type @var{type} from the device the input frames exist on.
  9320. @item reverse
  9321. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9322. and map them back to the source. This may be necessary in some cases where
  9323. a mapping in one direction is required but only the opposite direction is
  9324. supported by the devices being used.
  9325. This option is dangerous - it may break the preceding filter in undefined
  9326. ways if there are any additional constraints on that filter's output.
  9327. Do not use it without fully understanding the implications of its use.
  9328. @end table
  9329. @anchor{hwupload}
  9330. @section hwupload
  9331. Upload system memory frames to hardware surfaces.
  9332. The device to upload to must be supplied when the filter is initialised. If
  9333. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9334. option or with the @option{derive_device} option. The input and output devices
  9335. must be of different types and compatible - the exact meaning of this is
  9336. system-dependent, but typically it means that they must refer to the same
  9337. underlying hardware context (for example, refer to the same graphics card).
  9338. The following additional parameters are accepted:
  9339. @table @option
  9340. @item derive_device @var{type}
  9341. Rather than using the device supplied at initialisation, instead derive a new
  9342. device of type @var{type} from the device the input frames exist on.
  9343. @end table
  9344. @anchor{hwupload_cuda}
  9345. @section hwupload_cuda
  9346. Upload system memory frames to a CUDA device.
  9347. It accepts the following optional parameters:
  9348. @table @option
  9349. @item device
  9350. The number of the CUDA device to use
  9351. @end table
  9352. @section hqx
  9353. Apply a high-quality magnification filter designed for pixel art. This filter
  9354. was originally created by Maxim Stepin.
  9355. It accepts the following option:
  9356. @table @option
  9357. @item n
  9358. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9359. @code{hq3x} and @code{4} for @code{hq4x}.
  9360. Default is @code{3}.
  9361. @end table
  9362. @section hstack
  9363. Stack input videos horizontally.
  9364. All streams must be of same pixel format and of same height.
  9365. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9366. to create same output.
  9367. The filter accepts the following option:
  9368. @table @option
  9369. @item inputs
  9370. Set number of input streams. Default is 2.
  9371. @item shortest
  9372. If set to 1, force the output to terminate when the shortest input
  9373. terminates. Default value is 0.
  9374. @end table
  9375. @section hue
  9376. Modify the hue and/or the saturation of the input.
  9377. It accepts the following parameters:
  9378. @table @option
  9379. @item h
  9380. Specify the hue angle as a number of degrees. It accepts an expression,
  9381. and defaults to "0".
  9382. @item s
  9383. Specify the saturation in the [-10,10] range. It accepts an expression and
  9384. defaults to "1".
  9385. @item H
  9386. Specify the hue angle as a number of radians. It accepts an
  9387. expression, and defaults to "0".
  9388. @item b
  9389. Specify the brightness in the [-10,10] range. It accepts an expression and
  9390. defaults to "0".
  9391. @end table
  9392. @option{h} and @option{H} are mutually exclusive, and can't be
  9393. specified at the same time.
  9394. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9395. expressions containing the following constants:
  9396. @table @option
  9397. @item n
  9398. frame count of the input frame starting from 0
  9399. @item pts
  9400. presentation timestamp of the input frame expressed in time base units
  9401. @item r
  9402. frame rate of the input video, NAN if the input frame rate is unknown
  9403. @item t
  9404. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9405. @item tb
  9406. time base of the input video
  9407. @end table
  9408. @subsection Examples
  9409. @itemize
  9410. @item
  9411. Set the hue to 90 degrees and the saturation to 1.0:
  9412. @example
  9413. hue=h=90:s=1
  9414. @end example
  9415. @item
  9416. Same command but expressing the hue in radians:
  9417. @example
  9418. hue=H=PI/2:s=1
  9419. @end example
  9420. @item
  9421. Rotate hue and make the saturation swing between 0
  9422. and 2 over a period of 1 second:
  9423. @example
  9424. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9425. @end example
  9426. @item
  9427. Apply a 3 seconds saturation fade-in effect starting at 0:
  9428. @example
  9429. hue="s=min(t/3\,1)"
  9430. @end example
  9431. The general fade-in expression can be written as:
  9432. @example
  9433. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9434. @end example
  9435. @item
  9436. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9437. @example
  9438. hue="s=max(0\, min(1\, (8-t)/3))"
  9439. @end example
  9440. The general fade-out expression can be written as:
  9441. @example
  9442. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9443. @end example
  9444. @end itemize
  9445. @subsection Commands
  9446. This filter supports the following commands:
  9447. @table @option
  9448. @item b
  9449. @item s
  9450. @item h
  9451. @item H
  9452. Modify the hue and/or the saturation and/or brightness of the input video.
  9453. The command accepts the same syntax of the corresponding option.
  9454. If the specified expression is not valid, it is kept at its current
  9455. value.
  9456. @end table
  9457. @section hysteresis
  9458. Grow first stream into second stream by connecting components.
  9459. This makes it possible to build more robust edge masks.
  9460. This filter accepts the following options:
  9461. @table @option
  9462. @item planes
  9463. Set which planes will be processed as bitmap, unprocessed planes will be
  9464. copied from first stream.
  9465. By default value 0xf, all planes will be processed.
  9466. @item threshold
  9467. Set threshold which is used in filtering. If pixel component value is higher than
  9468. this value filter algorithm for connecting components is activated.
  9469. By default value is 0.
  9470. @end table
  9471. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9472. @section idet
  9473. Detect video interlacing type.
  9474. This filter tries to detect if the input frames are interlaced, progressive,
  9475. top or bottom field first. It will also try to detect fields that are
  9476. repeated between adjacent frames (a sign of telecine).
  9477. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9478. Multiple frame detection incorporates the classification history of previous frames.
  9479. The filter will log these metadata values:
  9480. @table @option
  9481. @item single.current_frame
  9482. Detected type of current frame using single-frame detection. One of:
  9483. ``tff'' (top field first), ``bff'' (bottom field first),
  9484. ``progressive'', or ``undetermined''
  9485. @item single.tff
  9486. Cumulative number of frames detected as top field first using single-frame detection.
  9487. @item multiple.tff
  9488. Cumulative number of frames detected as top field first using multiple-frame detection.
  9489. @item single.bff
  9490. Cumulative number of frames detected as bottom field first using single-frame detection.
  9491. @item multiple.current_frame
  9492. Detected type of current frame using multiple-frame detection. One of:
  9493. ``tff'' (top field first), ``bff'' (bottom field first),
  9494. ``progressive'', or ``undetermined''
  9495. @item multiple.bff
  9496. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9497. @item single.progressive
  9498. Cumulative number of frames detected as progressive using single-frame detection.
  9499. @item multiple.progressive
  9500. Cumulative number of frames detected as progressive using multiple-frame detection.
  9501. @item single.undetermined
  9502. Cumulative number of frames that could not be classified using single-frame detection.
  9503. @item multiple.undetermined
  9504. Cumulative number of frames that could not be classified using multiple-frame detection.
  9505. @item repeated.current_frame
  9506. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9507. @item repeated.neither
  9508. Cumulative number of frames with no repeated field.
  9509. @item repeated.top
  9510. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9511. @item repeated.bottom
  9512. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9513. @end table
  9514. The filter accepts the following options:
  9515. @table @option
  9516. @item intl_thres
  9517. Set interlacing threshold.
  9518. @item prog_thres
  9519. Set progressive threshold.
  9520. @item rep_thres
  9521. Threshold for repeated field detection.
  9522. @item half_life
  9523. Number of frames after which a given frame's contribution to the
  9524. statistics is halved (i.e., it contributes only 0.5 to its
  9525. classification). The default of 0 means that all frames seen are given
  9526. full weight of 1.0 forever.
  9527. @item analyze_interlaced_flag
  9528. When this is not 0 then idet will use the specified number of frames to determine
  9529. if the interlaced flag is accurate, it will not count undetermined frames.
  9530. If the flag is found to be accurate it will be used without any further
  9531. computations, if it is found to be inaccurate it will be cleared without any
  9532. further computations. This allows inserting the idet filter as a low computational
  9533. method to clean up the interlaced flag
  9534. @end table
  9535. @section il
  9536. Deinterleave or interleave fields.
  9537. This filter allows one to process interlaced images fields without
  9538. deinterlacing them. Deinterleaving splits the input frame into 2
  9539. fields (so called half pictures). Odd lines are moved to the top
  9540. half of the output image, even lines to the bottom half.
  9541. You can process (filter) them independently and then re-interleave them.
  9542. The filter accepts the following options:
  9543. @table @option
  9544. @item luma_mode, l
  9545. @item chroma_mode, c
  9546. @item alpha_mode, a
  9547. Available values for @var{luma_mode}, @var{chroma_mode} and
  9548. @var{alpha_mode} are:
  9549. @table @samp
  9550. @item none
  9551. Do nothing.
  9552. @item deinterleave, d
  9553. Deinterleave fields, placing one above the other.
  9554. @item interleave, i
  9555. Interleave fields. Reverse the effect of deinterleaving.
  9556. @end table
  9557. Default value is @code{none}.
  9558. @item luma_swap, ls
  9559. @item chroma_swap, cs
  9560. @item alpha_swap, as
  9561. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9562. @end table
  9563. @subsection Commands
  9564. This filter supports the all above options as @ref{commands}.
  9565. @section inflate
  9566. Apply inflate effect to the video.
  9567. This filter replaces the pixel by the local(3x3) average by taking into account
  9568. only values higher than the pixel.
  9569. It accepts the following options:
  9570. @table @option
  9571. @item threshold0
  9572. @item threshold1
  9573. @item threshold2
  9574. @item threshold3
  9575. Limit the maximum change for each plane, default is 65535.
  9576. If 0, plane will remain unchanged.
  9577. @end table
  9578. @subsection Commands
  9579. This filter supports the all above options as @ref{commands}.
  9580. @section interlace
  9581. Simple interlacing filter from progressive contents. This interleaves upper (or
  9582. lower) lines from odd frames with lower (or upper) lines from even frames,
  9583. halving the frame rate and preserving image height.
  9584. @example
  9585. Original Original New Frame
  9586. Frame 'j' Frame 'j+1' (tff)
  9587. ========== =========== ==================
  9588. Line 0 --------------------> Frame 'j' Line 0
  9589. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9590. Line 2 ---------------------> Frame 'j' Line 2
  9591. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9592. ... ... ...
  9593. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9594. @end example
  9595. It accepts the following optional parameters:
  9596. @table @option
  9597. @item scan
  9598. This determines whether the interlaced frame is taken from the even
  9599. (tff - default) or odd (bff) lines of the progressive frame.
  9600. @item lowpass
  9601. Vertical lowpass filter to avoid twitter interlacing and
  9602. reduce moire patterns.
  9603. @table @samp
  9604. @item 0, off
  9605. Disable vertical lowpass filter
  9606. @item 1, linear
  9607. Enable linear filter (default)
  9608. @item 2, complex
  9609. Enable complex filter. This will slightly less reduce twitter and moire
  9610. but better retain detail and subjective sharpness impression.
  9611. @end table
  9612. @end table
  9613. @section kerndeint
  9614. Deinterlace input video by applying Donald Graft's adaptive kernel
  9615. deinterling. Work on interlaced parts of a video to produce
  9616. progressive frames.
  9617. The description of the accepted parameters follows.
  9618. @table @option
  9619. @item thresh
  9620. Set the threshold which affects the filter's tolerance when
  9621. determining if a pixel line must be processed. It must be an integer
  9622. in the range [0,255] and defaults to 10. A value of 0 will result in
  9623. applying the process on every pixels.
  9624. @item map
  9625. Paint pixels exceeding the threshold value to white if set to 1.
  9626. Default is 0.
  9627. @item order
  9628. Set the fields order. Swap fields if set to 1, leave fields alone if
  9629. 0. Default is 0.
  9630. @item sharp
  9631. Enable additional sharpening if set to 1. Default is 0.
  9632. @item twoway
  9633. Enable twoway sharpening if set to 1. Default is 0.
  9634. @end table
  9635. @subsection Examples
  9636. @itemize
  9637. @item
  9638. Apply default values:
  9639. @example
  9640. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9641. @end example
  9642. @item
  9643. Enable additional sharpening:
  9644. @example
  9645. kerndeint=sharp=1
  9646. @end example
  9647. @item
  9648. Paint processed pixels in white:
  9649. @example
  9650. kerndeint=map=1
  9651. @end example
  9652. @end itemize
  9653. @section lagfun
  9654. Slowly update darker pixels.
  9655. This filter makes short flashes of light appear longer.
  9656. This filter accepts the following options:
  9657. @table @option
  9658. @item decay
  9659. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9660. @item planes
  9661. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9662. @end table
  9663. @section lenscorrection
  9664. Correct radial lens distortion
  9665. This filter can be used to correct for radial distortion as can result from the use
  9666. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9667. one can use tools available for example as part of opencv or simply trial-and-error.
  9668. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9669. and extract the k1 and k2 coefficients from the resulting matrix.
  9670. Note that effectively the same filter is available in the open-source tools Krita and
  9671. Digikam from the KDE project.
  9672. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9673. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9674. brightness distribution, so you may want to use both filters together in certain
  9675. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9676. be applied before or after lens correction.
  9677. @subsection Options
  9678. The filter accepts the following options:
  9679. @table @option
  9680. @item cx
  9681. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9682. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9683. width. Default is 0.5.
  9684. @item cy
  9685. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9686. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9687. height. Default is 0.5.
  9688. @item k1
  9689. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9690. no correction. Default is 0.
  9691. @item k2
  9692. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9693. 0 means no correction. Default is 0.
  9694. @end table
  9695. The formula that generates the correction is:
  9696. @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)
  9697. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9698. distances from the focal point in the source and target images, respectively.
  9699. @section lensfun
  9700. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9701. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9702. to apply the lens correction. The filter will load the lensfun database and
  9703. query it to find the corresponding camera and lens entries in the database. As
  9704. long as these entries can be found with the given options, the filter can
  9705. perform corrections on frames. Note that incomplete strings will result in the
  9706. filter choosing the best match with the given options, and the filter will
  9707. output the chosen camera and lens models (logged with level "info"). You must
  9708. provide the make, camera model, and lens model as they are required.
  9709. The filter accepts the following options:
  9710. @table @option
  9711. @item make
  9712. The make of the camera (for example, "Canon"). This option is required.
  9713. @item model
  9714. The model of the camera (for example, "Canon EOS 100D"). This option is
  9715. required.
  9716. @item lens_model
  9717. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9718. option is required.
  9719. @item mode
  9720. The type of correction to apply. The following values are valid options:
  9721. @table @samp
  9722. @item vignetting
  9723. Enables fixing lens vignetting.
  9724. @item geometry
  9725. Enables fixing lens geometry. This is the default.
  9726. @item subpixel
  9727. Enables fixing chromatic aberrations.
  9728. @item vig_geo
  9729. Enables fixing lens vignetting and lens geometry.
  9730. @item vig_subpixel
  9731. Enables fixing lens vignetting and chromatic aberrations.
  9732. @item distortion
  9733. Enables fixing both lens geometry and chromatic aberrations.
  9734. @item all
  9735. Enables all possible corrections.
  9736. @end table
  9737. @item focal_length
  9738. The focal length of the image/video (zoom; expected constant for video). For
  9739. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9740. range should be chosen when using that lens. Default 18.
  9741. @item aperture
  9742. The aperture of the image/video (expected constant for video). Note that
  9743. aperture is only used for vignetting correction. Default 3.5.
  9744. @item focus_distance
  9745. The focus distance of the image/video (expected constant for video). Note that
  9746. focus distance is only used for vignetting and only slightly affects the
  9747. vignetting correction process. If unknown, leave it at the default value (which
  9748. is 1000).
  9749. @item scale
  9750. The scale factor which is applied after transformation. After correction the
  9751. video is no longer necessarily rectangular. This parameter controls how much of
  9752. the resulting image is visible. The value 0 means that a value will be chosen
  9753. automatically such that there is little or no unmapped area in the output
  9754. image. 1.0 means that no additional scaling is done. Lower values may result
  9755. in more of the corrected image being visible, while higher values may avoid
  9756. unmapped areas in the output.
  9757. @item target_geometry
  9758. The target geometry of the output image/video. The following values are valid
  9759. options:
  9760. @table @samp
  9761. @item rectilinear (default)
  9762. @item fisheye
  9763. @item panoramic
  9764. @item equirectangular
  9765. @item fisheye_orthographic
  9766. @item fisheye_stereographic
  9767. @item fisheye_equisolid
  9768. @item fisheye_thoby
  9769. @end table
  9770. @item reverse
  9771. Apply the reverse of image correction (instead of correcting distortion, apply
  9772. it).
  9773. @item interpolation
  9774. The type of interpolation used when correcting distortion. The following values
  9775. are valid options:
  9776. @table @samp
  9777. @item nearest
  9778. @item linear (default)
  9779. @item lanczos
  9780. @end table
  9781. @end table
  9782. @subsection Examples
  9783. @itemize
  9784. @item
  9785. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9786. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9787. aperture of "8.0".
  9788. @example
  9789. 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
  9790. @end example
  9791. @item
  9792. Apply the same as before, but only for the first 5 seconds of video.
  9793. @example
  9794. 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
  9795. @end example
  9796. @end itemize
  9797. @section libvmaf
  9798. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9799. score between two input videos.
  9800. The obtained VMAF score is printed through the logging system.
  9801. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9802. After installing the library it can be enabled using:
  9803. @code{./configure --enable-libvmaf}.
  9804. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9805. The filter has following options:
  9806. @table @option
  9807. @item model_path
  9808. Set the model path which is to be used for SVM.
  9809. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9810. @item log_path
  9811. Set the file path to be used to store logs.
  9812. @item log_fmt
  9813. Set the format of the log file (xml or json).
  9814. @item enable_transform
  9815. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9816. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9817. Default value: @code{false}
  9818. @item phone_model
  9819. Invokes the phone model which will generate VMAF scores higher than in the
  9820. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9821. Default value: @code{false}
  9822. @item psnr
  9823. Enables computing psnr along with vmaf.
  9824. Default value: @code{false}
  9825. @item ssim
  9826. Enables computing ssim along with vmaf.
  9827. Default value: @code{false}
  9828. @item ms_ssim
  9829. Enables computing ms_ssim along with vmaf.
  9830. Default value: @code{false}
  9831. @item pool
  9832. Set the pool method to be used for computing vmaf.
  9833. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9834. @item n_threads
  9835. Set number of threads to be used when computing vmaf.
  9836. Default value: @code{0}, which makes use of all available logical processors.
  9837. @item n_subsample
  9838. Set interval for frame subsampling used when computing vmaf.
  9839. Default value: @code{1}
  9840. @item enable_conf_interval
  9841. Enables confidence interval.
  9842. Default value: @code{false}
  9843. @end table
  9844. This filter also supports the @ref{framesync} options.
  9845. @subsection Examples
  9846. @itemize
  9847. @item
  9848. On the below examples the input file @file{main.mpg} being processed is
  9849. compared with the reference file @file{ref.mpg}.
  9850. @example
  9851. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9852. @end example
  9853. @item
  9854. Example with options:
  9855. @example
  9856. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9857. @end example
  9858. @item
  9859. Example with options and different containers:
  9860. @example
  9861. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9862. @end example
  9863. @end itemize
  9864. @section limiter
  9865. Limits the pixel components values to the specified range [min, max].
  9866. The filter accepts the following options:
  9867. @table @option
  9868. @item min
  9869. Lower bound. Defaults to the lowest allowed value for the input.
  9870. @item max
  9871. Upper bound. Defaults to the highest allowed value for the input.
  9872. @item planes
  9873. Specify which planes will be processed. Defaults to all available.
  9874. @end table
  9875. @section loop
  9876. Loop video frames.
  9877. The filter accepts the following options:
  9878. @table @option
  9879. @item loop
  9880. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9881. Default is 0.
  9882. @item size
  9883. Set maximal size in number of frames. Default is 0.
  9884. @item start
  9885. Set first frame of loop. Default is 0.
  9886. @end table
  9887. @subsection Examples
  9888. @itemize
  9889. @item
  9890. Loop single first frame infinitely:
  9891. @example
  9892. loop=loop=-1:size=1:start=0
  9893. @end example
  9894. @item
  9895. Loop single first frame 10 times:
  9896. @example
  9897. loop=loop=10:size=1:start=0
  9898. @end example
  9899. @item
  9900. Loop 10 first frames 5 times:
  9901. @example
  9902. loop=loop=5:size=10:start=0
  9903. @end example
  9904. @end itemize
  9905. @section lut1d
  9906. Apply a 1D LUT to an input video.
  9907. The filter accepts the following options:
  9908. @table @option
  9909. @item file
  9910. Set the 1D LUT file name.
  9911. Currently supported formats:
  9912. @table @samp
  9913. @item cube
  9914. Iridas
  9915. @item csp
  9916. cineSpace
  9917. @end table
  9918. @item interp
  9919. Select interpolation mode.
  9920. Available values are:
  9921. @table @samp
  9922. @item nearest
  9923. Use values from the nearest defined point.
  9924. @item linear
  9925. Interpolate values using the linear interpolation.
  9926. @item cosine
  9927. Interpolate values using the cosine interpolation.
  9928. @item cubic
  9929. Interpolate values using the cubic interpolation.
  9930. @item spline
  9931. Interpolate values using the spline interpolation.
  9932. @end table
  9933. @end table
  9934. @anchor{lut3d}
  9935. @section lut3d
  9936. Apply a 3D LUT to an input video.
  9937. The filter accepts the following options:
  9938. @table @option
  9939. @item file
  9940. Set the 3D LUT file name.
  9941. Currently supported formats:
  9942. @table @samp
  9943. @item 3dl
  9944. AfterEffects
  9945. @item cube
  9946. Iridas
  9947. @item dat
  9948. DaVinci
  9949. @item m3d
  9950. Pandora
  9951. @item csp
  9952. cineSpace
  9953. @end table
  9954. @item interp
  9955. Select interpolation mode.
  9956. Available values are:
  9957. @table @samp
  9958. @item nearest
  9959. Use values from the nearest defined point.
  9960. @item trilinear
  9961. Interpolate values using the 8 points defining a cube.
  9962. @item tetrahedral
  9963. Interpolate values using a tetrahedron.
  9964. @end table
  9965. @end table
  9966. @section lumakey
  9967. Turn certain luma values into transparency.
  9968. The filter accepts the following options:
  9969. @table @option
  9970. @item threshold
  9971. Set the luma which will be used as base for transparency.
  9972. Default value is @code{0}.
  9973. @item tolerance
  9974. Set the range of luma values to be keyed out.
  9975. Default value is @code{0.01}.
  9976. @item softness
  9977. Set the range of softness. Default value is @code{0}.
  9978. Use this to control gradual transition from zero to full transparency.
  9979. @end table
  9980. @subsection Commands
  9981. This filter supports same @ref{commands} as options.
  9982. The command accepts the same syntax of the corresponding option.
  9983. If the specified expression is not valid, it is kept at its current
  9984. value.
  9985. @section lut, lutrgb, lutyuv
  9986. Compute a look-up table for binding each pixel component input value
  9987. to an output value, and apply it to the input video.
  9988. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9989. to an RGB input video.
  9990. These filters accept the following parameters:
  9991. @table @option
  9992. @item c0
  9993. set first pixel component expression
  9994. @item c1
  9995. set second pixel component expression
  9996. @item c2
  9997. set third pixel component expression
  9998. @item c3
  9999. set fourth pixel component expression, corresponds to the alpha component
  10000. @item r
  10001. set red component expression
  10002. @item g
  10003. set green component expression
  10004. @item b
  10005. set blue component expression
  10006. @item a
  10007. alpha component expression
  10008. @item y
  10009. set Y/luminance component expression
  10010. @item u
  10011. set U/Cb component expression
  10012. @item v
  10013. set V/Cr component expression
  10014. @end table
  10015. Each of them specifies the expression to use for computing the lookup table for
  10016. the corresponding pixel component values.
  10017. The exact component associated to each of the @var{c*} options depends on the
  10018. format in input.
  10019. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10020. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10021. The expressions can contain the following constants and functions:
  10022. @table @option
  10023. @item w
  10024. @item h
  10025. The input width and height.
  10026. @item val
  10027. The input value for the pixel component.
  10028. @item clipval
  10029. The input value, clipped to the @var{minval}-@var{maxval} range.
  10030. @item maxval
  10031. The maximum value for the pixel component.
  10032. @item minval
  10033. The minimum value for the pixel component.
  10034. @item negval
  10035. The negated value for the pixel component value, clipped to the
  10036. @var{minval}-@var{maxval} range; it corresponds to the expression
  10037. "maxval-clipval+minval".
  10038. @item clip(val)
  10039. The computed value in @var{val}, clipped to the
  10040. @var{minval}-@var{maxval} range.
  10041. @item gammaval(gamma)
  10042. The computed gamma correction value of the pixel component value,
  10043. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10044. expression
  10045. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10046. @end table
  10047. All expressions default to "val".
  10048. @subsection Examples
  10049. @itemize
  10050. @item
  10051. Negate input video:
  10052. @example
  10053. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10054. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10055. @end example
  10056. The above is the same as:
  10057. @example
  10058. lutrgb="r=negval:g=negval:b=negval"
  10059. lutyuv="y=negval:u=negval:v=negval"
  10060. @end example
  10061. @item
  10062. Negate luminance:
  10063. @example
  10064. lutyuv=y=negval
  10065. @end example
  10066. @item
  10067. Remove chroma components, turning the video into a graytone image:
  10068. @example
  10069. lutyuv="u=128:v=128"
  10070. @end example
  10071. @item
  10072. Apply a luma burning effect:
  10073. @example
  10074. lutyuv="y=2*val"
  10075. @end example
  10076. @item
  10077. Remove green and blue components:
  10078. @example
  10079. lutrgb="g=0:b=0"
  10080. @end example
  10081. @item
  10082. Set a constant alpha channel value on input:
  10083. @example
  10084. format=rgba,lutrgb=a="maxval-minval/2"
  10085. @end example
  10086. @item
  10087. Correct luminance gamma by a factor of 0.5:
  10088. @example
  10089. lutyuv=y=gammaval(0.5)
  10090. @end example
  10091. @item
  10092. Discard least significant bits of luma:
  10093. @example
  10094. lutyuv=y='bitand(val, 128+64+32)'
  10095. @end example
  10096. @item
  10097. Technicolor like effect:
  10098. @example
  10099. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10100. @end example
  10101. @end itemize
  10102. @section lut2, tlut2
  10103. The @code{lut2} filter takes two input streams and outputs one
  10104. stream.
  10105. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10106. from one single stream.
  10107. This filter accepts the following parameters:
  10108. @table @option
  10109. @item c0
  10110. set first pixel component expression
  10111. @item c1
  10112. set second pixel component expression
  10113. @item c2
  10114. set third pixel component expression
  10115. @item c3
  10116. set fourth pixel component expression, corresponds to the alpha component
  10117. @item d
  10118. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10119. which means bit depth is automatically picked from first input format.
  10120. @end table
  10121. The @code{lut2} filter also supports the @ref{framesync} options.
  10122. Each of them specifies the expression to use for computing the lookup table for
  10123. the corresponding pixel component values.
  10124. The exact component associated to each of the @var{c*} options depends on the
  10125. format in inputs.
  10126. The expressions can contain the following constants:
  10127. @table @option
  10128. @item w
  10129. @item h
  10130. The input width and height.
  10131. @item x
  10132. The first input value for the pixel component.
  10133. @item y
  10134. The second input value for the pixel component.
  10135. @item bdx
  10136. The first input video bit depth.
  10137. @item bdy
  10138. The second input video bit depth.
  10139. @end table
  10140. All expressions default to "x".
  10141. @subsection Examples
  10142. @itemize
  10143. @item
  10144. Highlight differences between two RGB video streams:
  10145. @example
  10146. 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)'
  10147. @end example
  10148. @item
  10149. Highlight differences between two YUV video streams:
  10150. @example
  10151. 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)'
  10152. @end example
  10153. @item
  10154. Show max difference between two video streams:
  10155. @example
  10156. 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)))'
  10157. @end example
  10158. @end itemize
  10159. @section maskedclamp
  10160. Clamp the first input stream with the second input and third input stream.
  10161. Returns the value of first stream to be between second input
  10162. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10163. This filter accepts the following options:
  10164. @table @option
  10165. @item undershoot
  10166. Default value is @code{0}.
  10167. @item overshoot
  10168. Default value is @code{0}.
  10169. @item planes
  10170. Set which planes will be processed as bitmap, unprocessed planes will be
  10171. copied from first stream.
  10172. By default value 0xf, all planes will be processed.
  10173. @end table
  10174. @section maskedmax
  10175. Merge the second and third input stream into output stream using absolute differences
  10176. between second input stream and first input stream and absolute difference between
  10177. third input stream and first input stream. The picked value will be from second input
  10178. stream if second absolute difference is greater than first one or from third input stream
  10179. otherwise.
  10180. This filter accepts the following options:
  10181. @table @option
  10182. @item planes
  10183. Set which planes will be processed as bitmap, unprocessed planes will be
  10184. copied from first stream.
  10185. By default value 0xf, all planes will be processed.
  10186. @end table
  10187. @section maskedmerge
  10188. Merge the first input stream with the second input stream using per pixel
  10189. weights in the third input stream.
  10190. A value of 0 in the third stream pixel component means that pixel component
  10191. from first stream is returned unchanged, while maximum value (eg. 255 for
  10192. 8-bit videos) means that pixel component from second stream is returned
  10193. unchanged. Intermediate values define the amount of merging between both
  10194. input stream's pixel components.
  10195. This filter accepts the following options:
  10196. @table @option
  10197. @item planes
  10198. Set which planes will be processed as bitmap, unprocessed planes will be
  10199. copied from first stream.
  10200. By default value 0xf, all planes will be processed.
  10201. @end table
  10202. @section maskedmin
  10203. Merge the second and third input stream into output stream using absolute differences
  10204. between second input stream and first input stream and absolute difference between
  10205. third input stream and first input stream. The picked value will be from second input
  10206. stream if second absolute difference is less than first one or from third input stream
  10207. otherwise.
  10208. This filter accepts the following options:
  10209. @table @option
  10210. @item planes
  10211. Set which planes will be processed as bitmap, unprocessed planes will be
  10212. copied from first stream.
  10213. By default value 0xf, all planes will be processed.
  10214. @end table
  10215. @section maskedthreshold
  10216. Pick pixels comparing absolute difference of two video streams with fixed
  10217. threshold.
  10218. If absolute difference between pixel component of first and second video
  10219. stream is equal or lower than user supplied threshold than pixel component
  10220. from first video stream is picked, otherwise pixel component from second
  10221. video stream is picked.
  10222. This filter accepts the following options:
  10223. @table @option
  10224. @item threshold
  10225. Set threshold used when picking pixels from absolute difference from two input
  10226. video streams.
  10227. @item planes
  10228. Set which planes will be processed as bitmap, unprocessed planes will be
  10229. copied from second stream.
  10230. By default value 0xf, all planes will be processed.
  10231. @end table
  10232. @section maskfun
  10233. Create mask from input video.
  10234. For example it is useful to create motion masks after @code{tblend} filter.
  10235. This filter accepts the following options:
  10236. @table @option
  10237. @item low
  10238. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10239. @item high
  10240. Set high threshold. Any pixel component higher than this value will be set to max value
  10241. allowed for current pixel format.
  10242. @item planes
  10243. Set planes to filter, by default all available planes are filtered.
  10244. @item fill
  10245. Fill all frame pixels with this value.
  10246. @item sum
  10247. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10248. average, output frame will be completely filled with value set by @var{fill} option.
  10249. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10250. @end table
  10251. @section mcdeint
  10252. Apply motion-compensation deinterlacing.
  10253. It needs one field per frame as input and must thus be used together
  10254. with yadif=1/3 or equivalent.
  10255. This filter accepts the following options:
  10256. @table @option
  10257. @item mode
  10258. Set the deinterlacing mode.
  10259. It accepts one of the following values:
  10260. @table @samp
  10261. @item fast
  10262. @item medium
  10263. @item slow
  10264. use iterative motion estimation
  10265. @item extra_slow
  10266. like @samp{slow}, but use multiple reference frames.
  10267. @end table
  10268. Default value is @samp{fast}.
  10269. @item parity
  10270. Set the picture field parity assumed for the input video. It must be
  10271. one of the following values:
  10272. @table @samp
  10273. @item 0, tff
  10274. assume top field first
  10275. @item 1, bff
  10276. assume bottom field first
  10277. @end table
  10278. Default value is @samp{bff}.
  10279. @item qp
  10280. Set per-block quantization parameter (QP) used by the internal
  10281. encoder.
  10282. Higher values should result in a smoother motion vector field but less
  10283. optimal individual vectors. Default value is 1.
  10284. @end table
  10285. @section median
  10286. Pick median pixel from certain rectangle defined by radius.
  10287. This filter accepts the following options:
  10288. @table @option
  10289. @item radius
  10290. Set horizontal radius size. Default value is @code{1}.
  10291. Allowed range is integer from 1 to 127.
  10292. @item planes
  10293. Set which planes to process. Default is @code{15}, which is all available planes.
  10294. @item radiusV
  10295. Set vertical radius size. Default value is @code{0}.
  10296. Allowed range is integer from 0 to 127.
  10297. If it is 0, value will be picked from horizontal @code{radius} option.
  10298. @item percentile
  10299. Set median percentile. Default value is @code{0.5}.
  10300. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10301. minimum values, and @code{1} maximum values.
  10302. @end table
  10303. @subsection Commands
  10304. This filter supports same @ref{commands} as options.
  10305. The command accepts the same syntax of the corresponding option.
  10306. If the specified expression is not valid, it is kept at its current
  10307. value.
  10308. @section mergeplanes
  10309. Merge color channel components from several video streams.
  10310. The filter accepts up to 4 input streams, and merge selected input
  10311. planes to the output video.
  10312. This filter accepts the following options:
  10313. @table @option
  10314. @item mapping
  10315. Set input to output plane mapping. Default is @code{0}.
  10316. The mappings is specified as a bitmap. It should be specified as a
  10317. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10318. mapping for the first plane of the output stream. 'A' sets the number of
  10319. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10320. corresponding input to use (from 0 to 3). The rest of the mappings is
  10321. similar, 'Bb' describes the mapping for the output stream second
  10322. plane, 'Cc' describes the mapping for the output stream third plane and
  10323. 'Dd' describes the mapping for the output stream fourth plane.
  10324. @item format
  10325. Set output pixel format. Default is @code{yuva444p}.
  10326. @end table
  10327. @subsection Examples
  10328. @itemize
  10329. @item
  10330. Merge three gray video streams of same width and height into single video stream:
  10331. @example
  10332. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10333. @end example
  10334. @item
  10335. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10336. @example
  10337. [a0][a1]mergeplanes=0x00010210:yuva444p
  10338. @end example
  10339. @item
  10340. Swap Y and A plane in yuva444p stream:
  10341. @example
  10342. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10343. @end example
  10344. @item
  10345. Swap U and V plane in yuv420p stream:
  10346. @example
  10347. format=yuv420p,mergeplanes=0x000201:yuv420p
  10348. @end example
  10349. @item
  10350. Cast a rgb24 clip to yuv444p:
  10351. @example
  10352. format=rgb24,mergeplanes=0x000102:yuv444p
  10353. @end example
  10354. @end itemize
  10355. @section mestimate
  10356. Estimate and export motion vectors using block matching algorithms.
  10357. Motion vectors are stored in frame side data to be used by other filters.
  10358. This filter accepts the following options:
  10359. @table @option
  10360. @item method
  10361. Specify the motion estimation method. Accepts one of the following values:
  10362. @table @samp
  10363. @item esa
  10364. Exhaustive search algorithm.
  10365. @item tss
  10366. Three step search algorithm.
  10367. @item tdls
  10368. Two dimensional logarithmic search algorithm.
  10369. @item ntss
  10370. New three step search algorithm.
  10371. @item fss
  10372. Four step search algorithm.
  10373. @item ds
  10374. Diamond search algorithm.
  10375. @item hexbs
  10376. Hexagon-based search algorithm.
  10377. @item epzs
  10378. Enhanced predictive zonal search algorithm.
  10379. @item umh
  10380. Uneven multi-hexagon search algorithm.
  10381. @end table
  10382. Default value is @samp{esa}.
  10383. @item mb_size
  10384. Macroblock size. Default @code{16}.
  10385. @item search_param
  10386. Search parameter. Default @code{7}.
  10387. @end table
  10388. @section midequalizer
  10389. Apply Midway Image Equalization effect using two video streams.
  10390. Midway Image Equalization adjusts a pair of images to have the same
  10391. histogram, while maintaining their dynamics as much as possible. It's
  10392. useful for e.g. matching exposures from a pair of stereo cameras.
  10393. This filter has two inputs and one output, which must be of same pixel format, but
  10394. may be of different sizes. The output of filter is first input adjusted with
  10395. midway histogram of both inputs.
  10396. This filter accepts the following option:
  10397. @table @option
  10398. @item planes
  10399. Set which planes to process. Default is @code{15}, which is all available planes.
  10400. @end table
  10401. @section minterpolate
  10402. Convert the video to specified frame rate using motion interpolation.
  10403. This filter accepts the following options:
  10404. @table @option
  10405. @item fps
  10406. 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}.
  10407. @item mi_mode
  10408. Motion interpolation mode. Following values are accepted:
  10409. @table @samp
  10410. @item dup
  10411. Duplicate previous or next frame for interpolating new ones.
  10412. @item blend
  10413. Blend source frames. Interpolated frame is mean of previous and next frames.
  10414. @item mci
  10415. Motion compensated interpolation. Following options are effective when this mode is selected:
  10416. @table @samp
  10417. @item mc_mode
  10418. Motion compensation mode. Following values are accepted:
  10419. @table @samp
  10420. @item obmc
  10421. Overlapped block motion compensation.
  10422. @item aobmc
  10423. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10424. @end table
  10425. Default mode is @samp{obmc}.
  10426. @item me_mode
  10427. Motion estimation mode. Following values are accepted:
  10428. @table @samp
  10429. @item bidir
  10430. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10431. @item bilat
  10432. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10433. @end table
  10434. Default mode is @samp{bilat}.
  10435. @item me
  10436. The algorithm to be used for motion estimation. Following values are accepted:
  10437. @table @samp
  10438. @item esa
  10439. Exhaustive search algorithm.
  10440. @item tss
  10441. Three step search algorithm.
  10442. @item tdls
  10443. Two dimensional logarithmic search algorithm.
  10444. @item ntss
  10445. New three step search algorithm.
  10446. @item fss
  10447. Four step search algorithm.
  10448. @item ds
  10449. Diamond search algorithm.
  10450. @item hexbs
  10451. Hexagon-based search algorithm.
  10452. @item epzs
  10453. Enhanced predictive zonal search algorithm.
  10454. @item umh
  10455. Uneven multi-hexagon search algorithm.
  10456. @end table
  10457. Default algorithm is @samp{epzs}.
  10458. @item mb_size
  10459. Macroblock size. Default @code{16}.
  10460. @item search_param
  10461. Motion estimation search parameter. Default @code{32}.
  10462. @item vsbmc
  10463. 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).
  10464. @end table
  10465. @end table
  10466. @item scd
  10467. 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:
  10468. @table @samp
  10469. @item none
  10470. Disable scene change detection.
  10471. @item fdiff
  10472. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10473. @end table
  10474. Default method is @samp{fdiff}.
  10475. @item scd_threshold
  10476. Scene change detection threshold. Default is @code{10.}.
  10477. @end table
  10478. @section mix
  10479. Mix several video input streams into one video stream.
  10480. A description of the accepted options follows.
  10481. @table @option
  10482. @item nb_inputs
  10483. The number of inputs. If unspecified, it defaults to 2.
  10484. @item weights
  10485. Specify weight of each input video stream as sequence.
  10486. Each weight is separated by space. If number of weights
  10487. is smaller than number of @var{frames} last specified
  10488. weight will be used for all remaining unset weights.
  10489. @item scale
  10490. Specify scale, if it is set it will be multiplied with sum
  10491. of each weight multiplied with pixel values to give final destination
  10492. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10493. @item duration
  10494. Specify how end of stream is determined.
  10495. @table @samp
  10496. @item longest
  10497. The duration of the longest input. (default)
  10498. @item shortest
  10499. The duration of the shortest input.
  10500. @item first
  10501. The duration of the first input.
  10502. @end table
  10503. @end table
  10504. @section mpdecimate
  10505. Drop frames that do not differ greatly from the previous frame in
  10506. order to reduce frame rate.
  10507. The main use of this filter is for very-low-bitrate encoding
  10508. (e.g. streaming over dialup modem), but it could in theory be used for
  10509. fixing movies that were inverse-telecined incorrectly.
  10510. A description of the accepted options follows.
  10511. @table @option
  10512. @item max
  10513. Set the maximum number of consecutive frames which can be dropped (if
  10514. positive), or the minimum interval between dropped frames (if
  10515. negative). If the value is 0, the frame is dropped disregarding the
  10516. number of previous sequentially dropped frames.
  10517. Default value is 0.
  10518. @item hi
  10519. @item lo
  10520. @item frac
  10521. Set the dropping threshold values.
  10522. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10523. represent actual pixel value differences, so a threshold of 64
  10524. corresponds to 1 unit of difference for each pixel, or the same spread
  10525. out differently over the block.
  10526. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10527. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10528. meaning the whole image) differ by more than a threshold of @option{lo}.
  10529. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10530. 64*5, and default value for @option{frac} is 0.33.
  10531. @end table
  10532. @section negate
  10533. Negate (invert) the input video.
  10534. It accepts the following option:
  10535. @table @option
  10536. @item negate_alpha
  10537. With value 1, it negates the alpha component, if present. Default value is 0.
  10538. @end table
  10539. @anchor{nlmeans}
  10540. @section nlmeans
  10541. Denoise frames using Non-Local Means algorithm.
  10542. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10543. context similarity is defined by comparing their surrounding patches of size
  10544. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10545. around the pixel.
  10546. Note that the research area defines centers for patches, which means some
  10547. patches will be made of pixels outside that research area.
  10548. The filter accepts the following options.
  10549. @table @option
  10550. @item s
  10551. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10552. @item p
  10553. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10554. @item pc
  10555. Same as @option{p} but for chroma planes.
  10556. The default value is @var{0} and means automatic.
  10557. @item r
  10558. Set research size. Default is 15. Must be odd number in range [0, 99].
  10559. @item rc
  10560. Same as @option{r} but for chroma planes.
  10561. The default value is @var{0} and means automatic.
  10562. @end table
  10563. @section nnedi
  10564. Deinterlace video using neural network edge directed interpolation.
  10565. This filter accepts the following options:
  10566. @table @option
  10567. @item weights
  10568. Mandatory option, without binary file filter can not work.
  10569. Currently file can be found here:
  10570. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10571. @item deint
  10572. Set which frames to deinterlace, by default it is @code{all}.
  10573. Can be @code{all} or @code{interlaced}.
  10574. @item field
  10575. Set mode of operation.
  10576. Can be one of the following:
  10577. @table @samp
  10578. @item af
  10579. Use frame flags, both fields.
  10580. @item a
  10581. Use frame flags, single field.
  10582. @item t
  10583. Use top field only.
  10584. @item b
  10585. Use bottom field only.
  10586. @item tf
  10587. Use both fields, top first.
  10588. @item bf
  10589. Use both fields, bottom first.
  10590. @end table
  10591. @item planes
  10592. Set which planes to process, by default filter process all frames.
  10593. @item nsize
  10594. Set size of local neighborhood around each pixel, used by the predictor neural
  10595. network.
  10596. Can be one of the following:
  10597. @table @samp
  10598. @item s8x6
  10599. @item s16x6
  10600. @item s32x6
  10601. @item s48x6
  10602. @item s8x4
  10603. @item s16x4
  10604. @item s32x4
  10605. @end table
  10606. @item nns
  10607. Set the number of neurons in predictor neural network.
  10608. Can be one of the following:
  10609. @table @samp
  10610. @item n16
  10611. @item n32
  10612. @item n64
  10613. @item n128
  10614. @item n256
  10615. @end table
  10616. @item qual
  10617. Controls the number of different neural network predictions that are blended
  10618. together to compute the final output value. Can be @code{fast}, default or
  10619. @code{slow}.
  10620. @item etype
  10621. Set which set of weights to use in the predictor.
  10622. Can be one of the following:
  10623. @table @samp
  10624. @item a
  10625. weights trained to minimize absolute error
  10626. @item s
  10627. weights trained to minimize squared error
  10628. @end table
  10629. @item pscrn
  10630. Controls whether or not the prescreener neural network is used to decide
  10631. which pixels should be processed by the predictor neural network and which
  10632. can be handled by simple cubic interpolation.
  10633. The prescreener is trained to know whether cubic interpolation will be
  10634. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10635. The computational complexity of the prescreener nn is much less than that of
  10636. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10637. using the prescreener generally results in much faster processing.
  10638. The prescreener is pretty accurate, so the difference between using it and not
  10639. using it is almost always unnoticeable.
  10640. Can be one of the following:
  10641. @table @samp
  10642. @item none
  10643. @item original
  10644. @item new
  10645. @end table
  10646. Default is @code{new}.
  10647. @item fapprox
  10648. Set various debugging flags.
  10649. @end table
  10650. @section noformat
  10651. Force libavfilter not to use any of the specified pixel formats for the
  10652. input to the next filter.
  10653. It accepts the following parameters:
  10654. @table @option
  10655. @item pix_fmts
  10656. A '|'-separated list of pixel format names, such as
  10657. pix_fmts=yuv420p|monow|rgb24".
  10658. @end table
  10659. @subsection Examples
  10660. @itemize
  10661. @item
  10662. Force libavfilter to use a format different from @var{yuv420p} for the
  10663. input to the vflip filter:
  10664. @example
  10665. noformat=pix_fmts=yuv420p,vflip
  10666. @end example
  10667. @item
  10668. Convert the input video to any of the formats not contained in the list:
  10669. @example
  10670. noformat=yuv420p|yuv444p|yuv410p
  10671. @end example
  10672. @end itemize
  10673. @section noise
  10674. Add noise on video input frame.
  10675. The filter accepts the following options:
  10676. @table @option
  10677. @item all_seed
  10678. @item c0_seed
  10679. @item c1_seed
  10680. @item c2_seed
  10681. @item c3_seed
  10682. Set noise seed for specific pixel component or all pixel components in case
  10683. of @var{all_seed}. Default value is @code{123457}.
  10684. @item all_strength, alls
  10685. @item c0_strength, c0s
  10686. @item c1_strength, c1s
  10687. @item c2_strength, c2s
  10688. @item c3_strength, c3s
  10689. Set noise strength for specific pixel component or all pixel components in case
  10690. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10691. @item all_flags, allf
  10692. @item c0_flags, c0f
  10693. @item c1_flags, c1f
  10694. @item c2_flags, c2f
  10695. @item c3_flags, c3f
  10696. Set pixel component flags or set flags for all components if @var{all_flags}.
  10697. Available values for component flags are:
  10698. @table @samp
  10699. @item a
  10700. averaged temporal noise (smoother)
  10701. @item p
  10702. mix random noise with a (semi)regular pattern
  10703. @item t
  10704. temporal noise (noise pattern changes between frames)
  10705. @item u
  10706. uniform noise (gaussian otherwise)
  10707. @end table
  10708. @end table
  10709. @subsection Examples
  10710. Add temporal and uniform noise to input video:
  10711. @example
  10712. noise=alls=20:allf=t+u
  10713. @end example
  10714. @section normalize
  10715. Normalize RGB video (aka histogram stretching, contrast stretching).
  10716. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10717. For each channel of each frame, the filter computes the input range and maps
  10718. it linearly to the user-specified output range. The output range defaults
  10719. to the full dynamic range from pure black to pure white.
  10720. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10721. changes in brightness) caused when small dark or bright objects enter or leave
  10722. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10723. video camera, and, like a video camera, it may cause a period of over- or
  10724. under-exposure of the video.
  10725. The R,G,B channels can be normalized independently, which may cause some
  10726. color shifting, or linked together as a single channel, which prevents
  10727. color shifting. Linked normalization preserves hue. Independent normalization
  10728. does not, so it can be used to remove some color casts. Independent and linked
  10729. normalization can be combined in any ratio.
  10730. The normalize filter accepts the following options:
  10731. @table @option
  10732. @item blackpt
  10733. @item whitept
  10734. Colors which define the output range. The minimum input value is mapped to
  10735. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10736. The defaults are black and white respectively. Specifying white for
  10737. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10738. normalized video. Shades of grey can be used to reduce the dynamic range
  10739. (contrast). Specifying saturated colors here can create some interesting
  10740. effects.
  10741. @item smoothing
  10742. The number of previous frames to use for temporal smoothing. The input range
  10743. of each channel is smoothed using a rolling average over the current frame
  10744. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10745. smoothing).
  10746. @item independence
  10747. Controls the ratio of independent (color shifting) channel normalization to
  10748. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10749. independent. Defaults to 1.0 (fully independent).
  10750. @item strength
  10751. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10752. expensive no-op. Defaults to 1.0 (full strength).
  10753. @end table
  10754. @subsection Commands
  10755. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10756. The command accepts the same syntax of the corresponding option.
  10757. If the specified expression is not valid, it is kept at its current
  10758. value.
  10759. @subsection Examples
  10760. Stretch video contrast to use the full dynamic range, with no temporal
  10761. smoothing; may flicker depending on the source content:
  10762. @example
  10763. normalize=blackpt=black:whitept=white:smoothing=0
  10764. @end example
  10765. As above, but with 50 frames of temporal smoothing; flicker should be
  10766. reduced, depending on the source content:
  10767. @example
  10768. normalize=blackpt=black:whitept=white:smoothing=50
  10769. @end example
  10770. As above, but with hue-preserving linked channel normalization:
  10771. @example
  10772. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10773. @end example
  10774. As above, but with half strength:
  10775. @example
  10776. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10777. @end example
  10778. Map the darkest input color to red, the brightest input color to cyan:
  10779. @example
  10780. normalize=blackpt=red:whitept=cyan
  10781. @end example
  10782. @section null
  10783. Pass the video source unchanged to the output.
  10784. @section ocr
  10785. Optical Character Recognition
  10786. This filter uses Tesseract for optical character recognition. To enable
  10787. compilation of this filter, you need to configure FFmpeg with
  10788. @code{--enable-libtesseract}.
  10789. It accepts the following options:
  10790. @table @option
  10791. @item datapath
  10792. Set datapath to tesseract data. Default is to use whatever was
  10793. set at installation.
  10794. @item language
  10795. Set language, default is "eng".
  10796. @item whitelist
  10797. Set character whitelist.
  10798. @item blacklist
  10799. Set character blacklist.
  10800. @end table
  10801. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10802. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10803. @section ocv
  10804. Apply a video transform using libopencv.
  10805. To enable this filter, install the libopencv library and headers and
  10806. configure FFmpeg with @code{--enable-libopencv}.
  10807. It accepts the following parameters:
  10808. @table @option
  10809. @item filter_name
  10810. The name of the libopencv filter to apply.
  10811. @item filter_params
  10812. The parameters to pass to the libopencv filter. If not specified, the default
  10813. values are assumed.
  10814. @end table
  10815. Refer to the official libopencv documentation for more precise
  10816. information:
  10817. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10818. Several libopencv filters are supported; see the following subsections.
  10819. @anchor{dilate}
  10820. @subsection dilate
  10821. Dilate an image by using a specific structuring element.
  10822. It corresponds to the libopencv function @code{cvDilate}.
  10823. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10824. @var{struct_el} represents a structuring element, and has the syntax:
  10825. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10826. @var{cols} and @var{rows} represent the number of columns and rows of
  10827. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10828. point, and @var{shape} the shape for the structuring element. @var{shape}
  10829. must be "rect", "cross", "ellipse", or "custom".
  10830. If the value for @var{shape} is "custom", it must be followed by a
  10831. string of the form "=@var{filename}". The file with name
  10832. @var{filename} is assumed to represent a binary image, with each
  10833. printable character corresponding to a bright pixel. When a custom
  10834. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10835. or columns and rows of the read file are assumed instead.
  10836. The default value for @var{struct_el} is "3x3+0x0/rect".
  10837. @var{nb_iterations} specifies the number of times the transform is
  10838. applied to the image, and defaults to 1.
  10839. Some examples:
  10840. @example
  10841. # Use the default values
  10842. ocv=dilate
  10843. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10844. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10845. # Read the shape from the file diamond.shape, iterating two times.
  10846. # The file diamond.shape may contain a pattern of characters like this
  10847. # *
  10848. # ***
  10849. # *****
  10850. # ***
  10851. # *
  10852. # The specified columns and rows are ignored
  10853. # but the anchor point coordinates are not
  10854. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10855. @end example
  10856. @subsection erode
  10857. Erode an image by using a specific structuring element.
  10858. It corresponds to the libopencv function @code{cvErode}.
  10859. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10860. with the same syntax and semantics as the @ref{dilate} filter.
  10861. @subsection smooth
  10862. Smooth the input video.
  10863. The filter takes the following parameters:
  10864. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10865. @var{type} is the type of smooth filter to apply, and must be one of
  10866. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10867. or "bilateral". The default value is "gaussian".
  10868. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10869. depends on the smooth type. @var{param1} and
  10870. @var{param2} accept integer positive values or 0. @var{param3} and
  10871. @var{param4} accept floating point values.
  10872. The default value for @var{param1} is 3. The default value for the
  10873. other parameters is 0.
  10874. These parameters correspond to the parameters assigned to the
  10875. libopencv function @code{cvSmooth}.
  10876. @section oscilloscope
  10877. 2D Video Oscilloscope.
  10878. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10879. It accepts the following parameters:
  10880. @table @option
  10881. @item x
  10882. Set scope center x position.
  10883. @item y
  10884. Set scope center y position.
  10885. @item s
  10886. Set scope size, relative to frame diagonal.
  10887. @item t
  10888. Set scope tilt/rotation.
  10889. @item o
  10890. Set trace opacity.
  10891. @item tx
  10892. Set trace center x position.
  10893. @item ty
  10894. Set trace center y position.
  10895. @item tw
  10896. Set trace width, relative to width of frame.
  10897. @item th
  10898. Set trace height, relative to height of frame.
  10899. @item c
  10900. Set which components to trace. By default it traces first three components.
  10901. @item g
  10902. Draw trace grid. By default is enabled.
  10903. @item st
  10904. Draw some statistics. By default is enabled.
  10905. @item sc
  10906. Draw scope. By default is enabled.
  10907. @end table
  10908. @subsection Commands
  10909. This filter supports same @ref{commands} as options.
  10910. The command accepts the same syntax of the corresponding option.
  10911. If the specified expression is not valid, it is kept at its current
  10912. value.
  10913. @subsection Examples
  10914. @itemize
  10915. @item
  10916. Inspect full first row of video frame.
  10917. @example
  10918. oscilloscope=x=0.5:y=0:s=1
  10919. @end example
  10920. @item
  10921. Inspect full last row of video frame.
  10922. @example
  10923. oscilloscope=x=0.5:y=1:s=1
  10924. @end example
  10925. @item
  10926. Inspect full 5th line of video frame of height 1080.
  10927. @example
  10928. oscilloscope=x=0.5:y=5/1080:s=1
  10929. @end example
  10930. @item
  10931. Inspect full last column of video frame.
  10932. @example
  10933. oscilloscope=x=1:y=0.5:s=1:t=1
  10934. @end example
  10935. @end itemize
  10936. @anchor{overlay}
  10937. @section overlay
  10938. Overlay one video on top of another.
  10939. It takes two inputs and has one output. The first input is the "main"
  10940. video on which the second input is overlaid.
  10941. It accepts the following parameters:
  10942. A description of the accepted options follows.
  10943. @table @option
  10944. @item x
  10945. @item y
  10946. Set the expression for the x and y coordinates of the overlaid video
  10947. on the main video. Default value is "0" for both expressions. In case
  10948. the expression is invalid, it is set to a huge value (meaning that the
  10949. overlay will not be displayed within the output visible area).
  10950. @item eof_action
  10951. See @ref{framesync}.
  10952. @item eval
  10953. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10954. It accepts the following values:
  10955. @table @samp
  10956. @item init
  10957. only evaluate expressions once during the filter initialization or
  10958. when a command is processed
  10959. @item frame
  10960. evaluate expressions for each incoming frame
  10961. @end table
  10962. Default value is @samp{frame}.
  10963. @item shortest
  10964. See @ref{framesync}.
  10965. @item format
  10966. Set the format for the output video.
  10967. It accepts the following values:
  10968. @table @samp
  10969. @item yuv420
  10970. force YUV420 output
  10971. @item yuv420p10
  10972. force YUV420p10 output
  10973. @item yuv422
  10974. force YUV422 output
  10975. @item yuv422p10
  10976. force YUV422p10 output
  10977. @item yuv444
  10978. force YUV444 output
  10979. @item rgb
  10980. force packed RGB output
  10981. @item gbrp
  10982. force planar RGB output
  10983. @item auto
  10984. automatically pick format
  10985. @end table
  10986. Default value is @samp{yuv420}.
  10987. @item repeatlast
  10988. See @ref{framesync}.
  10989. @item alpha
  10990. Set format of alpha of the overlaid video, it can be @var{straight} or
  10991. @var{premultiplied}. Default is @var{straight}.
  10992. @end table
  10993. The @option{x}, and @option{y} expressions can contain the following
  10994. parameters.
  10995. @table @option
  10996. @item main_w, W
  10997. @item main_h, H
  10998. The main input width and height.
  10999. @item overlay_w, w
  11000. @item overlay_h, h
  11001. The overlay input width and height.
  11002. @item x
  11003. @item y
  11004. The computed values for @var{x} and @var{y}. They are evaluated for
  11005. each new frame.
  11006. @item hsub
  11007. @item vsub
  11008. horizontal and vertical chroma subsample values of the output
  11009. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11010. @var{vsub} is 1.
  11011. @item n
  11012. the number of input frame, starting from 0
  11013. @item pos
  11014. the position in the file of the input frame, NAN if unknown
  11015. @item t
  11016. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11017. @end table
  11018. This filter also supports the @ref{framesync} options.
  11019. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11020. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11021. when @option{eval} is set to @samp{init}.
  11022. Be aware that frames are taken from each input video in timestamp
  11023. order, hence, if their initial timestamps differ, it is a good idea
  11024. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11025. have them begin in the same zero timestamp, as the example for
  11026. the @var{movie} filter does.
  11027. You can chain together more overlays but you should test the
  11028. efficiency of such approach.
  11029. @subsection Commands
  11030. This filter supports the following commands:
  11031. @table @option
  11032. @item x
  11033. @item y
  11034. Modify the x and y of the overlay input.
  11035. The command accepts the same syntax of the corresponding option.
  11036. If the specified expression is not valid, it is kept at its current
  11037. value.
  11038. @end table
  11039. @subsection Examples
  11040. @itemize
  11041. @item
  11042. Draw the overlay at 10 pixels from the bottom right corner of the main
  11043. video:
  11044. @example
  11045. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11046. @end example
  11047. Using named options the example above becomes:
  11048. @example
  11049. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11050. @end example
  11051. @item
  11052. Insert a transparent PNG logo in the bottom left corner of the input,
  11053. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11054. @example
  11055. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11056. @end example
  11057. @item
  11058. Insert 2 different transparent PNG logos (second logo on bottom
  11059. right corner) using the @command{ffmpeg} tool:
  11060. @example
  11061. 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
  11062. @end example
  11063. @item
  11064. Add a transparent color layer on top of the main video; @code{WxH}
  11065. must specify the size of the main input to the overlay filter:
  11066. @example
  11067. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11068. @end example
  11069. @item
  11070. Play an original video and a filtered version (here with the deshake
  11071. filter) side by side using the @command{ffplay} tool:
  11072. @example
  11073. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11074. @end example
  11075. The above command is the same as:
  11076. @example
  11077. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11078. @end example
  11079. @item
  11080. Make a sliding overlay appearing from the left to the right top part of the
  11081. screen starting since time 2:
  11082. @example
  11083. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11084. @end example
  11085. @item
  11086. Compose output by putting two input videos side to side:
  11087. @example
  11088. ffmpeg -i left.avi -i right.avi -filter_complex "
  11089. nullsrc=size=200x100 [background];
  11090. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11091. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11092. [background][left] overlay=shortest=1 [background+left];
  11093. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11094. "
  11095. @end example
  11096. @item
  11097. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11098. @example
  11099. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11100. -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]'
  11101. masked.avi
  11102. @end example
  11103. @item
  11104. Chain several overlays in cascade:
  11105. @example
  11106. nullsrc=s=200x200 [bg];
  11107. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11108. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11109. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11110. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11111. [in3] null, [mid2] overlay=100:100 [out0]
  11112. @end example
  11113. @end itemize
  11114. @anchor{overlay_cuda}
  11115. @section overlay_cuda
  11116. Overlay one video on top of another.
  11117. This is the CUDA cariant of the @ref{overlay} filter.
  11118. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11119. It takes two inputs and has one output. The first input is the "main"
  11120. video on which the second input is overlaid.
  11121. It accepts the following parameters:
  11122. @table @option
  11123. @item x
  11124. @item y
  11125. Set the x and y coordinates of the overlaid video on the main video.
  11126. Default value is "0" for both expressions.
  11127. @item eof_action
  11128. See @ref{framesync}.
  11129. @item shortest
  11130. See @ref{framesync}.
  11131. @item repeatlast
  11132. See @ref{framesync}.
  11133. @end table
  11134. This filter also supports the @ref{framesync} options.
  11135. @section owdenoise
  11136. Apply Overcomplete Wavelet denoiser.
  11137. The filter accepts the following options:
  11138. @table @option
  11139. @item depth
  11140. Set depth.
  11141. Larger depth values will denoise lower frequency components more, but
  11142. slow down filtering.
  11143. Must be an int in the range 8-16, default is @code{8}.
  11144. @item luma_strength, ls
  11145. Set luma strength.
  11146. Must be a double value in the range 0-1000, default is @code{1.0}.
  11147. @item chroma_strength, cs
  11148. Set chroma strength.
  11149. Must be a double value in the range 0-1000, default is @code{1.0}.
  11150. @end table
  11151. @anchor{pad}
  11152. @section pad
  11153. Add paddings to the input image, and place the original input at the
  11154. provided @var{x}, @var{y} coordinates.
  11155. It accepts the following parameters:
  11156. @table @option
  11157. @item width, w
  11158. @item height, h
  11159. Specify an expression for the size of the output image with the
  11160. paddings added. If the value for @var{width} or @var{height} is 0, the
  11161. corresponding input size is used for the output.
  11162. The @var{width} expression can reference the value set by the
  11163. @var{height} expression, and vice versa.
  11164. The default value of @var{width} and @var{height} is 0.
  11165. @item x
  11166. @item y
  11167. Specify the offsets to place the input image at within the padded area,
  11168. with respect to the top/left border of the output image.
  11169. The @var{x} expression can reference the value set by the @var{y}
  11170. expression, and vice versa.
  11171. The default value of @var{x} and @var{y} is 0.
  11172. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11173. so the input image is centered on the padded area.
  11174. @item color
  11175. Specify the color of the padded area. For the syntax of this option,
  11176. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11177. manual,ffmpeg-utils}.
  11178. The default value of @var{color} is "black".
  11179. @item eval
  11180. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11181. It accepts the following values:
  11182. @table @samp
  11183. @item init
  11184. Only evaluate expressions once during the filter initialization or when
  11185. a command is processed.
  11186. @item frame
  11187. Evaluate expressions for each incoming frame.
  11188. @end table
  11189. Default value is @samp{init}.
  11190. @item aspect
  11191. Pad to aspect instead to a resolution.
  11192. @end table
  11193. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11194. options are expressions containing the following constants:
  11195. @table @option
  11196. @item in_w
  11197. @item in_h
  11198. The input video width and height.
  11199. @item iw
  11200. @item ih
  11201. These are the same as @var{in_w} and @var{in_h}.
  11202. @item out_w
  11203. @item out_h
  11204. The output width and height (the size of the padded area), as
  11205. specified by the @var{width} and @var{height} expressions.
  11206. @item ow
  11207. @item oh
  11208. These are the same as @var{out_w} and @var{out_h}.
  11209. @item x
  11210. @item y
  11211. The x and y offsets as specified by the @var{x} and @var{y}
  11212. expressions, or NAN if not yet specified.
  11213. @item a
  11214. same as @var{iw} / @var{ih}
  11215. @item sar
  11216. input sample aspect ratio
  11217. @item dar
  11218. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11219. @item hsub
  11220. @item vsub
  11221. The horizontal and vertical chroma subsample values. For example for the
  11222. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11223. @end table
  11224. @subsection Examples
  11225. @itemize
  11226. @item
  11227. Add paddings with the color "violet" to the input video. The output video
  11228. size is 640x480, and the top-left corner of the input video is placed at
  11229. column 0, row 40
  11230. @example
  11231. pad=640:480:0:40:violet
  11232. @end example
  11233. The example above is equivalent to the following command:
  11234. @example
  11235. pad=width=640:height=480:x=0:y=40:color=violet
  11236. @end example
  11237. @item
  11238. Pad the input to get an output with dimensions increased by 3/2,
  11239. and put the input video at the center of the padded area:
  11240. @example
  11241. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11242. @end example
  11243. @item
  11244. Pad the input to get a squared output with size equal to the maximum
  11245. value between the input width and height, and put the input video at
  11246. the center of the padded area:
  11247. @example
  11248. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11249. @end example
  11250. @item
  11251. Pad the input to get a final w/h ratio of 16:9:
  11252. @example
  11253. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11254. @end example
  11255. @item
  11256. In case of anamorphic video, in order to set the output display aspect
  11257. correctly, it is necessary to use @var{sar} in the expression,
  11258. according to the relation:
  11259. @example
  11260. (ih * X / ih) * sar = output_dar
  11261. X = output_dar / sar
  11262. @end example
  11263. Thus the previous example needs to be modified to:
  11264. @example
  11265. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11266. @end example
  11267. @item
  11268. Double the output size and put the input video in the bottom-right
  11269. corner of the output padded area:
  11270. @example
  11271. pad="2*iw:2*ih:ow-iw:oh-ih"
  11272. @end example
  11273. @end itemize
  11274. @anchor{palettegen}
  11275. @section palettegen
  11276. Generate one palette for a whole video stream.
  11277. It accepts the following options:
  11278. @table @option
  11279. @item max_colors
  11280. Set the maximum number of colors to quantize in the palette.
  11281. Note: the palette will still contain 256 colors; the unused palette entries
  11282. will be black.
  11283. @item reserve_transparent
  11284. Create a palette of 255 colors maximum and reserve the last one for
  11285. transparency. Reserving the transparency color is useful for GIF optimization.
  11286. If not set, the maximum of colors in the palette will be 256. You probably want
  11287. to disable this option for a standalone image.
  11288. Set by default.
  11289. @item transparency_color
  11290. Set the color that will be used as background for transparency.
  11291. @item stats_mode
  11292. Set statistics mode.
  11293. It accepts the following values:
  11294. @table @samp
  11295. @item full
  11296. Compute full frame histograms.
  11297. @item diff
  11298. Compute histograms only for the part that differs from previous frame. This
  11299. might be relevant to give more importance to the moving part of your input if
  11300. the background is static.
  11301. @item single
  11302. Compute new histogram for each frame.
  11303. @end table
  11304. Default value is @var{full}.
  11305. @end table
  11306. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11307. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11308. color quantization of the palette. This information is also visible at
  11309. @var{info} logging level.
  11310. @subsection Examples
  11311. @itemize
  11312. @item
  11313. Generate a representative palette of a given video using @command{ffmpeg}:
  11314. @example
  11315. ffmpeg -i input.mkv -vf palettegen palette.png
  11316. @end example
  11317. @end itemize
  11318. @section paletteuse
  11319. Use a palette to downsample an input video stream.
  11320. The filter takes two inputs: one video stream and a palette. The palette must
  11321. be a 256 pixels image.
  11322. It accepts the following options:
  11323. @table @option
  11324. @item dither
  11325. Select dithering mode. Available algorithms are:
  11326. @table @samp
  11327. @item bayer
  11328. Ordered 8x8 bayer dithering (deterministic)
  11329. @item heckbert
  11330. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11331. Note: this dithering is sometimes considered "wrong" and is included as a
  11332. reference.
  11333. @item floyd_steinberg
  11334. Floyd and Steingberg dithering (error diffusion)
  11335. @item sierra2
  11336. Frankie Sierra dithering v2 (error diffusion)
  11337. @item sierra2_4a
  11338. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11339. @end table
  11340. Default is @var{sierra2_4a}.
  11341. @item bayer_scale
  11342. When @var{bayer} dithering is selected, this option defines the scale of the
  11343. pattern (how much the crosshatch pattern is visible). A low value means more
  11344. visible pattern for less banding, and higher value means less visible pattern
  11345. at the cost of more banding.
  11346. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11347. @item diff_mode
  11348. If set, define the zone to process
  11349. @table @samp
  11350. @item rectangle
  11351. Only the changing rectangle will be reprocessed. This is similar to GIF
  11352. cropping/offsetting compression mechanism. This option can be useful for speed
  11353. if only a part of the image is changing, and has use cases such as limiting the
  11354. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11355. moving scene (it leads to more deterministic output if the scene doesn't change
  11356. much, and as a result less moving noise and better GIF compression).
  11357. @end table
  11358. Default is @var{none}.
  11359. @item new
  11360. Take new palette for each output frame.
  11361. @item alpha_threshold
  11362. Sets the alpha threshold for transparency. Alpha values above this threshold
  11363. will be treated as completely opaque, and values below this threshold will be
  11364. treated as completely transparent.
  11365. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11366. @end table
  11367. @subsection Examples
  11368. @itemize
  11369. @item
  11370. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11371. using @command{ffmpeg}:
  11372. @example
  11373. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11374. @end example
  11375. @end itemize
  11376. @section perspective
  11377. Correct perspective of video not recorded perpendicular to the screen.
  11378. A description of the accepted parameters follows.
  11379. @table @option
  11380. @item x0
  11381. @item y0
  11382. @item x1
  11383. @item y1
  11384. @item x2
  11385. @item y2
  11386. @item x3
  11387. @item y3
  11388. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11389. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11390. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11391. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11392. then the corners of the source will be sent to the specified coordinates.
  11393. The expressions can use the following variables:
  11394. @table @option
  11395. @item W
  11396. @item H
  11397. the width and height of video frame.
  11398. @item in
  11399. Input frame count.
  11400. @item on
  11401. Output frame count.
  11402. @end table
  11403. @item interpolation
  11404. Set interpolation for perspective correction.
  11405. It accepts the following values:
  11406. @table @samp
  11407. @item linear
  11408. @item cubic
  11409. @end table
  11410. Default value is @samp{linear}.
  11411. @item sense
  11412. Set interpretation of coordinate options.
  11413. It accepts the following values:
  11414. @table @samp
  11415. @item 0, source
  11416. Send point in the source specified by the given coordinates to
  11417. the corners of the destination.
  11418. @item 1, destination
  11419. Send the corners of the source to the point in the destination specified
  11420. by the given coordinates.
  11421. Default value is @samp{source}.
  11422. @end table
  11423. @item eval
  11424. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11425. It accepts the following values:
  11426. @table @samp
  11427. @item init
  11428. only evaluate expressions once during the filter initialization or
  11429. when a command is processed
  11430. @item frame
  11431. evaluate expressions for each incoming frame
  11432. @end table
  11433. Default value is @samp{init}.
  11434. @end table
  11435. @section phase
  11436. Delay interlaced video by one field time so that the field order changes.
  11437. The intended use is to fix PAL movies that have been captured with the
  11438. opposite field order to the film-to-video transfer.
  11439. A description of the accepted parameters follows.
  11440. @table @option
  11441. @item mode
  11442. Set phase mode.
  11443. It accepts the following values:
  11444. @table @samp
  11445. @item t
  11446. Capture field order top-first, transfer bottom-first.
  11447. Filter will delay the bottom field.
  11448. @item b
  11449. Capture field order bottom-first, transfer top-first.
  11450. Filter will delay the top field.
  11451. @item p
  11452. Capture and transfer with the same field order. This mode only exists
  11453. for the documentation of the other options to refer to, but if you
  11454. actually select it, the filter will faithfully do nothing.
  11455. @item a
  11456. Capture field order determined automatically by field flags, transfer
  11457. opposite.
  11458. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11459. basis using field flags. If no field information is available,
  11460. then this works just like @samp{u}.
  11461. @item u
  11462. Capture unknown or varying, transfer opposite.
  11463. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11464. analyzing the images and selecting the alternative that produces best
  11465. match between the fields.
  11466. @item T
  11467. Capture top-first, transfer unknown or varying.
  11468. Filter selects among @samp{t} and @samp{p} using image analysis.
  11469. @item B
  11470. Capture bottom-first, transfer unknown or varying.
  11471. Filter selects among @samp{b} and @samp{p} using image analysis.
  11472. @item A
  11473. Capture determined by field flags, transfer unknown or varying.
  11474. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11475. image analysis. If no field information is available, then this works just
  11476. like @samp{U}. This is the default mode.
  11477. @item U
  11478. Both capture and transfer unknown or varying.
  11479. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11480. @end table
  11481. @end table
  11482. @section photosensitivity
  11483. Reduce various flashes in video, so to help users with epilepsy.
  11484. It accepts the following options:
  11485. @table @option
  11486. @item frames, f
  11487. Set how many frames to use when filtering. Default is 30.
  11488. @item threshold, t
  11489. Set detection threshold factor. Default is 1.
  11490. Lower is stricter.
  11491. @item skip
  11492. Set how many pixels to skip when sampling frames. Default is 1.
  11493. Allowed range is from 1 to 1024.
  11494. @item bypass
  11495. Leave frames unchanged. Default is disabled.
  11496. @end table
  11497. @section pixdesctest
  11498. Pixel format descriptor test filter, mainly useful for internal
  11499. testing. The output video should be equal to the input video.
  11500. For example:
  11501. @example
  11502. format=monow, pixdesctest
  11503. @end example
  11504. can be used to test the monowhite pixel format descriptor definition.
  11505. @section pixscope
  11506. Display sample values of color channels. Mainly useful for checking color
  11507. and levels. Minimum supported resolution is 640x480.
  11508. The filters accept the following options:
  11509. @table @option
  11510. @item x
  11511. Set scope X position, relative offset on X axis.
  11512. @item y
  11513. Set scope Y position, relative offset on Y axis.
  11514. @item w
  11515. Set scope width.
  11516. @item h
  11517. Set scope height.
  11518. @item o
  11519. Set window opacity. This window also holds statistics about pixel area.
  11520. @item wx
  11521. Set window X position, relative offset on X axis.
  11522. @item wy
  11523. Set window Y position, relative offset on Y axis.
  11524. @end table
  11525. @section pp
  11526. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11527. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11528. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11529. Each subfilter and some options have a short and a long name that can be used
  11530. interchangeably, i.e. dr/dering are the same.
  11531. The filters accept the following options:
  11532. @table @option
  11533. @item subfilters
  11534. Set postprocessing subfilters string.
  11535. @end table
  11536. All subfilters share common options to determine their scope:
  11537. @table @option
  11538. @item a/autoq
  11539. Honor the quality commands for this subfilter.
  11540. @item c/chrom
  11541. Do chrominance filtering, too (default).
  11542. @item y/nochrom
  11543. Do luminance filtering only (no chrominance).
  11544. @item n/noluma
  11545. Do chrominance filtering only (no luminance).
  11546. @end table
  11547. These options can be appended after the subfilter name, separated by a '|'.
  11548. Available subfilters are:
  11549. @table @option
  11550. @item hb/hdeblock[|difference[|flatness]]
  11551. Horizontal deblocking filter
  11552. @table @option
  11553. @item difference
  11554. Difference factor where higher values mean more deblocking (default: @code{32}).
  11555. @item flatness
  11556. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11557. @end table
  11558. @item vb/vdeblock[|difference[|flatness]]
  11559. Vertical deblocking filter
  11560. @table @option
  11561. @item difference
  11562. Difference factor where higher values mean more deblocking (default: @code{32}).
  11563. @item flatness
  11564. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11565. @end table
  11566. @item ha/hadeblock[|difference[|flatness]]
  11567. Accurate horizontal deblocking filter
  11568. @table @option
  11569. @item difference
  11570. Difference factor where higher values mean more deblocking (default: @code{32}).
  11571. @item flatness
  11572. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11573. @end table
  11574. @item va/vadeblock[|difference[|flatness]]
  11575. Accurate vertical deblocking filter
  11576. @table @option
  11577. @item difference
  11578. Difference factor where higher values mean more deblocking (default: @code{32}).
  11579. @item flatness
  11580. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11581. @end table
  11582. @end table
  11583. The horizontal and vertical deblocking filters share the difference and
  11584. flatness values so you cannot set different horizontal and vertical
  11585. thresholds.
  11586. @table @option
  11587. @item h1/x1hdeblock
  11588. Experimental horizontal deblocking filter
  11589. @item v1/x1vdeblock
  11590. Experimental vertical deblocking filter
  11591. @item dr/dering
  11592. Deringing filter
  11593. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11594. @table @option
  11595. @item threshold1
  11596. larger -> stronger filtering
  11597. @item threshold2
  11598. larger -> stronger filtering
  11599. @item threshold3
  11600. larger -> stronger filtering
  11601. @end table
  11602. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11603. @table @option
  11604. @item f/fullyrange
  11605. Stretch luminance to @code{0-255}.
  11606. @end table
  11607. @item lb/linblenddeint
  11608. Linear blend deinterlacing filter that deinterlaces the given block by
  11609. filtering all lines with a @code{(1 2 1)} filter.
  11610. @item li/linipoldeint
  11611. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11612. linearly interpolating every second line.
  11613. @item ci/cubicipoldeint
  11614. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11615. cubically interpolating every second line.
  11616. @item md/mediandeint
  11617. Median deinterlacing filter that deinterlaces the given block by applying a
  11618. median filter to every second line.
  11619. @item fd/ffmpegdeint
  11620. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11621. second line with a @code{(-1 4 2 4 -1)} filter.
  11622. @item l5/lowpass5
  11623. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11624. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11625. @item fq/forceQuant[|quantizer]
  11626. Overrides the quantizer table from the input with the constant quantizer you
  11627. specify.
  11628. @table @option
  11629. @item quantizer
  11630. Quantizer to use
  11631. @end table
  11632. @item de/default
  11633. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11634. @item fa/fast
  11635. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11636. @item ac
  11637. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11638. @end table
  11639. @subsection Examples
  11640. @itemize
  11641. @item
  11642. Apply horizontal and vertical deblocking, deringing and automatic
  11643. brightness/contrast:
  11644. @example
  11645. pp=hb/vb/dr/al
  11646. @end example
  11647. @item
  11648. Apply default filters without brightness/contrast correction:
  11649. @example
  11650. pp=de/-al
  11651. @end example
  11652. @item
  11653. Apply default filters and temporal denoiser:
  11654. @example
  11655. pp=default/tmpnoise|1|2|3
  11656. @end example
  11657. @item
  11658. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11659. automatically depending on available CPU time:
  11660. @example
  11661. pp=hb|y/vb|a
  11662. @end example
  11663. @end itemize
  11664. @section pp7
  11665. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11666. similar to spp = 6 with 7 point DCT, where only the center sample is
  11667. used after IDCT.
  11668. The filter accepts the following options:
  11669. @table @option
  11670. @item qp
  11671. Force a constant quantization parameter. It accepts an integer in range
  11672. 0 to 63. If not set, the filter will use the QP from the video stream
  11673. (if available).
  11674. @item mode
  11675. Set thresholding mode. Available modes are:
  11676. @table @samp
  11677. @item hard
  11678. Set hard thresholding.
  11679. @item soft
  11680. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11681. @item medium
  11682. Set medium thresholding (good results, default).
  11683. @end table
  11684. @end table
  11685. @section premultiply
  11686. Apply alpha premultiply effect to input video stream using first plane
  11687. of second stream as alpha.
  11688. Both streams must have same dimensions and same pixel format.
  11689. The filter accepts the following option:
  11690. @table @option
  11691. @item planes
  11692. Set which planes will be processed, unprocessed planes will be copied.
  11693. By default value 0xf, all planes will be processed.
  11694. @item inplace
  11695. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11696. @end table
  11697. @section prewitt
  11698. Apply prewitt operator to input video stream.
  11699. The filter accepts the following option:
  11700. @table @option
  11701. @item planes
  11702. Set which planes will be processed, unprocessed planes will be copied.
  11703. By default value 0xf, all planes will be processed.
  11704. @item scale
  11705. Set value which will be multiplied with filtered result.
  11706. @item delta
  11707. Set value which will be added to filtered result.
  11708. @end table
  11709. @section pseudocolor
  11710. Alter frame colors in video with pseudocolors.
  11711. This filter accepts the following options:
  11712. @table @option
  11713. @item c0
  11714. set pixel first component expression
  11715. @item c1
  11716. set pixel second component expression
  11717. @item c2
  11718. set pixel third component expression
  11719. @item c3
  11720. set pixel fourth component expression, corresponds to the alpha component
  11721. @item i
  11722. set component to use as base for altering colors
  11723. @end table
  11724. Each of them specifies the expression to use for computing the lookup table for
  11725. the corresponding pixel component values.
  11726. The expressions can contain the following constants and functions:
  11727. @table @option
  11728. @item w
  11729. @item h
  11730. The input width and height.
  11731. @item val
  11732. The input value for the pixel component.
  11733. @item ymin, umin, vmin, amin
  11734. The minimum allowed component value.
  11735. @item ymax, umax, vmax, amax
  11736. The maximum allowed component value.
  11737. @end table
  11738. All expressions default to "val".
  11739. @subsection Examples
  11740. @itemize
  11741. @item
  11742. Change too high luma values to gradient:
  11743. @example
  11744. 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'"
  11745. @end example
  11746. @end itemize
  11747. @section psnr
  11748. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11749. Ratio) between two input videos.
  11750. This filter takes in input two input videos, the first input is
  11751. considered the "main" source and is passed unchanged to the
  11752. output. The second input is used as a "reference" video for computing
  11753. the PSNR.
  11754. Both video inputs must have the same resolution and pixel format for
  11755. this filter to work correctly. Also it assumes that both inputs
  11756. have the same number of frames, which are compared one by one.
  11757. The obtained average PSNR is printed through the logging system.
  11758. The filter stores the accumulated MSE (mean squared error) of each
  11759. frame, and at the end of the processing it is averaged across all frames
  11760. equally, and the following formula is applied to obtain the PSNR:
  11761. @example
  11762. PSNR = 10*log10(MAX^2/MSE)
  11763. @end example
  11764. Where MAX is the average of the maximum values of each component of the
  11765. image.
  11766. The description of the accepted parameters follows.
  11767. @table @option
  11768. @item stats_file, f
  11769. If specified the filter will use the named file to save the PSNR of
  11770. each individual frame. When filename equals "-" the data is sent to
  11771. standard output.
  11772. @item stats_version
  11773. Specifies which version of the stats file format to use. Details of
  11774. each format are written below.
  11775. Default value is 1.
  11776. @item stats_add_max
  11777. Determines whether the max value is output to the stats log.
  11778. Default value is 0.
  11779. Requires stats_version >= 2. If this is set and stats_version < 2,
  11780. the filter will return an error.
  11781. @end table
  11782. This filter also supports the @ref{framesync} options.
  11783. The file printed if @var{stats_file} is selected, contains a sequence of
  11784. key/value pairs of the form @var{key}:@var{value} for each compared
  11785. couple of frames.
  11786. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11787. the list of per-frame-pair stats, with key value pairs following the frame
  11788. format with the following parameters:
  11789. @table @option
  11790. @item psnr_log_version
  11791. The version of the log file format. Will match @var{stats_version}.
  11792. @item fields
  11793. A comma separated list of the per-frame-pair parameters included in
  11794. the log.
  11795. @end table
  11796. A description of each shown per-frame-pair parameter follows:
  11797. @table @option
  11798. @item n
  11799. sequential number of the input frame, starting from 1
  11800. @item mse_avg
  11801. Mean Square Error pixel-by-pixel average difference of the compared
  11802. frames, averaged over all the image components.
  11803. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11804. Mean Square Error pixel-by-pixel average difference of the compared
  11805. frames for the component specified by the suffix.
  11806. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11807. Peak Signal to Noise ratio of the compared frames for the component
  11808. specified by the suffix.
  11809. @item max_avg, max_y, max_u, max_v
  11810. Maximum allowed value for each channel, and average over all
  11811. channels.
  11812. @end table
  11813. @subsection Examples
  11814. @itemize
  11815. @item
  11816. For example:
  11817. @example
  11818. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11819. [main][ref] psnr="stats_file=stats.log" [out]
  11820. @end example
  11821. On this example the input file being processed is compared with the
  11822. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11823. is stored in @file{stats.log}.
  11824. @item
  11825. Another example with different containers:
  11826. @example
  11827. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11828. @end example
  11829. @end itemize
  11830. @anchor{pullup}
  11831. @section pullup
  11832. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11833. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11834. content.
  11835. The pullup filter is designed to take advantage of future context in making
  11836. its decisions. This filter is stateless in the sense that it does not lock
  11837. onto a pattern to follow, but it instead looks forward to the following
  11838. fields in order to identify matches and rebuild progressive frames.
  11839. To produce content with an even framerate, insert the fps filter after
  11840. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11841. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11842. The filter accepts the following options:
  11843. @table @option
  11844. @item jl
  11845. @item jr
  11846. @item jt
  11847. @item jb
  11848. These options set the amount of "junk" to ignore at the left, right, top, and
  11849. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11850. while top and bottom are in units of 2 lines.
  11851. The default is 8 pixels on each side.
  11852. @item sb
  11853. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11854. filter generating an occasional mismatched frame, but it may also cause an
  11855. excessive number of frames to be dropped during high motion sequences.
  11856. Conversely, setting it to -1 will make filter match fields more easily.
  11857. This may help processing of video where there is slight blurring between
  11858. the fields, but may also cause there to be interlaced frames in the output.
  11859. Default value is @code{0}.
  11860. @item mp
  11861. Set the metric plane to use. It accepts the following values:
  11862. @table @samp
  11863. @item l
  11864. Use luma plane.
  11865. @item u
  11866. Use chroma blue plane.
  11867. @item v
  11868. Use chroma red plane.
  11869. @end table
  11870. This option may be set to use chroma plane instead of the default luma plane
  11871. for doing filter's computations. This may improve accuracy on very clean
  11872. source material, but more likely will decrease accuracy, especially if there
  11873. is chroma noise (rainbow effect) or any grayscale video.
  11874. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11875. load and make pullup usable in realtime on slow machines.
  11876. @end table
  11877. For best results (without duplicated frames in the output file) it is
  11878. necessary to change the output frame rate. For example, to inverse
  11879. telecine NTSC input:
  11880. @example
  11881. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11882. @end example
  11883. @section qp
  11884. Change video quantization parameters (QP).
  11885. The filter accepts the following option:
  11886. @table @option
  11887. @item qp
  11888. Set expression for quantization parameter.
  11889. @end table
  11890. The expression is evaluated through the eval API and can contain, among others,
  11891. the following constants:
  11892. @table @var
  11893. @item known
  11894. 1 if index is not 129, 0 otherwise.
  11895. @item qp
  11896. Sequential index starting from -129 to 128.
  11897. @end table
  11898. @subsection Examples
  11899. @itemize
  11900. @item
  11901. Some equation like:
  11902. @example
  11903. qp=2+2*sin(PI*qp)
  11904. @end example
  11905. @end itemize
  11906. @section random
  11907. Flush video frames from internal cache of frames into a random order.
  11908. No frame is discarded.
  11909. Inspired by @ref{frei0r} nervous filter.
  11910. @table @option
  11911. @item frames
  11912. Set size in number of frames of internal cache, in range from @code{2} to
  11913. @code{512}. Default is @code{30}.
  11914. @item seed
  11915. Set seed for random number generator, must be an integer included between
  11916. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11917. less than @code{0}, the filter will try to use a good random seed on a
  11918. best effort basis.
  11919. @end table
  11920. @section readeia608
  11921. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11922. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11923. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11924. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11925. @table @option
  11926. @item lavfi.readeia608.X.cc
  11927. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11928. @item lavfi.readeia608.X.line
  11929. The number of the line on which the EIA-608 data was identified and read.
  11930. @end table
  11931. This filter accepts the following options:
  11932. @table @option
  11933. @item scan_min
  11934. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11935. @item scan_max
  11936. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11937. @item spw
  11938. Set the ratio of width reserved for sync code detection.
  11939. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11940. @item chp
  11941. Enable checking the parity bit. In the event of a parity error, the filter will output
  11942. @code{0x00} for that character. Default is false.
  11943. @item lp
  11944. Lowpass lines prior to further processing. Default is enabled.
  11945. @end table
  11946. @subsection Examples
  11947. @itemize
  11948. @item
  11949. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11950. @example
  11951. 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
  11952. @end example
  11953. @end itemize
  11954. @section readvitc
  11955. Read vertical interval timecode (VITC) information from the top lines of a
  11956. video frame.
  11957. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11958. timecode value, if a valid timecode has been detected. Further metadata key
  11959. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11960. timecode data has been found or not.
  11961. This filter accepts the following options:
  11962. @table @option
  11963. @item scan_max
  11964. Set the maximum number of lines to scan for VITC data. If the value is set to
  11965. @code{-1} the full video frame is scanned. Default is @code{45}.
  11966. @item thr_b
  11967. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11968. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11969. @item thr_w
  11970. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11971. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11972. @end table
  11973. @subsection Examples
  11974. @itemize
  11975. @item
  11976. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11977. draw @code{--:--:--:--} as a placeholder:
  11978. @example
  11979. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11980. @end example
  11981. @end itemize
  11982. @section remap
  11983. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11984. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11985. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11986. value for pixel will be used for destination pixel.
  11987. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11988. will have Xmap/Ymap video stream dimensions.
  11989. Xmap and Ymap input video streams are 16bit depth, single channel.
  11990. @table @option
  11991. @item format
  11992. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11993. Default is @code{color}.
  11994. @item fill
  11995. Specify the color of the unmapped pixels. For the syntax of this option,
  11996. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11997. manual,ffmpeg-utils}. Default color is @code{black}.
  11998. @end table
  11999. @section removegrain
  12000. The removegrain filter is a spatial denoiser for progressive video.
  12001. @table @option
  12002. @item m0
  12003. Set mode for the first plane.
  12004. @item m1
  12005. Set mode for the second plane.
  12006. @item m2
  12007. Set mode for the third plane.
  12008. @item m3
  12009. Set mode for the fourth plane.
  12010. @end table
  12011. Range of mode is from 0 to 24. Description of each mode follows:
  12012. @table @var
  12013. @item 0
  12014. Leave input plane unchanged. Default.
  12015. @item 1
  12016. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12017. @item 2
  12018. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12019. @item 3
  12020. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12021. @item 4
  12022. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12023. This is equivalent to a median filter.
  12024. @item 5
  12025. Line-sensitive clipping giving the minimal change.
  12026. @item 6
  12027. Line-sensitive clipping, intermediate.
  12028. @item 7
  12029. Line-sensitive clipping, intermediate.
  12030. @item 8
  12031. Line-sensitive clipping, intermediate.
  12032. @item 9
  12033. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12034. @item 10
  12035. Replaces the target pixel with the closest neighbour.
  12036. @item 11
  12037. [1 2 1] horizontal and vertical kernel blur.
  12038. @item 12
  12039. Same as mode 11.
  12040. @item 13
  12041. Bob mode, interpolates top field from the line where the neighbours
  12042. pixels are the closest.
  12043. @item 14
  12044. Bob mode, interpolates bottom field from the line where the neighbours
  12045. pixels are the closest.
  12046. @item 15
  12047. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12048. interpolation formula.
  12049. @item 16
  12050. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12051. interpolation formula.
  12052. @item 17
  12053. Clips the pixel with the minimum and maximum of respectively the maximum and
  12054. minimum of each pair of opposite neighbour pixels.
  12055. @item 18
  12056. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12057. the current pixel is minimal.
  12058. @item 19
  12059. Replaces the pixel with the average of its 8 neighbours.
  12060. @item 20
  12061. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12062. @item 21
  12063. Clips pixels using the averages of opposite neighbour.
  12064. @item 22
  12065. Same as mode 21 but simpler and faster.
  12066. @item 23
  12067. Small edge and halo removal, but reputed useless.
  12068. @item 24
  12069. Similar as 23.
  12070. @end table
  12071. @section removelogo
  12072. Suppress a TV station logo, using an image file to determine which
  12073. pixels comprise the logo. It works by filling in the pixels that
  12074. comprise the logo with neighboring pixels.
  12075. The filter accepts the following options:
  12076. @table @option
  12077. @item filename, f
  12078. Set the filter bitmap file, which can be any image format supported by
  12079. libavformat. The width and height of the image file must match those of the
  12080. video stream being processed.
  12081. @end table
  12082. Pixels in the provided bitmap image with a value of zero are not
  12083. considered part of the logo, non-zero pixels are considered part of
  12084. the logo. If you use white (255) for the logo and black (0) for the
  12085. rest, you will be safe. For making the filter bitmap, it is
  12086. recommended to take a screen capture of a black frame with the logo
  12087. visible, and then using a threshold filter followed by the erode
  12088. filter once or twice.
  12089. If needed, little splotches can be fixed manually. Remember that if
  12090. logo pixels are not covered, the filter quality will be much
  12091. reduced. Marking too many pixels as part of the logo does not hurt as
  12092. much, but it will increase the amount of blurring needed to cover over
  12093. the image and will destroy more information than necessary, and extra
  12094. pixels will slow things down on a large logo.
  12095. @section repeatfields
  12096. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12097. fields based on its value.
  12098. @section reverse
  12099. Reverse a video clip.
  12100. Warning: This filter requires memory to buffer the entire clip, so trimming
  12101. is suggested.
  12102. @subsection Examples
  12103. @itemize
  12104. @item
  12105. Take the first 5 seconds of a clip, and reverse it.
  12106. @example
  12107. trim=end=5,reverse
  12108. @end example
  12109. @end itemize
  12110. @section rgbashift
  12111. Shift R/G/B/A pixels horizontally and/or vertically.
  12112. The filter accepts the following options:
  12113. @table @option
  12114. @item rh
  12115. Set amount to shift red horizontally.
  12116. @item rv
  12117. Set amount to shift red vertically.
  12118. @item gh
  12119. Set amount to shift green horizontally.
  12120. @item gv
  12121. Set amount to shift green vertically.
  12122. @item bh
  12123. Set amount to shift blue horizontally.
  12124. @item bv
  12125. Set amount to shift blue vertically.
  12126. @item ah
  12127. Set amount to shift alpha horizontally.
  12128. @item av
  12129. Set amount to shift alpha vertically.
  12130. @item edge
  12131. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12132. @end table
  12133. @subsection Commands
  12134. This filter supports the all above options as @ref{commands}.
  12135. @section roberts
  12136. Apply roberts cross operator to input video stream.
  12137. The filter accepts the following option:
  12138. @table @option
  12139. @item planes
  12140. Set which planes will be processed, unprocessed planes will be copied.
  12141. By default value 0xf, all planes will be processed.
  12142. @item scale
  12143. Set value which will be multiplied with filtered result.
  12144. @item delta
  12145. Set value which will be added to filtered result.
  12146. @end table
  12147. @section rotate
  12148. Rotate video by an arbitrary angle expressed in radians.
  12149. The filter accepts the following options:
  12150. A description of the optional parameters follows.
  12151. @table @option
  12152. @item angle, a
  12153. Set an expression for the angle by which to rotate the input video
  12154. clockwise, expressed as a number of radians. A negative value will
  12155. result in a counter-clockwise rotation. By default it is set to "0".
  12156. This expression is evaluated for each frame.
  12157. @item out_w, ow
  12158. Set the output width expression, default value is "iw".
  12159. This expression is evaluated just once during configuration.
  12160. @item out_h, oh
  12161. Set the output height expression, default value is "ih".
  12162. This expression is evaluated just once during configuration.
  12163. @item bilinear
  12164. Enable bilinear interpolation if set to 1, a value of 0 disables
  12165. it. Default value is 1.
  12166. @item fillcolor, c
  12167. Set the color used to fill the output area not covered by the rotated
  12168. image. For the general syntax of this option, check the
  12169. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12170. If the special value "none" is selected then no
  12171. background is printed (useful for example if the background is never shown).
  12172. Default value is "black".
  12173. @end table
  12174. The expressions for the angle and the output size can contain the
  12175. following constants and functions:
  12176. @table @option
  12177. @item n
  12178. sequential number of the input frame, starting from 0. It is always NAN
  12179. before the first frame is filtered.
  12180. @item t
  12181. time in seconds of the input frame, it is set to 0 when the filter is
  12182. configured. It is always NAN before the first frame is filtered.
  12183. @item hsub
  12184. @item vsub
  12185. horizontal and vertical chroma subsample values. For example for the
  12186. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12187. @item in_w, iw
  12188. @item in_h, ih
  12189. the input video width and height
  12190. @item out_w, ow
  12191. @item out_h, oh
  12192. the output width and height, that is the size of the padded area as
  12193. specified by the @var{width} and @var{height} expressions
  12194. @item rotw(a)
  12195. @item roth(a)
  12196. the minimal width/height required for completely containing the input
  12197. video rotated by @var{a} radians.
  12198. These are only available when computing the @option{out_w} and
  12199. @option{out_h} expressions.
  12200. @end table
  12201. @subsection Examples
  12202. @itemize
  12203. @item
  12204. Rotate the input by PI/6 radians clockwise:
  12205. @example
  12206. rotate=PI/6
  12207. @end example
  12208. @item
  12209. Rotate the input by PI/6 radians counter-clockwise:
  12210. @example
  12211. rotate=-PI/6
  12212. @end example
  12213. @item
  12214. Rotate the input by 45 degrees clockwise:
  12215. @example
  12216. rotate=45*PI/180
  12217. @end example
  12218. @item
  12219. Apply a constant rotation with period T, starting from an angle of PI/3:
  12220. @example
  12221. rotate=PI/3+2*PI*t/T
  12222. @end example
  12223. @item
  12224. Make the input video rotation oscillating with a period of T
  12225. seconds and an amplitude of A radians:
  12226. @example
  12227. rotate=A*sin(2*PI/T*t)
  12228. @end example
  12229. @item
  12230. Rotate the video, output size is chosen so that the whole rotating
  12231. input video is always completely contained in the output:
  12232. @example
  12233. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12234. @end example
  12235. @item
  12236. Rotate the video, reduce the output size so that no background is ever
  12237. shown:
  12238. @example
  12239. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12240. @end example
  12241. @end itemize
  12242. @subsection Commands
  12243. The filter supports the following commands:
  12244. @table @option
  12245. @item a, angle
  12246. Set the angle expression.
  12247. The command accepts the same syntax of the corresponding option.
  12248. If the specified expression is not valid, it is kept at its current
  12249. value.
  12250. @end table
  12251. @section sab
  12252. Apply Shape Adaptive Blur.
  12253. The filter accepts the following options:
  12254. @table @option
  12255. @item luma_radius, lr
  12256. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12257. value is 1.0. A greater value will result in a more blurred image, and
  12258. in slower processing.
  12259. @item luma_pre_filter_radius, lpfr
  12260. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12261. value is 1.0.
  12262. @item luma_strength, ls
  12263. Set luma maximum difference between pixels to still be considered, must
  12264. be a value in the 0.1-100.0 range, default value is 1.0.
  12265. @item chroma_radius, cr
  12266. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12267. greater value will result in a more blurred image, and in slower
  12268. processing.
  12269. @item chroma_pre_filter_radius, cpfr
  12270. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12271. @item chroma_strength, cs
  12272. Set chroma maximum difference between pixels to still be considered,
  12273. must be a value in the -0.9-100.0 range.
  12274. @end table
  12275. Each chroma option value, if not explicitly specified, is set to the
  12276. corresponding luma option value.
  12277. @anchor{scale}
  12278. @section scale
  12279. Scale (resize) the input video, using the libswscale library.
  12280. The scale filter forces the output display aspect ratio to be the same
  12281. of the input, by changing the output sample aspect ratio.
  12282. If the input image format is different from the format requested by
  12283. the next filter, the scale filter will convert the input to the
  12284. requested format.
  12285. @subsection Options
  12286. The filter accepts the following options, or any of the options
  12287. supported by the libswscale scaler.
  12288. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12289. the complete list of scaler options.
  12290. @table @option
  12291. @item width, w
  12292. @item height, h
  12293. Set the output video dimension expression. Default value is the input
  12294. dimension.
  12295. If the @var{width} or @var{w} value is 0, the input width is used for
  12296. the output. If the @var{height} or @var{h} value is 0, the input height
  12297. is used for the output.
  12298. If one and only one of the values is -n with n >= 1, the scale filter
  12299. will use a value that maintains the aspect ratio of the input image,
  12300. calculated from the other specified dimension. After that it will,
  12301. however, make sure that the calculated dimension is divisible by n and
  12302. adjust the value if necessary.
  12303. If both values are -n with n >= 1, the behavior will be identical to
  12304. both values being set to 0 as previously detailed.
  12305. See below for the list of accepted constants for use in the dimension
  12306. expression.
  12307. @item eval
  12308. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12309. @table @samp
  12310. @item init
  12311. Only evaluate expressions once during the filter initialization or when a command is processed.
  12312. @item frame
  12313. Evaluate expressions for each incoming frame.
  12314. @end table
  12315. Default value is @samp{init}.
  12316. @item interl
  12317. Set the interlacing mode. It accepts the following values:
  12318. @table @samp
  12319. @item 1
  12320. Force interlaced aware scaling.
  12321. @item 0
  12322. Do not apply interlaced scaling.
  12323. @item -1
  12324. Select interlaced aware scaling depending on whether the source frames
  12325. are flagged as interlaced or not.
  12326. @end table
  12327. Default value is @samp{0}.
  12328. @item flags
  12329. Set libswscale scaling flags. See
  12330. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12331. complete list of values. If not explicitly specified the filter applies
  12332. the default flags.
  12333. @item param0, param1
  12334. Set libswscale input parameters for scaling algorithms that need them. See
  12335. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12336. complete documentation. If not explicitly specified the filter applies
  12337. empty parameters.
  12338. @item size, s
  12339. Set the video size. For the syntax of this option, check the
  12340. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12341. @item in_color_matrix
  12342. @item out_color_matrix
  12343. Set in/output YCbCr color space type.
  12344. This allows the autodetected value to be overridden as well as allows forcing
  12345. a specific value used for the output and encoder.
  12346. If not specified, the color space type depends on the pixel format.
  12347. Possible values:
  12348. @table @samp
  12349. @item auto
  12350. Choose automatically.
  12351. @item bt709
  12352. Format conforming to International Telecommunication Union (ITU)
  12353. Recommendation BT.709.
  12354. @item fcc
  12355. Set color space conforming to the United States Federal Communications
  12356. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12357. @item bt601
  12358. @item bt470
  12359. @item smpte170m
  12360. Set color space conforming to:
  12361. @itemize
  12362. @item
  12363. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12364. @item
  12365. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12366. @item
  12367. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12368. @end itemize
  12369. @item smpte240m
  12370. Set color space conforming to SMPTE ST 240:1999.
  12371. @item bt2020
  12372. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12373. @end table
  12374. @item in_range
  12375. @item out_range
  12376. Set in/output YCbCr sample range.
  12377. This allows the autodetected value to be overridden as well as allows forcing
  12378. a specific value used for the output and encoder. If not specified, the
  12379. range depends on the pixel format. Possible values:
  12380. @table @samp
  12381. @item auto/unknown
  12382. Choose automatically.
  12383. @item jpeg/full/pc
  12384. Set full range (0-255 in case of 8-bit luma).
  12385. @item mpeg/limited/tv
  12386. Set "MPEG" range (16-235 in case of 8-bit luma).
  12387. @end table
  12388. @item force_original_aspect_ratio
  12389. Enable decreasing or increasing output video width or height if necessary to
  12390. keep the original aspect ratio. Possible values:
  12391. @table @samp
  12392. @item disable
  12393. Scale the video as specified and disable this feature.
  12394. @item decrease
  12395. The output video dimensions will automatically be decreased if needed.
  12396. @item increase
  12397. The output video dimensions will automatically be increased if needed.
  12398. @end table
  12399. One useful instance of this option is that when you know a specific device's
  12400. maximum allowed resolution, you can use this to limit the output video to
  12401. that, while retaining the aspect ratio. For example, device A allows
  12402. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12403. decrease) and specifying 1280x720 to the command line makes the output
  12404. 1280x533.
  12405. Please note that this is a different thing than specifying -1 for @option{w}
  12406. or @option{h}, you still need to specify the output resolution for this option
  12407. to work.
  12408. @item force_divisible_by
  12409. Ensures that both the output dimensions, width and height, are divisible by the
  12410. given integer when used together with @option{force_original_aspect_ratio}. This
  12411. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12412. This option respects the value set for @option{force_original_aspect_ratio},
  12413. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12414. may be slightly modified.
  12415. This option can be handy if you need to have a video fit within or exceed
  12416. a defined resolution using @option{force_original_aspect_ratio} but also have
  12417. encoder restrictions on width or height divisibility.
  12418. @end table
  12419. The values of the @option{w} and @option{h} options are expressions
  12420. containing the following constants:
  12421. @table @var
  12422. @item in_w
  12423. @item in_h
  12424. The input width and height
  12425. @item iw
  12426. @item ih
  12427. These are the same as @var{in_w} and @var{in_h}.
  12428. @item out_w
  12429. @item out_h
  12430. The output (scaled) width and height
  12431. @item ow
  12432. @item oh
  12433. These are the same as @var{out_w} and @var{out_h}
  12434. @item a
  12435. The same as @var{iw} / @var{ih}
  12436. @item sar
  12437. input sample aspect ratio
  12438. @item dar
  12439. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12440. @item hsub
  12441. @item vsub
  12442. horizontal and vertical input chroma subsample values. For example for the
  12443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12444. @item ohsub
  12445. @item ovsub
  12446. horizontal and vertical output chroma subsample values. For example for the
  12447. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12448. @item n
  12449. The (sequential) number of the input frame, starting from 0.
  12450. Only available with @code{eval=frame}.
  12451. @item t
  12452. The presentation timestamp of the input frame, expressed as a number of
  12453. seconds. Only available with @code{eval=frame}.
  12454. @item pos
  12455. The position (byte offset) of the frame in the input stream, or NaN if
  12456. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12457. Only available with @code{eval=frame}.
  12458. @end table
  12459. @subsection Examples
  12460. @itemize
  12461. @item
  12462. Scale the input video to a size of 200x100
  12463. @example
  12464. scale=w=200:h=100
  12465. @end example
  12466. This is equivalent to:
  12467. @example
  12468. scale=200:100
  12469. @end example
  12470. or:
  12471. @example
  12472. scale=200x100
  12473. @end example
  12474. @item
  12475. Specify a size abbreviation for the output size:
  12476. @example
  12477. scale=qcif
  12478. @end example
  12479. which can also be written as:
  12480. @example
  12481. scale=size=qcif
  12482. @end example
  12483. @item
  12484. Scale the input to 2x:
  12485. @example
  12486. scale=w=2*iw:h=2*ih
  12487. @end example
  12488. @item
  12489. The above is the same as:
  12490. @example
  12491. scale=2*in_w:2*in_h
  12492. @end example
  12493. @item
  12494. Scale the input to 2x with forced interlaced scaling:
  12495. @example
  12496. scale=2*iw:2*ih:interl=1
  12497. @end example
  12498. @item
  12499. Scale the input to half size:
  12500. @example
  12501. scale=w=iw/2:h=ih/2
  12502. @end example
  12503. @item
  12504. Increase the width, and set the height to the same size:
  12505. @example
  12506. scale=3/2*iw:ow
  12507. @end example
  12508. @item
  12509. Seek Greek harmony:
  12510. @example
  12511. scale=iw:1/PHI*iw
  12512. scale=ih*PHI:ih
  12513. @end example
  12514. @item
  12515. Increase the height, and set the width to 3/2 of the height:
  12516. @example
  12517. scale=w=3/2*oh:h=3/5*ih
  12518. @end example
  12519. @item
  12520. Increase the size, making the size a multiple of the chroma
  12521. subsample values:
  12522. @example
  12523. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12524. @end example
  12525. @item
  12526. Increase the width to a maximum of 500 pixels,
  12527. keeping the same aspect ratio as the input:
  12528. @example
  12529. scale=w='min(500\, iw*3/2):h=-1'
  12530. @end example
  12531. @item
  12532. Make pixels square by combining scale and setsar:
  12533. @example
  12534. scale='trunc(ih*dar):ih',setsar=1/1
  12535. @end example
  12536. @item
  12537. Make pixels square by combining scale and setsar,
  12538. making sure the resulting resolution is even (required by some codecs):
  12539. @example
  12540. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12541. @end example
  12542. @end itemize
  12543. @subsection Commands
  12544. This filter supports the following commands:
  12545. @table @option
  12546. @item width, w
  12547. @item height, h
  12548. Set the output video dimension expression.
  12549. The command accepts the same syntax of the corresponding option.
  12550. If the specified expression is not valid, it is kept at its current
  12551. value.
  12552. @end table
  12553. @section scale_npp
  12554. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12555. format conversion on CUDA video frames. Setting the output width and height
  12556. works in the same way as for the @var{scale} filter.
  12557. The following additional options are accepted:
  12558. @table @option
  12559. @item format
  12560. The pixel format of the output CUDA frames. If set to the string "same" (the
  12561. default), the input format will be kept. Note that automatic format negotiation
  12562. and conversion is not yet supported for hardware frames
  12563. @item interp_algo
  12564. The interpolation algorithm used for resizing. One of the following:
  12565. @table @option
  12566. @item nn
  12567. Nearest neighbour.
  12568. @item linear
  12569. @item cubic
  12570. @item cubic2p_bspline
  12571. 2-parameter cubic (B=1, C=0)
  12572. @item cubic2p_catmullrom
  12573. 2-parameter cubic (B=0, C=1/2)
  12574. @item cubic2p_b05c03
  12575. 2-parameter cubic (B=1/2, C=3/10)
  12576. @item super
  12577. Supersampling
  12578. @item lanczos
  12579. @end table
  12580. @item force_original_aspect_ratio
  12581. Enable decreasing or increasing output video width or height if necessary to
  12582. keep the original aspect ratio. Possible values:
  12583. @table @samp
  12584. @item disable
  12585. Scale the video as specified and disable this feature.
  12586. @item decrease
  12587. The output video dimensions will automatically be decreased if needed.
  12588. @item increase
  12589. The output video dimensions will automatically be increased if needed.
  12590. @end table
  12591. One useful instance of this option is that when you know a specific device's
  12592. maximum allowed resolution, you can use this to limit the output video to
  12593. that, while retaining the aspect ratio. For example, device A allows
  12594. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12595. decrease) and specifying 1280x720 to the command line makes the output
  12596. 1280x533.
  12597. Please note that this is a different thing than specifying -1 for @option{w}
  12598. or @option{h}, you still need to specify the output resolution for this option
  12599. to work.
  12600. @item force_divisible_by
  12601. Ensures that both the output dimensions, width and height, are divisible by the
  12602. given integer when used together with @option{force_original_aspect_ratio}. This
  12603. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12604. This option respects the value set for @option{force_original_aspect_ratio},
  12605. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12606. may be slightly modified.
  12607. This option can be handy if you need to have a video fit within or exceed
  12608. a defined resolution using @option{force_original_aspect_ratio} but also have
  12609. encoder restrictions on width or height divisibility.
  12610. @end table
  12611. @section scale2ref
  12612. Scale (resize) the input video, based on a reference video.
  12613. See the scale filter for available options, scale2ref supports the same but
  12614. uses the reference video instead of the main input as basis. scale2ref also
  12615. supports the following additional constants for the @option{w} and
  12616. @option{h} options:
  12617. @table @var
  12618. @item main_w
  12619. @item main_h
  12620. The main input video's width and height
  12621. @item main_a
  12622. The same as @var{main_w} / @var{main_h}
  12623. @item main_sar
  12624. The main input video's sample aspect ratio
  12625. @item main_dar, mdar
  12626. The main input video's display aspect ratio. Calculated from
  12627. @code{(main_w / main_h) * main_sar}.
  12628. @item main_hsub
  12629. @item main_vsub
  12630. The main input video's horizontal and vertical chroma subsample values.
  12631. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12632. is 1.
  12633. @item main_n
  12634. The (sequential) number of the main input frame, starting from 0.
  12635. Only available with @code{eval=frame}.
  12636. @item main_t
  12637. The presentation timestamp of the main input frame, expressed as a number of
  12638. seconds. Only available with @code{eval=frame}.
  12639. @item main_pos
  12640. The position (byte offset) of the frame in the main input stream, or NaN if
  12641. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12642. Only available with @code{eval=frame}.
  12643. @end table
  12644. @subsection Examples
  12645. @itemize
  12646. @item
  12647. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12648. @example
  12649. 'scale2ref[b][a];[a][b]overlay'
  12650. @end example
  12651. @item
  12652. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12653. @example
  12654. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12655. @end example
  12656. @end itemize
  12657. @subsection Commands
  12658. This filter supports the following commands:
  12659. @table @option
  12660. @item width, w
  12661. @item height, h
  12662. Set the output video dimension expression.
  12663. The command accepts the same syntax of the corresponding option.
  12664. If the specified expression is not valid, it is kept at its current
  12665. value.
  12666. @end table
  12667. @section scroll
  12668. Scroll input video horizontally and/or vertically by constant speed.
  12669. The filter accepts the following options:
  12670. @table @option
  12671. @item horizontal, h
  12672. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12673. Negative values changes scrolling direction.
  12674. @item vertical, v
  12675. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12676. Negative values changes scrolling direction.
  12677. @item hpos
  12678. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12679. @item vpos
  12680. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12681. @end table
  12682. @subsection Commands
  12683. This filter supports the following @ref{commands}:
  12684. @table @option
  12685. @item horizontal, h
  12686. Set the horizontal scrolling speed.
  12687. @item vertical, v
  12688. Set the vertical scrolling speed.
  12689. @end table
  12690. @anchor{scdet}
  12691. @section scdet
  12692. Detect video scene change.
  12693. This filter sets frame metadata with mafd between frame, the scene score, and
  12694. forward the frame to the next filter, so they can use these metadata to detect
  12695. scene change or others.
  12696. In addition, this filter logs a message and sets frame metadata when it detects
  12697. a scene change by @option{threshold}.
  12698. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12699. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12700. to detect scene change.
  12701. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12702. detect scene change with @option{threshold}.
  12703. The filter accepts the following options:
  12704. @table @option
  12705. @item threshold, t
  12706. Set the scene change detection threshold as a percentage of maximum change. Good
  12707. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12708. @code{[0., 100.]}.
  12709. Default value is @code{10.}.
  12710. @item sc_pass, s
  12711. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12712. You can enable it if you want to get snapshot of scene change frames only.
  12713. @end table
  12714. @anchor{selectivecolor}
  12715. @section selectivecolor
  12716. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12717. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12718. by the "purity" of the color (that is, how saturated it already is).
  12719. This filter is similar to the Adobe Photoshop Selective Color tool.
  12720. The filter accepts the following options:
  12721. @table @option
  12722. @item correction_method
  12723. Select color correction method.
  12724. Available values are:
  12725. @table @samp
  12726. @item absolute
  12727. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12728. component value).
  12729. @item relative
  12730. Specified adjustments are relative to the original component value.
  12731. @end table
  12732. Default is @code{absolute}.
  12733. @item reds
  12734. Adjustments for red pixels (pixels where the red component is the maximum)
  12735. @item yellows
  12736. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12737. @item greens
  12738. Adjustments for green pixels (pixels where the green component is the maximum)
  12739. @item cyans
  12740. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12741. @item blues
  12742. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12743. @item magentas
  12744. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12745. @item whites
  12746. Adjustments for white pixels (pixels where all components are greater than 128)
  12747. @item neutrals
  12748. Adjustments for all pixels except pure black and pure white
  12749. @item blacks
  12750. Adjustments for black pixels (pixels where all components are lesser than 128)
  12751. @item psfile
  12752. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12753. @end table
  12754. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12755. 4 space separated floating point adjustment values in the [-1,1] range,
  12756. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12757. pixels of its range.
  12758. @subsection Examples
  12759. @itemize
  12760. @item
  12761. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12762. increase magenta by 27% in blue areas:
  12763. @example
  12764. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12765. @end example
  12766. @item
  12767. Use a Photoshop selective color preset:
  12768. @example
  12769. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12770. @end example
  12771. @end itemize
  12772. @anchor{separatefields}
  12773. @section separatefields
  12774. The @code{separatefields} takes a frame-based video input and splits
  12775. each frame into its components fields, producing a new half height clip
  12776. with twice the frame rate and twice the frame count.
  12777. This filter use field-dominance information in frame to decide which
  12778. of each pair of fields to place first in the output.
  12779. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12780. @section setdar, setsar
  12781. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12782. output video.
  12783. This is done by changing the specified Sample (aka Pixel) Aspect
  12784. Ratio, according to the following equation:
  12785. @example
  12786. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12787. @end example
  12788. Keep in mind that the @code{setdar} filter does not modify the pixel
  12789. dimensions of the video frame. Also, the display aspect ratio set by
  12790. this filter may be changed by later filters in the filterchain,
  12791. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12792. applied.
  12793. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12794. the filter output video.
  12795. Note that as a consequence of the application of this filter, the
  12796. output display aspect ratio will change according to the equation
  12797. above.
  12798. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12799. filter may be changed by later filters in the filterchain, e.g. if
  12800. another "setsar" or a "setdar" filter is applied.
  12801. It accepts the following parameters:
  12802. @table @option
  12803. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12804. Set the aspect ratio used by the filter.
  12805. The parameter can be a floating point number string, an expression, or
  12806. a string of the form @var{num}:@var{den}, where @var{num} and
  12807. @var{den} are the numerator and denominator of the aspect ratio. If
  12808. the parameter is not specified, it is assumed the value "0".
  12809. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12810. should be escaped.
  12811. @item max
  12812. Set the maximum integer value to use for expressing numerator and
  12813. denominator when reducing the expressed aspect ratio to a rational.
  12814. Default value is @code{100}.
  12815. @end table
  12816. The parameter @var{sar} is an expression containing
  12817. the following constants:
  12818. @table @option
  12819. @item E, PI, PHI
  12820. These are approximated values for the mathematical constants e
  12821. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12822. @item w, h
  12823. The input width and height.
  12824. @item a
  12825. These are the same as @var{w} / @var{h}.
  12826. @item sar
  12827. The input sample aspect ratio.
  12828. @item dar
  12829. The input display aspect ratio. It is the same as
  12830. (@var{w} / @var{h}) * @var{sar}.
  12831. @item hsub, vsub
  12832. Horizontal and vertical chroma subsample values. For example, for the
  12833. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12834. @end table
  12835. @subsection Examples
  12836. @itemize
  12837. @item
  12838. To change the display aspect ratio to 16:9, specify one of the following:
  12839. @example
  12840. setdar=dar=1.77777
  12841. setdar=dar=16/9
  12842. @end example
  12843. @item
  12844. To change the sample aspect ratio to 10:11, specify:
  12845. @example
  12846. setsar=sar=10/11
  12847. @end example
  12848. @item
  12849. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12850. 1000 in the aspect ratio reduction, use the command:
  12851. @example
  12852. setdar=ratio=16/9:max=1000
  12853. @end example
  12854. @end itemize
  12855. @anchor{setfield}
  12856. @section setfield
  12857. Force field for the output video frame.
  12858. The @code{setfield} filter marks the interlace type field for the
  12859. output frames. It does not change the input frame, but only sets the
  12860. corresponding property, which affects how the frame is treated by
  12861. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12862. The filter accepts the following options:
  12863. @table @option
  12864. @item mode
  12865. Available values are:
  12866. @table @samp
  12867. @item auto
  12868. Keep the same field property.
  12869. @item bff
  12870. Mark the frame as bottom-field-first.
  12871. @item tff
  12872. Mark the frame as top-field-first.
  12873. @item prog
  12874. Mark the frame as progressive.
  12875. @end table
  12876. @end table
  12877. @anchor{setparams}
  12878. @section setparams
  12879. Force frame parameter for the output video frame.
  12880. The @code{setparams} filter marks interlace and color range for the
  12881. output frames. It does not change the input frame, but only sets the
  12882. corresponding property, which affects how the frame is treated by
  12883. filters/encoders.
  12884. @table @option
  12885. @item field_mode
  12886. Available values are:
  12887. @table @samp
  12888. @item auto
  12889. Keep the same field property (default).
  12890. @item bff
  12891. Mark the frame as bottom-field-first.
  12892. @item tff
  12893. Mark the frame as top-field-first.
  12894. @item prog
  12895. Mark the frame as progressive.
  12896. @end table
  12897. @item range
  12898. Available values are:
  12899. @table @samp
  12900. @item auto
  12901. Keep the same color range property (default).
  12902. @item unspecified, unknown
  12903. Mark the frame as unspecified color range.
  12904. @item limited, tv, mpeg
  12905. Mark the frame as limited range.
  12906. @item full, pc, jpeg
  12907. Mark the frame as full range.
  12908. @end table
  12909. @item color_primaries
  12910. Set the color primaries.
  12911. Available values are:
  12912. @table @samp
  12913. @item auto
  12914. Keep the same color primaries property (default).
  12915. @item bt709
  12916. @item unknown
  12917. @item bt470m
  12918. @item bt470bg
  12919. @item smpte170m
  12920. @item smpte240m
  12921. @item film
  12922. @item bt2020
  12923. @item smpte428
  12924. @item smpte431
  12925. @item smpte432
  12926. @item jedec-p22
  12927. @end table
  12928. @item color_trc
  12929. Set the color transfer.
  12930. Available values are:
  12931. @table @samp
  12932. @item auto
  12933. Keep the same color trc property (default).
  12934. @item bt709
  12935. @item unknown
  12936. @item bt470m
  12937. @item bt470bg
  12938. @item smpte170m
  12939. @item smpte240m
  12940. @item linear
  12941. @item log100
  12942. @item log316
  12943. @item iec61966-2-4
  12944. @item bt1361e
  12945. @item iec61966-2-1
  12946. @item bt2020-10
  12947. @item bt2020-12
  12948. @item smpte2084
  12949. @item smpte428
  12950. @item arib-std-b67
  12951. @end table
  12952. @item colorspace
  12953. Set the colorspace.
  12954. Available values are:
  12955. @table @samp
  12956. @item auto
  12957. Keep the same colorspace property (default).
  12958. @item gbr
  12959. @item bt709
  12960. @item unknown
  12961. @item fcc
  12962. @item bt470bg
  12963. @item smpte170m
  12964. @item smpte240m
  12965. @item ycgco
  12966. @item bt2020nc
  12967. @item bt2020c
  12968. @item smpte2085
  12969. @item chroma-derived-nc
  12970. @item chroma-derived-c
  12971. @item ictcp
  12972. @end table
  12973. @end table
  12974. @section showinfo
  12975. Show a line containing various information for each input video frame.
  12976. The input video is not modified.
  12977. This filter supports the following options:
  12978. @table @option
  12979. @item checksum
  12980. Calculate checksums of each plane. By default enabled.
  12981. @end table
  12982. The shown line contains a sequence of key/value pairs of the form
  12983. @var{key}:@var{value}.
  12984. The following values are shown in the output:
  12985. @table @option
  12986. @item n
  12987. The (sequential) number of the input frame, starting from 0.
  12988. @item pts
  12989. The Presentation TimeStamp of the input frame, expressed as a number of
  12990. time base units. The time base unit depends on the filter input pad.
  12991. @item pts_time
  12992. The Presentation TimeStamp of the input frame, expressed as a number of
  12993. seconds.
  12994. @item pos
  12995. The position of the frame in the input stream, or -1 if this information is
  12996. unavailable and/or meaningless (for example in case of synthetic video).
  12997. @item fmt
  12998. The pixel format name.
  12999. @item sar
  13000. The sample aspect ratio of the input frame, expressed in the form
  13001. @var{num}/@var{den}.
  13002. @item s
  13003. The size of the input frame. For the syntax of this option, check the
  13004. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13005. @item i
  13006. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13007. for bottom field first).
  13008. @item iskey
  13009. This is 1 if the frame is a key frame, 0 otherwise.
  13010. @item type
  13011. The picture type of the input frame ("I" for an I-frame, "P" for a
  13012. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13013. Also refer to the documentation of the @code{AVPictureType} enum and of
  13014. the @code{av_get_picture_type_char} function defined in
  13015. @file{libavutil/avutil.h}.
  13016. @item checksum
  13017. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13018. @item plane_checksum
  13019. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13020. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13021. @item mean
  13022. The mean value of pixels in each plane of the input frame, expressed in the form
  13023. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13024. @item stdev
  13025. The standard deviation of pixel values in each plane of the input frame, expressed
  13026. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13027. @end table
  13028. @section showpalette
  13029. Displays the 256 colors palette of each frame. This filter is only relevant for
  13030. @var{pal8} pixel format frames.
  13031. It accepts the following option:
  13032. @table @option
  13033. @item s
  13034. Set the size of the box used to represent one palette color entry. Default is
  13035. @code{30} (for a @code{30x30} pixel box).
  13036. @end table
  13037. @section shuffleframes
  13038. Reorder and/or duplicate and/or drop video frames.
  13039. It accepts the following parameters:
  13040. @table @option
  13041. @item mapping
  13042. Set the destination indexes of input frames.
  13043. This is space or '|' separated list of indexes that maps input frames to output
  13044. frames. Number of indexes also sets maximal value that each index may have.
  13045. '-1' index have special meaning and that is to drop frame.
  13046. @end table
  13047. The first frame has the index 0. The default is to keep the input unchanged.
  13048. @subsection Examples
  13049. @itemize
  13050. @item
  13051. Swap second and third frame of every three frames of the input:
  13052. @example
  13053. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13054. @end example
  13055. @item
  13056. Swap 10th and 1st frame of every ten frames of the input:
  13057. @example
  13058. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13059. @end example
  13060. @end itemize
  13061. @section shuffleplanes
  13062. Reorder and/or duplicate video planes.
  13063. It accepts the following parameters:
  13064. @table @option
  13065. @item map0
  13066. The index of the input plane to be used as the first output plane.
  13067. @item map1
  13068. The index of the input plane to be used as the second output plane.
  13069. @item map2
  13070. The index of the input plane to be used as the third output plane.
  13071. @item map3
  13072. The index of the input plane to be used as the fourth output plane.
  13073. @end table
  13074. The first plane has the index 0. The default is to keep the input unchanged.
  13075. @subsection Examples
  13076. @itemize
  13077. @item
  13078. Swap the second and third planes of the input:
  13079. @example
  13080. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13081. @end example
  13082. @end itemize
  13083. @anchor{signalstats}
  13084. @section signalstats
  13085. Evaluate various visual metrics that assist in determining issues associated
  13086. with the digitization of analog video media.
  13087. By default the filter will log these metadata values:
  13088. @table @option
  13089. @item YMIN
  13090. Display the minimal Y value contained within the input frame. Expressed in
  13091. range of [0-255].
  13092. @item YLOW
  13093. Display the Y value at the 10% percentile within the input frame. Expressed in
  13094. range of [0-255].
  13095. @item YAVG
  13096. Display the average Y value within the input frame. Expressed in range of
  13097. [0-255].
  13098. @item YHIGH
  13099. Display the Y value at the 90% percentile within the input frame. Expressed in
  13100. range of [0-255].
  13101. @item YMAX
  13102. Display the maximum Y value contained within the input frame. Expressed in
  13103. range of [0-255].
  13104. @item UMIN
  13105. Display the minimal U value contained within the input frame. Expressed in
  13106. range of [0-255].
  13107. @item ULOW
  13108. Display the U value at the 10% percentile within the input frame. Expressed in
  13109. range of [0-255].
  13110. @item UAVG
  13111. Display the average U value within the input frame. Expressed in range of
  13112. [0-255].
  13113. @item UHIGH
  13114. Display the U value at the 90% percentile within the input frame. Expressed in
  13115. range of [0-255].
  13116. @item UMAX
  13117. Display the maximum U value contained within the input frame. Expressed in
  13118. range of [0-255].
  13119. @item VMIN
  13120. Display the minimal V value contained within the input frame. Expressed in
  13121. range of [0-255].
  13122. @item VLOW
  13123. Display the V value at the 10% percentile within the input frame. Expressed in
  13124. range of [0-255].
  13125. @item VAVG
  13126. Display the average V value within the input frame. Expressed in range of
  13127. [0-255].
  13128. @item VHIGH
  13129. Display the V value at the 90% percentile within the input frame. Expressed in
  13130. range of [0-255].
  13131. @item VMAX
  13132. Display the maximum V value contained within the input frame. Expressed in
  13133. range of [0-255].
  13134. @item SATMIN
  13135. Display the minimal saturation value contained within the input frame.
  13136. Expressed in range of [0-~181.02].
  13137. @item SATLOW
  13138. Display the saturation value at the 10% percentile within the input frame.
  13139. Expressed in range of [0-~181.02].
  13140. @item SATAVG
  13141. Display the average saturation value within the input frame. Expressed in range
  13142. of [0-~181.02].
  13143. @item SATHIGH
  13144. Display the saturation value at the 90% percentile within the input frame.
  13145. Expressed in range of [0-~181.02].
  13146. @item SATMAX
  13147. Display the maximum saturation value contained within the input frame.
  13148. Expressed in range of [0-~181.02].
  13149. @item HUEMED
  13150. Display the median value for hue within the input frame. Expressed in range of
  13151. [0-360].
  13152. @item HUEAVG
  13153. Display the average value for hue within the input frame. Expressed in range of
  13154. [0-360].
  13155. @item YDIF
  13156. Display the average of sample value difference between all values of the Y
  13157. plane in the current frame and corresponding values of the previous input frame.
  13158. Expressed in range of [0-255].
  13159. @item UDIF
  13160. Display the average of sample value difference between all values of the U
  13161. plane in the current frame and corresponding values of the previous input frame.
  13162. Expressed in range of [0-255].
  13163. @item VDIF
  13164. Display the average of sample value difference between all values of the V
  13165. plane in the current frame and corresponding values of the previous input frame.
  13166. Expressed in range of [0-255].
  13167. @item YBITDEPTH
  13168. Display bit depth of Y plane in current frame.
  13169. Expressed in range of [0-16].
  13170. @item UBITDEPTH
  13171. Display bit depth of U plane in current frame.
  13172. Expressed in range of [0-16].
  13173. @item VBITDEPTH
  13174. Display bit depth of V plane in current frame.
  13175. Expressed in range of [0-16].
  13176. @end table
  13177. The filter accepts the following options:
  13178. @table @option
  13179. @item stat
  13180. @item out
  13181. @option{stat} specify an additional form of image analysis.
  13182. @option{out} output video with the specified type of pixel highlighted.
  13183. Both options accept the following values:
  13184. @table @samp
  13185. @item tout
  13186. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13187. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13188. include the results of video dropouts, head clogs, or tape tracking issues.
  13189. @item vrep
  13190. Identify @var{vertical line repetition}. Vertical line repetition includes
  13191. similar rows of pixels within a frame. In born-digital video vertical line
  13192. repetition is common, but this pattern is uncommon in video digitized from an
  13193. analog source. When it occurs in video that results from the digitization of an
  13194. analog source it can indicate concealment from a dropout compensator.
  13195. @item brng
  13196. Identify pixels that fall outside of legal broadcast range.
  13197. @end table
  13198. @item color, c
  13199. Set the highlight color for the @option{out} option. The default color is
  13200. yellow.
  13201. @end table
  13202. @subsection Examples
  13203. @itemize
  13204. @item
  13205. Output data of various video metrics:
  13206. @example
  13207. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13208. @end example
  13209. @item
  13210. Output specific data about the minimum and maximum values of the Y plane per frame:
  13211. @example
  13212. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13213. @end example
  13214. @item
  13215. Playback video while highlighting pixels that are outside of broadcast range in red.
  13216. @example
  13217. ffplay example.mov -vf signalstats="out=brng:color=red"
  13218. @end example
  13219. @item
  13220. Playback video with signalstats metadata drawn over the frame.
  13221. @example
  13222. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13223. @end example
  13224. The contents of signalstat_drawtext.txt used in the command are:
  13225. @example
  13226. time %@{pts:hms@}
  13227. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13228. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13229. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13230. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13231. @end example
  13232. @end itemize
  13233. @anchor{signature}
  13234. @section signature
  13235. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13236. input. In this case the matching between the inputs can be calculated additionally.
  13237. The filter always passes through the first input. The signature of each stream can
  13238. be written into a file.
  13239. It accepts the following options:
  13240. @table @option
  13241. @item detectmode
  13242. Enable or disable the matching process.
  13243. Available values are:
  13244. @table @samp
  13245. @item off
  13246. Disable the calculation of a matching (default).
  13247. @item full
  13248. Calculate the matching for the whole video and output whether the whole video
  13249. matches or only parts.
  13250. @item fast
  13251. Calculate only until a matching is found or the video ends. Should be faster in
  13252. some cases.
  13253. @end table
  13254. @item nb_inputs
  13255. Set the number of inputs. The option value must be a non negative integer.
  13256. Default value is 1.
  13257. @item filename
  13258. Set the path to which the output is written. If there is more than one input,
  13259. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13260. integer), that will be replaced with the input number. If no filename is
  13261. specified, no output will be written. This is the default.
  13262. @item format
  13263. Choose the output format.
  13264. Available values are:
  13265. @table @samp
  13266. @item binary
  13267. Use the specified binary representation (default).
  13268. @item xml
  13269. Use the specified xml representation.
  13270. @end table
  13271. @item th_d
  13272. Set threshold to detect one word as similar. The option value must be an integer
  13273. greater than zero. The default value is 9000.
  13274. @item th_dc
  13275. Set threshold to detect all words as similar. The option value must be an integer
  13276. greater than zero. The default value is 60000.
  13277. @item th_xh
  13278. Set threshold to detect frames as similar. The option value must be an integer
  13279. greater than zero. The default value is 116.
  13280. @item th_di
  13281. Set the minimum length of a sequence in frames to recognize it as matching
  13282. sequence. The option value must be a non negative integer value.
  13283. The default value is 0.
  13284. @item th_it
  13285. Set the minimum relation, that matching frames to all frames must have.
  13286. The option value must be a double value between 0 and 1. The default value is 0.5.
  13287. @end table
  13288. @subsection Examples
  13289. @itemize
  13290. @item
  13291. To calculate the signature of an input video and store it in signature.bin:
  13292. @example
  13293. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13294. @end example
  13295. @item
  13296. To detect whether two videos match and store the signatures in XML format in
  13297. signature0.xml and signature1.xml:
  13298. @example
  13299. 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 -
  13300. @end example
  13301. @end itemize
  13302. @anchor{smartblur}
  13303. @section smartblur
  13304. Blur the input video without impacting the outlines.
  13305. It accepts the following options:
  13306. @table @option
  13307. @item luma_radius, lr
  13308. Set the luma radius. The option value must be a float number in
  13309. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13310. used to blur the image (slower if larger). Default value is 1.0.
  13311. @item luma_strength, ls
  13312. Set the luma strength. The option value must be a float number
  13313. in the range [-1.0,1.0] that configures the blurring. A value included
  13314. in [0.0,1.0] will blur the image whereas a value included in
  13315. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13316. @item luma_threshold, lt
  13317. Set the luma threshold used as a coefficient to determine
  13318. whether a pixel should be blurred or not. The option value must be an
  13319. integer in the range [-30,30]. A value of 0 will filter all the image,
  13320. a value included in [0,30] will filter flat areas and a value included
  13321. in [-30,0] will filter edges. Default value is 0.
  13322. @item chroma_radius, cr
  13323. Set the chroma radius. The option value must be a float number in
  13324. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13325. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13326. @item chroma_strength, cs
  13327. Set the chroma strength. The option value must be a float number
  13328. in the range [-1.0,1.0] that configures the blurring. A value included
  13329. in [0.0,1.0] will blur the image whereas a value included in
  13330. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13331. @item chroma_threshold, ct
  13332. Set the chroma threshold used as a coefficient to determine
  13333. whether a pixel should be blurred or not. The option value must be an
  13334. integer in the range [-30,30]. A value of 0 will filter all the image,
  13335. a value included in [0,30] will filter flat areas and a value included
  13336. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13337. @end table
  13338. If a chroma option is not explicitly set, the corresponding luma value
  13339. is set.
  13340. @section sobel
  13341. Apply sobel operator to input video stream.
  13342. The filter accepts the following option:
  13343. @table @option
  13344. @item planes
  13345. Set which planes will be processed, unprocessed planes will be copied.
  13346. By default value 0xf, all planes will be processed.
  13347. @item scale
  13348. Set value which will be multiplied with filtered result.
  13349. @item delta
  13350. Set value which will be added to filtered result.
  13351. @end table
  13352. @anchor{spp}
  13353. @section spp
  13354. Apply a simple postprocessing filter that compresses and decompresses the image
  13355. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13356. and average the results.
  13357. The filter accepts the following options:
  13358. @table @option
  13359. @item quality
  13360. Set quality. This option defines the number of levels for averaging. It accepts
  13361. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13362. effect. A value of @code{6} means the higher quality. For each increment of
  13363. that value the speed drops by a factor of approximately 2. Default value is
  13364. @code{3}.
  13365. @item qp
  13366. Force a constant quantization parameter. If not set, the filter will use the QP
  13367. from the video stream (if available).
  13368. @item mode
  13369. Set thresholding mode. Available modes are:
  13370. @table @samp
  13371. @item hard
  13372. Set hard thresholding (default).
  13373. @item soft
  13374. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13375. @end table
  13376. @item use_bframe_qp
  13377. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13378. option may cause flicker since the B-Frames have often larger QP. Default is
  13379. @code{0} (not enabled).
  13380. @end table
  13381. @subsection Commands
  13382. This filter supports the following commands:
  13383. @table @option
  13384. @item quality, level
  13385. Set quality level. The value @code{max} can be used to set the maximum level,
  13386. currently @code{6}.
  13387. @end table
  13388. @anchor{sr}
  13389. @section sr
  13390. Scale the input by applying one of the super-resolution methods based on
  13391. convolutional neural networks. Supported models:
  13392. @itemize
  13393. @item
  13394. Super-Resolution Convolutional Neural Network model (SRCNN).
  13395. See @url{https://arxiv.org/abs/1501.00092}.
  13396. @item
  13397. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13398. See @url{https://arxiv.org/abs/1609.05158}.
  13399. @end itemize
  13400. Training scripts as well as scripts for model file (.pb) saving can be found at
  13401. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13402. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13403. Native model files (.model) can be generated from TensorFlow model
  13404. files (.pb) by using tools/python/convert.py
  13405. The filter accepts the following options:
  13406. @table @option
  13407. @item dnn_backend
  13408. Specify which DNN backend to use for model loading and execution. This option accepts
  13409. the following values:
  13410. @table @samp
  13411. @item native
  13412. Native implementation of DNN loading and execution.
  13413. @item tensorflow
  13414. TensorFlow backend. To enable this backend you
  13415. need to install the TensorFlow for C library (see
  13416. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13417. @code{--enable-libtensorflow}
  13418. @end table
  13419. Default value is @samp{native}.
  13420. @item model
  13421. Set path to model file specifying network architecture and its parameters.
  13422. Note that different backends use different file formats. TensorFlow backend
  13423. can load files for both formats, while native backend can load files for only
  13424. its format.
  13425. @item scale_factor
  13426. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13427. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13428. input upscaled using bicubic upscaling with proper scale factor.
  13429. @end table
  13430. This feature can also be finished with @ref{dnn_processing} filter.
  13431. @section ssim
  13432. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13433. This filter takes in input two input videos, the first input is
  13434. considered the "main" source and is passed unchanged to the
  13435. output. The second input is used as a "reference" video for computing
  13436. the SSIM.
  13437. Both video inputs must have the same resolution and pixel format for
  13438. this filter to work correctly. Also it assumes that both inputs
  13439. have the same number of frames, which are compared one by one.
  13440. The filter stores the calculated SSIM of each frame.
  13441. The description of the accepted parameters follows.
  13442. @table @option
  13443. @item stats_file, f
  13444. If specified the filter will use the named file to save the SSIM of
  13445. each individual frame. When filename equals "-" the data is sent to
  13446. standard output.
  13447. @end table
  13448. The file printed if @var{stats_file} is selected, contains a sequence of
  13449. key/value pairs of the form @var{key}:@var{value} for each compared
  13450. couple of frames.
  13451. A description of each shown parameter follows:
  13452. @table @option
  13453. @item n
  13454. sequential number of the input frame, starting from 1
  13455. @item Y, U, V, R, G, B
  13456. SSIM of the compared frames for the component specified by the suffix.
  13457. @item All
  13458. SSIM of the compared frames for the whole frame.
  13459. @item dB
  13460. Same as above but in dB representation.
  13461. @end table
  13462. This filter also supports the @ref{framesync} options.
  13463. @subsection Examples
  13464. @itemize
  13465. @item
  13466. For example:
  13467. @example
  13468. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13469. [main][ref] ssim="stats_file=stats.log" [out]
  13470. @end example
  13471. On this example the input file being processed is compared with the
  13472. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13473. is stored in @file{stats.log}.
  13474. @item
  13475. Another example with both psnr and ssim at same time:
  13476. @example
  13477. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13478. @end example
  13479. @item
  13480. Another example with different containers:
  13481. @example
  13482. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13483. @end example
  13484. @end itemize
  13485. @section stereo3d
  13486. Convert between different stereoscopic image formats.
  13487. The filters accept the following options:
  13488. @table @option
  13489. @item in
  13490. Set stereoscopic image format of input.
  13491. Available values for input image formats are:
  13492. @table @samp
  13493. @item sbsl
  13494. side by side parallel (left eye left, right eye right)
  13495. @item sbsr
  13496. side by side crosseye (right eye left, left eye right)
  13497. @item sbs2l
  13498. side by side parallel with half width resolution
  13499. (left eye left, right eye right)
  13500. @item sbs2r
  13501. side by side crosseye with half width resolution
  13502. (right eye left, left eye right)
  13503. @item abl
  13504. @item tbl
  13505. above-below (left eye above, right eye below)
  13506. @item abr
  13507. @item tbr
  13508. above-below (right eye above, left eye below)
  13509. @item ab2l
  13510. @item tb2l
  13511. above-below with half height resolution
  13512. (left eye above, right eye below)
  13513. @item ab2r
  13514. @item tb2r
  13515. above-below with half height resolution
  13516. (right eye above, left eye below)
  13517. @item al
  13518. alternating frames (left eye first, right eye second)
  13519. @item ar
  13520. alternating frames (right eye first, left eye second)
  13521. @item irl
  13522. interleaved rows (left eye has top row, right eye starts on next row)
  13523. @item irr
  13524. interleaved rows (right eye has top row, left eye starts on next row)
  13525. @item icl
  13526. interleaved columns, left eye first
  13527. @item icr
  13528. interleaved columns, right eye first
  13529. Default value is @samp{sbsl}.
  13530. @end table
  13531. @item out
  13532. Set stereoscopic image format of output.
  13533. @table @samp
  13534. @item sbsl
  13535. side by side parallel (left eye left, right eye right)
  13536. @item sbsr
  13537. side by side crosseye (right eye left, left eye right)
  13538. @item sbs2l
  13539. side by side parallel with half width resolution
  13540. (left eye left, right eye right)
  13541. @item sbs2r
  13542. side by side crosseye with half width resolution
  13543. (right eye left, left eye right)
  13544. @item abl
  13545. @item tbl
  13546. above-below (left eye above, right eye below)
  13547. @item abr
  13548. @item tbr
  13549. above-below (right eye above, left eye below)
  13550. @item ab2l
  13551. @item tb2l
  13552. above-below with half height resolution
  13553. (left eye above, right eye below)
  13554. @item ab2r
  13555. @item tb2r
  13556. above-below with half height resolution
  13557. (right eye above, left eye below)
  13558. @item al
  13559. alternating frames (left eye first, right eye second)
  13560. @item ar
  13561. alternating frames (right eye first, left eye second)
  13562. @item irl
  13563. interleaved rows (left eye has top row, right eye starts on next row)
  13564. @item irr
  13565. interleaved rows (right eye has top row, left eye starts on next row)
  13566. @item arbg
  13567. anaglyph red/blue gray
  13568. (red filter on left eye, blue filter on right eye)
  13569. @item argg
  13570. anaglyph red/green gray
  13571. (red filter on left eye, green filter on right eye)
  13572. @item arcg
  13573. anaglyph red/cyan gray
  13574. (red filter on left eye, cyan filter on right eye)
  13575. @item arch
  13576. anaglyph red/cyan half colored
  13577. (red filter on left eye, cyan filter on right eye)
  13578. @item arcc
  13579. anaglyph red/cyan color
  13580. (red filter on left eye, cyan filter on right eye)
  13581. @item arcd
  13582. anaglyph red/cyan color optimized with the least squares projection of dubois
  13583. (red filter on left eye, cyan filter on right eye)
  13584. @item agmg
  13585. anaglyph green/magenta gray
  13586. (green filter on left eye, magenta filter on right eye)
  13587. @item agmh
  13588. anaglyph green/magenta half colored
  13589. (green filter on left eye, magenta filter on right eye)
  13590. @item agmc
  13591. anaglyph green/magenta colored
  13592. (green filter on left eye, magenta filter on right eye)
  13593. @item agmd
  13594. anaglyph green/magenta color optimized with the least squares projection of dubois
  13595. (green filter on left eye, magenta filter on right eye)
  13596. @item aybg
  13597. anaglyph yellow/blue gray
  13598. (yellow filter on left eye, blue filter on right eye)
  13599. @item aybh
  13600. anaglyph yellow/blue half colored
  13601. (yellow filter on left eye, blue filter on right eye)
  13602. @item aybc
  13603. anaglyph yellow/blue colored
  13604. (yellow filter on left eye, blue filter on right eye)
  13605. @item aybd
  13606. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13607. (yellow filter on left eye, blue filter on right eye)
  13608. @item ml
  13609. mono output (left eye only)
  13610. @item mr
  13611. mono output (right eye only)
  13612. @item chl
  13613. checkerboard, left eye first
  13614. @item chr
  13615. checkerboard, right eye first
  13616. @item icl
  13617. interleaved columns, left eye first
  13618. @item icr
  13619. interleaved columns, right eye first
  13620. @item hdmi
  13621. HDMI frame pack
  13622. @end table
  13623. Default value is @samp{arcd}.
  13624. @end table
  13625. @subsection Examples
  13626. @itemize
  13627. @item
  13628. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13629. @example
  13630. stereo3d=sbsl:aybd
  13631. @end example
  13632. @item
  13633. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13634. @example
  13635. stereo3d=abl:sbsr
  13636. @end example
  13637. @end itemize
  13638. @section streamselect, astreamselect
  13639. Select video or audio streams.
  13640. The filter accepts the following options:
  13641. @table @option
  13642. @item inputs
  13643. Set number of inputs. Default is 2.
  13644. @item map
  13645. Set input indexes to remap to outputs.
  13646. @end table
  13647. @subsection Commands
  13648. The @code{streamselect} and @code{astreamselect} filter supports the following
  13649. commands:
  13650. @table @option
  13651. @item map
  13652. Set input indexes to remap to outputs.
  13653. @end table
  13654. @subsection Examples
  13655. @itemize
  13656. @item
  13657. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13658. @example
  13659. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13660. @end example
  13661. @item
  13662. Same as above, but for audio:
  13663. @example
  13664. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13665. @end example
  13666. @end itemize
  13667. @anchor{subtitles}
  13668. @section subtitles
  13669. Draw subtitles on top of input video using the libass library.
  13670. To enable compilation of this filter you need to configure FFmpeg with
  13671. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13672. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13673. Alpha) subtitles format.
  13674. The filter accepts the following options:
  13675. @table @option
  13676. @item filename, f
  13677. Set the filename of the subtitle file to read. It must be specified.
  13678. @item original_size
  13679. Specify the size of the original video, the video for which the ASS file
  13680. was composed. For the syntax of this option, check the
  13681. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13682. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13683. correctly scale the fonts if the aspect ratio has been changed.
  13684. @item fontsdir
  13685. Set a directory path containing fonts that can be used by the filter.
  13686. These fonts will be used in addition to whatever the font provider uses.
  13687. @item alpha
  13688. Process alpha channel, by default alpha channel is untouched.
  13689. @item charenc
  13690. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13691. useful if not UTF-8.
  13692. @item stream_index, si
  13693. Set subtitles stream index. @code{subtitles} filter only.
  13694. @item force_style
  13695. Override default style or script info parameters of the subtitles. It accepts a
  13696. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13697. @end table
  13698. If the first key is not specified, it is assumed that the first value
  13699. specifies the @option{filename}.
  13700. For example, to render the file @file{sub.srt} on top of the input
  13701. video, use the command:
  13702. @example
  13703. subtitles=sub.srt
  13704. @end example
  13705. which is equivalent to:
  13706. @example
  13707. subtitles=filename=sub.srt
  13708. @end example
  13709. To render the default subtitles stream from file @file{video.mkv}, use:
  13710. @example
  13711. subtitles=video.mkv
  13712. @end example
  13713. To render the second subtitles stream from that file, use:
  13714. @example
  13715. subtitles=video.mkv:si=1
  13716. @end example
  13717. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13718. @code{DejaVu Serif}, use:
  13719. @example
  13720. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13721. @end example
  13722. @section super2xsai
  13723. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13724. Interpolate) pixel art scaling algorithm.
  13725. Useful for enlarging pixel art images without reducing sharpness.
  13726. @section swaprect
  13727. Swap two rectangular objects in video.
  13728. This filter accepts the following options:
  13729. @table @option
  13730. @item w
  13731. Set object width.
  13732. @item h
  13733. Set object height.
  13734. @item x1
  13735. Set 1st rect x coordinate.
  13736. @item y1
  13737. Set 1st rect y coordinate.
  13738. @item x2
  13739. Set 2nd rect x coordinate.
  13740. @item y2
  13741. Set 2nd rect y coordinate.
  13742. All expressions are evaluated once for each frame.
  13743. @end table
  13744. The all options are expressions containing the following constants:
  13745. @table @option
  13746. @item w
  13747. @item h
  13748. The input width and height.
  13749. @item a
  13750. same as @var{w} / @var{h}
  13751. @item sar
  13752. input sample aspect ratio
  13753. @item dar
  13754. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13755. @item n
  13756. The number of the input frame, starting from 0.
  13757. @item t
  13758. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13759. @item pos
  13760. the position in the file of the input frame, NAN if unknown
  13761. @end table
  13762. @section swapuv
  13763. Swap U & V plane.
  13764. @section tblend
  13765. Blend successive video frames.
  13766. See @ref{blend}
  13767. @section telecine
  13768. Apply telecine process to the video.
  13769. This filter accepts the following options:
  13770. @table @option
  13771. @item first_field
  13772. @table @samp
  13773. @item top, t
  13774. top field first
  13775. @item bottom, b
  13776. bottom field first
  13777. The default value is @code{top}.
  13778. @end table
  13779. @item pattern
  13780. A string of numbers representing the pulldown pattern you wish to apply.
  13781. The default value is @code{23}.
  13782. @end table
  13783. @example
  13784. Some typical patterns:
  13785. NTSC output (30i):
  13786. 27.5p: 32222
  13787. 24p: 23 (classic)
  13788. 24p: 2332 (preferred)
  13789. 20p: 33
  13790. 18p: 334
  13791. 16p: 3444
  13792. PAL output (25i):
  13793. 27.5p: 12222
  13794. 24p: 222222222223 ("Euro pulldown")
  13795. 16.67p: 33
  13796. 16p: 33333334
  13797. @end example
  13798. @section thistogram
  13799. Compute and draw a color distribution histogram for the input video across time.
  13800. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13801. at certain time, this filter shows also past histograms of number of frames defined
  13802. by @code{width} option.
  13803. The computed histogram is a representation of the color component
  13804. distribution in an image.
  13805. The filter accepts the following options:
  13806. @table @option
  13807. @item width, w
  13808. Set width of single color component output. Default value is @code{0}.
  13809. Value of @code{0} means width will be picked from input video.
  13810. This also set number of passed histograms to keep.
  13811. Allowed range is [0, 8192].
  13812. @item display_mode, d
  13813. Set display mode.
  13814. It accepts the following values:
  13815. @table @samp
  13816. @item stack
  13817. Per color component graphs are placed below each other.
  13818. @item parade
  13819. Per color component graphs are placed side by side.
  13820. @item overlay
  13821. Presents information identical to that in the @code{parade}, except
  13822. that the graphs representing color components are superimposed directly
  13823. over one another.
  13824. @end table
  13825. Default is @code{stack}.
  13826. @item levels_mode, m
  13827. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13828. Default is @code{linear}.
  13829. @item components, c
  13830. Set what color components to display.
  13831. Default is @code{7}.
  13832. @item bgopacity, b
  13833. Set background opacity. Default is @code{0.9}.
  13834. @item envelope, e
  13835. Show envelope. Default is disabled.
  13836. @item ecolor, ec
  13837. Set envelope color. Default is @code{gold}.
  13838. @end table
  13839. @section threshold
  13840. Apply threshold effect to video stream.
  13841. This filter needs four video streams to perform thresholding.
  13842. First stream is stream we are filtering.
  13843. Second stream is holding threshold values, third stream is holding min values,
  13844. and last, fourth stream is holding max values.
  13845. The filter accepts the following option:
  13846. @table @option
  13847. @item planes
  13848. Set which planes will be processed, unprocessed planes will be copied.
  13849. By default value 0xf, all planes will be processed.
  13850. @end table
  13851. For example if first stream pixel's component value is less then threshold value
  13852. of pixel component from 2nd threshold stream, third stream value will picked,
  13853. otherwise fourth stream pixel component value will be picked.
  13854. Using color source filter one can perform various types of thresholding:
  13855. @subsection Examples
  13856. @itemize
  13857. @item
  13858. Binary threshold, using gray color as threshold:
  13859. @example
  13860. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13861. @end example
  13862. @item
  13863. Inverted binary threshold, using gray color as threshold:
  13864. @example
  13865. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13866. @end example
  13867. @item
  13868. Truncate binary threshold, using gray color as threshold:
  13869. @example
  13870. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13871. @end example
  13872. @item
  13873. Threshold to zero, using gray color as threshold:
  13874. @example
  13875. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13876. @end example
  13877. @item
  13878. Inverted threshold to zero, using gray color as threshold:
  13879. @example
  13880. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13881. @end example
  13882. @end itemize
  13883. @section thumbnail
  13884. Select the most representative frame in a given sequence of consecutive frames.
  13885. The filter accepts the following options:
  13886. @table @option
  13887. @item n
  13888. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13889. will pick one of them, and then handle the next batch of @var{n} frames until
  13890. the end. Default is @code{100}.
  13891. @end table
  13892. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13893. value will result in a higher memory usage, so a high value is not recommended.
  13894. @subsection Examples
  13895. @itemize
  13896. @item
  13897. Extract one picture each 50 frames:
  13898. @example
  13899. thumbnail=50
  13900. @end example
  13901. @item
  13902. Complete example of a thumbnail creation with @command{ffmpeg}:
  13903. @example
  13904. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13905. @end example
  13906. @end itemize
  13907. @anchor{tile}
  13908. @section tile
  13909. Tile several successive frames together.
  13910. The @ref{untile} filter can do the reverse.
  13911. The filter accepts the following options:
  13912. @table @option
  13913. @item layout
  13914. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13915. this option, check the
  13916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13917. @item nb_frames
  13918. Set the maximum number of frames to render in the given area. It must be less
  13919. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13920. the area will be used.
  13921. @item margin
  13922. Set the outer border margin in pixels.
  13923. @item padding
  13924. Set the inner border thickness (i.e. the number of pixels between frames). For
  13925. more advanced padding options (such as having different values for the edges),
  13926. refer to the pad video filter.
  13927. @item color
  13928. Specify the color of the unused area. For the syntax of this option, check the
  13929. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13930. The default value of @var{color} is "black".
  13931. @item overlap
  13932. Set the number of frames to overlap when tiling several successive frames together.
  13933. The value must be between @code{0} and @var{nb_frames - 1}.
  13934. @item init_padding
  13935. Set the number of frames to initially be empty before displaying first output frame.
  13936. This controls how soon will one get first output frame.
  13937. The value must be between @code{0} and @var{nb_frames - 1}.
  13938. @end table
  13939. @subsection Examples
  13940. @itemize
  13941. @item
  13942. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13943. @example
  13944. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13945. @end example
  13946. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13947. duplicating each output frame to accommodate the originally detected frame
  13948. rate.
  13949. @item
  13950. Display @code{5} pictures in an area of @code{3x2} frames,
  13951. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13952. mixed flat and named options:
  13953. @example
  13954. tile=3x2:nb_frames=5:padding=7:margin=2
  13955. @end example
  13956. @end itemize
  13957. @section tinterlace
  13958. Perform various types of temporal field interlacing.
  13959. Frames are counted starting from 1, so the first input frame is
  13960. considered odd.
  13961. The filter accepts the following options:
  13962. @table @option
  13963. @item mode
  13964. Specify the mode of the interlacing. This option can also be specified
  13965. as a value alone. See below for a list of values for this option.
  13966. Available values are:
  13967. @table @samp
  13968. @item merge, 0
  13969. Move odd frames into the upper field, even into the lower field,
  13970. generating a double height frame at half frame rate.
  13971. @example
  13972. ------> time
  13973. Input:
  13974. Frame 1 Frame 2 Frame 3 Frame 4
  13975. 11111 22222 33333 44444
  13976. 11111 22222 33333 44444
  13977. 11111 22222 33333 44444
  13978. 11111 22222 33333 44444
  13979. Output:
  13980. 11111 33333
  13981. 22222 44444
  13982. 11111 33333
  13983. 22222 44444
  13984. 11111 33333
  13985. 22222 44444
  13986. 11111 33333
  13987. 22222 44444
  13988. @end example
  13989. @item drop_even, 1
  13990. Only output odd frames, even frames are dropped, generating a frame with
  13991. unchanged height at half frame rate.
  13992. @example
  13993. ------> time
  13994. Input:
  13995. Frame 1 Frame 2 Frame 3 Frame 4
  13996. 11111 22222 33333 44444
  13997. 11111 22222 33333 44444
  13998. 11111 22222 33333 44444
  13999. 11111 22222 33333 44444
  14000. Output:
  14001. 11111 33333
  14002. 11111 33333
  14003. 11111 33333
  14004. 11111 33333
  14005. @end example
  14006. @item drop_odd, 2
  14007. Only output even frames, odd frames are dropped, generating a frame with
  14008. unchanged height at half frame rate.
  14009. @example
  14010. ------> time
  14011. Input:
  14012. Frame 1 Frame 2 Frame 3 Frame 4
  14013. 11111 22222 33333 44444
  14014. 11111 22222 33333 44444
  14015. 11111 22222 33333 44444
  14016. 11111 22222 33333 44444
  14017. Output:
  14018. 22222 44444
  14019. 22222 44444
  14020. 22222 44444
  14021. 22222 44444
  14022. @end example
  14023. @item pad, 3
  14024. Expand each frame to full height, but pad alternate lines with black,
  14025. generating a frame with double height at the same input frame rate.
  14026. @example
  14027. ------> time
  14028. Input:
  14029. Frame 1 Frame 2 Frame 3 Frame 4
  14030. 11111 22222 33333 44444
  14031. 11111 22222 33333 44444
  14032. 11111 22222 33333 44444
  14033. 11111 22222 33333 44444
  14034. Output:
  14035. 11111 ..... 33333 .....
  14036. ..... 22222 ..... 44444
  14037. 11111 ..... 33333 .....
  14038. ..... 22222 ..... 44444
  14039. 11111 ..... 33333 .....
  14040. ..... 22222 ..... 44444
  14041. 11111 ..... 33333 .....
  14042. ..... 22222 ..... 44444
  14043. @end example
  14044. @item interleave_top, 4
  14045. Interleave the upper field from odd frames with the lower field from
  14046. even frames, generating a frame with unchanged height at half frame rate.
  14047. @example
  14048. ------> time
  14049. Input:
  14050. Frame 1 Frame 2 Frame 3 Frame 4
  14051. 11111<- 22222 33333<- 44444
  14052. 11111 22222<- 33333 44444<-
  14053. 11111<- 22222 33333<- 44444
  14054. 11111 22222<- 33333 44444<-
  14055. Output:
  14056. 11111 33333
  14057. 22222 44444
  14058. 11111 33333
  14059. 22222 44444
  14060. @end example
  14061. @item interleave_bottom, 5
  14062. Interleave the lower field from odd frames with the upper field from
  14063. even frames, generating a frame with unchanged height at half frame rate.
  14064. @example
  14065. ------> time
  14066. Input:
  14067. Frame 1 Frame 2 Frame 3 Frame 4
  14068. 11111 22222<- 33333 44444<-
  14069. 11111<- 22222 33333<- 44444
  14070. 11111 22222<- 33333 44444<-
  14071. 11111<- 22222 33333<- 44444
  14072. Output:
  14073. 22222 44444
  14074. 11111 33333
  14075. 22222 44444
  14076. 11111 33333
  14077. @end example
  14078. @item interlacex2, 6
  14079. Double frame rate with unchanged height. Frames are inserted each
  14080. containing the second temporal field from the previous input frame and
  14081. the first temporal field from the next input frame. This mode relies on
  14082. the top_field_first flag. Useful for interlaced video displays with no
  14083. field synchronisation.
  14084. @example
  14085. ------> time
  14086. Input:
  14087. Frame 1 Frame 2 Frame 3 Frame 4
  14088. 11111 22222 33333 44444
  14089. 11111 22222 33333 44444
  14090. 11111 22222 33333 44444
  14091. 11111 22222 33333 44444
  14092. Output:
  14093. 11111 22222 22222 33333 33333 44444 44444
  14094. 11111 11111 22222 22222 33333 33333 44444
  14095. 11111 22222 22222 33333 33333 44444 44444
  14096. 11111 11111 22222 22222 33333 33333 44444
  14097. @end example
  14098. @item mergex2, 7
  14099. Move odd frames into the upper field, even into the lower field,
  14100. generating a double height frame at same frame rate.
  14101. @example
  14102. ------> time
  14103. Input:
  14104. Frame 1 Frame 2 Frame 3 Frame 4
  14105. 11111 22222 33333 44444
  14106. 11111 22222 33333 44444
  14107. 11111 22222 33333 44444
  14108. 11111 22222 33333 44444
  14109. Output:
  14110. 11111 33333 33333 55555
  14111. 22222 22222 44444 44444
  14112. 11111 33333 33333 55555
  14113. 22222 22222 44444 44444
  14114. 11111 33333 33333 55555
  14115. 22222 22222 44444 44444
  14116. 11111 33333 33333 55555
  14117. 22222 22222 44444 44444
  14118. @end example
  14119. @end table
  14120. Numeric values are deprecated but are accepted for backward
  14121. compatibility reasons.
  14122. Default mode is @code{merge}.
  14123. @item flags
  14124. Specify flags influencing the filter process.
  14125. Available value for @var{flags} is:
  14126. @table @option
  14127. @item low_pass_filter, vlpf
  14128. Enable linear vertical low-pass filtering in the filter.
  14129. Vertical low-pass filtering is required when creating an interlaced
  14130. destination from a progressive source which contains high-frequency
  14131. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14132. patterning.
  14133. @item complex_filter, cvlpf
  14134. Enable complex vertical low-pass filtering.
  14135. This will slightly less reduce interlace 'twitter' and Moire
  14136. patterning but better retain detail and subjective sharpness impression.
  14137. @item bypass_il
  14138. Bypass already interlaced frames, only adjust the frame rate.
  14139. @end table
  14140. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14141. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14142. @end table
  14143. @section tmedian
  14144. Pick median pixels from several successive input video frames.
  14145. The filter accepts the following options:
  14146. @table @option
  14147. @item radius
  14148. Set radius of median filter.
  14149. Default is 1. Allowed range is from 1 to 127.
  14150. @item planes
  14151. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14152. @item percentile
  14153. Set median percentile. Default value is @code{0.5}.
  14154. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14155. minimum values, and @code{1} maximum values.
  14156. @end table
  14157. @section tmix
  14158. Mix successive video frames.
  14159. A description of the accepted options follows.
  14160. @table @option
  14161. @item frames
  14162. The number of successive frames to mix. If unspecified, it defaults to 3.
  14163. @item weights
  14164. Specify weight of each input video frame.
  14165. Each weight is separated by space. If number of weights is smaller than
  14166. number of @var{frames} last specified weight will be used for all remaining
  14167. unset weights.
  14168. @item scale
  14169. Specify scale, if it is set it will be multiplied with sum
  14170. of each weight multiplied with pixel values to give final destination
  14171. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14172. @end table
  14173. @subsection Examples
  14174. @itemize
  14175. @item
  14176. Average 7 successive frames:
  14177. @example
  14178. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14179. @end example
  14180. @item
  14181. Apply simple temporal convolution:
  14182. @example
  14183. tmix=frames=3:weights="-1 3 -1"
  14184. @end example
  14185. @item
  14186. Similar as above but only showing temporal differences:
  14187. @example
  14188. tmix=frames=3:weights="-1 2 -1":scale=1
  14189. @end example
  14190. @end itemize
  14191. @anchor{tonemap}
  14192. @section tonemap
  14193. Tone map colors from different dynamic ranges.
  14194. This filter expects data in single precision floating point, as it needs to
  14195. operate on (and can output) out-of-range values. Another filter, such as
  14196. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14197. The tonemapping algorithms implemented only work on linear light, so input
  14198. data should be linearized beforehand (and possibly correctly tagged).
  14199. @example
  14200. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14201. @end example
  14202. @subsection Options
  14203. The filter accepts the following options.
  14204. @table @option
  14205. @item tonemap
  14206. Set the tone map algorithm to use.
  14207. Possible values are:
  14208. @table @var
  14209. @item none
  14210. Do not apply any tone map, only desaturate overbright pixels.
  14211. @item clip
  14212. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14213. in-range values, while distorting out-of-range values.
  14214. @item linear
  14215. Stretch the entire reference gamut to a linear multiple of the display.
  14216. @item gamma
  14217. Fit a logarithmic transfer between the tone curves.
  14218. @item reinhard
  14219. Preserve overall image brightness with a simple curve, using nonlinear
  14220. contrast, which results in flattening details and degrading color accuracy.
  14221. @item hable
  14222. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14223. of slightly darkening everything. Use it when detail preservation is more
  14224. important than color and brightness accuracy.
  14225. @item mobius
  14226. Smoothly map out-of-range values, while retaining contrast and colors for
  14227. in-range material as much as possible. Use it when color accuracy is more
  14228. important than detail preservation.
  14229. @end table
  14230. Default is none.
  14231. @item param
  14232. Tune the tone mapping algorithm.
  14233. This affects the following algorithms:
  14234. @table @var
  14235. @item none
  14236. Ignored.
  14237. @item linear
  14238. Specifies the scale factor to use while stretching.
  14239. Default to 1.0.
  14240. @item gamma
  14241. Specifies the exponent of the function.
  14242. Default to 1.8.
  14243. @item clip
  14244. Specify an extra linear coefficient to multiply into the signal before clipping.
  14245. Default to 1.0.
  14246. @item reinhard
  14247. Specify the local contrast coefficient at the display peak.
  14248. Default to 0.5, which means that in-gamut values will be about half as bright
  14249. as when clipping.
  14250. @item hable
  14251. Ignored.
  14252. @item mobius
  14253. Specify the transition point from linear to mobius transform. Every value
  14254. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14255. more accurate the result will be, at the cost of losing bright details.
  14256. Default to 0.3, which due to the steep initial slope still preserves in-range
  14257. colors fairly accurately.
  14258. @end table
  14259. @item desat
  14260. Apply desaturation for highlights that exceed this level of brightness. The
  14261. higher the parameter, the more color information will be preserved. This
  14262. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14263. (smoothly) turning into white instead. This makes images feel more natural,
  14264. at the cost of reducing information about out-of-range colors.
  14265. The default of 2.0 is somewhat conservative and will mostly just apply to
  14266. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14267. This option works only if the input frame has a supported color tag.
  14268. @item peak
  14269. Override signal/nominal/reference peak with this value. Useful when the
  14270. embedded peak information in display metadata is not reliable or when tone
  14271. mapping from a lower range to a higher range.
  14272. @end table
  14273. @section tpad
  14274. Temporarily pad video frames.
  14275. The filter accepts the following options:
  14276. @table @option
  14277. @item start
  14278. Specify number of delay frames before input video stream. Default is 0.
  14279. @item stop
  14280. Specify number of padding frames after input video stream.
  14281. Set to -1 to pad indefinitely. Default is 0.
  14282. @item start_mode
  14283. Set kind of frames added to beginning of stream.
  14284. Can be either @var{add} or @var{clone}.
  14285. With @var{add} frames of solid-color are added.
  14286. With @var{clone} frames are clones of first frame.
  14287. Default is @var{add}.
  14288. @item stop_mode
  14289. Set kind of frames added to end of stream.
  14290. Can be either @var{add} or @var{clone}.
  14291. With @var{add} frames of solid-color are added.
  14292. With @var{clone} frames are clones of last frame.
  14293. Default is @var{add}.
  14294. @item start_duration, stop_duration
  14295. Specify the duration of the start/stop delay. See
  14296. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14297. for the accepted syntax.
  14298. These options override @var{start} and @var{stop}. Default is 0.
  14299. @item color
  14300. Specify the color of the padded area. For the syntax of this option,
  14301. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14302. manual,ffmpeg-utils}.
  14303. The default value of @var{color} is "black".
  14304. @end table
  14305. @anchor{transpose}
  14306. @section transpose
  14307. Transpose rows with columns in the input video and optionally flip it.
  14308. It accepts the following parameters:
  14309. @table @option
  14310. @item dir
  14311. Specify the transposition direction.
  14312. Can assume the following values:
  14313. @table @samp
  14314. @item 0, 4, cclock_flip
  14315. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14316. @example
  14317. L.R L.l
  14318. . . -> . .
  14319. l.r R.r
  14320. @end example
  14321. @item 1, 5, clock
  14322. Rotate by 90 degrees clockwise, that is:
  14323. @example
  14324. L.R l.L
  14325. . . -> . .
  14326. l.r r.R
  14327. @end example
  14328. @item 2, 6, cclock
  14329. Rotate by 90 degrees counterclockwise, that is:
  14330. @example
  14331. L.R R.r
  14332. . . -> . .
  14333. l.r L.l
  14334. @end example
  14335. @item 3, 7, clock_flip
  14336. Rotate by 90 degrees clockwise and vertically flip, that is:
  14337. @example
  14338. L.R r.R
  14339. . . -> . .
  14340. l.r l.L
  14341. @end example
  14342. @end table
  14343. For values between 4-7, the transposition is only done if the input
  14344. video geometry is portrait and not landscape. These values are
  14345. deprecated, the @code{passthrough} option should be used instead.
  14346. Numerical values are deprecated, and should be dropped in favor of
  14347. symbolic constants.
  14348. @item passthrough
  14349. Do not apply the transposition if the input geometry matches the one
  14350. specified by the specified value. It accepts the following values:
  14351. @table @samp
  14352. @item none
  14353. Always apply transposition.
  14354. @item portrait
  14355. Preserve portrait geometry (when @var{height} >= @var{width}).
  14356. @item landscape
  14357. Preserve landscape geometry (when @var{width} >= @var{height}).
  14358. @end table
  14359. Default value is @code{none}.
  14360. @end table
  14361. For example to rotate by 90 degrees clockwise and preserve portrait
  14362. layout:
  14363. @example
  14364. transpose=dir=1:passthrough=portrait
  14365. @end example
  14366. The command above can also be specified as:
  14367. @example
  14368. transpose=1:portrait
  14369. @end example
  14370. @section transpose_npp
  14371. Transpose rows with columns in the input video and optionally flip it.
  14372. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14373. It accepts the following parameters:
  14374. @table @option
  14375. @item dir
  14376. Specify the transposition direction.
  14377. Can assume the following values:
  14378. @table @samp
  14379. @item cclock_flip
  14380. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14381. @item clock
  14382. Rotate by 90 degrees clockwise.
  14383. @item cclock
  14384. Rotate by 90 degrees counterclockwise.
  14385. @item clock_flip
  14386. Rotate by 90 degrees clockwise and vertically flip.
  14387. @end table
  14388. @item passthrough
  14389. Do not apply the transposition if the input geometry matches the one
  14390. specified by the specified value. It accepts the following values:
  14391. @table @samp
  14392. @item none
  14393. Always apply transposition. (default)
  14394. @item portrait
  14395. Preserve portrait geometry (when @var{height} >= @var{width}).
  14396. @item landscape
  14397. Preserve landscape geometry (when @var{width} >= @var{height}).
  14398. @end table
  14399. @end table
  14400. @section trim
  14401. Trim the input so that the output contains one continuous subpart of the input.
  14402. It accepts the following parameters:
  14403. @table @option
  14404. @item start
  14405. Specify the time of the start of the kept section, i.e. the frame with the
  14406. timestamp @var{start} will be the first frame in the output.
  14407. @item end
  14408. Specify the time of the first frame that will be dropped, i.e. the frame
  14409. immediately preceding the one with the timestamp @var{end} will be the last
  14410. frame in the output.
  14411. @item start_pts
  14412. This is the same as @var{start}, except this option sets the start timestamp
  14413. in timebase units instead of seconds.
  14414. @item end_pts
  14415. This is the same as @var{end}, except this option sets the end timestamp
  14416. in timebase units instead of seconds.
  14417. @item duration
  14418. The maximum duration of the output in seconds.
  14419. @item start_frame
  14420. The number of the first frame that should be passed to the output.
  14421. @item end_frame
  14422. The number of the first frame that should be dropped.
  14423. @end table
  14424. @option{start}, @option{end}, and @option{duration} are expressed as time
  14425. duration specifications; see
  14426. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14427. for the accepted syntax.
  14428. Note that the first two sets of the start/end options and the @option{duration}
  14429. option look at the frame timestamp, while the _frame variants simply count the
  14430. frames that pass through the filter. Also note that this filter does not modify
  14431. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14432. setpts filter after the trim filter.
  14433. If multiple start or end options are set, this filter tries to be greedy and
  14434. keep all the frames that match at least one of the specified constraints. To keep
  14435. only the part that matches all the constraints at once, chain multiple trim
  14436. filters.
  14437. The defaults are such that all the input is kept. So it is possible to set e.g.
  14438. just the end values to keep everything before the specified time.
  14439. Examples:
  14440. @itemize
  14441. @item
  14442. Drop everything except the second minute of input:
  14443. @example
  14444. ffmpeg -i INPUT -vf trim=60:120
  14445. @end example
  14446. @item
  14447. Keep only the first second:
  14448. @example
  14449. ffmpeg -i INPUT -vf trim=duration=1
  14450. @end example
  14451. @end itemize
  14452. @section unpremultiply
  14453. Apply alpha unpremultiply effect to input video stream using first plane
  14454. of second stream as alpha.
  14455. Both streams must have same dimensions and same pixel format.
  14456. The filter accepts the following option:
  14457. @table @option
  14458. @item planes
  14459. Set which planes will be processed, unprocessed planes will be copied.
  14460. By default value 0xf, all planes will be processed.
  14461. If the format has 1 or 2 components, then luma is bit 0.
  14462. If the format has 3 or 4 components:
  14463. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14464. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14465. If present, the alpha channel is always the last bit.
  14466. @item inplace
  14467. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14468. @end table
  14469. @anchor{unsharp}
  14470. @section unsharp
  14471. Sharpen or blur the input video.
  14472. It accepts the following parameters:
  14473. @table @option
  14474. @item luma_msize_x, lx
  14475. Set the luma matrix horizontal size. It must be an odd integer between
  14476. 3 and 23. The default value is 5.
  14477. @item luma_msize_y, ly
  14478. Set the luma matrix vertical size. It must be an odd integer between 3
  14479. and 23. The default value is 5.
  14480. @item luma_amount, la
  14481. Set the luma effect strength. It must be a floating point number, reasonable
  14482. values lay between -1.5 and 1.5.
  14483. Negative values will blur the input video, while positive values will
  14484. sharpen it, a value of zero will disable the effect.
  14485. Default value is 1.0.
  14486. @item chroma_msize_x, cx
  14487. Set the chroma matrix horizontal size. It must be an odd integer
  14488. between 3 and 23. The default value is 5.
  14489. @item chroma_msize_y, cy
  14490. Set the chroma matrix vertical size. It must be an odd integer
  14491. between 3 and 23. The default value is 5.
  14492. @item chroma_amount, ca
  14493. Set the chroma effect strength. It must be a floating point number, reasonable
  14494. values lay between -1.5 and 1.5.
  14495. Negative values will blur the input video, while positive values will
  14496. sharpen it, a value of zero will disable the effect.
  14497. Default value is 0.0.
  14498. @end table
  14499. All parameters are optional and default to the equivalent of the
  14500. string '5:5:1.0:5:5:0.0'.
  14501. @subsection Examples
  14502. @itemize
  14503. @item
  14504. Apply strong luma sharpen effect:
  14505. @example
  14506. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14507. @end example
  14508. @item
  14509. Apply a strong blur of both luma and chroma parameters:
  14510. @example
  14511. unsharp=7:7:-2:7:7:-2
  14512. @end example
  14513. @end itemize
  14514. @anchor{untile}
  14515. @section untile
  14516. Decompose a video made of tiled images into the individual images.
  14517. The frame rate of the output video is the frame rate of the input video
  14518. multiplied by the number of tiles.
  14519. This filter does the reverse of @ref{tile}.
  14520. The filter accepts the following options:
  14521. @table @option
  14522. @item layout
  14523. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14524. this option, check the
  14525. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14526. @end table
  14527. @subsection Examples
  14528. @itemize
  14529. @item
  14530. Produce a 1-second video from a still image file made of 25 frames stacked
  14531. vertically, like an analogic film reel:
  14532. @example
  14533. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14534. @end example
  14535. @end itemize
  14536. @section uspp
  14537. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14538. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14539. shifts and average the results.
  14540. The way this differs from the behavior of spp is that uspp actually encodes &
  14541. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14542. DCT similar to MJPEG.
  14543. The filter accepts the following options:
  14544. @table @option
  14545. @item quality
  14546. Set quality. This option defines the number of levels for averaging. It accepts
  14547. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14548. effect. A value of @code{8} means the higher quality. For each increment of
  14549. that value the speed drops by a factor of approximately 2. Default value is
  14550. @code{3}.
  14551. @item qp
  14552. Force a constant quantization parameter. If not set, the filter will use the QP
  14553. from the video stream (if available).
  14554. @end table
  14555. @section v360
  14556. Convert 360 videos between various formats.
  14557. The filter accepts the following options:
  14558. @table @option
  14559. @item input
  14560. @item output
  14561. Set format of the input/output video.
  14562. Available formats:
  14563. @table @samp
  14564. @item e
  14565. @item equirect
  14566. Equirectangular projection.
  14567. @item c3x2
  14568. @item c6x1
  14569. @item c1x6
  14570. Cubemap with 3x2/6x1/1x6 layout.
  14571. Format specific options:
  14572. @table @option
  14573. @item in_pad
  14574. @item out_pad
  14575. Set padding proportion for the input/output cubemap. Values in decimals.
  14576. Example values:
  14577. @table @samp
  14578. @item 0
  14579. No padding.
  14580. @item 0.01
  14581. 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)
  14582. @end table
  14583. Default value is @b{@samp{0}}.
  14584. Maximum value is @b{@samp{0.1}}.
  14585. @item fin_pad
  14586. @item fout_pad
  14587. Set fixed padding for the input/output cubemap. Values in pixels.
  14588. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14589. @item in_forder
  14590. @item out_forder
  14591. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14592. Designation of directions:
  14593. @table @samp
  14594. @item r
  14595. right
  14596. @item l
  14597. left
  14598. @item u
  14599. up
  14600. @item d
  14601. down
  14602. @item f
  14603. forward
  14604. @item b
  14605. back
  14606. @end table
  14607. Default value is @b{@samp{rludfb}}.
  14608. @item in_frot
  14609. @item out_frot
  14610. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14611. Designation of angles:
  14612. @table @samp
  14613. @item 0
  14614. 0 degrees clockwise
  14615. @item 1
  14616. 90 degrees clockwise
  14617. @item 2
  14618. 180 degrees clockwise
  14619. @item 3
  14620. 270 degrees clockwise
  14621. @end table
  14622. Default value is @b{@samp{000000}}.
  14623. @end table
  14624. @item eac
  14625. Equi-Angular Cubemap.
  14626. @item flat
  14627. @item gnomonic
  14628. @item rectilinear
  14629. Regular video.
  14630. Format specific options:
  14631. @table @option
  14632. @item h_fov
  14633. @item v_fov
  14634. @item d_fov
  14635. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14636. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14637. @item ih_fov
  14638. @item iv_fov
  14639. @item id_fov
  14640. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14641. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14642. @end table
  14643. @item dfisheye
  14644. Dual fisheye.
  14645. Format specific options:
  14646. @table @option
  14647. @item h_fov
  14648. @item v_fov
  14649. @item d_fov
  14650. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14651. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14652. @item ih_fov
  14653. @item iv_fov
  14654. @item id_fov
  14655. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14656. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14657. @end table
  14658. @item barrel
  14659. @item fb
  14660. @item barrelsplit
  14661. Facebook's 360 formats.
  14662. @item sg
  14663. Stereographic format.
  14664. Format specific options:
  14665. @table @option
  14666. @item h_fov
  14667. @item v_fov
  14668. @item d_fov
  14669. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14670. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14671. @item ih_fov
  14672. @item iv_fov
  14673. @item id_fov
  14674. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14675. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14676. @end table
  14677. @item mercator
  14678. Mercator format.
  14679. @item ball
  14680. Ball format, gives significant distortion toward the back.
  14681. @item hammer
  14682. Hammer-Aitoff map projection format.
  14683. @item sinusoidal
  14684. Sinusoidal map projection format.
  14685. @item fisheye
  14686. Fisheye projection.
  14687. Format specific options:
  14688. @table @option
  14689. @item h_fov
  14690. @item v_fov
  14691. @item d_fov
  14692. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14693. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14694. @item ih_fov
  14695. @item iv_fov
  14696. @item id_fov
  14697. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14698. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14699. @end table
  14700. @item pannini
  14701. Pannini projection.
  14702. Format specific options:
  14703. @table @option
  14704. @item h_fov
  14705. Set output pannini parameter.
  14706. @item ih_fov
  14707. Set input pannini parameter.
  14708. @end table
  14709. @item cylindrical
  14710. Cylindrical projection.
  14711. Format specific options:
  14712. @table @option
  14713. @item h_fov
  14714. @item v_fov
  14715. @item d_fov
  14716. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14717. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14718. @item ih_fov
  14719. @item iv_fov
  14720. @item id_fov
  14721. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14722. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14723. @end table
  14724. @item perspective
  14725. Perspective projection. @i{(output only)}
  14726. Format specific options:
  14727. @table @option
  14728. @item v_fov
  14729. Set perspective parameter.
  14730. @end table
  14731. @item tetrahedron
  14732. Tetrahedron projection.
  14733. @item tsp
  14734. Truncated square pyramid projection.
  14735. @item he
  14736. @item hequirect
  14737. Half equirectangular projection.
  14738. @item equisolid
  14739. Equisolid format.
  14740. Format specific options:
  14741. @table @option
  14742. @item h_fov
  14743. @item v_fov
  14744. @item d_fov
  14745. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14746. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14747. @item ih_fov
  14748. @item iv_fov
  14749. @item id_fov
  14750. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14751. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14752. @end table
  14753. @item og
  14754. Orthographic format.
  14755. Format specific options:
  14756. @table @option
  14757. @item h_fov
  14758. @item v_fov
  14759. @item d_fov
  14760. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14761. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14762. @item ih_fov
  14763. @item iv_fov
  14764. @item id_fov
  14765. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14766. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14767. @end table
  14768. @end table
  14769. @item interp
  14770. Set interpolation method.@*
  14771. @i{Note: more complex interpolation methods require much more memory to run.}
  14772. Available methods:
  14773. @table @samp
  14774. @item near
  14775. @item nearest
  14776. Nearest neighbour.
  14777. @item line
  14778. @item linear
  14779. Bilinear interpolation.
  14780. @item lagrange9
  14781. Lagrange9 interpolation.
  14782. @item cube
  14783. @item cubic
  14784. Bicubic interpolation.
  14785. @item lanc
  14786. @item lanczos
  14787. Lanczos interpolation.
  14788. @item sp16
  14789. @item spline16
  14790. Spline16 interpolation.
  14791. @item gauss
  14792. @item gaussian
  14793. Gaussian interpolation.
  14794. @end table
  14795. Default value is @b{@samp{line}}.
  14796. @item w
  14797. @item h
  14798. Set the output video resolution.
  14799. Default resolution depends on formats.
  14800. @item in_stereo
  14801. @item out_stereo
  14802. Set the input/output stereo format.
  14803. @table @samp
  14804. @item 2d
  14805. 2D mono
  14806. @item sbs
  14807. Side by side
  14808. @item tb
  14809. Top bottom
  14810. @end table
  14811. Default value is @b{@samp{2d}} for input and output format.
  14812. @item yaw
  14813. @item pitch
  14814. @item roll
  14815. Set rotation for the output video. Values in degrees.
  14816. @item rorder
  14817. Set rotation order for the output video. Choose one item for each position.
  14818. @table @samp
  14819. @item y, Y
  14820. yaw
  14821. @item p, P
  14822. pitch
  14823. @item r, R
  14824. roll
  14825. @end table
  14826. Default value is @b{@samp{ypr}}.
  14827. @item h_flip
  14828. @item v_flip
  14829. @item d_flip
  14830. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14831. @item ih_flip
  14832. @item iv_flip
  14833. Set if input video is flipped horizontally/vertically. Boolean values.
  14834. @item in_trans
  14835. Set if input video is transposed. Boolean value, by default disabled.
  14836. @item out_trans
  14837. Set if output video needs to be transposed. Boolean value, by default disabled.
  14838. @item alpha_mask
  14839. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14840. @end table
  14841. @subsection Examples
  14842. @itemize
  14843. @item
  14844. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14845. @example
  14846. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14847. @end example
  14848. @item
  14849. Extract back view of Equi-Angular Cubemap:
  14850. @example
  14851. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14852. @end example
  14853. @item
  14854. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14855. @example
  14856. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14857. @end example
  14858. @end itemize
  14859. @subsection Commands
  14860. This filter supports subset of above options as @ref{commands}.
  14861. @section vaguedenoiser
  14862. Apply a wavelet based denoiser.
  14863. It transforms each frame from the video input into the wavelet domain,
  14864. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14865. the obtained coefficients. It does an inverse wavelet transform after.
  14866. Due to wavelet properties, it should give a nice smoothed result, and
  14867. reduced noise, without blurring picture features.
  14868. This filter accepts the following options:
  14869. @table @option
  14870. @item threshold
  14871. The filtering strength. The higher, the more filtered the video will be.
  14872. Hard thresholding can use a higher threshold than soft thresholding
  14873. before the video looks overfiltered. Default value is 2.
  14874. @item method
  14875. The filtering method the filter will use.
  14876. It accepts the following values:
  14877. @table @samp
  14878. @item hard
  14879. All values under the threshold will be zeroed.
  14880. @item soft
  14881. All values under the threshold will be zeroed. All values above will be
  14882. reduced by the threshold.
  14883. @item garrote
  14884. Scales or nullifies coefficients - intermediary between (more) soft and
  14885. (less) hard thresholding.
  14886. @end table
  14887. Default is garrote.
  14888. @item nsteps
  14889. Number of times, the wavelet will decompose the picture. Picture can't
  14890. be decomposed beyond a particular point (typically, 8 for a 640x480
  14891. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14892. @item percent
  14893. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14894. @item planes
  14895. A list of the planes to process. By default all planes are processed.
  14896. @item type
  14897. The threshold type the filter will use.
  14898. It accepts the following values:
  14899. @table @samp
  14900. @item universal
  14901. Threshold used is same for all decompositions.
  14902. @item bayes
  14903. Threshold used depends also on each decomposition coefficients.
  14904. @end table
  14905. Default is universal.
  14906. @end table
  14907. @section vectorscope
  14908. Display 2 color component values in the two dimensional graph (which is called
  14909. a vectorscope).
  14910. This filter accepts the following options:
  14911. @table @option
  14912. @item mode, m
  14913. Set vectorscope mode.
  14914. It accepts the following values:
  14915. @table @samp
  14916. @item gray
  14917. @item tint
  14918. Gray values are displayed on graph, higher brightness means more pixels have
  14919. same component color value on location in graph. This is the default mode.
  14920. @item color
  14921. Gray values are displayed on graph. Surrounding pixels values which are not
  14922. present in video frame are drawn in gradient of 2 color components which are
  14923. set by option @code{x} and @code{y}. The 3rd color component is static.
  14924. @item color2
  14925. Actual color components values present in video frame are displayed on graph.
  14926. @item color3
  14927. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14928. on graph increases value of another color component, which is luminance by
  14929. default values of @code{x} and @code{y}.
  14930. @item color4
  14931. Actual colors present in video frame are displayed on graph. If two different
  14932. colors map to same position on graph then color with higher value of component
  14933. not present in graph is picked.
  14934. @item color5
  14935. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14936. component picked from radial gradient.
  14937. @end table
  14938. @item x
  14939. Set which color component will be represented on X-axis. Default is @code{1}.
  14940. @item y
  14941. Set which color component will be represented on Y-axis. Default is @code{2}.
  14942. @item intensity, i
  14943. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14944. of color component which represents frequency of (X, Y) location in graph.
  14945. @item envelope, e
  14946. @table @samp
  14947. @item none
  14948. No envelope, this is default.
  14949. @item instant
  14950. Instant envelope, even darkest single pixel will be clearly highlighted.
  14951. @item peak
  14952. Hold maximum and minimum values presented in graph over time. This way you
  14953. can still spot out of range values without constantly looking at vectorscope.
  14954. @item peak+instant
  14955. Peak and instant envelope combined together.
  14956. @end table
  14957. @item graticule, g
  14958. Set what kind of graticule to draw.
  14959. @table @samp
  14960. @item none
  14961. @item green
  14962. @item color
  14963. @item invert
  14964. @end table
  14965. @item opacity, o
  14966. Set graticule opacity.
  14967. @item flags, f
  14968. Set graticule flags.
  14969. @table @samp
  14970. @item white
  14971. Draw graticule for white point.
  14972. @item black
  14973. Draw graticule for black point.
  14974. @item name
  14975. Draw color points short names.
  14976. @end table
  14977. @item bgopacity, b
  14978. Set background opacity.
  14979. @item lthreshold, l
  14980. Set low threshold for color component not represented on X or Y axis.
  14981. Values lower than this value will be ignored. Default is 0.
  14982. Note this value is multiplied with actual max possible value one pixel component
  14983. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14984. is 0.1 * 255 = 25.
  14985. @item hthreshold, h
  14986. Set high threshold for color component not represented on X or Y axis.
  14987. Values higher than this value will be ignored. Default is 1.
  14988. Note this value is multiplied with actual max possible value one pixel component
  14989. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14990. is 0.9 * 255 = 230.
  14991. @item colorspace, c
  14992. Set what kind of colorspace to use when drawing graticule.
  14993. @table @samp
  14994. @item auto
  14995. @item 601
  14996. @item 709
  14997. @end table
  14998. Default is auto.
  14999. @item tint0, t0
  15000. @item tint1, t1
  15001. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15002. This means no tint, and output will remain gray.
  15003. @end table
  15004. @anchor{vidstabdetect}
  15005. @section vidstabdetect
  15006. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15007. @ref{vidstabtransform} for pass 2.
  15008. This filter generates a file with relative translation and rotation
  15009. transform information about subsequent frames, which is then used by
  15010. the @ref{vidstabtransform} filter.
  15011. To enable compilation of this filter you need to configure FFmpeg with
  15012. @code{--enable-libvidstab}.
  15013. This filter accepts the following options:
  15014. @table @option
  15015. @item result
  15016. Set the path to the file used to write the transforms information.
  15017. Default value is @file{transforms.trf}.
  15018. @item shakiness
  15019. Set how shaky the video is and how quick the camera is. It accepts an
  15020. integer in the range 1-10, a value of 1 means little shakiness, a
  15021. value of 10 means strong shakiness. Default value is 5.
  15022. @item accuracy
  15023. Set the accuracy of the detection process. It must be a value in the
  15024. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15025. accuracy. Default value is 15.
  15026. @item stepsize
  15027. Set stepsize of the search process. The region around minimum is
  15028. scanned with 1 pixel resolution. Default value is 6.
  15029. @item mincontrast
  15030. Set minimum contrast. Below this value a local measurement field is
  15031. discarded. Must be a floating point value in the range 0-1. Default
  15032. value is 0.3.
  15033. @item tripod
  15034. Set reference frame number for tripod mode.
  15035. If enabled, the motion of the frames is compared to a reference frame
  15036. in the filtered stream, identified by the specified number. The idea
  15037. is to compensate all movements in a more-or-less static scene and keep
  15038. the camera view absolutely still.
  15039. If set to 0, it is disabled. The frames are counted starting from 1.
  15040. @item show
  15041. Show fields and transforms in the resulting frames. It accepts an
  15042. integer in the range 0-2. Default value is 0, which disables any
  15043. visualization.
  15044. @end table
  15045. @subsection Examples
  15046. @itemize
  15047. @item
  15048. Use default values:
  15049. @example
  15050. vidstabdetect
  15051. @end example
  15052. @item
  15053. Analyze strongly shaky movie and put the results in file
  15054. @file{mytransforms.trf}:
  15055. @example
  15056. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15057. @end example
  15058. @item
  15059. Visualize the result of internal transformations in the resulting
  15060. video:
  15061. @example
  15062. vidstabdetect=show=1
  15063. @end example
  15064. @item
  15065. Analyze a video with medium shakiness using @command{ffmpeg}:
  15066. @example
  15067. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15068. @end example
  15069. @end itemize
  15070. @anchor{vidstabtransform}
  15071. @section vidstabtransform
  15072. Video stabilization/deshaking: pass 2 of 2,
  15073. see @ref{vidstabdetect} for pass 1.
  15074. Read a file with transform information for each frame and
  15075. apply/compensate them. Together with the @ref{vidstabdetect}
  15076. filter this can be used to deshake videos. See also
  15077. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15078. the @ref{unsharp} filter, see below.
  15079. To enable compilation of this filter you need to configure FFmpeg with
  15080. @code{--enable-libvidstab}.
  15081. @subsection Options
  15082. @table @option
  15083. @item input
  15084. Set path to the file used to read the transforms. Default value is
  15085. @file{transforms.trf}.
  15086. @item smoothing
  15087. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15088. camera movements. Default value is 10.
  15089. For example a number of 10 means that 21 frames are used (10 in the
  15090. past and 10 in the future) to smoothen the motion in the video. A
  15091. larger value leads to a smoother video, but limits the acceleration of
  15092. the camera (pan/tilt movements). 0 is a special case where a static
  15093. camera is simulated.
  15094. @item optalgo
  15095. Set the camera path optimization algorithm.
  15096. Accepted values are:
  15097. @table @samp
  15098. @item gauss
  15099. gaussian kernel low-pass filter on camera motion (default)
  15100. @item avg
  15101. averaging on transformations
  15102. @end table
  15103. @item maxshift
  15104. Set maximal number of pixels to translate frames. Default value is -1,
  15105. meaning no limit.
  15106. @item maxangle
  15107. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15108. value is -1, meaning no limit.
  15109. @item crop
  15110. Specify how to deal with borders that may be visible due to movement
  15111. compensation.
  15112. Available values are:
  15113. @table @samp
  15114. @item keep
  15115. keep image information from previous frame (default)
  15116. @item black
  15117. fill the border black
  15118. @end table
  15119. @item invert
  15120. Invert transforms if set to 1. Default value is 0.
  15121. @item relative
  15122. Consider transforms as relative to previous frame if set to 1,
  15123. absolute if set to 0. Default value is 0.
  15124. @item zoom
  15125. Set percentage to zoom. A positive value will result in a zoom-in
  15126. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15127. zoom).
  15128. @item optzoom
  15129. Set optimal zooming to avoid borders.
  15130. Accepted values are:
  15131. @table @samp
  15132. @item 0
  15133. disabled
  15134. @item 1
  15135. optimal static zoom value is determined (only very strong movements
  15136. will lead to visible borders) (default)
  15137. @item 2
  15138. optimal adaptive zoom value is determined (no borders will be
  15139. visible), see @option{zoomspeed}
  15140. @end table
  15141. Note that the value given at zoom is added to the one calculated here.
  15142. @item zoomspeed
  15143. Set percent to zoom maximally each frame (enabled when
  15144. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15145. 0.25.
  15146. @item interpol
  15147. Specify type of interpolation.
  15148. Available values are:
  15149. @table @samp
  15150. @item no
  15151. no interpolation
  15152. @item linear
  15153. linear only horizontal
  15154. @item bilinear
  15155. linear in both directions (default)
  15156. @item bicubic
  15157. cubic in both directions (slow)
  15158. @end table
  15159. @item tripod
  15160. Enable virtual tripod mode if set to 1, which is equivalent to
  15161. @code{relative=0:smoothing=0}. Default value is 0.
  15162. Use also @code{tripod} option of @ref{vidstabdetect}.
  15163. @item debug
  15164. Increase log verbosity if set to 1. Also the detected global motions
  15165. are written to the temporary file @file{global_motions.trf}. Default
  15166. value is 0.
  15167. @end table
  15168. @subsection Examples
  15169. @itemize
  15170. @item
  15171. Use @command{ffmpeg} for a typical stabilization with default values:
  15172. @example
  15173. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15174. @end example
  15175. Note the use of the @ref{unsharp} filter which is always recommended.
  15176. @item
  15177. Zoom in a bit more and load transform data from a given file:
  15178. @example
  15179. vidstabtransform=zoom=5:input="mytransforms.trf"
  15180. @end example
  15181. @item
  15182. Smoothen the video even more:
  15183. @example
  15184. vidstabtransform=smoothing=30
  15185. @end example
  15186. @end itemize
  15187. @section vflip
  15188. Flip the input video vertically.
  15189. For example, to vertically flip a video with @command{ffmpeg}:
  15190. @example
  15191. ffmpeg -i in.avi -vf "vflip" out.avi
  15192. @end example
  15193. @section vfrdet
  15194. Detect variable frame rate video.
  15195. This filter tries to detect if the input is variable or constant frame rate.
  15196. At end it will output number of frames detected as having variable delta pts,
  15197. and ones with constant delta pts.
  15198. If there was frames with variable delta, than it will also show min, max and
  15199. average delta encountered.
  15200. @section vibrance
  15201. Boost or alter saturation.
  15202. The filter accepts the following options:
  15203. @table @option
  15204. @item intensity
  15205. Set strength of boost if positive value or strength of alter if negative value.
  15206. Default is 0. Allowed range is from -2 to 2.
  15207. @item rbal
  15208. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15209. @item gbal
  15210. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15211. @item bbal
  15212. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15213. @item rlum
  15214. Set the red luma coefficient.
  15215. @item glum
  15216. Set the green luma coefficient.
  15217. @item blum
  15218. Set the blue luma coefficient.
  15219. @item alternate
  15220. If @code{intensity} is negative and this is set to 1, colors will change,
  15221. otherwise colors will be less saturated, more towards gray.
  15222. @end table
  15223. @subsection Commands
  15224. This filter supports the all above options as @ref{commands}.
  15225. @anchor{vignette}
  15226. @section vignette
  15227. Make or reverse a natural vignetting effect.
  15228. The filter accepts the following options:
  15229. @table @option
  15230. @item angle, a
  15231. Set lens angle expression as a number of radians.
  15232. The value is clipped in the @code{[0,PI/2]} range.
  15233. Default value: @code{"PI/5"}
  15234. @item x0
  15235. @item y0
  15236. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15237. by default.
  15238. @item mode
  15239. Set forward/backward mode.
  15240. Available modes are:
  15241. @table @samp
  15242. @item forward
  15243. The larger the distance from the central point, the darker the image becomes.
  15244. @item backward
  15245. The larger the distance from the central point, the brighter the image becomes.
  15246. This can be used to reverse a vignette effect, though there is no automatic
  15247. detection to extract the lens @option{angle} and other settings (yet). It can
  15248. also be used to create a burning effect.
  15249. @end table
  15250. Default value is @samp{forward}.
  15251. @item eval
  15252. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15253. It accepts the following values:
  15254. @table @samp
  15255. @item init
  15256. Evaluate expressions only once during the filter initialization.
  15257. @item frame
  15258. Evaluate expressions for each incoming frame. This is way slower than the
  15259. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15260. allows advanced dynamic expressions.
  15261. @end table
  15262. Default value is @samp{init}.
  15263. @item dither
  15264. Set dithering to reduce the circular banding effects. Default is @code{1}
  15265. (enabled).
  15266. @item aspect
  15267. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15268. Setting this value to the SAR of the input will make a rectangular vignetting
  15269. following the dimensions of the video.
  15270. Default is @code{1/1}.
  15271. @end table
  15272. @subsection Expressions
  15273. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15274. following parameters.
  15275. @table @option
  15276. @item w
  15277. @item h
  15278. input width and height
  15279. @item n
  15280. the number of input frame, starting from 0
  15281. @item pts
  15282. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15283. @var{TB} units, NAN if undefined
  15284. @item r
  15285. frame rate of the input video, NAN if the input frame rate is unknown
  15286. @item t
  15287. the PTS (Presentation TimeStamp) of the filtered video frame,
  15288. expressed in seconds, NAN if undefined
  15289. @item tb
  15290. time base of the input video
  15291. @end table
  15292. @subsection Examples
  15293. @itemize
  15294. @item
  15295. Apply simple strong vignetting effect:
  15296. @example
  15297. vignette=PI/4
  15298. @end example
  15299. @item
  15300. Make a flickering vignetting:
  15301. @example
  15302. vignette='PI/4+random(1)*PI/50':eval=frame
  15303. @end example
  15304. @end itemize
  15305. @section vmafmotion
  15306. Obtain the average VMAF motion score of a video.
  15307. It is one of the component metrics of VMAF.
  15308. The obtained average motion score is printed through the logging system.
  15309. The filter accepts the following options:
  15310. @table @option
  15311. @item stats_file
  15312. If specified, the filter will use the named file to save the motion score of
  15313. each frame with respect to the previous frame.
  15314. When filename equals "-" the data is sent to standard output.
  15315. @end table
  15316. Example:
  15317. @example
  15318. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15319. @end example
  15320. @section vstack
  15321. Stack input videos vertically.
  15322. All streams must be of same pixel format and of same width.
  15323. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15324. to create same output.
  15325. The filter accepts the following options:
  15326. @table @option
  15327. @item inputs
  15328. Set number of input streams. Default is 2.
  15329. @item shortest
  15330. If set to 1, force the output to terminate when the shortest input
  15331. terminates. Default value is 0.
  15332. @end table
  15333. @section w3fdif
  15334. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15335. Deinterlacing Filter").
  15336. Based on the process described by Martin Weston for BBC R&D, and
  15337. implemented based on the de-interlace algorithm written by Jim
  15338. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15339. uses filter coefficients calculated by BBC R&D.
  15340. This filter uses field-dominance information in frame to decide which
  15341. of each pair of fields to place first in the output.
  15342. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15343. There are two sets of filter coefficients, so called "simple"
  15344. and "complex". Which set of filter coefficients is used can
  15345. be set by passing an optional parameter:
  15346. @table @option
  15347. @item filter
  15348. Set the interlacing filter coefficients. Accepts one of the following values:
  15349. @table @samp
  15350. @item simple
  15351. Simple filter coefficient set.
  15352. @item complex
  15353. More-complex filter coefficient set.
  15354. @end table
  15355. Default value is @samp{complex}.
  15356. @item deint
  15357. Specify which frames to deinterlace. Accepts one of the following values:
  15358. @table @samp
  15359. @item all
  15360. Deinterlace all frames,
  15361. @item interlaced
  15362. Only deinterlace frames marked as interlaced.
  15363. @end table
  15364. Default value is @samp{all}.
  15365. @end table
  15366. @section waveform
  15367. Video waveform monitor.
  15368. The waveform monitor plots color component intensity. By default luminance
  15369. only. Each column of the waveform corresponds to a column of pixels in the
  15370. source video.
  15371. It accepts the following options:
  15372. @table @option
  15373. @item mode, m
  15374. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15375. In row mode, the graph on the left side represents color component value 0 and
  15376. the right side represents value = 255. In column mode, the top side represents
  15377. color component value = 0 and bottom side represents value = 255.
  15378. @item intensity, i
  15379. Set intensity. Smaller values are useful to find out how many values of the same
  15380. luminance are distributed across input rows/columns.
  15381. Default value is @code{0.04}. Allowed range is [0, 1].
  15382. @item mirror, r
  15383. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15384. In mirrored mode, higher values will be represented on the left
  15385. side for @code{row} mode and at the top for @code{column} mode. Default is
  15386. @code{1} (mirrored).
  15387. @item display, d
  15388. Set display mode.
  15389. It accepts the following values:
  15390. @table @samp
  15391. @item overlay
  15392. Presents information identical to that in the @code{parade}, except
  15393. that the graphs representing color components are superimposed directly
  15394. over one another.
  15395. This display mode makes it easier to spot relative differences or similarities
  15396. in overlapping areas of the color components that are supposed to be identical,
  15397. such as neutral whites, grays, or blacks.
  15398. @item stack
  15399. Display separate graph for the color components side by side in
  15400. @code{row} mode or one below the other in @code{column} mode.
  15401. @item parade
  15402. Display separate graph for the color components side by side in
  15403. @code{column} mode or one below the other in @code{row} mode.
  15404. Using this display mode makes it easy to spot color casts in the highlights
  15405. and shadows of an image, by comparing the contours of the top and the bottom
  15406. graphs of each waveform. Since whites, grays, and blacks are characterized
  15407. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15408. should display three waveforms of roughly equal width/height. If not, the
  15409. correction is easy to perform by making level adjustments the three waveforms.
  15410. @end table
  15411. Default is @code{stack}.
  15412. @item components, c
  15413. Set which color components to display. Default is 1, which means only luminance
  15414. or red color component if input is in RGB colorspace. If is set for example to
  15415. 7 it will display all 3 (if) available color components.
  15416. @item envelope, e
  15417. @table @samp
  15418. @item none
  15419. No envelope, this is default.
  15420. @item instant
  15421. Instant envelope, minimum and maximum values presented in graph will be easily
  15422. visible even with small @code{step} value.
  15423. @item peak
  15424. Hold minimum and maximum values presented in graph across time. This way you
  15425. can still spot out of range values without constantly looking at waveforms.
  15426. @item peak+instant
  15427. Peak and instant envelope combined together.
  15428. @end table
  15429. @item filter, f
  15430. @table @samp
  15431. @item lowpass
  15432. No filtering, this is default.
  15433. @item flat
  15434. Luma and chroma combined together.
  15435. @item aflat
  15436. Similar as above, but shows difference between blue and red chroma.
  15437. @item xflat
  15438. Similar as above, but use different colors.
  15439. @item yflat
  15440. Similar as above, but again with different colors.
  15441. @item chroma
  15442. Displays only chroma.
  15443. @item color
  15444. Displays actual color value on waveform.
  15445. @item acolor
  15446. Similar as above, but with luma showing frequency of chroma values.
  15447. @end table
  15448. @item graticule, g
  15449. Set which graticule to display.
  15450. @table @samp
  15451. @item none
  15452. Do not display graticule.
  15453. @item green
  15454. Display green graticule showing legal broadcast ranges.
  15455. @item orange
  15456. Display orange graticule showing legal broadcast ranges.
  15457. @item invert
  15458. Display invert graticule showing legal broadcast ranges.
  15459. @end table
  15460. @item opacity, o
  15461. Set graticule opacity.
  15462. @item flags, fl
  15463. Set graticule flags.
  15464. @table @samp
  15465. @item numbers
  15466. Draw numbers above lines. By default enabled.
  15467. @item dots
  15468. Draw dots instead of lines.
  15469. @end table
  15470. @item scale, s
  15471. Set scale used for displaying graticule.
  15472. @table @samp
  15473. @item digital
  15474. @item millivolts
  15475. @item ire
  15476. @end table
  15477. Default is digital.
  15478. @item bgopacity, b
  15479. Set background opacity.
  15480. @item tint0, t0
  15481. @item tint1, t1
  15482. Set tint for output.
  15483. Only used with lowpass filter and when display is not overlay and input
  15484. pixel formats are not RGB.
  15485. @end table
  15486. @section weave, doubleweave
  15487. The @code{weave} takes a field-based video input and join
  15488. each two sequential fields into single frame, producing a new double
  15489. height clip with half the frame rate and half the frame count.
  15490. The @code{doubleweave} works same as @code{weave} but without
  15491. halving frame rate and frame count.
  15492. It accepts the following option:
  15493. @table @option
  15494. @item first_field
  15495. Set first field. Available values are:
  15496. @table @samp
  15497. @item top, t
  15498. Set the frame as top-field-first.
  15499. @item bottom, b
  15500. Set the frame as bottom-field-first.
  15501. @end table
  15502. @end table
  15503. @subsection Examples
  15504. @itemize
  15505. @item
  15506. Interlace video using @ref{select} and @ref{separatefields} filter:
  15507. @example
  15508. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15509. @end example
  15510. @end itemize
  15511. @section xbr
  15512. Apply the xBR high-quality magnification filter which is designed for pixel
  15513. art. It follows a set of edge-detection rules, see
  15514. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15515. It accepts the following option:
  15516. @table @option
  15517. @item n
  15518. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15519. @code{3xBR} and @code{4} for @code{4xBR}.
  15520. Default is @code{3}.
  15521. @end table
  15522. @section xfade
  15523. Apply cross fade from one input video stream to another input video stream.
  15524. The cross fade is applied for specified duration.
  15525. The filter accepts the following options:
  15526. @table @option
  15527. @item transition
  15528. Set one of available transition effects:
  15529. @table @samp
  15530. @item custom
  15531. @item fade
  15532. @item wipeleft
  15533. @item wiperight
  15534. @item wipeup
  15535. @item wipedown
  15536. @item slideleft
  15537. @item slideright
  15538. @item slideup
  15539. @item slidedown
  15540. @item circlecrop
  15541. @item rectcrop
  15542. @item distance
  15543. @item fadeblack
  15544. @item fadewhite
  15545. @item radial
  15546. @item smoothleft
  15547. @item smoothright
  15548. @item smoothup
  15549. @item smoothdown
  15550. @item circleopen
  15551. @item circleclose
  15552. @item vertopen
  15553. @item vertclose
  15554. @item horzopen
  15555. @item horzclose
  15556. @item dissolve
  15557. @item pixelize
  15558. @item diagtl
  15559. @item diagtr
  15560. @item diagbl
  15561. @item diagbr
  15562. @item hlslice
  15563. @item hrslice
  15564. @item vuslice
  15565. @item vdslice
  15566. @item hblur
  15567. @end table
  15568. Default transition effect is fade.
  15569. @item duration
  15570. Set cross fade duration in seconds.
  15571. Default duration is 1 second.
  15572. @item offset
  15573. Set cross fade start relative to first input stream in seconds.
  15574. Default offset is 0.
  15575. @item expr
  15576. Set expression for custom transition effect.
  15577. The expressions can use the following variables and functions:
  15578. @table @option
  15579. @item X
  15580. @item Y
  15581. The coordinates of the current sample.
  15582. @item W
  15583. @item H
  15584. The width and height of the image.
  15585. @item P
  15586. Progress of transition effect.
  15587. @item PLANE
  15588. Currently processed plane.
  15589. @item A
  15590. Return value of first input at current location and plane.
  15591. @item B
  15592. Return value of second input at current location and plane.
  15593. @item a0(x, y)
  15594. @item a1(x, y)
  15595. @item a2(x, y)
  15596. @item a3(x, y)
  15597. Return the value of the pixel at location (@var{x},@var{y}) of the
  15598. first/second/third/fourth component of first input.
  15599. @item b0(x, y)
  15600. @item b1(x, y)
  15601. @item b2(x, y)
  15602. @item b3(x, y)
  15603. Return the value of the pixel at location (@var{x},@var{y}) of the
  15604. first/second/third/fourth component of second input.
  15605. @end table
  15606. @end table
  15607. @subsection Examples
  15608. @itemize
  15609. @item
  15610. Cross fade from one input video to another input video, with fade transition and duration of transition
  15611. of 2 seconds starting at offset of 5 seconds:
  15612. @example
  15613. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15614. @end example
  15615. @end itemize
  15616. @section xmedian
  15617. Pick median pixels from several input videos.
  15618. The filter accepts the following options:
  15619. @table @option
  15620. @item inputs
  15621. Set number of inputs.
  15622. Default is 3. Allowed range is from 3 to 255.
  15623. If number of inputs is even number, than result will be mean value between two median values.
  15624. @item planes
  15625. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15626. @item percentile
  15627. Set median percentile. Default value is @code{0.5}.
  15628. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15629. minimum values, and @code{1} maximum values.
  15630. @end table
  15631. @section xstack
  15632. Stack video inputs into custom layout.
  15633. All streams must be of same pixel format.
  15634. The filter accepts the following options:
  15635. @table @option
  15636. @item inputs
  15637. Set number of input streams. Default is 2.
  15638. @item layout
  15639. Specify layout of inputs.
  15640. This option requires the desired layout configuration to be explicitly set by the user.
  15641. This sets position of each video input in output. Each input
  15642. is separated by '|'.
  15643. The first number represents the column, and the second number represents the row.
  15644. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15645. where X is video input from which to take width or height.
  15646. Multiple values can be used when separated by '+'. In such
  15647. case values are summed together.
  15648. Note that if inputs are of different sizes gaps may appear, as not all of
  15649. the output video frame will be filled. Similarly, videos can overlap each
  15650. other if their position doesn't leave enough space for the full frame of
  15651. adjoining videos.
  15652. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15653. a layout must be set by the user.
  15654. @item shortest
  15655. If set to 1, force the output to terminate when the shortest input
  15656. terminates. Default value is 0.
  15657. @item fill
  15658. If set to valid color, all unused pixels will be filled with that color.
  15659. By default fill is set to none, so it is disabled.
  15660. @end table
  15661. @subsection Examples
  15662. @itemize
  15663. @item
  15664. Display 4 inputs into 2x2 grid.
  15665. Layout:
  15666. @example
  15667. input1(0, 0) | input3(w0, 0)
  15668. input2(0, h0) | input4(w0, h0)
  15669. @end example
  15670. @example
  15671. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15672. @end example
  15673. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15674. @item
  15675. Display 4 inputs into 1x4 grid.
  15676. Layout:
  15677. @example
  15678. input1(0, 0)
  15679. input2(0, h0)
  15680. input3(0, h0+h1)
  15681. input4(0, h0+h1+h2)
  15682. @end example
  15683. @example
  15684. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15685. @end example
  15686. Note that if inputs are of different widths, unused space will appear.
  15687. @item
  15688. Display 9 inputs into 3x3 grid.
  15689. Layout:
  15690. @example
  15691. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15692. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15693. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15694. @end example
  15695. @example
  15696. 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
  15697. @end example
  15698. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15699. @item
  15700. Display 16 inputs into 4x4 grid.
  15701. Layout:
  15702. @example
  15703. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15704. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15705. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15706. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15707. @end example
  15708. @example
  15709. 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|
  15710. 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
  15711. @end example
  15712. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15713. @end itemize
  15714. @anchor{yadif}
  15715. @section yadif
  15716. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15717. filter").
  15718. It accepts the following parameters:
  15719. @table @option
  15720. @item mode
  15721. The interlacing mode to adopt. It accepts one of the following values:
  15722. @table @option
  15723. @item 0, send_frame
  15724. Output one frame for each frame.
  15725. @item 1, send_field
  15726. Output one frame for each field.
  15727. @item 2, send_frame_nospatial
  15728. Like @code{send_frame}, but it skips the spatial interlacing check.
  15729. @item 3, send_field_nospatial
  15730. Like @code{send_field}, but it skips the spatial interlacing check.
  15731. @end table
  15732. The default value is @code{send_frame}.
  15733. @item parity
  15734. The picture field parity assumed for the input interlaced video. It accepts one
  15735. of the following values:
  15736. @table @option
  15737. @item 0, tff
  15738. Assume the top field is first.
  15739. @item 1, bff
  15740. Assume the bottom field is first.
  15741. @item -1, auto
  15742. Enable automatic detection of field parity.
  15743. @end table
  15744. The default value is @code{auto}.
  15745. If the interlacing is unknown or the decoder does not export this information,
  15746. top field first will be assumed.
  15747. @item deint
  15748. Specify which frames to deinterlace. Accepts one of the following
  15749. values:
  15750. @table @option
  15751. @item 0, all
  15752. Deinterlace all frames.
  15753. @item 1, interlaced
  15754. Only deinterlace frames marked as interlaced.
  15755. @end table
  15756. The default value is @code{all}.
  15757. @end table
  15758. @section yadif_cuda
  15759. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15760. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15761. and/or nvenc.
  15762. It accepts the following parameters:
  15763. @table @option
  15764. @item mode
  15765. The interlacing mode to adopt. It accepts one of the following values:
  15766. @table @option
  15767. @item 0, send_frame
  15768. Output one frame for each frame.
  15769. @item 1, send_field
  15770. Output one frame for each field.
  15771. @item 2, send_frame_nospatial
  15772. Like @code{send_frame}, but it skips the spatial interlacing check.
  15773. @item 3, send_field_nospatial
  15774. Like @code{send_field}, but it skips the spatial interlacing check.
  15775. @end table
  15776. The default value is @code{send_frame}.
  15777. @item parity
  15778. The picture field parity assumed for the input interlaced video. It accepts one
  15779. of the following values:
  15780. @table @option
  15781. @item 0, tff
  15782. Assume the top field is first.
  15783. @item 1, bff
  15784. Assume the bottom field is first.
  15785. @item -1, auto
  15786. Enable automatic detection of field parity.
  15787. @end table
  15788. The default value is @code{auto}.
  15789. If the interlacing is unknown or the decoder does not export this information,
  15790. top field first will be assumed.
  15791. @item deint
  15792. Specify which frames to deinterlace. Accepts one of the following
  15793. values:
  15794. @table @option
  15795. @item 0, all
  15796. Deinterlace all frames.
  15797. @item 1, interlaced
  15798. Only deinterlace frames marked as interlaced.
  15799. @end table
  15800. The default value is @code{all}.
  15801. @end table
  15802. @section yaepblur
  15803. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15804. The algorithm is described in
  15805. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15806. It accepts the following parameters:
  15807. @table @option
  15808. @item radius, r
  15809. Set the window radius. Default value is 3.
  15810. @item planes, p
  15811. Set which planes to filter. Default is only the first plane.
  15812. @item sigma, s
  15813. Set blur strength. Default value is 128.
  15814. @end table
  15815. @subsection Commands
  15816. This filter supports same @ref{commands} as options.
  15817. @section zoompan
  15818. Apply Zoom & Pan effect.
  15819. This filter accepts the following options:
  15820. @table @option
  15821. @item zoom, z
  15822. Set the zoom expression. Range is 1-10. Default is 1.
  15823. @item x
  15824. @item y
  15825. Set the x and y expression. Default is 0.
  15826. @item d
  15827. Set the duration expression in number of frames.
  15828. This sets for how many number of frames effect will last for
  15829. single input image.
  15830. @item s
  15831. Set the output image size, default is 'hd720'.
  15832. @item fps
  15833. Set the output frame rate, default is '25'.
  15834. @end table
  15835. Each expression can contain the following constants:
  15836. @table @option
  15837. @item in_w, iw
  15838. Input width.
  15839. @item in_h, ih
  15840. Input height.
  15841. @item out_w, ow
  15842. Output width.
  15843. @item out_h, oh
  15844. Output height.
  15845. @item in
  15846. Input frame count.
  15847. @item on
  15848. Output frame count.
  15849. @item in_time, it
  15850. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15851. @item out_time, time, ot
  15852. The output timestamp expressed in seconds.
  15853. @item x
  15854. @item y
  15855. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15856. for current input frame.
  15857. @item px
  15858. @item py
  15859. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15860. not yet such frame (first input frame).
  15861. @item zoom
  15862. Last calculated zoom from 'z' expression for current input frame.
  15863. @item pzoom
  15864. Last calculated zoom of last output frame of previous input frame.
  15865. @item duration
  15866. Number of output frames for current input frame. Calculated from 'd' expression
  15867. for each input frame.
  15868. @item pduration
  15869. number of output frames created for previous input frame
  15870. @item a
  15871. Rational number: input width / input height
  15872. @item sar
  15873. sample aspect ratio
  15874. @item dar
  15875. display aspect ratio
  15876. @end table
  15877. @subsection Examples
  15878. @itemize
  15879. @item
  15880. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  15881. @example
  15882. 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
  15883. @end example
  15884. @item
  15885. Zoom in up to 1.5x and pan always at center of picture:
  15886. @example
  15887. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15888. @end example
  15889. @item
  15890. Same as above but without pausing:
  15891. @example
  15892. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15893. @end example
  15894. @item
  15895. Zoom in 2x into center of picture only for the first second of the input video:
  15896. @example
  15897. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15898. @end example
  15899. @end itemize
  15900. @anchor{zscale}
  15901. @section zscale
  15902. Scale (resize) the input video, using the z.lib library:
  15903. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15904. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15905. The zscale filter forces the output display aspect ratio to be the same
  15906. as the input, by changing the output sample aspect ratio.
  15907. If the input image format is different from the format requested by
  15908. the next filter, the zscale filter will convert the input to the
  15909. requested format.
  15910. @subsection Options
  15911. The filter accepts the following options.
  15912. @table @option
  15913. @item width, w
  15914. @item height, h
  15915. Set the output video dimension expression. Default value is the input
  15916. dimension.
  15917. If the @var{width} or @var{w} value is 0, the input width is used for
  15918. the output. If the @var{height} or @var{h} value is 0, the input height
  15919. is used for the output.
  15920. If one and only one of the values is -n with n >= 1, the zscale filter
  15921. will use a value that maintains the aspect ratio of the input image,
  15922. calculated from the other specified dimension. After that it will,
  15923. however, make sure that the calculated dimension is divisible by n and
  15924. adjust the value if necessary.
  15925. If both values are -n with n >= 1, the behavior will be identical to
  15926. both values being set to 0 as previously detailed.
  15927. See below for the list of accepted constants for use in the dimension
  15928. expression.
  15929. @item size, s
  15930. Set the video size. For the syntax of this option, check the
  15931. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15932. @item dither, d
  15933. Set the dither type.
  15934. Possible values are:
  15935. @table @var
  15936. @item none
  15937. @item ordered
  15938. @item random
  15939. @item error_diffusion
  15940. @end table
  15941. Default is none.
  15942. @item filter, f
  15943. Set the resize filter type.
  15944. Possible values are:
  15945. @table @var
  15946. @item point
  15947. @item bilinear
  15948. @item bicubic
  15949. @item spline16
  15950. @item spline36
  15951. @item lanczos
  15952. @end table
  15953. Default is bilinear.
  15954. @item range, r
  15955. Set the color range.
  15956. Possible values are:
  15957. @table @var
  15958. @item input
  15959. @item limited
  15960. @item full
  15961. @end table
  15962. Default is same as input.
  15963. @item primaries, p
  15964. Set the color primaries.
  15965. Possible values are:
  15966. @table @var
  15967. @item input
  15968. @item 709
  15969. @item unspecified
  15970. @item 170m
  15971. @item 240m
  15972. @item 2020
  15973. @end table
  15974. Default is same as input.
  15975. @item transfer, t
  15976. Set the transfer characteristics.
  15977. Possible values are:
  15978. @table @var
  15979. @item input
  15980. @item 709
  15981. @item unspecified
  15982. @item 601
  15983. @item linear
  15984. @item 2020_10
  15985. @item 2020_12
  15986. @item smpte2084
  15987. @item iec61966-2-1
  15988. @item arib-std-b67
  15989. @end table
  15990. Default is same as input.
  15991. @item matrix, m
  15992. Set the colorspace matrix.
  15993. Possible value are:
  15994. @table @var
  15995. @item input
  15996. @item 709
  15997. @item unspecified
  15998. @item 470bg
  15999. @item 170m
  16000. @item 2020_ncl
  16001. @item 2020_cl
  16002. @end table
  16003. Default is same as input.
  16004. @item rangein, rin
  16005. Set the input color range.
  16006. Possible values are:
  16007. @table @var
  16008. @item input
  16009. @item limited
  16010. @item full
  16011. @end table
  16012. Default is same as input.
  16013. @item primariesin, pin
  16014. Set the input color primaries.
  16015. Possible values are:
  16016. @table @var
  16017. @item input
  16018. @item 709
  16019. @item unspecified
  16020. @item 170m
  16021. @item 240m
  16022. @item 2020
  16023. @end table
  16024. Default is same as input.
  16025. @item transferin, tin
  16026. Set the input transfer characteristics.
  16027. Possible values are:
  16028. @table @var
  16029. @item input
  16030. @item 709
  16031. @item unspecified
  16032. @item 601
  16033. @item linear
  16034. @item 2020_10
  16035. @item 2020_12
  16036. @end table
  16037. Default is same as input.
  16038. @item matrixin, min
  16039. Set the input colorspace matrix.
  16040. Possible value are:
  16041. @table @var
  16042. @item input
  16043. @item 709
  16044. @item unspecified
  16045. @item 470bg
  16046. @item 170m
  16047. @item 2020_ncl
  16048. @item 2020_cl
  16049. @end table
  16050. @item chromal, c
  16051. Set the output chroma location.
  16052. Possible values are:
  16053. @table @var
  16054. @item input
  16055. @item left
  16056. @item center
  16057. @item topleft
  16058. @item top
  16059. @item bottomleft
  16060. @item bottom
  16061. @end table
  16062. @item chromalin, cin
  16063. Set the input chroma location.
  16064. Possible values are:
  16065. @table @var
  16066. @item input
  16067. @item left
  16068. @item center
  16069. @item topleft
  16070. @item top
  16071. @item bottomleft
  16072. @item bottom
  16073. @end table
  16074. @item npl
  16075. Set the nominal peak luminance.
  16076. @end table
  16077. The values of the @option{w} and @option{h} options are expressions
  16078. containing the following constants:
  16079. @table @var
  16080. @item in_w
  16081. @item in_h
  16082. The input width and height
  16083. @item iw
  16084. @item ih
  16085. These are the same as @var{in_w} and @var{in_h}.
  16086. @item out_w
  16087. @item out_h
  16088. The output (scaled) width and height
  16089. @item ow
  16090. @item oh
  16091. These are the same as @var{out_w} and @var{out_h}
  16092. @item a
  16093. The same as @var{iw} / @var{ih}
  16094. @item sar
  16095. input sample aspect ratio
  16096. @item dar
  16097. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16098. @item hsub
  16099. @item vsub
  16100. horizontal and vertical input chroma subsample values. For example for the
  16101. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16102. @item ohsub
  16103. @item ovsub
  16104. horizontal and vertical output chroma subsample values. For example for the
  16105. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16106. @end table
  16107. @subsection Commands
  16108. This filter supports the following commands:
  16109. @table @option
  16110. @item width, w
  16111. @item height, h
  16112. Set the output video dimension expression.
  16113. The command accepts the same syntax of the corresponding option.
  16114. If the specified expression is not valid, it is kept at its current
  16115. value.
  16116. @end table
  16117. @c man end VIDEO FILTERS
  16118. @chapter OpenCL Video Filters
  16119. @c man begin OPENCL VIDEO FILTERS
  16120. Below is a description of the currently available OpenCL video filters.
  16121. To enable compilation of these filters you need to configure FFmpeg with
  16122. @code{--enable-opencl}.
  16123. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16124. @table @option
  16125. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16126. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16127. given device parameters.
  16128. @item -filter_hw_device @var{name}
  16129. Pass the hardware device called @var{name} to all filters in any filter graph.
  16130. @end table
  16131. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16132. @itemize
  16133. @item
  16134. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16135. @example
  16136. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16137. @end example
  16138. @end itemize
  16139. 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.
  16140. @section avgblur_opencl
  16141. Apply average blur filter.
  16142. The filter accepts the following options:
  16143. @table @option
  16144. @item sizeX
  16145. Set horizontal radius size.
  16146. Range is @code{[1, 1024]} and default value is @code{1}.
  16147. @item planes
  16148. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16149. @item sizeY
  16150. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16151. @end table
  16152. @subsection Example
  16153. @itemize
  16154. @item
  16155. 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.
  16156. @example
  16157. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16158. @end example
  16159. @end itemize
  16160. @section boxblur_opencl
  16161. Apply a boxblur algorithm to the input video.
  16162. It accepts the following parameters:
  16163. @table @option
  16164. @item luma_radius, lr
  16165. @item luma_power, lp
  16166. @item chroma_radius, cr
  16167. @item chroma_power, cp
  16168. @item alpha_radius, ar
  16169. @item alpha_power, ap
  16170. @end table
  16171. A description of the accepted options follows.
  16172. @table @option
  16173. @item luma_radius, lr
  16174. @item chroma_radius, cr
  16175. @item alpha_radius, ar
  16176. Set an expression for the box radius in pixels used for blurring the
  16177. corresponding input plane.
  16178. The radius value must be a non-negative number, and must not be
  16179. greater than the value of the expression @code{min(w,h)/2} for the
  16180. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16181. planes.
  16182. Default value for @option{luma_radius} is "2". If not specified,
  16183. @option{chroma_radius} and @option{alpha_radius} default to the
  16184. corresponding value set for @option{luma_radius}.
  16185. The expressions can contain the following constants:
  16186. @table @option
  16187. @item w
  16188. @item h
  16189. The input width and height in pixels.
  16190. @item cw
  16191. @item ch
  16192. The input chroma image width and height in pixels.
  16193. @item hsub
  16194. @item vsub
  16195. The horizontal and vertical chroma subsample values. For example, for the
  16196. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16197. @end table
  16198. @item luma_power, lp
  16199. @item chroma_power, cp
  16200. @item alpha_power, ap
  16201. Specify how many times the boxblur filter is applied to the
  16202. corresponding plane.
  16203. Default value for @option{luma_power} is 2. If not specified,
  16204. @option{chroma_power} and @option{alpha_power} default to the
  16205. corresponding value set for @option{luma_power}.
  16206. A value of 0 will disable the effect.
  16207. @end table
  16208. @subsection Examples
  16209. 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.
  16210. @itemize
  16211. @item
  16212. Apply a boxblur filter with the luma, chroma, and alpha radius
  16213. 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.
  16214. @example
  16215. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16216. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16217. @end example
  16218. @item
  16219. 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.
  16220. For the luma plane, a 2x2 box radius will be run once.
  16221. For the chroma plane, a 4x4 box radius will be run 5 times.
  16222. For the alpha plane, a 3x3 box radius will be run 7 times.
  16223. @example
  16224. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16225. @end example
  16226. @end itemize
  16227. @section colorkey_opencl
  16228. RGB colorspace color keying.
  16229. The filter accepts the following options:
  16230. @table @option
  16231. @item color
  16232. The color which will be replaced with transparency.
  16233. @item similarity
  16234. Similarity percentage with the key color.
  16235. 0.01 matches only the exact key color, while 1.0 matches everything.
  16236. @item blend
  16237. Blend percentage.
  16238. 0.0 makes pixels either fully transparent, or not transparent at all.
  16239. Higher values result in semi-transparent pixels, with a higher transparency
  16240. the more similar the pixels color is to the key color.
  16241. @end table
  16242. @subsection Examples
  16243. @itemize
  16244. @item
  16245. Make every semi-green pixel in the input transparent with some slight blending:
  16246. @example
  16247. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16248. @end example
  16249. @end itemize
  16250. @section convolution_opencl
  16251. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16252. The filter accepts the following options:
  16253. @table @option
  16254. @item 0m
  16255. @item 1m
  16256. @item 2m
  16257. @item 3m
  16258. Set matrix for each plane.
  16259. Matrix is sequence of 9, 25 or 49 signed numbers.
  16260. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16261. @item 0rdiv
  16262. @item 1rdiv
  16263. @item 2rdiv
  16264. @item 3rdiv
  16265. Set multiplier for calculated value for each plane.
  16266. If unset or 0, it will be sum of all matrix elements.
  16267. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16268. @item 0bias
  16269. @item 1bias
  16270. @item 2bias
  16271. @item 3bias
  16272. Set bias for each plane. This value is added to the result of the multiplication.
  16273. Useful for making the overall image brighter or darker.
  16274. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16275. @end table
  16276. @subsection Examples
  16277. @itemize
  16278. @item
  16279. Apply sharpen:
  16280. @example
  16281. -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
  16282. @end example
  16283. @item
  16284. Apply blur:
  16285. @example
  16286. -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
  16287. @end example
  16288. @item
  16289. Apply edge enhance:
  16290. @example
  16291. -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
  16292. @end example
  16293. @item
  16294. Apply edge detect:
  16295. @example
  16296. -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
  16297. @end example
  16298. @item
  16299. Apply laplacian edge detector which includes diagonals:
  16300. @example
  16301. -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
  16302. @end example
  16303. @item
  16304. Apply emboss:
  16305. @example
  16306. -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
  16307. @end example
  16308. @end itemize
  16309. @section erosion_opencl
  16310. Apply erosion effect to the video.
  16311. This filter replaces the pixel by the local(3x3) minimum.
  16312. It accepts the following options:
  16313. @table @option
  16314. @item threshold0
  16315. @item threshold1
  16316. @item threshold2
  16317. @item threshold3
  16318. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16319. If @code{0}, plane will remain unchanged.
  16320. @item coordinates
  16321. Flag which specifies the pixel to refer to.
  16322. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16323. Flags to local 3x3 coordinates region centered on @code{x}:
  16324. 1 2 3
  16325. 4 x 5
  16326. 6 7 8
  16327. @end table
  16328. @subsection Example
  16329. @itemize
  16330. @item
  16331. 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.
  16332. @example
  16333. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16334. @end example
  16335. @end itemize
  16336. @section deshake_opencl
  16337. Feature-point based video stabilization filter.
  16338. The filter accepts the following options:
  16339. @table @option
  16340. @item tripod
  16341. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16342. @item debug
  16343. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16344. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16345. Viewing point matches in the output video is only supported for RGB input.
  16346. Defaults to @code{0}.
  16347. @item adaptive_crop
  16348. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16349. Defaults to @code{1}.
  16350. @item refine_features
  16351. Whether or not feature points should be refined at a sub-pixel level.
  16352. This can be turned off for a slight performance gain at the cost of precision.
  16353. Defaults to @code{1}.
  16354. @item smooth_strength
  16355. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16356. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16357. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16358. Defaults to @code{0.0}.
  16359. @item smooth_window_multiplier
  16360. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16361. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16362. Acceptable values range from @code{0.1} to @code{10.0}.
  16363. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16364. potentially improving smoothness, but also increase latency and memory usage.
  16365. Defaults to @code{2.0}.
  16366. @end table
  16367. @subsection Examples
  16368. @itemize
  16369. @item
  16370. Stabilize a video with a fixed, medium smoothing strength:
  16371. @example
  16372. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16373. @end example
  16374. @item
  16375. Stabilize a video with debugging (both in console and in rendered video):
  16376. @example
  16377. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16378. @end example
  16379. @end itemize
  16380. @section dilation_opencl
  16381. Apply dilation effect to the video.
  16382. This filter replaces the pixel by the local(3x3) maximum.
  16383. It accepts the following options:
  16384. @table @option
  16385. @item threshold0
  16386. @item threshold1
  16387. @item threshold2
  16388. @item threshold3
  16389. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16390. If @code{0}, plane will remain unchanged.
  16391. @item coordinates
  16392. Flag which specifies the pixel to refer to.
  16393. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16394. Flags to local 3x3 coordinates region centered on @code{x}:
  16395. 1 2 3
  16396. 4 x 5
  16397. 6 7 8
  16398. @end table
  16399. @subsection Example
  16400. @itemize
  16401. @item
  16402. 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.
  16403. @example
  16404. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16405. @end example
  16406. @end itemize
  16407. @section nlmeans_opencl
  16408. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16409. @section overlay_opencl
  16410. Overlay one video on top of another.
  16411. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16412. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16413. The filter accepts the following options:
  16414. @table @option
  16415. @item x
  16416. Set the x coordinate of the overlaid video on the main video.
  16417. Default value is @code{0}.
  16418. @item y
  16419. Set the y coordinate of the overlaid video on the main video.
  16420. Default value is @code{0}.
  16421. @end table
  16422. @subsection Examples
  16423. @itemize
  16424. @item
  16425. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16426. @example
  16427. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16428. @end example
  16429. @item
  16430. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16431. @example
  16432. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16433. @end example
  16434. @end itemize
  16435. @section pad_opencl
  16436. Add paddings to the input image, and place the original input at the
  16437. provided @var{x}, @var{y} coordinates.
  16438. It accepts the following options:
  16439. @table @option
  16440. @item width, w
  16441. @item height, h
  16442. Specify an expression for the size of the output image with the
  16443. paddings added. If the value for @var{width} or @var{height} is 0, the
  16444. corresponding input size is used for the output.
  16445. The @var{width} expression can reference the value set by the
  16446. @var{height} expression, and vice versa.
  16447. The default value of @var{width} and @var{height} is 0.
  16448. @item x
  16449. @item y
  16450. Specify the offsets to place the input image at within the padded area,
  16451. with respect to the top/left border of the output image.
  16452. The @var{x} expression can reference the value set by the @var{y}
  16453. expression, and vice versa.
  16454. The default value of @var{x} and @var{y} is 0.
  16455. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16456. so the input image is centered on the padded area.
  16457. @item color
  16458. Specify the color of the padded area. For the syntax of this option,
  16459. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16460. manual,ffmpeg-utils}.
  16461. @item aspect
  16462. Pad to an aspect instead to a resolution.
  16463. @end table
  16464. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16465. options are expressions containing the following constants:
  16466. @table @option
  16467. @item in_w
  16468. @item in_h
  16469. The input video width and height.
  16470. @item iw
  16471. @item ih
  16472. These are the same as @var{in_w} and @var{in_h}.
  16473. @item out_w
  16474. @item out_h
  16475. The output width and height (the size of the padded area), as
  16476. specified by the @var{width} and @var{height} expressions.
  16477. @item ow
  16478. @item oh
  16479. These are the same as @var{out_w} and @var{out_h}.
  16480. @item x
  16481. @item y
  16482. The x and y offsets as specified by the @var{x} and @var{y}
  16483. expressions, or NAN if not yet specified.
  16484. @item a
  16485. same as @var{iw} / @var{ih}
  16486. @item sar
  16487. input sample aspect ratio
  16488. @item dar
  16489. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16490. @end table
  16491. @section prewitt_opencl
  16492. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16493. The filter accepts the following option:
  16494. @table @option
  16495. @item planes
  16496. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16497. @item scale
  16498. Set value which will be multiplied with filtered result.
  16499. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16500. @item delta
  16501. Set value which will be added to filtered result.
  16502. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16503. @end table
  16504. @subsection Example
  16505. @itemize
  16506. @item
  16507. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16508. @example
  16509. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16510. @end example
  16511. @end itemize
  16512. @anchor{program_opencl}
  16513. @section program_opencl
  16514. Filter video using an OpenCL program.
  16515. @table @option
  16516. @item source
  16517. OpenCL program source file.
  16518. @item kernel
  16519. Kernel name in program.
  16520. @item inputs
  16521. Number of inputs to the filter. Defaults to 1.
  16522. @item size, s
  16523. Size of output frames. Defaults to the same as the first input.
  16524. @end table
  16525. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16526. The program source file must contain a kernel function with the given name,
  16527. which will be run once for each plane of the output. Each run on a plane
  16528. gets enqueued as a separate 2D global NDRange with one work-item for each
  16529. pixel to be generated. The global ID offset for each work-item is therefore
  16530. the coordinates of a pixel in the destination image.
  16531. The kernel function needs to take the following arguments:
  16532. @itemize
  16533. @item
  16534. Destination image, @var{__write_only image2d_t}.
  16535. This image will become the output; the kernel should write all of it.
  16536. @item
  16537. Frame index, @var{unsigned int}.
  16538. This is a counter starting from zero and increasing by one for each frame.
  16539. @item
  16540. Source images, @var{__read_only image2d_t}.
  16541. These are the most recent images on each input. The kernel may read from
  16542. them to generate the output, but they can't be written to.
  16543. @end itemize
  16544. Example programs:
  16545. @itemize
  16546. @item
  16547. Copy the input to the output (output must be the same size as the input).
  16548. @verbatim
  16549. __kernel void copy(__write_only image2d_t destination,
  16550. unsigned int index,
  16551. __read_only image2d_t source)
  16552. {
  16553. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16554. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16555. float4 value = read_imagef(source, sampler, location);
  16556. write_imagef(destination, location, value);
  16557. }
  16558. @end verbatim
  16559. @item
  16560. Apply a simple transformation, rotating the input by an amount increasing
  16561. with the index counter. Pixel values are linearly interpolated by the
  16562. sampler, and the output need not have the same dimensions as the input.
  16563. @verbatim
  16564. __kernel void rotate_image(__write_only image2d_t dst,
  16565. unsigned int index,
  16566. __read_only image2d_t src)
  16567. {
  16568. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16569. CLK_FILTER_LINEAR);
  16570. float angle = (float)index / 100.0f;
  16571. float2 dst_dim = convert_float2(get_image_dim(dst));
  16572. float2 src_dim = convert_float2(get_image_dim(src));
  16573. float2 dst_cen = dst_dim / 2.0f;
  16574. float2 src_cen = src_dim / 2.0f;
  16575. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16576. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16577. float2 src_pos = {
  16578. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16579. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16580. };
  16581. src_pos = src_pos * src_dim / dst_dim;
  16582. float2 src_loc = src_pos + src_cen;
  16583. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16584. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16585. write_imagef(dst, dst_loc, 0.5f);
  16586. else
  16587. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16588. }
  16589. @end verbatim
  16590. @item
  16591. Blend two inputs together, with the amount of each input used varying
  16592. with the index counter.
  16593. @verbatim
  16594. __kernel void blend_images(__write_only image2d_t dst,
  16595. unsigned int index,
  16596. __read_only image2d_t src1,
  16597. __read_only image2d_t src2)
  16598. {
  16599. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16600. CLK_FILTER_LINEAR);
  16601. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16602. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16603. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16604. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16605. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16606. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16607. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16608. }
  16609. @end verbatim
  16610. @end itemize
  16611. @section roberts_opencl
  16612. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16613. The filter accepts the following option:
  16614. @table @option
  16615. @item planes
  16616. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16617. @item scale
  16618. Set value which will be multiplied with filtered result.
  16619. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16620. @item delta
  16621. Set value which will be added to filtered result.
  16622. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16623. @end table
  16624. @subsection Example
  16625. @itemize
  16626. @item
  16627. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16628. @example
  16629. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16630. @end example
  16631. @end itemize
  16632. @section sobel_opencl
  16633. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16634. The filter accepts the following option:
  16635. @table @option
  16636. @item planes
  16637. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16638. @item scale
  16639. Set value which will be multiplied with filtered result.
  16640. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16641. @item delta
  16642. Set value which will be added to filtered result.
  16643. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16644. @end table
  16645. @subsection Example
  16646. @itemize
  16647. @item
  16648. Apply sobel operator with scale set to 2 and delta set to 10
  16649. @example
  16650. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16651. @end example
  16652. @end itemize
  16653. @section tonemap_opencl
  16654. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16655. It accepts the following parameters:
  16656. @table @option
  16657. @item tonemap
  16658. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16659. @item param
  16660. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16661. @item desat
  16662. Apply desaturation for highlights that exceed this level of brightness. The
  16663. higher the parameter, the more color information will be preserved. This
  16664. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16665. (smoothly) turning into white instead. This makes images feel more natural,
  16666. at the cost of reducing information about out-of-range colors.
  16667. The default value is 0.5, and the algorithm here is a little different from
  16668. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16669. @item threshold
  16670. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16671. is used to detect whether the scene has changed or not. If the distance between
  16672. the current frame average brightness and the current running average exceeds
  16673. a threshold value, we would re-calculate scene average and peak brightness.
  16674. The default value is 0.2.
  16675. @item format
  16676. Specify the output pixel format.
  16677. Currently supported formats are:
  16678. @table @var
  16679. @item p010
  16680. @item nv12
  16681. @end table
  16682. @item range, r
  16683. Set the output color range.
  16684. Possible values are:
  16685. @table @var
  16686. @item tv/mpeg
  16687. @item pc/jpeg
  16688. @end table
  16689. Default is same as input.
  16690. @item primaries, p
  16691. Set the output color primaries.
  16692. Possible values are:
  16693. @table @var
  16694. @item bt709
  16695. @item bt2020
  16696. @end table
  16697. Default is same as input.
  16698. @item transfer, t
  16699. Set the output transfer characteristics.
  16700. Possible values are:
  16701. @table @var
  16702. @item bt709
  16703. @item bt2020
  16704. @end table
  16705. Default is bt709.
  16706. @item matrix, m
  16707. Set the output colorspace matrix.
  16708. Possible value are:
  16709. @table @var
  16710. @item bt709
  16711. @item bt2020
  16712. @end table
  16713. Default is same as input.
  16714. @end table
  16715. @subsection Example
  16716. @itemize
  16717. @item
  16718. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16719. @example
  16720. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16721. @end example
  16722. @end itemize
  16723. @section unsharp_opencl
  16724. Sharpen or blur the input video.
  16725. It accepts the following parameters:
  16726. @table @option
  16727. @item luma_msize_x, lx
  16728. Set the luma matrix horizontal size.
  16729. Range is @code{[1, 23]} and default value is @code{5}.
  16730. @item luma_msize_y, ly
  16731. Set the luma matrix vertical size.
  16732. Range is @code{[1, 23]} and default value is @code{5}.
  16733. @item luma_amount, la
  16734. Set the luma effect strength.
  16735. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16736. Negative values will blur the input video, while positive values will
  16737. sharpen it, a value of zero will disable the effect.
  16738. @item chroma_msize_x, cx
  16739. Set the chroma matrix horizontal size.
  16740. Range is @code{[1, 23]} and default value is @code{5}.
  16741. @item chroma_msize_y, cy
  16742. Set the chroma matrix vertical size.
  16743. Range is @code{[1, 23]} and default value is @code{5}.
  16744. @item chroma_amount, ca
  16745. Set the chroma effect strength.
  16746. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16747. Negative values will blur the input video, while positive values will
  16748. sharpen it, a value of zero will disable the effect.
  16749. @end table
  16750. All parameters are optional and default to the equivalent of the
  16751. string '5:5:1.0:5:5:0.0'.
  16752. @subsection Examples
  16753. @itemize
  16754. @item
  16755. Apply strong luma sharpen effect:
  16756. @example
  16757. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16758. @end example
  16759. @item
  16760. Apply a strong blur of both luma and chroma parameters:
  16761. @example
  16762. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16763. @end example
  16764. @end itemize
  16765. @section xfade_opencl
  16766. Cross fade two videos with custom transition effect by using OpenCL.
  16767. It accepts the following options:
  16768. @table @option
  16769. @item transition
  16770. Set one of possible transition effects.
  16771. @table @option
  16772. @item custom
  16773. Select custom transition effect, the actual transition description
  16774. will be picked from source and kernel options.
  16775. @item fade
  16776. @item wipeleft
  16777. @item wiperight
  16778. @item wipeup
  16779. @item wipedown
  16780. @item slideleft
  16781. @item slideright
  16782. @item slideup
  16783. @item slidedown
  16784. Default transition is fade.
  16785. @end table
  16786. @item source
  16787. OpenCL program source file for custom transition.
  16788. @item kernel
  16789. Set name of kernel to use for custom transition from program source file.
  16790. @item duration
  16791. Set duration of video transition.
  16792. @item offset
  16793. Set time of start of transition relative to first video.
  16794. @end table
  16795. The program source file must contain a kernel function with the given name,
  16796. which will be run once for each plane of the output. Each run on a plane
  16797. gets enqueued as a separate 2D global NDRange with one work-item for each
  16798. pixel to be generated. The global ID offset for each work-item is therefore
  16799. the coordinates of a pixel in the destination image.
  16800. The kernel function needs to take the following arguments:
  16801. @itemize
  16802. @item
  16803. Destination image, @var{__write_only image2d_t}.
  16804. This image will become the output; the kernel should write all of it.
  16805. @item
  16806. First Source image, @var{__read_only image2d_t}.
  16807. Second Source image, @var{__read_only image2d_t}.
  16808. These are the most recent images on each input. The kernel may read from
  16809. them to generate the output, but they can't be written to.
  16810. @item
  16811. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16812. @end itemize
  16813. Example programs:
  16814. @itemize
  16815. @item
  16816. Apply dots curtain transition effect:
  16817. @verbatim
  16818. __kernel void blend_images(__write_only image2d_t dst,
  16819. __read_only image2d_t src1,
  16820. __read_only image2d_t src2,
  16821. float progress)
  16822. {
  16823. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16824. CLK_FILTER_LINEAR);
  16825. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16826. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16827. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16828. rp = rp / dim;
  16829. float2 dots = (float2)(20.0, 20.0);
  16830. float2 center = (float2)(0,0);
  16831. float2 unused;
  16832. float4 val1 = read_imagef(src1, sampler, p);
  16833. float4 val2 = read_imagef(src2, sampler, p);
  16834. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16835. write_imagef(dst, p, next ? val1 : val2);
  16836. }
  16837. @end verbatim
  16838. @end itemize
  16839. @c man end OPENCL VIDEO FILTERS
  16840. @chapter VAAPI Video Filters
  16841. @c man begin VAAPI VIDEO FILTERS
  16842. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16843. To enable compilation of these filters you need to configure FFmpeg with
  16844. @code{--enable-vaapi}.
  16845. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16846. @section tonemap_vaapi
  16847. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16848. It maps the dynamic range of HDR10 content to the SDR content.
  16849. It currently only accepts HDR10 as input.
  16850. It accepts the following parameters:
  16851. @table @option
  16852. @item format
  16853. Specify the output pixel format.
  16854. Currently supported formats are:
  16855. @table @var
  16856. @item p010
  16857. @item nv12
  16858. @end table
  16859. Default is nv12.
  16860. @item primaries, p
  16861. Set the output color primaries.
  16862. Default is same as input.
  16863. @item transfer, t
  16864. Set the output transfer characteristics.
  16865. Default is bt709.
  16866. @item matrix, m
  16867. Set the output colorspace matrix.
  16868. Default is same as input.
  16869. @end table
  16870. @subsection Example
  16871. @itemize
  16872. @item
  16873. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16874. @example
  16875. tonemap_vaapi=format=p010:t=bt2020-10
  16876. @end example
  16877. @end itemize
  16878. @c man end VAAPI VIDEO FILTERS
  16879. @chapter Video Sources
  16880. @c man begin VIDEO SOURCES
  16881. Below is a description of the currently available video sources.
  16882. @section buffer
  16883. Buffer video frames, and make them available to the filter chain.
  16884. This source is mainly intended for a programmatic use, in particular
  16885. through the interface defined in @file{libavfilter/buffersrc.h}.
  16886. It accepts the following parameters:
  16887. @table @option
  16888. @item video_size
  16889. Specify the size (width and height) of the buffered video frames. For the
  16890. syntax of this option, check the
  16891. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16892. @item width
  16893. The input video width.
  16894. @item height
  16895. The input video height.
  16896. @item pix_fmt
  16897. A string representing the pixel format of the buffered video frames.
  16898. It may be a number corresponding to a pixel format, or a pixel format
  16899. name.
  16900. @item time_base
  16901. Specify the timebase assumed by the timestamps of the buffered frames.
  16902. @item frame_rate
  16903. Specify the frame rate expected for the video stream.
  16904. @item pixel_aspect, sar
  16905. The sample (pixel) aspect ratio of the input video.
  16906. @item sws_param
  16907. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16908. to the filtergraph description to specify swscale flags for automatically
  16909. inserted scalers. See @ref{Filtergraph syntax}.
  16910. @item hw_frames_ctx
  16911. When using a hardware pixel format, this should be a reference to an
  16912. AVHWFramesContext describing input frames.
  16913. @end table
  16914. For example:
  16915. @example
  16916. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16917. @end example
  16918. will instruct the source to accept video frames with size 320x240 and
  16919. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16920. square pixels (1:1 sample aspect ratio).
  16921. Since the pixel format with name "yuv410p" corresponds to the number 6
  16922. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16923. this example corresponds to:
  16924. @example
  16925. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16926. @end example
  16927. Alternatively, the options can be specified as a flat string, but this
  16928. syntax is deprecated:
  16929. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16930. @section cellauto
  16931. Create a pattern generated by an elementary cellular automaton.
  16932. The initial state of the cellular automaton can be defined through the
  16933. @option{filename} and @option{pattern} options. If such options are
  16934. not specified an initial state is created randomly.
  16935. At each new frame a new row in the video is filled with the result of
  16936. the cellular automaton next generation. The behavior when the whole
  16937. frame is filled is defined by the @option{scroll} option.
  16938. This source accepts the following options:
  16939. @table @option
  16940. @item filename, f
  16941. Read the initial cellular automaton state, i.e. the starting row, from
  16942. the specified file.
  16943. In the file, each non-whitespace character is considered an alive
  16944. cell, a newline will terminate the row, and further characters in the
  16945. file will be ignored.
  16946. @item pattern, p
  16947. Read the initial cellular automaton state, i.e. the starting row, from
  16948. the specified string.
  16949. Each non-whitespace character in the string is considered an alive
  16950. cell, a newline will terminate the row, and further characters in the
  16951. string will be ignored.
  16952. @item rate, r
  16953. Set the video rate, that is the number of frames generated per second.
  16954. Default is 25.
  16955. @item random_fill_ratio, ratio
  16956. Set the random fill ratio for the initial cellular automaton row. It
  16957. is a floating point number value ranging from 0 to 1, defaults to
  16958. 1/PHI.
  16959. This option is ignored when a file or a pattern is specified.
  16960. @item random_seed, seed
  16961. Set the seed for filling randomly the initial row, must be an integer
  16962. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16963. set to -1, the filter will try to use a good random seed on a best
  16964. effort basis.
  16965. @item rule
  16966. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16967. Default value is 110.
  16968. @item size, s
  16969. Set the size of the output video. For the syntax of this option, check the
  16970. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16971. If @option{filename} or @option{pattern} is specified, the size is set
  16972. by default to the width of the specified initial state row, and the
  16973. height is set to @var{width} * PHI.
  16974. If @option{size} is set, it must contain the width of the specified
  16975. pattern string, and the specified pattern will be centered in the
  16976. larger row.
  16977. If a filename or a pattern string is not specified, the size value
  16978. defaults to "320x518" (used for a randomly generated initial state).
  16979. @item scroll
  16980. If set to 1, scroll the output upward when all the rows in the output
  16981. have been already filled. If set to 0, the new generated row will be
  16982. written over the top row just after the bottom row is filled.
  16983. Defaults to 1.
  16984. @item start_full, full
  16985. If set to 1, completely fill the output with generated rows before
  16986. outputting the first frame.
  16987. This is the default behavior, for disabling set the value to 0.
  16988. @item stitch
  16989. If set to 1, stitch the left and right row edges together.
  16990. This is the default behavior, for disabling set the value to 0.
  16991. @end table
  16992. @subsection Examples
  16993. @itemize
  16994. @item
  16995. Read the initial state from @file{pattern}, and specify an output of
  16996. size 200x400.
  16997. @example
  16998. cellauto=f=pattern:s=200x400
  16999. @end example
  17000. @item
  17001. Generate a random initial row with a width of 200 cells, with a fill
  17002. ratio of 2/3:
  17003. @example
  17004. cellauto=ratio=2/3:s=200x200
  17005. @end example
  17006. @item
  17007. Create a pattern generated by rule 18 starting by a single alive cell
  17008. centered on an initial row with width 100:
  17009. @example
  17010. cellauto=p=@@:s=100x400:full=0:rule=18
  17011. @end example
  17012. @item
  17013. Specify a more elaborated initial pattern:
  17014. @example
  17015. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17016. @end example
  17017. @end itemize
  17018. @anchor{coreimagesrc}
  17019. @section coreimagesrc
  17020. Video source generated on GPU using Apple's CoreImage API on OSX.
  17021. This video source is a specialized version of the @ref{coreimage} video filter.
  17022. Use a core image generator at the beginning of the applied filterchain to
  17023. generate the content.
  17024. The coreimagesrc video source accepts the following options:
  17025. @table @option
  17026. @item list_generators
  17027. List all available generators along with all their respective options as well as
  17028. possible minimum and maximum values along with the default values.
  17029. @example
  17030. list_generators=true
  17031. @end example
  17032. @item size, s
  17033. Specify the size of the sourced video. For the syntax of this option, check the
  17034. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17035. The default value is @code{320x240}.
  17036. @item rate, r
  17037. Specify the frame rate of the sourced video, as the number of frames
  17038. generated per second. It has to be a string in the format
  17039. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17040. number or a valid video frame rate abbreviation. The default value is
  17041. "25".
  17042. @item sar
  17043. Set the sample aspect ratio of the sourced video.
  17044. @item duration, d
  17045. Set the duration of the sourced video. See
  17046. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17047. for the accepted syntax.
  17048. If not specified, or the expressed duration is negative, the video is
  17049. supposed to be generated forever.
  17050. @end table
  17051. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17052. A complete filterchain can be used for further processing of the
  17053. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17054. and examples for details.
  17055. @subsection Examples
  17056. @itemize
  17057. @item
  17058. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17059. given as complete and escaped command-line for Apple's standard bash shell:
  17060. @example
  17061. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17062. @end example
  17063. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17064. need for a nullsrc video source.
  17065. @end itemize
  17066. @section gradients
  17067. Generate several gradients.
  17068. @table @option
  17069. @item size, s
  17070. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17071. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17072. @item rate, r
  17073. Set frame rate, expressed as number of frames per second. Default
  17074. value is "25".
  17075. @item c0, c1, c2, c3, c4, c5, c6, c7
  17076. Set 8 colors. Default values for colors is to pick random one.
  17077. @item x0, y0, y0, y1
  17078. Set gradient line source and destination points. If negative or out of range, random ones
  17079. are picked.
  17080. @item nb_colors, n
  17081. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17082. @item seed
  17083. Set seed for picking gradient line points.
  17084. @end table
  17085. @section mandelbrot
  17086. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17087. point specified with @var{start_x} and @var{start_y}.
  17088. This source accepts the following options:
  17089. @table @option
  17090. @item end_pts
  17091. Set the terminal pts value. Default value is 400.
  17092. @item end_scale
  17093. Set the terminal scale value.
  17094. Must be a floating point value. Default value is 0.3.
  17095. @item inner
  17096. Set the inner coloring mode, that is the algorithm used to draw the
  17097. Mandelbrot fractal internal region.
  17098. It shall assume one of the following values:
  17099. @table @option
  17100. @item black
  17101. Set black mode.
  17102. @item convergence
  17103. Show time until convergence.
  17104. @item mincol
  17105. Set color based on point closest to the origin of the iterations.
  17106. @item period
  17107. Set period mode.
  17108. @end table
  17109. Default value is @var{mincol}.
  17110. @item bailout
  17111. Set the bailout value. Default value is 10.0.
  17112. @item maxiter
  17113. Set the maximum of iterations performed by the rendering
  17114. algorithm. Default value is 7189.
  17115. @item outer
  17116. Set outer coloring mode.
  17117. It shall assume one of following values:
  17118. @table @option
  17119. @item iteration_count
  17120. Set iteration count mode.
  17121. @item normalized_iteration_count
  17122. set normalized iteration count mode.
  17123. @end table
  17124. Default value is @var{normalized_iteration_count}.
  17125. @item rate, r
  17126. Set frame rate, expressed as number of frames per second. Default
  17127. value is "25".
  17128. @item size, s
  17129. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17130. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17131. @item start_scale
  17132. Set the initial scale value. Default value is 3.0.
  17133. @item start_x
  17134. Set the initial x position. Must be a floating point value between
  17135. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17136. @item start_y
  17137. Set the initial y position. Must be a floating point value between
  17138. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17139. @end table
  17140. @section mptestsrc
  17141. Generate various test patterns, as generated by the MPlayer test filter.
  17142. The size of the generated video is fixed, and is 256x256.
  17143. This source is useful in particular for testing encoding features.
  17144. This source accepts the following options:
  17145. @table @option
  17146. @item rate, r
  17147. Specify the frame rate of the sourced video, as the number of frames
  17148. generated per second. It has to be a string in the format
  17149. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17150. number or a valid video frame rate abbreviation. The default value is
  17151. "25".
  17152. @item duration, d
  17153. Set the duration of the sourced video. See
  17154. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17155. for the accepted syntax.
  17156. If not specified, or the expressed duration is negative, the video is
  17157. supposed to be generated forever.
  17158. @item test, t
  17159. Set the number or the name of the test to perform. Supported tests are:
  17160. @table @option
  17161. @item dc_luma
  17162. @item dc_chroma
  17163. @item freq_luma
  17164. @item freq_chroma
  17165. @item amp_luma
  17166. @item amp_chroma
  17167. @item cbp
  17168. @item mv
  17169. @item ring1
  17170. @item ring2
  17171. @item all
  17172. @item max_frames, m
  17173. Set the maximum number of frames generated for each test, default value is 30.
  17174. @end table
  17175. Default value is "all", which will cycle through the list of all tests.
  17176. @end table
  17177. Some examples:
  17178. @example
  17179. mptestsrc=t=dc_luma
  17180. @end example
  17181. will generate a "dc_luma" test pattern.
  17182. @section frei0r_src
  17183. Provide a frei0r source.
  17184. To enable compilation of this filter you need to install the frei0r
  17185. header and configure FFmpeg with @code{--enable-frei0r}.
  17186. This source accepts the following parameters:
  17187. @table @option
  17188. @item size
  17189. The size of the video to generate. For the syntax of this option, check the
  17190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17191. @item framerate
  17192. The framerate of the generated video. It may be a string of the form
  17193. @var{num}/@var{den} or a frame rate abbreviation.
  17194. @item filter_name
  17195. The name to the frei0r source to load. For more information regarding frei0r and
  17196. how to set the parameters, read the @ref{frei0r} section in the video filters
  17197. documentation.
  17198. @item filter_params
  17199. A '|'-separated list of parameters to pass to the frei0r source.
  17200. @end table
  17201. For example, to generate a frei0r partik0l source with size 200x200
  17202. and frame rate 10 which is overlaid on the overlay filter main input:
  17203. @example
  17204. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17205. @end example
  17206. @section life
  17207. Generate a life pattern.
  17208. This source is based on a generalization of John Conway's life game.
  17209. The sourced input represents a life grid, each pixel represents a cell
  17210. which can be in one of two possible states, alive or dead. Every cell
  17211. interacts with its eight neighbours, which are the cells that are
  17212. horizontally, vertically, or diagonally adjacent.
  17213. At each interaction the grid evolves according to the adopted rule,
  17214. which specifies the number of neighbor alive cells which will make a
  17215. cell stay alive or born. The @option{rule} option allows one to specify
  17216. the rule to adopt.
  17217. This source accepts the following options:
  17218. @table @option
  17219. @item filename, f
  17220. Set the file from which to read the initial grid state. In the file,
  17221. each non-whitespace character is considered an alive cell, and newline
  17222. is used to delimit the end of each row.
  17223. If this option is not specified, the initial grid is generated
  17224. randomly.
  17225. @item rate, r
  17226. Set the video rate, that is the number of frames generated per second.
  17227. Default is 25.
  17228. @item random_fill_ratio, ratio
  17229. Set the random fill ratio for the initial random grid. It is a
  17230. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17231. It is ignored when a file is specified.
  17232. @item random_seed, seed
  17233. Set the seed for filling the initial random grid, must be an integer
  17234. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17235. set to -1, the filter will try to use a good random seed on a best
  17236. effort basis.
  17237. @item rule
  17238. Set the life rule.
  17239. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17240. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17241. @var{NS} specifies the number of alive neighbor cells which make a
  17242. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17243. which make a dead cell to become alive (i.e. to "born").
  17244. "s" and "b" can be used in place of "S" and "B", respectively.
  17245. Alternatively a rule can be specified by an 18-bits integer. The 9
  17246. high order bits are used to encode the next cell state if it is alive
  17247. for each number of neighbor alive cells, the low order bits specify
  17248. the rule for "borning" new cells. Higher order bits encode for an
  17249. higher number of neighbor cells.
  17250. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17251. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17252. Default value is "S23/B3", which is the original Conway's game of life
  17253. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17254. cells, and will born a new cell if there are three alive cells around
  17255. a dead cell.
  17256. @item size, s
  17257. Set the size of the output video. For the syntax of this option, check the
  17258. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17259. If @option{filename} is specified, the size is set by default to the
  17260. same size of the input file. If @option{size} is set, it must contain
  17261. the size specified in the input file, and the initial grid defined in
  17262. that file is centered in the larger resulting area.
  17263. If a filename is not specified, the size value defaults to "320x240"
  17264. (used for a randomly generated initial grid).
  17265. @item stitch
  17266. If set to 1, stitch the left and right grid edges together, and the
  17267. top and bottom edges also. Defaults to 1.
  17268. @item mold
  17269. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17270. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17271. value from 0 to 255.
  17272. @item life_color
  17273. Set the color of living (or new born) cells.
  17274. @item death_color
  17275. Set the color of dead cells. If @option{mold} is set, this is the first color
  17276. used to represent a dead cell.
  17277. @item mold_color
  17278. Set mold color, for definitely dead and moldy cells.
  17279. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17280. ffmpeg-utils manual,ffmpeg-utils}.
  17281. @end table
  17282. @subsection Examples
  17283. @itemize
  17284. @item
  17285. Read a grid from @file{pattern}, and center it on a grid of size
  17286. 300x300 pixels:
  17287. @example
  17288. life=f=pattern:s=300x300
  17289. @end example
  17290. @item
  17291. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17292. @example
  17293. life=ratio=2/3:s=200x200
  17294. @end example
  17295. @item
  17296. Specify a custom rule for evolving a randomly generated grid:
  17297. @example
  17298. life=rule=S14/B34
  17299. @end example
  17300. @item
  17301. Full example with slow death effect (mold) using @command{ffplay}:
  17302. @example
  17303. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17304. @end example
  17305. @end itemize
  17306. @anchor{allrgb}
  17307. @anchor{allyuv}
  17308. @anchor{color}
  17309. @anchor{haldclutsrc}
  17310. @anchor{nullsrc}
  17311. @anchor{pal75bars}
  17312. @anchor{pal100bars}
  17313. @anchor{rgbtestsrc}
  17314. @anchor{smptebars}
  17315. @anchor{smptehdbars}
  17316. @anchor{testsrc}
  17317. @anchor{testsrc2}
  17318. @anchor{yuvtestsrc}
  17319. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17320. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17321. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17322. The @code{color} source provides an uniformly colored input.
  17323. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17324. @ref{haldclut} filter.
  17325. The @code{nullsrc} source returns unprocessed video frames. It is
  17326. mainly useful to be employed in analysis / debugging tools, or as the
  17327. source for filters which ignore the input data.
  17328. The @code{pal75bars} source generates a color bars pattern, based on
  17329. EBU PAL recommendations with 75% color levels.
  17330. The @code{pal100bars} source generates a color bars pattern, based on
  17331. EBU PAL recommendations with 100% color levels.
  17332. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17333. detecting RGB vs BGR issues. You should see a red, green and blue
  17334. stripe from top to bottom.
  17335. The @code{smptebars} source generates a color bars pattern, based on
  17336. the SMPTE Engineering Guideline EG 1-1990.
  17337. The @code{smptehdbars} source generates a color bars pattern, based on
  17338. the SMPTE RP 219-2002.
  17339. The @code{testsrc} source generates a test video pattern, showing a
  17340. color pattern, a scrolling gradient and a timestamp. This is mainly
  17341. intended for testing purposes.
  17342. The @code{testsrc2} source is similar to testsrc, but supports more
  17343. pixel formats instead of just @code{rgb24}. This allows using it as an
  17344. input for other tests without requiring a format conversion.
  17345. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17346. see a y, cb and cr stripe from top to bottom.
  17347. The sources accept the following parameters:
  17348. @table @option
  17349. @item level
  17350. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17351. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17352. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17353. coded on a @code{1/(N*N)} scale.
  17354. @item color, c
  17355. Specify the color of the source, only available in the @code{color}
  17356. source. For the syntax of this option, check the
  17357. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17358. @item size, s
  17359. Specify the size of the sourced video. For the syntax of this option, check the
  17360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17361. The default value is @code{320x240}.
  17362. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17363. @code{haldclutsrc} filters.
  17364. @item rate, r
  17365. Specify the frame rate of the sourced video, as the number of frames
  17366. generated per second. It has to be a string in the format
  17367. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17368. number or a valid video frame rate abbreviation. The default value is
  17369. "25".
  17370. @item duration, d
  17371. Set the duration of the sourced video. See
  17372. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17373. for the accepted syntax.
  17374. If not specified, or the expressed duration is negative, the video is
  17375. supposed to be generated forever.
  17376. @item sar
  17377. Set the sample aspect ratio of the sourced video.
  17378. @item alpha
  17379. Specify the alpha (opacity) of the background, only available in the
  17380. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17381. 255 (fully opaque, the default).
  17382. @item decimals, n
  17383. Set the number of decimals to show in the timestamp, only available in the
  17384. @code{testsrc} source.
  17385. The displayed timestamp value will correspond to the original
  17386. timestamp value multiplied by the power of 10 of the specified
  17387. value. Default value is 0.
  17388. @end table
  17389. @subsection Examples
  17390. @itemize
  17391. @item
  17392. Generate a video with a duration of 5.3 seconds, with size
  17393. 176x144 and a frame rate of 10 frames per second:
  17394. @example
  17395. testsrc=duration=5.3:size=qcif:rate=10
  17396. @end example
  17397. @item
  17398. The following graph description will generate a red source
  17399. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17400. frames per second:
  17401. @example
  17402. color=c=red@@0.2:s=qcif:r=10
  17403. @end example
  17404. @item
  17405. If the input content is to be ignored, @code{nullsrc} can be used. The
  17406. following command generates noise in the luminance plane by employing
  17407. the @code{geq} filter:
  17408. @example
  17409. nullsrc=s=256x256, geq=random(1)*255:128:128
  17410. @end example
  17411. @end itemize
  17412. @subsection Commands
  17413. The @code{color} source supports the following commands:
  17414. @table @option
  17415. @item c, color
  17416. Set the color of the created image. Accepts the same syntax of the
  17417. corresponding @option{color} option.
  17418. @end table
  17419. @section openclsrc
  17420. Generate video using an OpenCL program.
  17421. @table @option
  17422. @item source
  17423. OpenCL program source file.
  17424. @item kernel
  17425. Kernel name in program.
  17426. @item size, s
  17427. Size of frames to generate. This must be set.
  17428. @item format
  17429. Pixel format to use for the generated frames. This must be set.
  17430. @item rate, r
  17431. Number of frames generated every second. Default value is '25'.
  17432. @end table
  17433. For details of how the program loading works, see the @ref{program_opencl}
  17434. filter.
  17435. Example programs:
  17436. @itemize
  17437. @item
  17438. Generate a colour ramp by setting pixel values from the position of the pixel
  17439. in the output image. (Note that this will work with all pixel formats, but
  17440. the generated output will not be the same.)
  17441. @verbatim
  17442. __kernel void ramp(__write_only image2d_t dst,
  17443. unsigned int index)
  17444. {
  17445. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17446. float4 val;
  17447. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17448. write_imagef(dst, loc, val);
  17449. }
  17450. @end verbatim
  17451. @item
  17452. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17453. @verbatim
  17454. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17455. unsigned int index)
  17456. {
  17457. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17458. float4 value = 0.0f;
  17459. int x = loc.x + index;
  17460. int y = loc.y + index;
  17461. while (x > 0 || y > 0) {
  17462. if (x % 3 == 1 && y % 3 == 1) {
  17463. value = 1.0f;
  17464. break;
  17465. }
  17466. x /= 3;
  17467. y /= 3;
  17468. }
  17469. write_imagef(dst, loc, value);
  17470. }
  17471. @end verbatim
  17472. @end itemize
  17473. @section sierpinski
  17474. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17475. This source accepts the following options:
  17476. @table @option
  17477. @item size, s
  17478. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17479. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17480. @item rate, r
  17481. Set frame rate, expressed as number of frames per second. Default
  17482. value is "25".
  17483. @item seed
  17484. Set seed which is used for random panning.
  17485. @item jump
  17486. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17487. @item type
  17488. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17489. @end table
  17490. @c man end VIDEO SOURCES
  17491. @chapter Video Sinks
  17492. @c man begin VIDEO SINKS
  17493. Below is a description of the currently available video sinks.
  17494. @section buffersink
  17495. Buffer video frames, and make them available to the end of the filter
  17496. graph.
  17497. This sink is mainly intended for programmatic use, in particular
  17498. through the interface defined in @file{libavfilter/buffersink.h}
  17499. or the options system.
  17500. It accepts a pointer to an AVBufferSinkContext structure, which
  17501. defines the incoming buffers' formats, to be passed as the opaque
  17502. parameter to @code{avfilter_init_filter} for initialization.
  17503. @section nullsink
  17504. Null video sink: do absolutely nothing with the input video. It is
  17505. mainly useful as a template and for use in analysis / debugging
  17506. tools.
  17507. @c man end VIDEO SINKS
  17508. @chapter Multimedia Filters
  17509. @c man begin MULTIMEDIA FILTERS
  17510. Below is a description of the currently available multimedia filters.
  17511. @section abitscope
  17512. Convert input audio to a video output, displaying the audio bit scope.
  17513. The filter accepts the following options:
  17514. @table @option
  17515. @item rate, r
  17516. Set frame rate, expressed as number of frames per second. Default
  17517. value is "25".
  17518. @item size, s
  17519. Specify the video size for the output. For the syntax of this option, check the
  17520. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17521. Default value is @code{1024x256}.
  17522. @item colors
  17523. Specify list of colors separated by space or by '|' which will be used to
  17524. draw channels. Unrecognized or missing colors will be replaced
  17525. by white color.
  17526. @end table
  17527. @section adrawgraph
  17528. Draw a graph using input audio metadata.
  17529. See @ref{drawgraph}
  17530. @section agraphmonitor
  17531. See @ref{graphmonitor}.
  17532. @section ahistogram
  17533. Convert input audio to a video output, displaying the volume histogram.
  17534. The filter accepts the following options:
  17535. @table @option
  17536. @item dmode
  17537. Specify how histogram is calculated.
  17538. It accepts the following values:
  17539. @table @samp
  17540. @item single
  17541. Use single histogram for all channels.
  17542. @item separate
  17543. Use separate histogram for each channel.
  17544. @end table
  17545. Default is @code{single}.
  17546. @item rate, r
  17547. Set frame rate, expressed as number of frames per second. Default
  17548. value is "25".
  17549. @item size, s
  17550. Specify the video size for the output. For the syntax of this option, check the
  17551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17552. Default value is @code{hd720}.
  17553. @item scale
  17554. Set display scale.
  17555. It accepts the following values:
  17556. @table @samp
  17557. @item log
  17558. logarithmic
  17559. @item sqrt
  17560. square root
  17561. @item cbrt
  17562. cubic root
  17563. @item lin
  17564. linear
  17565. @item rlog
  17566. reverse logarithmic
  17567. @end table
  17568. Default is @code{log}.
  17569. @item ascale
  17570. Set amplitude scale.
  17571. It accepts the following values:
  17572. @table @samp
  17573. @item log
  17574. logarithmic
  17575. @item lin
  17576. linear
  17577. @end table
  17578. Default is @code{log}.
  17579. @item acount
  17580. Set how much frames to accumulate in histogram.
  17581. Default is 1. Setting this to -1 accumulates all frames.
  17582. @item rheight
  17583. Set histogram ratio of window height.
  17584. @item slide
  17585. Set sonogram sliding.
  17586. It accepts the following values:
  17587. @table @samp
  17588. @item replace
  17589. replace old rows with new ones.
  17590. @item scroll
  17591. scroll from top to bottom.
  17592. @end table
  17593. Default is @code{replace}.
  17594. @end table
  17595. @section aphasemeter
  17596. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17597. representing mean phase of current audio frame. A video output can also be produced and is
  17598. enabled by default. The audio is passed through as first output.
  17599. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17600. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17601. and @code{1} means channels are in phase.
  17602. The filter accepts the following options, all related to its video output:
  17603. @table @option
  17604. @item rate, r
  17605. Set the output frame rate. Default value is @code{25}.
  17606. @item size, s
  17607. Set the video size for the output. For the syntax of this option, check the
  17608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17609. Default value is @code{800x400}.
  17610. @item rc
  17611. @item gc
  17612. @item bc
  17613. Specify the red, green, blue contrast. Default values are @code{2},
  17614. @code{7} and @code{1}.
  17615. Allowed range is @code{[0, 255]}.
  17616. @item mpc
  17617. Set color which will be used for drawing median phase. If color is
  17618. @code{none} which is default, no median phase value will be drawn.
  17619. @item video
  17620. Enable video output. Default is enabled.
  17621. @end table
  17622. @section avectorscope
  17623. Convert input audio to a video output, representing the audio vector
  17624. scope.
  17625. The filter is used to measure the difference between channels of stereo
  17626. audio stream. A monaural signal, consisting of identical left and right
  17627. signal, results in straight vertical line. Any stereo separation is visible
  17628. as a deviation from this line, creating a Lissajous figure.
  17629. If the straight (or deviation from it) but horizontal line appears this
  17630. indicates that the left and right channels are out of phase.
  17631. The filter accepts the following options:
  17632. @table @option
  17633. @item mode, m
  17634. Set the vectorscope mode.
  17635. Available values are:
  17636. @table @samp
  17637. @item lissajous
  17638. Lissajous rotated by 45 degrees.
  17639. @item lissajous_xy
  17640. Same as above but not rotated.
  17641. @item polar
  17642. Shape resembling half of circle.
  17643. @end table
  17644. Default value is @samp{lissajous}.
  17645. @item size, s
  17646. Set the video size for the output. For the syntax of this option, check the
  17647. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17648. Default value is @code{400x400}.
  17649. @item rate, r
  17650. Set the output frame rate. Default value is @code{25}.
  17651. @item rc
  17652. @item gc
  17653. @item bc
  17654. @item ac
  17655. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17656. @code{160}, @code{80} and @code{255}.
  17657. Allowed range is @code{[0, 255]}.
  17658. @item rf
  17659. @item gf
  17660. @item bf
  17661. @item af
  17662. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17663. @code{10}, @code{5} and @code{5}.
  17664. Allowed range is @code{[0, 255]}.
  17665. @item zoom
  17666. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17667. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17668. @item draw
  17669. Set the vectorscope drawing mode.
  17670. Available values are:
  17671. @table @samp
  17672. @item dot
  17673. Draw dot for each sample.
  17674. @item line
  17675. Draw line between previous and current sample.
  17676. @end table
  17677. Default value is @samp{dot}.
  17678. @item scale
  17679. Specify amplitude scale of audio samples.
  17680. Available values are:
  17681. @table @samp
  17682. @item lin
  17683. Linear.
  17684. @item sqrt
  17685. Square root.
  17686. @item cbrt
  17687. Cubic root.
  17688. @item log
  17689. Logarithmic.
  17690. @end table
  17691. @item swap
  17692. Swap left channel axis with right channel axis.
  17693. @item mirror
  17694. Mirror axis.
  17695. @table @samp
  17696. @item none
  17697. No mirror.
  17698. @item x
  17699. Mirror only x axis.
  17700. @item y
  17701. Mirror only y axis.
  17702. @item xy
  17703. Mirror both axis.
  17704. @end table
  17705. @end table
  17706. @subsection Examples
  17707. @itemize
  17708. @item
  17709. Complete example using @command{ffplay}:
  17710. @example
  17711. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17712. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17713. @end example
  17714. @end itemize
  17715. @section bench, abench
  17716. Benchmark part of a filtergraph.
  17717. The filter accepts the following options:
  17718. @table @option
  17719. @item action
  17720. Start or stop a timer.
  17721. Available values are:
  17722. @table @samp
  17723. @item start
  17724. Get the current time, set it as frame metadata (using the key
  17725. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17726. @item stop
  17727. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17728. the input frame metadata to get the time difference. Time difference, average,
  17729. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17730. @code{min}) are then printed. The timestamps are expressed in seconds.
  17731. @end table
  17732. @end table
  17733. @subsection Examples
  17734. @itemize
  17735. @item
  17736. Benchmark @ref{selectivecolor} filter:
  17737. @example
  17738. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17739. @end example
  17740. @end itemize
  17741. @section concat
  17742. Concatenate audio and video streams, joining them together one after the
  17743. other.
  17744. The filter works on segments of synchronized video and audio streams. All
  17745. segments must have the same number of streams of each type, and that will
  17746. also be the number of streams at output.
  17747. The filter accepts the following options:
  17748. @table @option
  17749. @item n
  17750. Set the number of segments. Default is 2.
  17751. @item v
  17752. Set the number of output video streams, that is also the number of video
  17753. streams in each segment. Default is 1.
  17754. @item a
  17755. Set the number of output audio streams, that is also the number of audio
  17756. streams in each segment. Default is 0.
  17757. @item unsafe
  17758. Activate unsafe mode: do not fail if segments have a different format.
  17759. @end table
  17760. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17761. @var{a} audio outputs.
  17762. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17763. segment, in the same order as the outputs, then the inputs for the second
  17764. segment, etc.
  17765. Related streams do not always have exactly the same duration, for various
  17766. reasons including codec frame size or sloppy authoring. For that reason,
  17767. related synchronized streams (e.g. a video and its audio track) should be
  17768. concatenated at once. The concat filter will use the duration of the longest
  17769. stream in each segment (except the last one), and if necessary pad shorter
  17770. audio streams with silence.
  17771. For this filter to work correctly, all segments must start at timestamp 0.
  17772. All corresponding streams must have the same parameters in all segments; the
  17773. filtering system will automatically select a common pixel format for video
  17774. streams, and a common sample format, sample rate and channel layout for
  17775. audio streams, but other settings, such as resolution, must be converted
  17776. explicitly by the user.
  17777. Different frame rates are acceptable but will result in variable frame rate
  17778. at output; be sure to configure the output file to handle it.
  17779. @subsection Examples
  17780. @itemize
  17781. @item
  17782. Concatenate an opening, an episode and an ending, all in bilingual version
  17783. (video in stream 0, audio in streams 1 and 2):
  17784. @example
  17785. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17786. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17787. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17788. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17789. @end example
  17790. @item
  17791. Concatenate two parts, handling audio and video separately, using the
  17792. (a)movie sources, and adjusting the resolution:
  17793. @example
  17794. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17795. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17796. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17797. @end example
  17798. Note that a desync will happen at the stitch if the audio and video streams
  17799. do not have exactly the same duration in the first file.
  17800. @end itemize
  17801. @subsection Commands
  17802. This filter supports the following commands:
  17803. @table @option
  17804. @item next
  17805. Close the current segment and step to the next one
  17806. @end table
  17807. @anchor{ebur128}
  17808. @section ebur128
  17809. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17810. level. By default, it logs a message at a frequency of 10Hz with the
  17811. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17812. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17813. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17814. sample format is double-precision floating point. The input stream will be converted to
  17815. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17816. after this filter to obtain the original parameters.
  17817. The filter also has a video output (see the @var{video} option) with a real
  17818. time graph to observe the loudness evolution. The graphic contains the logged
  17819. message mentioned above, so it is not printed anymore when this option is set,
  17820. unless the verbose logging is set. The main graphing area contains the
  17821. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17822. the momentary loudness (400 milliseconds), but can optionally be configured
  17823. to instead display short-term loudness (see @var{gauge}).
  17824. The green area marks a +/- 1LU target range around the target loudness
  17825. (-23LUFS by default, unless modified through @var{target}).
  17826. More information about the Loudness Recommendation EBU R128 on
  17827. @url{http://tech.ebu.ch/loudness}.
  17828. The filter accepts the following options:
  17829. @table @option
  17830. @item video
  17831. Activate the video output. The audio stream is passed unchanged whether this
  17832. option is set or no. The video stream will be the first output stream if
  17833. activated. Default is @code{0}.
  17834. @item size
  17835. Set the video size. This option is for video only. For the syntax of this
  17836. option, check the
  17837. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17838. Default and minimum resolution is @code{640x480}.
  17839. @item meter
  17840. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17841. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17842. other integer value between this range is allowed.
  17843. @item metadata
  17844. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17845. into 100ms output frames, each of them containing various loudness information
  17846. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17847. Default is @code{0}.
  17848. @item framelog
  17849. Force the frame logging level.
  17850. Available values are:
  17851. @table @samp
  17852. @item info
  17853. information logging level
  17854. @item verbose
  17855. verbose logging level
  17856. @end table
  17857. By default, the logging level is set to @var{info}. If the @option{video} or
  17858. the @option{metadata} options are set, it switches to @var{verbose}.
  17859. @item peak
  17860. Set peak mode(s).
  17861. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17862. values are:
  17863. @table @samp
  17864. @item none
  17865. Disable any peak mode (default).
  17866. @item sample
  17867. Enable sample-peak mode.
  17868. Simple peak mode looking for the higher sample value. It logs a message
  17869. for sample-peak (identified by @code{SPK}).
  17870. @item true
  17871. Enable true-peak mode.
  17872. If enabled, the peak lookup is done on an over-sampled version of the input
  17873. stream for better peak accuracy. It logs a message for true-peak.
  17874. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17875. This mode requires a build with @code{libswresample}.
  17876. @end table
  17877. @item dualmono
  17878. Treat mono input files as "dual mono". If a mono file is intended for playback
  17879. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17880. If set to @code{true}, this option will compensate for this effect.
  17881. Multi-channel input files are not affected by this option.
  17882. @item panlaw
  17883. Set a specific pan law to be used for the measurement of dual mono files.
  17884. This parameter is optional, and has a default value of -3.01dB.
  17885. @item target
  17886. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17887. This parameter is optional and has a default value of -23LUFS as specified
  17888. by EBU R128. However, material published online may prefer a level of -16LUFS
  17889. (e.g. for use with podcasts or video platforms).
  17890. @item gauge
  17891. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17892. @code{shortterm}. By default the momentary value will be used, but in certain
  17893. scenarios it may be more useful to observe the short term value instead (e.g.
  17894. live mixing).
  17895. @item scale
  17896. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17897. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17898. video output, not the summary or continuous log output.
  17899. @end table
  17900. @subsection Examples
  17901. @itemize
  17902. @item
  17903. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17904. @example
  17905. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17906. @end example
  17907. @item
  17908. Run an analysis with @command{ffmpeg}:
  17909. @example
  17910. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17911. @end example
  17912. @end itemize
  17913. @section interleave, ainterleave
  17914. Temporally interleave frames from several inputs.
  17915. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17916. These filters read frames from several inputs and send the oldest
  17917. queued frame to the output.
  17918. Input streams must have well defined, monotonically increasing frame
  17919. timestamp values.
  17920. In order to submit one frame to output, these filters need to enqueue
  17921. at least one frame for each input, so they cannot work in case one
  17922. input is not yet terminated and will not receive incoming frames.
  17923. For example consider the case when one input is a @code{select} filter
  17924. which always drops input frames. The @code{interleave} filter will keep
  17925. reading from that input, but it will never be able to send new frames
  17926. to output until the input sends an end-of-stream signal.
  17927. Also, depending on inputs synchronization, the filters will drop
  17928. frames in case one input receives more frames than the other ones, and
  17929. the queue is already filled.
  17930. These filters accept the following options:
  17931. @table @option
  17932. @item nb_inputs, n
  17933. Set the number of different inputs, it is 2 by default.
  17934. @item duration
  17935. How to determine the end-of-stream.
  17936. @table @option
  17937. @item longest
  17938. The duration of the longest input. (default)
  17939. @item shortest
  17940. The duration of the shortest input.
  17941. @item first
  17942. The duration of the first input.
  17943. @end table
  17944. @end table
  17945. @subsection Examples
  17946. @itemize
  17947. @item
  17948. Interleave frames belonging to different streams using @command{ffmpeg}:
  17949. @example
  17950. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17951. @end example
  17952. @item
  17953. Add flickering blur effect:
  17954. @example
  17955. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17956. @end example
  17957. @end itemize
  17958. @section metadata, ametadata
  17959. Manipulate frame metadata.
  17960. This filter accepts the following options:
  17961. @table @option
  17962. @item mode
  17963. Set mode of operation of the filter.
  17964. Can be one of the following:
  17965. @table @samp
  17966. @item select
  17967. If both @code{value} and @code{key} is set, select frames
  17968. which have such metadata. If only @code{key} is set, select
  17969. every frame that has such key in metadata.
  17970. @item add
  17971. Add new metadata @code{key} and @code{value}. If key is already available
  17972. do nothing.
  17973. @item modify
  17974. Modify value of already present key.
  17975. @item delete
  17976. If @code{value} is set, delete only keys that have such value.
  17977. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17978. the frame.
  17979. @item print
  17980. Print key and its value if metadata was found. If @code{key} is not set print all
  17981. metadata values available in frame.
  17982. @end table
  17983. @item key
  17984. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17985. @item value
  17986. Set metadata value which will be used. This option is mandatory for
  17987. @code{modify} and @code{add} mode.
  17988. @item function
  17989. Which function to use when comparing metadata value and @code{value}.
  17990. Can be one of following:
  17991. @table @samp
  17992. @item same_str
  17993. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17994. @item starts_with
  17995. Values are interpreted as strings, returns true if metadata value starts with
  17996. the @code{value} option string.
  17997. @item less
  17998. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17999. @item equal
  18000. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18001. @item greater
  18002. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18003. @item expr
  18004. Values are interpreted as floats, returns true if expression from option @code{expr}
  18005. evaluates to true.
  18006. @item ends_with
  18007. Values are interpreted as strings, returns true if metadata value ends with
  18008. the @code{value} option string.
  18009. @end table
  18010. @item expr
  18011. Set expression which is used when @code{function} is set to @code{expr}.
  18012. The expression is evaluated through the eval API and can contain the following
  18013. constants:
  18014. @table @option
  18015. @item VALUE1
  18016. Float representation of @code{value} from metadata key.
  18017. @item VALUE2
  18018. Float representation of @code{value} as supplied by user in @code{value} option.
  18019. @end table
  18020. @item file
  18021. If specified in @code{print} mode, output is written to the named file. Instead of
  18022. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18023. for standard output. If @code{file} option is not set, output is written to the log
  18024. with AV_LOG_INFO loglevel.
  18025. @item direct
  18026. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18027. @end table
  18028. @subsection Examples
  18029. @itemize
  18030. @item
  18031. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18032. between 0 and 1.
  18033. @example
  18034. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18035. @end example
  18036. @item
  18037. Print silencedetect output to file @file{metadata.txt}.
  18038. @example
  18039. silencedetect,ametadata=mode=print:file=metadata.txt
  18040. @end example
  18041. @item
  18042. Direct all metadata to a pipe with file descriptor 4.
  18043. @example
  18044. metadata=mode=print:file='pipe\:4'
  18045. @end example
  18046. @end itemize
  18047. @section perms, aperms
  18048. Set read/write permissions for the output frames.
  18049. These filters are mainly aimed at developers to test direct path in the
  18050. following filter in the filtergraph.
  18051. The filters accept the following options:
  18052. @table @option
  18053. @item mode
  18054. Select the permissions mode.
  18055. It accepts the following values:
  18056. @table @samp
  18057. @item none
  18058. Do nothing. This is the default.
  18059. @item ro
  18060. Set all the output frames read-only.
  18061. @item rw
  18062. Set all the output frames directly writable.
  18063. @item toggle
  18064. Make the frame read-only if writable, and writable if read-only.
  18065. @item random
  18066. Set each output frame read-only or writable randomly.
  18067. @end table
  18068. @item seed
  18069. Set the seed for the @var{random} mode, must be an integer included between
  18070. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18071. @code{-1}, the filter will try to use a good random seed on a best effort
  18072. basis.
  18073. @end table
  18074. Note: in case of auto-inserted filter between the permission filter and the
  18075. following one, the permission might not be received as expected in that
  18076. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18077. perms/aperms filter can avoid this problem.
  18078. @section realtime, arealtime
  18079. Slow down filtering to match real time approximately.
  18080. These filters will pause the filtering for a variable amount of time to
  18081. match the output rate with the input timestamps.
  18082. They are similar to the @option{re} option to @code{ffmpeg}.
  18083. They accept the following options:
  18084. @table @option
  18085. @item limit
  18086. Time limit for the pauses. Any pause longer than that will be considered
  18087. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18088. @item speed
  18089. Speed factor for processing. The value must be a float larger than zero.
  18090. Values larger than 1.0 will result in faster than realtime processing,
  18091. smaller will slow processing down. The @var{limit} is automatically adapted
  18092. accordingly. Default is 1.0.
  18093. A processing speed faster than what is possible without these filters cannot
  18094. be achieved.
  18095. @end table
  18096. @anchor{select}
  18097. @section select, aselect
  18098. Select frames to pass in output.
  18099. This filter accepts the following options:
  18100. @table @option
  18101. @item expr, e
  18102. Set expression, which is evaluated for each input frame.
  18103. If the expression is evaluated to zero, the frame is discarded.
  18104. If the evaluation result is negative or NaN, the frame is sent to the
  18105. first output; otherwise it is sent to the output with index
  18106. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18107. For example a value of @code{1.2} corresponds to the output with index
  18108. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18109. @item outputs, n
  18110. Set the number of outputs. The output to which to send the selected
  18111. frame is based on the result of the evaluation. Default value is 1.
  18112. @end table
  18113. The expression can contain the following constants:
  18114. @table @option
  18115. @item n
  18116. The (sequential) number of the filtered frame, starting from 0.
  18117. @item selected_n
  18118. The (sequential) number of the selected frame, starting from 0.
  18119. @item prev_selected_n
  18120. The sequential number of the last selected frame. It's NAN if undefined.
  18121. @item TB
  18122. The timebase of the input timestamps.
  18123. @item pts
  18124. The PTS (Presentation TimeStamp) of the filtered video frame,
  18125. expressed in @var{TB} units. It's NAN if undefined.
  18126. @item t
  18127. The PTS of the filtered video frame,
  18128. expressed in seconds. It's NAN if undefined.
  18129. @item prev_pts
  18130. The PTS of the previously filtered video frame. It's NAN if undefined.
  18131. @item prev_selected_pts
  18132. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18133. @item prev_selected_t
  18134. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18135. @item start_pts
  18136. The PTS of the first video frame in the video. It's NAN if undefined.
  18137. @item start_t
  18138. The time of the first video frame in the video. It's NAN if undefined.
  18139. @item pict_type @emph{(video only)}
  18140. The type of the filtered frame. It can assume one of the following
  18141. values:
  18142. @table @option
  18143. @item I
  18144. @item P
  18145. @item B
  18146. @item S
  18147. @item SI
  18148. @item SP
  18149. @item BI
  18150. @end table
  18151. @item interlace_type @emph{(video only)}
  18152. The frame interlace type. It can assume one of the following values:
  18153. @table @option
  18154. @item PROGRESSIVE
  18155. The frame is progressive (not interlaced).
  18156. @item TOPFIRST
  18157. The frame is top-field-first.
  18158. @item BOTTOMFIRST
  18159. The frame is bottom-field-first.
  18160. @end table
  18161. @item consumed_sample_n @emph{(audio only)}
  18162. the number of selected samples before the current frame
  18163. @item samples_n @emph{(audio only)}
  18164. the number of samples in the current frame
  18165. @item sample_rate @emph{(audio only)}
  18166. the input sample rate
  18167. @item key
  18168. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18169. @item pos
  18170. the position in the file of the filtered frame, -1 if the information
  18171. is not available (e.g. for synthetic video)
  18172. @item scene @emph{(video only)}
  18173. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18174. probability for the current frame to introduce a new scene, while a higher
  18175. value means the current frame is more likely to be one (see the example below)
  18176. @item concatdec_select
  18177. The concat demuxer can select only part of a concat input file by setting an
  18178. inpoint and an outpoint, but the output packets may not be entirely contained
  18179. in the selected interval. By using this variable, it is possible to skip frames
  18180. generated by the concat demuxer which are not exactly contained in the selected
  18181. interval.
  18182. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18183. and the @var{lavf.concat.duration} packet metadata values which are also
  18184. present in the decoded frames.
  18185. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18186. start_time and either the duration metadata is missing or the frame pts is less
  18187. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18188. missing.
  18189. That basically means that an input frame is selected if its pts is within the
  18190. interval set by the concat demuxer.
  18191. @end table
  18192. The default value of the select expression is "1".
  18193. @subsection Examples
  18194. @itemize
  18195. @item
  18196. Select all frames in input:
  18197. @example
  18198. select
  18199. @end example
  18200. The example above is the same as:
  18201. @example
  18202. select=1
  18203. @end example
  18204. @item
  18205. Skip all frames:
  18206. @example
  18207. select=0
  18208. @end example
  18209. @item
  18210. Select only I-frames:
  18211. @example
  18212. select='eq(pict_type\,I)'
  18213. @end example
  18214. @item
  18215. Select one frame every 100:
  18216. @example
  18217. select='not(mod(n\,100))'
  18218. @end example
  18219. @item
  18220. Select only frames contained in the 10-20 time interval:
  18221. @example
  18222. select=between(t\,10\,20)
  18223. @end example
  18224. @item
  18225. Select only I-frames contained in the 10-20 time interval:
  18226. @example
  18227. select=between(t\,10\,20)*eq(pict_type\,I)
  18228. @end example
  18229. @item
  18230. Select frames with a minimum distance of 10 seconds:
  18231. @example
  18232. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18233. @end example
  18234. @item
  18235. Use aselect to select only audio frames with samples number > 100:
  18236. @example
  18237. aselect='gt(samples_n\,100)'
  18238. @end example
  18239. @item
  18240. Create a mosaic of the first scenes:
  18241. @example
  18242. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18243. @end example
  18244. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18245. choice.
  18246. @item
  18247. Send even and odd frames to separate outputs, and compose them:
  18248. @example
  18249. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18250. @end example
  18251. @item
  18252. Select useful frames from an ffconcat file which is using inpoints and
  18253. outpoints but where the source files are not intra frame only.
  18254. @example
  18255. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18256. @end example
  18257. @end itemize
  18258. @section sendcmd, asendcmd
  18259. Send commands to filters in the filtergraph.
  18260. These filters read commands to be sent to other filters in the
  18261. filtergraph.
  18262. @code{sendcmd} must be inserted between two video filters,
  18263. @code{asendcmd} must be inserted between two audio filters, but apart
  18264. from that they act the same way.
  18265. The specification of commands can be provided in the filter arguments
  18266. with the @var{commands} option, or in a file specified by the
  18267. @var{filename} option.
  18268. These filters accept the following options:
  18269. @table @option
  18270. @item commands, c
  18271. Set the commands to be read and sent to the other filters.
  18272. @item filename, f
  18273. Set the filename of the commands to be read and sent to the other
  18274. filters.
  18275. @end table
  18276. @subsection Commands syntax
  18277. A commands description consists of a sequence of interval
  18278. specifications, comprising a list of commands to be executed when a
  18279. particular event related to that interval occurs. The occurring event
  18280. is typically the current frame time entering or leaving a given time
  18281. interval.
  18282. An interval is specified by the following syntax:
  18283. @example
  18284. @var{START}[-@var{END}] @var{COMMANDS};
  18285. @end example
  18286. The time interval is specified by the @var{START} and @var{END} times.
  18287. @var{END} is optional and defaults to the maximum time.
  18288. The current frame time is considered within the specified interval if
  18289. it is included in the interval [@var{START}, @var{END}), that is when
  18290. the time is greater or equal to @var{START} and is lesser than
  18291. @var{END}.
  18292. @var{COMMANDS} consists of a sequence of one or more command
  18293. specifications, separated by ",", relating to that interval. The
  18294. syntax of a command specification is given by:
  18295. @example
  18296. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18297. @end example
  18298. @var{FLAGS} is optional and specifies the type of events relating to
  18299. the time interval which enable sending the specified command, and must
  18300. be a non-null sequence of identifier flags separated by "+" or "|" and
  18301. enclosed between "[" and "]".
  18302. The following flags are recognized:
  18303. @table @option
  18304. @item enter
  18305. The command is sent when the current frame timestamp enters the
  18306. specified interval. In other words, the command is sent when the
  18307. previous frame timestamp was not in the given interval, and the
  18308. current is.
  18309. @item leave
  18310. The command is sent when the current frame timestamp leaves the
  18311. specified interval. In other words, the command is sent when the
  18312. previous frame timestamp was in the given interval, and the
  18313. current is not.
  18314. @item expr
  18315. The command @var{ARG} is interpreted as expression and result of
  18316. expression is passed as @var{ARG}.
  18317. The expression is evaluated through the eval API and can contain the following
  18318. constants:
  18319. @table @option
  18320. @item POS
  18321. Original position in the file of the frame, or undefined if undefined
  18322. for the current frame.
  18323. @item PTS
  18324. The presentation timestamp in input.
  18325. @item N
  18326. The count of the input frame for video or audio, starting from 0.
  18327. @item T
  18328. The time in seconds of the current frame.
  18329. @item TS
  18330. The start time in seconds of the current command interval.
  18331. @item TE
  18332. The end time in seconds of the current command interval.
  18333. @item TI
  18334. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18335. @end table
  18336. @end table
  18337. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18338. assumed.
  18339. @var{TARGET} specifies the target of the command, usually the name of
  18340. the filter class or a specific filter instance name.
  18341. @var{COMMAND} specifies the name of the command for the target filter.
  18342. @var{ARG} is optional and specifies the optional list of argument for
  18343. the given @var{COMMAND}.
  18344. Between one interval specification and another, whitespaces, or
  18345. sequences of characters starting with @code{#} until the end of line,
  18346. are ignored and can be used to annotate comments.
  18347. A simplified BNF description of the commands specification syntax
  18348. follows:
  18349. @example
  18350. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18351. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18352. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18353. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18354. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18355. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18356. @end example
  18357. @subsection Examples
  18358. @itemize
  18359. @item
  18360. Specify audio tempo change at second 4:
  18361. @example
  18362. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18363. @end example
  18364. @item
  18365. Target a specific filter instance:
  18366. @example
  18367. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18368. @end example
  18369. @item
  18370. Specify a list of drawtext and hue commands in a file.
  18371. @example
  18372. # show text in the interval 5-10
  18373. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18374. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18375. # desaturate the image in the interval 15-20
  18376. 15.0-20.0 [enter] hue s 0,
  18377. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18378. [leave] hue s 1,
  18379. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18380. # apply an exponential saturation fade-out effect, starting from time 25
  18381. 25 [enter] hue s exp(25-t)
  18382. @end example
  18383. A filtergraph allowing to read and process the above command list
  18384. stored in a file @file{test.cmd}, can be specified with:
  18385. @example
  18386. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18387. @end example
  18388. @end itemize
  18389. @anchor{setpts}
  18390. @section setpts, asetpts
  18391. Change the PTS (presentation timestamp) of the input frames.
  18392. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18393. This filter accepts the following options:
  18394. @table @option
  18395. @item expr
  18396. The expression which is evaluated for each frame to construct its timestamp.
  18397. @end table
  18398. The expression is evaluated through the eval API and can contain the following
  18399. constants:
  18400. @table @option
  18401. @item FRAME_RATE, FR
  18402. frame rate, only defined for constant frame-rate video
  18403. @item PTS
  18404. The presentation timestamp in input
  18405. @item N
  18406. The count of the input frame for video or the number of consumed samples,
  18407. not including the current frame for audio, starting from 0.
  18408. @item NB_CONSUMED_SAMPLES
  18409. The number of consumed samples, not including the current frame (only
  18410. audio)
  18411. @item NB_SAMPLES, S
  18412. The number of samples in the current frame (only audio)
  18413. @item SAMPLE_RATE, SR
  18414. The audio sample rate.
  18415. @item STARTPTS
  18416. The PTS of the first frame.
  18417. @item STARTT
  18418. the time in seconds of the first frame
  18419. @item INTERLACED
  18420. State whether the current frame is interlaced.
  18421. @item T
  18422. the time in seconds of the current frame
  18423. @item POS
  18424. original position in the file of the frame, or undefined if undefined
  18425. for the current frame
  18426. @item PREV_INPTS
  18427. The previous input PTS.
  18428. @item PREV_INT
  18429. previous input time in seconds
  18430. @item PREV_OUTPTS
  18431. The previous output PTS.
  18432. @item PREV_OUTT
  18433. previous output time in seconds
  18434. @item RTCTIME
  18435. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18436. instead.
  18437. @item RTCSTART
  18438. The wallclock (RTC) time at the start of the movie in microseconds.
  18439. @item TB
  18440. The timebase of the input timestamps.
  18441. @end table
  18442. @subsection Examples
  18443. @itemize
  18444. @item
  18445. Start counting PTS from zero
  18446. @example
  18447. setpts=PTS-STARTPTS
  18448. @end example
  18449. @item
  18450. Apply fast motion effect:
  18451. @example
  18452. setpts=0.5*PTS
  18453. @end example
  18454. @item
  18455. Apply slow motion effect:
  18456. @example
  18457. setpts=2.0*PTS
  18458. @end example
  18459. @item
  18460. Set fixed rate of 25 frames per second:
  18461. @example
  18462. setpts=N/(25*TB)
  18463. @end example
  18464. @item
  18465. Set fixed rate 25 fps with some jitter:
  18466. @example
  18467. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18468. @end example
  18469. @item
  18470. Apply an offset of 10 seconds to the input PTS:
  18471. @example
  18472. setpts=PTS+10/TB
  18473. @end example
  18474. @item
  18475. Generate timestamps from a "live source" and rebase onto the current timebase:
  18476. @example
  18477. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18478. @end example
  18479. @item
  18480. Generate timestamps by counting samples:
  18481. @example
  18482. asetpts=N/SR/TB
  18483. @end example
  18484. @end itemize
  18485. @section setrange
  18486. Force color range for the output video frame.
  18487. The @code{setrange} filter marks the color range property for the
  18488. output frames. It does not change the input frame, but only sets the
  18489. corresponding property, which affects how the frame is treated by
  18490. following filters.
  18491. The filter accepts the following options:
  18492. @table @option
  18493. @item range
  18494. Available values are:
  18495. @table @samp
  18496. @item auto
  18497. Keep the same color range property.
  18498. @item unspecified, unknown
  18499. Set the color range as unspecified.
  18500. @item limited, tv, mpeg
  18501. Set the color range as limited.
  18502. @item full, pc, jpeg
  18503. Set the color range as full.
  18504. @end table
  18505. @end table
  18506. @section settb, asettb
  18507. Set the timebase to use for the output frames timestamps.
  18508. It is mainly useful for testing timebase configuration.
  18509. It accepts the following parameters:
  18510. @table @option
  18511. @item expr, tb
  18512. The expression which is evaluated into the output timebase.
  18513. @end table
  18514. The value for @option{tb} is an arithmetic expression representing a
  18515. rational. The expression can contain the constants "AVTB" (the default
  18516. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18517. audio only). Default value is "intb".
  18518. @subsection Examples
  18519. @itemize
  18520. @item
  18521. Set the timebase to 1/25:
  18522. @example
  18523. settb=expr=1/25
  18524. @end example
  18525. @item
  18526. Set the timebase to 1/10:
  18527. @example
  18528. settb=expr=0.1
  18529. @end example
  18530. @item
  18531. Set the timebase to 1001/1000:
  18532. @example
  18533. settb=1+0.001
  18534. @end example
  18535. @item
  18536. Set the timebase to 2*intb:
  18537. @example
  18538. settb=2*intb
  18539. @end example
  18540. @item
  18541. Set the default timebase value:
  18542. @example
  18543. settb=AVTB
  18544. @end example
  18545. @end itemize
  18546. @section showcqt
  18547. Convert input audio to a video output representing frequency spectrum
  18548. logarithmically using Brown-Puckette constant Q transform algorithm with
  18549. direct frequency domain coefficient calculation (but the transform itself
  18550. is not really constant Q, instead the Q factor is actually variable/clamped),
  18551. with musical tone scale, from E0 to D#10.
  18552. The filter accepts the following options:
  18553. @table @option
  18554. @item size, s
  18555. Specify the video size for the output. It must be even. For the syntax of this option,
  18556. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18557. Default value is @code{1920x1080}.
  18558. @item fps, rate, r
  18559. Set the output frame rate. Default value is @code{25}.
  18560. @item bar_h
  18561. Set the bargraph height. It must be even. Default value is @code{-1} which
  18562. computes the bargraph height automatically.
  18563. @item axis_h
  18564. Set the axis height. It must be even. Default value is @code{-1} which computes
  18565. the axis height automatically.
  18566. @item sono_h
  18567. Set the sonogram height. It must be even. Default value is @code{-1} which
  18568. computes the sonogram height automatically.
  18569. @item fullhd
  18570. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18571. instead. Default value is @code{1}.
  18572. @item sono_v, volume
  18573. Specify the sonogram volume expression. It can contain variables:
  18574. @table @option
  18575. @item bar_v
  18576. the @var{bar_v} evaluated expression
  18577. @item frequency, freq, f
  18578. the frequency where it is evaluated
  18579. @item timeclamp, tc
  18580. the value of @var{timeclamp} option
  18581. @end table
  18582. and functions:
  18583. @table @option
  18584. @item a_weighting(f)
  18585. A-weighting of equal loudness
  18586. @item b_weighting(f)
  18587. B-weighting of equal loudness
  18588. @item c_weighting(f)
  18589. C-weighting of equal loudness.
  18590. @end table
  18591. Default value is @code{16}.
  18592. @item bar_v, volume2
  18593. Specify the bargraph volume expression. It can contain variables:
  18594. @table @option
  18595. @item sono_v
  18596. the @var{sono_v} evaluated expression
  18597. @item frequency, freq, f
  18598. the frequency where it is evaluated
  18599. @item timeclamp, tc
  18600. the value of @var{timeclamp} option
  18601. @end table
  18602. and functions:
  18603. @table @option
  18604. @item a_weighting(f)
  18605. A-weighting of equal loudness
  18606. @item b_weighting(f)
  18607. B-weighting of equal loudness
  18608. @item c_weighting(f)
  18609. C-weighting of equal loudness.
  18610. @end table
  18611. Default value is @code{sono_v}.
  18612. @item sono_g, gamma
  18613. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18614. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18615. Acceptable range is @code{[1, 7]}.
  18616. @item bar_g, gamma2
  18617. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18618. @code{[1, 7]}.
  18619. @item bar_t
  18620. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18621. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18622. @item timeclamp, tc
  18623. Specify the transform timeclamp. At low frequency, there is trade-off between
  18624. accuracy in time domain and frequency domain. If timeclamp is lower,
  18625. event in time domain is represented more accurately (such as fast bass drum),
  18626. otherwise event in frequency domain is represented more accurately
  18627. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18628. @item attack
  18629. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18630. limits future samples by applying asymmetric windowing in time domain, useful
  18631. when low latency is required. Accepted range is @code{[0, 1]}.
  18632. @item basefreq
  18633. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18634. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18635. @item endfreq
  18636. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18637. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18638. @item coeffclamp
  18639. This option is deprecated and ignored.
  18640. @item tlength
  18641. Specify the transform length in time domain. Use this option to control accuracy
  18642. trade-off between time domain and frequency domain at every frequency sample.
  18643. It can contain variables:
  18644. @table @option
  18645. @item frequency, freq, f
  18646. the frequency where it is evaluated
  18647. @item timeclamp, tc
  18648. the value of @var{timeclamp} option.
  18649. @end table
  18650. Default value is @code{384*tc/(384+tc*f)}.
  18651. @item count
  18652. Specify the transform count for every video frame. Default value is @code{6}.
  18653. Acceptable range is @code{[1, 30]}.
  18654. @item fcount
  18655. Specify the transform count for every single pixel. Default value is @code{0},
  18656. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18657. @item fontfile
  18658. Specify font file for use with freetype to draw the axis. If not specified,
  18659. use embedded font. Note that drawing with font file or embedded font is not
  18660. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18661. option instead.
  18662. @item font
  18663. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18664. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18665. escaping.
  18666. @item fontcolor
  18667. Specify font color expression. This is arithmetic expression that should return
  18668. integer value 0xRRGGBB. It can contain variables:
  18669. @table @option
  18670. @item frequency, freq, f
  18671. the frequency where it is evaluated
  18672. @item timeclamp, tc
  18673. the value of @var{timeclamp} option
  18674. @end table
  18675. and functions:
  18676. @table @option
  18677. @item midi(f)
  18678. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18679. @item r(x), g(x), b(x)
  18680. red, green, and blue value of intensity x.
  18681. @end table
  18682. Default value is @code{st(0, (midi(f)-59.5)/12);
  18683. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18684. r(1-ld(1)) + b(ld(1))}.
  18685. @item axisfile
  18686. Specify image file to draw the axis. This option override @var{fontfile} and
  18687. @var{fontcolor} option.
  18688. @item axis, text
  18689. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18690. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18691. Default value is @code{1}.
  18692. @item csp
  18693. Set colorspace. The accepted values are:
  18694. @table @samp
  18695. @item unspecified
  18696. Unspecified (default)
  18697. @item bt709
  18698. BT.709
  18699. @item fcc
  18700. FCC
  18701. @item bt470bg
  18702. BT.470BG or BT.601-6 625
  18703. @item smpte170m
  18704. SMPTE-170M or BT.601-6 525
  18705. @item smpte240m
  18706. SMPTE-240M
  18707. @item bt2020ncl
  18708. BT.2020 with non-constant luminance
  18709. @end table
  18710. @item cscheme
  18711. Set spectrogram color scheme. This is list of floating point values with format
  18712. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18713. The default is @code{1|0.5|0|0|0.5|1}.
  18714. @end table
  18715. @subsection Examples
  18716. @itemize
  18717. @item
  18718. Playing audio while showing the spectrum:
  18719. @example
  18720. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18721. @end example
  18722. @item
  18723. Same as above, but with frame rate 30 fps:
  18724. @example
  18725. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18726. @end example
  18727. @item
  18728. Playing at 1280x720:
  18729. @example
  18730. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18731. @end example
  18732. @item
  18733. Disable sonogram display:
  18734. @example
  18735. sono_h=0
  18736. @end example
  18737. @item
  18738. A1 and its harmonics: A1, A2, (near)E3, A3:
  18739. @example
  18740. 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),
  18741. asplit[a][out1]; [a] showcqt [out0]'
  18742. @end example
  18743. @item
  18744. Same as above, but with more accuracy in frequency domain:
  18745. @example
  18746. 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),
  18747. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18748. @end example
  18749. @item
  18750. Custom volume:
  18751. @example
  18752. bar_v=10:sono_v=bar_v*a_weighting(f)
  18753. @end example
  18754. @item
  18755. Custom gamma, now spectrum is linear to the amplitude.
  18756. @example
  18757. bar_g=2:sono_g=2
  18758. @end example
  18759. @item
  18760. Custom tlength equation:
  18761. @example
  18762. 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)))'
  18763. @end example
  18764. @item
  18765. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18766. @example
  18767. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18768. @end example
  18769. @item
  18770. Custom font using fontconfig:
  18771. @example
  18772. font='Courier New,Monospace,mono|bold'
  18773. @end example
  18774. @item
  18775. Custom frequency range with custom axis using image file:
  18776. @example
  18777. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18778. @end example
  18779. @end itemize
  18780. @section showfreqs
  18781. Convert input audio to video output representing the audio power spectrum.
  18782. Audio amplitude is on Y-axis while frequency is on X-axis.
  18783. The filter accepts the following options:
  18784. @table @option
  18785. @item size, s
  18786. Specify size of video. For the syntax of this option, check the
  18787. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18788. Default is @code{1024x512}.
  18789. @item mode
  18790. Set display mode.
  18791. This set how each frequency bin will be represented.
  18792. It accepts the following values:
  18793. @table @samp
  18794. @item line
  18795. @item bar
  18796. @item dot
  18797. @end table
  18798. Default is @code{bar}.
  18799. @item ascale
  18800. Set amplitude scale.
  18801. It accepts the following values:
  18802. @table @samp
  18803. @item lin
  18804. Linear scale.
  18805. @item sqrt
  18806. Square root scale.
  18807. @item cbrt
  18808. Cubic root scale.
  18809. @item log
  18810. Logarithmic scale.
  18811. @end table
  18812. Default is @code{log}.
  18813. @item fscale
  18814. Set frequency scale.
  18815. It accepts the following values:
  18816. @table @samp
  18817. @item lin
  18818. Linear scale.
  18819. @item log
  18820. Logarithmic scale.
  18821. @item rlog
  18822. Reverse logarithmic scale.
  18823. @end table
  18824. Default is @code{lin}.
  18825. @item win_size
  18826. Set window size. Allowed range is from 16 to 65536.
  18827. Default is @code{2048}
  18828. @item win_func
  18829. Set windowing function.
  18830. It accepts the following values:
  18831. @table @samp
  18832. @item rect
  18833. @item bartlett
  18834. @item hanning
  18835. @item hamming
  18836. @item blackman
  18837. @item welch
  18838. @item flattop
  18839. @item bharris
  18840. @item bnuttall
  18841. @item bhann
  18842. @item sine
  18843. @item nuttall
  18844. @item lanczos
  18845. @item gauss
  18846. @item tukey
  18847. @item dolph
  18848. @item cauchy
  18849. @item parzen
  18850. @item poisson
  18851. @item bohman
  18852. @end table
  18853. Default is @code{hanning}.
  18854. @item overlap
  18855. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18856. which means optimal overlap for selected window function will be picked.
  18857. @item averaging
  18858. Set time averaging. Setting this to 0 will display current maximal peaks.
  18859. Default is @code{1}, which means time averaging is disabled.
  18860. @item colors
  18861. Specify list of colors separated by space or by '|' which will be used to
  18862. draw channel frequencies. Unrecognized or missing colors will be replaced
  18863. by white color.
  18864. @item cmode
  18865. Set channel display mode.
  18866. It accepts the following values:
  18867. @table @samp
  18868. @item combined
  18869. @item separate
  18870. @end table
  18871. Default is @code{combined}.
  18872. @item minamp
  18873. Set minimum amplitude used in @code{log} amplitude scaler.
  18874. @end table
  18875. @section showspatial
  18876. Convert stereo input audio to a video output, representing the spatial relationship
  18877. between two channels.
  18878. The filter accepts the following options:
  18879. @table @option
  18880. @item size, s
  18881. Specify the video size for the output. For the syntax of this option, check the
  18882. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18883. Default value is @code{512x512}.
  18884. @item win_size
  18885. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18886. @item win_func
  18887. Set window function.
  18888. It accepts the following values:
  18889. @table @samp
  18890. @item rect
  18891. @item bartlett
  18892. @item hann
  18893. @item hanning
  18894. @item hamming
  18895. @item blackman
  18896. @item welch
  18897. @item flattop
  18898. @item bharris
  18899. @item bnuttall
  18900. @item bhann
  18901. @item sine
  18902. @item nuttall
  18903. @item lanczos
  18904. @item gauss
  18905. @item tukey
  18906. @item dolph
  18907. @item cauchy
  18908. @item parzen
  18909. @item poisson
  18910. @item bohman
  18911. @end table
  18912. Default value is @code{hann}.
  18913. @item overlap
  18914. Set ratio of overlap window. Default value is @code{0.5}.
  18915. When value is @code{1} overlap is set to recommended size for specific
  18916. window function currently used.
  18917. @end table
  18918. @anchor{showspectrum}
  18919. @section showspectrum
  18920. Convert input audio to a video output, representing the audio frequency
  18921. spectrum.
  18922. The filter accepts the following options:
  18923. @table @option
  18924. @item size, s
  18925. Specify the video size for the output. For the syntax of this option, check the
  18926. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18927. Default value is @code{640x512}.
  18928. @item slide
  18929. Specify how the spectrum should slide along the window.
  18930. It accepts the following values:
  18931. @table @samp
  18932. @item replace
  18933. the samples start again on the left when they reach the right
  18934. @item scroll
  18935. the samples scroll from right to left
  18936. @item fullframe
  18937. frames are only produced when the samples reach the right
  18938. @item rscroll
  18939. the samples scroll from left to right
  18940. @end table
  18941. Default value is @code{replace}.
  18942. @item mode
  18943. Specify display mode.
  18944. It accepts the following values:
  18945. @table @samp
  18946. @item combined
  18947. all channels are displayed in the same row
  18948. @item separate
  18949. all channels are displayed in separate rows
  18950. @end table
  18951. Default value is @samp{combined}.
  18952. @item color
  18953. Specify display color mode.
  18954. It accepts the following values:
  18955. @table @samp
  18956. @item channel
  18957. each channel is displayed in a separate color
  18958. @item intensity
  18959. each channel is displayed using the same color scheme
  18960. @item rainbow
  18961. each channel is displayed using the rainbow color scheme
  18962. @item moreland
  18963. each channel is displayed using the moreland color scheme
  18964. @item nebulae
  18965. each channel is displayed using the nebulae color scheme
  18966. @item fire
  18967. each channel is displayed using the fire color scheme
  18968. @item fiery
  18969. each channel is displayed using the fiery color scheme
  18970. @item fruit
  18971. each channel is displayed using the fruit color scheme
  18972. @item cool
  18973. each channel is displayed using the cool color scheme
  18974. @item magma
  18975. each channel is displayed using the magma color scheme
  18976. @item green
  18977. each channel is displayed using the green color scheme
  18978. @item viridis
  18979. each channel is displayed using the viridis color scheme
  18980. @item plasma
  18981. each channel is displayed using the plasma color scheme
  18982. @item cividis
  18983. each channel is displayed using the cividis color scheme
  18984. @item terrain
  18985. each channel is displayed using the terrain color scheme
  18986. @end table
  18987. Default value is @samp{channel}.
  18988. @item scale
  18989. Specify scale used for calculating intensity color values.
  18990. It accepts the following values:
  18991. @table @samp
  18992. @item lin
  18993. linear
  18994. @item sqrt
  18995. square root, default
  18996. @item cbrt
  18997. cubic root
  18998. @item log
  18999. logarithmic
  19000. @item 4thrt
  19001. 4th root
  19002. @item 5thrt
  19003. 5th root
  19004. @end table
  19005. Default value is @samp{sqrt}.
  19006. @item fscale
  19007. Specify frequency scale.
  19008. It accepts the following values:
  19009. @table @samp
  19010. @item lin
  19011. linear
  19012. @item log
  19013. logarithmic
  19014. @end table
  19015. Default value is @samp{lin}.
  19016. @item saturation
  19017. Set saturation modifier for displayed colors. Negative values provide
  19018. alternative color scheme. @code{0} is no saturation at all.
  19019. Saturation must be in [-10.0, 10.0] range.
  19020. Default value is @code{1}.
  19021. @item win_func
  19022. Set window function.
  19023. It accepts the following values:
  19024. @table @samp
  19025. @item rect
  19026. @item bartlett
  19027. @item hann
  19028. @item hanning
  19029. @item hamming
  19030. @item blackman
  19031. @item welch
  19032. @item flattop
  19033. @item bharris
  19034. @item bnuttall
  19035. @item bhann
  19036. @item sine
  19037. @item nuttall
  19038. @item lanczos
  19039. @item gauss
  19040. @item tukey
  19041. @item dolph
  19042. @item cauchy
  19043. @item parzen
  19044. @item poisson
  19045. @item bohman
  19046. @end table
  19047. Default value is @code{hann}.
  19048. @item orientation
  19049. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19050. @code{horizontal}. Default is @code{vertical}.
  19051. @item overlap
  19052. Set ratio of overlap window. Default value is @code{0}.
  19053. When value is @code{1} overlap is set to recommended size for specific
  19054. window function currently used.
  19055. @item gain
  19056. Set scale gain for calculating intensity color values.
  19057. Default value is @code{1}.
  19058. @item data
  19059. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19060. @item rotation
  19061. Set color rotation, must be in [-1.0, 1.0] range.
  19062. Default value is @code{0}.
  19063. @item start
  19064. Set start frequency from which to display spectrogram. Default is @code{0}.
  19065. @item stop
  19066. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19067. @item fps
  19068. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19069. @item legend
  19070. Draw time and frequency axes and legends. Default is disabled.
  19071. @end table
  19072. The usage is very similar to the showwaves filter; see the examples in that
  19073. section.
  19074. @subsection Examples
  19075. @itemize
  19076. @item
  19077. Large window with logarithmic color scaling:
  19078. @example
  19079. showspectrum=s=1280x480:scale=log
  19080. @end example
  19081. @item
  19082. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19083. @example
  19084. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19085. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19086. @end example
  19087. @end itemize
  19088. @section showspectrumpic
  19089. Convert input audio to a single video frame, representing the audio frequency
  19090. spectrum.
  19091. The filter accepts the following options:
  19092. @table @option
  19093. @item size, s
  19094. Specify the video size for the output. For the syntax of this option, check the
  19095. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19096. Default value is @code{4096x2048}.
  19097. @item mode
  19098. Specify display mode.
  19099. It accepts the following values:
  19100. @table @samp
  19101. @item combined
  19102. all channels are displayed in the same row
  19103. @item separate
  19104. all channels are displayed in separate rows
  19105. @end table
  19106. Default value is @samp{combined}.
  19107. @item color
  19108. Specify display color mode.
  19109. It accepts the following values:
  19110. @table @samp
  19111. @item channel
  19112. each channel is displayed in a separate color
  19113. @item intensity
  19114. each channel is displayed using the same color scheme
  19115. @item rainbow
  19116. each channel is displayed using the rainbow color scheme
  19117. @item moreland
  19118. each channel is displayed using the moreland color scheme
  19119. @item nebulae
  19120. each channel is displayed using the nebulae color scheme
  19121. @item fire
  19122. each channel is displayed using the fire color scheme
  19123. @item fiery
  19124. each channel is displayed using the fiery color scheme
  19125. @item fruit
  19126. each channel is displayed using the fruit color scheme
  19127. @item cool
  19128. each channel is displayed using the cool color scheme
  19129. @item magma
  19130. each channel is displayed using the magma color scheme
  19131. @item green
  19132. each channel is displayed using the green color scheme
  19133. @item viridis
  19134. each channel is displayed using the viridis color scheme
  19135. @item plasma
  19136. each channel is displayed using the plasma color scheme
  19137. @item cividis
  19138. each channel is displayed using the cividis color scheme
  19139. @item terrain
  19140. each channel is displayed using the terrain color scheme
  19141. @end table
  19142. Default value is @samp{intensity}.
  19143. @item scale
  19144. Specify scale used for calculating intensity color values.
  19145. It accepts the following values:
  19146. @table @samp
  19147. @item lin
  19148. linear
  19149. @item sqrt
  19150. square root, default
  19151. @item cbrt
  19152. cubic root
  19153. @item log
  19154. logarithmic
  19155. @item 4thrt
  19156. 4th root
  19157. @item 5thrt
  19158. 5th root
  19159. @end table
  19160. Default value is @samp{log}.
  19161. @item fscale
  19162. Specify frequency scale.
  19163. It accepts the following values:
  19164. @table @samp
  19165. @item lin
  19166. linear
  19167. @item log
  19168. logarithmic
  19169. @end table
  19170. Default value is @samp{lin}.
  19171. @item saturation
  19172. Set saturation modifier for displayed colors. Negative values provide
  19173. alternative color scheme. @code{0} is no saturation at all.
  19174. Saturation must be in [-10.0, 10.0] range.
  19175. Default value is @code{1}.
  19176. @item win_func
  19177. Set window function.
  19178. It accepts the following values:
  19179. @table @samp
  19180. @item rect
  19181. @item bartlett
  19182. @item hann
  19183. @item hanning
  19184. @item hamming
  19185. @item blackman
  19186. @item welch
  19187. @item flattop
  19188. @item bharris
  19189. @item bnuttall
  19190. @item bhann
  19191. @item sine
  19192. @item nuttall
  19193. @item lanczos
  19194. @item gauss
  19195. @item tukey
  19196. @item dolph
  19197. @item cauchy
  19198. @item parzen
  19199. @item poisson
  19200. @item bohman
  19201. @end table
  19202. Default value is @code{hann}.
  19203. @item orientation
  19204. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19205. @code{horizontal}. Default is @code{vertical}.
  19206. @item gain
  19207. Set scale gain for calculating intensity color values.
  19208. Default value is @code{1}.
  19209. @item legend
  19210. Draw time and frequency axes and legends. Default is enabled.
  19211. @item rotation
  19212. Set color rotation, must be in [-1.0, 1.0] range.
  19213. Default value is @code{0}.
  19214. @item start
  19215. Set start frequency from which to display spectrogram. Default is @code{0}.
  19216. @item stop
  19217. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19218. @end table
  19219. @subsection Examples
  19220. @itemize
  19221. @item
  19222. Extract an audio spectrogram of a whole audio track
  19223. in a 1024x1024 picture using @command{ffmpeg}:
  19224. @example
  19225. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19226. @end example
  19227. @end itemize
  19228. @section showvolume
  19229. Convert input audio volume to a video output.
  19230. The filter accepts the following options:
  19231. @table @option
  19232. @item rate, r
  19233. Set video rate.
  19234. @item b
  19235. Set border width, allowed range is [0, 5]. Default is 1.
  19236. @item w
  19237. Set channel width, allowed range is [80, 8192]. Default is 400.
  19238. @item h
  19239. Set channel height, allowed range is [1, 900]. Default is 20.
  19240. @item f
  19241. Set fade, allowed range is [0, 1]. Default is 0.95.
  19242. @item c
  19243. Set volume color expression.
  19244. The expression can use the following variables:
  19245. @table @option
  19246. @item VOLUME
  19247. Current max volume of channel in dB.
  19248. @item PEAK
  19249. Current peak.
  19250. @item CHANNEL
  19251. Current channel number, starting from 0.
  19252. @end table
  19253. @item t
  19254. If set, displays channel names. Default is enabled.
  19255. @item v
  19256. If set, displays volume values. Default is enabled.
  19257. @item o
  19258. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19259. default is @code{h}.
  19260. @item s
  19261. Set step size, allowed range is [0, 5]. Default is 0, which means
  19262. step is disabled.
  19263. @item p
  19264. Set background opacity, allowed range is [0, 1]. Default is 0.
  19265. @item m
  19266. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19267. default is @code{p}.
  19268. @item ds
  19269. Set display scale, can be linear: @code{lin} or log: @code{log},
  19270. default is @code{lin}.
  19271. @item dm
  19272. In second.
  19273. If set to > 0., display a line for the max level
  19274. in the previous seconds.
  19275. default is disabled: @code{0.}
  19276. @item dmc
  19277. The color of the max line. Use when @code{dm} option is set to > 0.
  19278. default is: @code{orange}
  19279. @end table
  19280. @section showwaves
  19281. Convert input audio to a video output, representing the samples waves.
  19282. The filter accepts the following options:
  19283. @table @option
  19284. @item size, s
  19285. Specify the video size for the output. For the syntax of this option, check the
  19286. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19287. Default value is @code{600x240}.
  19288. @item mode
  19289. Set display mode.
  19290. Available values are:
  19291. @table @samp
  19292. @item point
  19293. Draw a point for each sample.
  19294. @item line
  19295. Draw a vertical line for each sample.
  19296. @item p2p
  19297. Draw a point for each sample and a line between them.
  19298. @item cline
  19299. Draw a centered vertical line for each sample.
  19300. @end table
  19301. Default value is @code{point}.
  19302. @item n
  19303. Set the number of samples which are printed on the same column. A
  19304. larger value will decrease the frame rate. Must be a positive
  19305. integer. This option can be set only if the value for @var{rate}
  19306. is not explicitly specified.
  19307. @item rate, r
  19308. Set the (approximate) output frame rate. This is done by setting the
  19309. option @var{n}. Default value is "25".
  19310. @item split_channels
  19311. Set if channels should be drawn separately or overlap. Default value is 0.
  19312. @item colors
  19313. Set colors separated by '|' which are going to be used for drawing of each channel.
  19314. @item scale
  19315. Set amplitude scale.
  19316. Available values are:
  19317. @table @samp
  19318. @item lin
  19319. Linear.
  19320. @item log
  19321. Logarithmic.
  19322. @item sqrt
  19323. Square root.
  19324. @item cbrt
  19325. Cubic root.
  19326. @end table
  19327. Default is linear.
  19328. @item draw
  19329. Set the draw mode. This is mostly useful to set for high @var{n}.
  19330. Available values are:
  19331. @table @samp
  19332. @item scale
  19333. Scale pixel values for each drawn sample.
  19334. @item full
  19335. Draw every sample directly.
  19336. @end table
  19337. Default value is @code{scale}.
  19338. @end table
  19339. @subsection Examples
  19340. @itemize
  19341. @item
  19342. Output the input file audio and the corresponding video representation
  19343. at the same time:
  19344. @example
  19345. amovie=a.mp3,asplit[out0],showwaves[out1]
  19346. @end example
  19347. @item
  19348. Create a synthetic signal and show it with showwaves, forcing a
  19349. frame rate of 30 frames per second:
  19350. @example
  19351. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19352. @end example
  19353. @end itemize
  19354. @section showwavespic
  19355. Convert input audio to a single video frame, representing the samples waves.
  19356. The filter accepts the following options:
  19357. @table @option
  19358. @item size, s
  19359. Specify the video size for the output. For the syntax of this option, check the
  19360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19361. Default value is @code{600x240}.
  19362. @item split_channels
  19363. Set if channels should be drawn separately or overlap. Default value is 0.
  19364. @item colors
  19365. Set colors separated by '|' which are going to be used for drawing of each channel.
  19366. @item scale
  19367. Set amplitude scale.
  19368. Available values are:
  19369. @table @samp
  19370. @item lin
  19371. Linear.
  19372. @item log
  19373. Logarithmic.
  19374. @item sqrt
  19375. Square root.
  19376. @item cbrt
  19377. Cubic root.
  19378. @end table
  19379. Default is linear.
  19380. @item draw
  19381. Set the draw mode.
  19382. Available values are:
  19383. @table @samp
  19384. @item scale
  19385. Scale pixel values for each drawn sample.
  19386. @item full
  19387. Draw every sample directly.
  19388. @end table
  19389. Default value is @code{scale}.
  19390. @item filter
  19391. Set the filter mode.
  19392. Available values are:
  19393. @table @samp
  19394. @item average
  19395. Use average samples values for each drawn sample.
  19396. @item peak
  19397. Use peak samples values for each drawn sample.
  19398. @end table
  19399. Default value is @code{average}.
  19400. @end table
  19401. @subsection Examples
  19402. @itemize
  19403. @item
  19404. Extract a channel split representation of the wave form of a whole audio track
  19405. in a 1024x800 picture using @command{ffmpeg}:
  19406. @example
  19407. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19408. @end example
  19409. @end itemize
  19410. @section sidedata, asidedata
  19411. Delete frame side data, or select frames based on it.
  19412. This filter accepts the following options:
  19413. @table @option
  19414. @item mode
  19415. Set mode of operation of the filter.
  19416. Can be one of the following:
  19417. @table @samp
  19418. @item select
  19419. Select every frame with side data of @code{type}.
  19420. @item delete
  19421. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19422. data in the frame.
  19423. @end table
  19424. @item type
  19425. Set side data type used with all modes. Must be set for @code{select} mode. For
  19426. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19427. in @file{libavutil/frame.h}. For example, to choose
  19428. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19429. @end table
  19430. @section spectrumsynth
  19431. Synthesize audio from 2 input video spectrums, first input stream represents
  19432. magnitude across time and second represents phase across time.
  19433. The filter will transform from frequency domain as displayed in videos back
  19434. to time domain as presented in audio output.
  19435. This filter is primarily created for reversing processed @ref{showspectrum}
  19436. filter outputs, but can synthesize sound from other spectrograms too.
  19437. But in such case results are going to be poor if the phase data is not
  19438. available, because in such cases phase data need to be recreated, usually
  19439. it's just recreated from random noise.
  19440. For best results use gray only output (@code{channel} color mode in
  19441. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19442. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19443. @code{data} option. Inputs videos should generally use @code{fullframe}
  19444. slide mode as that saves resources needed for decoding video.
  19445. The filter accepts the following options:
  19446. @table @option
  19447. @item sample_rate
  19448. Specify sample rate of output audio, the sample rate of audio from which
  19449. spectrum was generated may differ.
  19450. @item channels
  19451. Set number of channels represented in input video spectrums.
  19452. @item scale
  19453. Set scale which was used when generating magnitude input spectrum.
  19454. Can be @code{lin} or @code{log}. Default is @code{log}.
  19455. @item slide
  19456. Set slide which was used when generating inputs spectrums.
  19457. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19458. Default is @code{fullframe}.
  19459. @item win_func
  19460. Set window function used for resynthesis.
  19461. @item overlap
  19462. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19463. which means optimal overlap for selected window function will be picked.
  19464. @item orientation
  19465. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19466. Default is @code{vertical}.
  19467. @end table
  19468. @subsection Examples
  19469. @itemize
  19470. @item
  19471. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19472. then resynthesize videos back to audio with spectrumsynth:
  19473. @example
  19474. 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
  19475. 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
  19476. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19477. @end example
  19478. @end itemize
  19479. @section split, asplit
  19480. Split input into several identical outputs.
  19481. @code{asplit} works with audio input, @code{split} with video.
  19482. The filter accepts a single parameter which specifies the number of outputs. If
  19483. unspecified, it defaults to 2.
  19484. @subsection Examples
  19485. @itemize
  19486. @item
  19487. Create two separate outputs from the same input:
  19488. @example
  19489. [in] split [out0][out1]
  19490. @end example
  19491. @item
  19492. To create 3 or more outputs, you need to specify the number of
  19493. outputs, like in:
  19494. @example
  19495. [in] asplit=3 [out0][out1][out2]
  19496. @end example
  19497. @item
  19498. Create two separate outputs from the same input, one cropped and
  19499. one padded:
  19500. @example
  19501. [in] split [splitout1][splitout2];
  19502. [splitout1] crop=100:100:0:0 [cropout];
  19503. [splitout2] pad=200:200:100:100 [padout];
  19504. @end example
  19505. @item
  19506. Create 5 copies of the input audio with @command{ffmpeg}:
  19507. @example
  19508. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19509. @end example
  19510. @end itemize
  19511. @section zmq, azmq
  19512. Receive commands sent through a libzmq client, and forward them to
  19513. filters in the filtergraph.
  19514. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19515. must be inserted between two video filters, @code{azmq} between two
  19516. audio filters. Both are capable to send messages to any filter type.
  19517. To enable these filters you need to install the libzmq library and
  19518. headers and configure FFmpeg with @code{--enable-libzmq}.
  19519. For more information about libzmq see:
  19520. @url{http://www.zeromq.org/}
  19521. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19522. receives messages sent through a network interface defined by the
  19523. @option{bind_address} (or the abbreviation "@option{b}") option.
  19524. Default value of this option is @file{tcp://localhost:5555}. You may
  19525. want to alter this value to your needs, but do not forget to escape any
  19526. ':' signs (see @ref{filtergraph escaping}).
  19527. The received message must be in the form:
  19528. @example
  19529. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19530. @end example
  19531. @var{TARGET} specifies the target of the command, usually the name of
  19532. the filter class or a specific filter instance name. The default
  19533. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19534. but you can override this by using the @samp{filter_name@@id} syntax
  19535. (see @ref{Filtergraph syntax}).
  19536. @var{COMMAND} specifies the name of the command for the target filter.
  19537. @var{ARG} is optional and specifies the optional argument list for the
  19538. given @var{COMMAND}.
  19539. Upon reception, the message is processed and the corresponding command
  19540. is injected into the filtergraph. Depending on the result, the filter
  19541. will send a reply to the client, adopting the format:
  19542. @example
  19543. @var{ERROR_CODE} @var{ERROR_REASON}
  19544. @var{MESSAGE}
  19545. @end example
  19546. @var{MESSAGE} is optional.
  19547. @subsection Examples
  19548. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19549. be used to send commands processed by these filters.
  19550. Consider the following filtergraph generated by @command{ffplay}.
  19551. In this example the last overlay filter has an instance name. All other
  19552. filters will have default instance names.
  19553. @example
  19554. ffplay -dumpgraph 1 -f lavfi "
  19555. color=s=100x100:c=red [l];
  19556. color=s=100x100:c=blue [r];
  19557. nullsrc=s=200x100, zmq [bg];
  19558. [bg][l] overlay [bg+l];
  19559. [bg+l][r] overlay@@my=x=100 "
  19560. @end example
  19561. To change the color of the left side of the video, the following
  19562. command can be used:
  19563. @example
  19564. echo Parsed_color_0 c yellow | tools/zmqsend
  19565. @end example
  19566. To change the right side:
  19567. @example
  19568. echo Parsed_color_1 c pink | tools/zmqsend
  19569. @end example
  19570. To change the position of the right side:
  19571. @example
  19572. echo overlay@@my x 150 | tools/zmqsend
  19573. @end example
  19574. @c man end MULTIMEDIA FILTERS
  19575. @chapter Multimedia Sources
  19576. @c man begin MULTIMEDIA SOURCES
  19577. Below is a description of the currently available multimedia sources.
  19578. @section amovie
  19579. This is the same as @ref{movie} source, except it selects an audio
  19580. stream by default.
  19581. @anchor{movie}
  19582. @section movie
  19583. Read audio and/or video stream(s) from a movie container.
  19584. It accepts the following parameters:
  19585. @table @option
  19586. @item filename
  19587. The name of the resource to read (not necessarily a file; it can also be a
  19588. device or a stream accessed through some protocol).
  19589. @item format_name, f
  19590. Specifies the format assumed for the movie to read, and can be either
  19591. the name of a container or an input device. If not specified, the
  19592. format is guessed from @var{movie_name} or by probing.
  19593. @item seek_point, sp
  19594. Specifies the seek point in seconds. The frames will be output
  19595. starting from this seek point. The parameter is evaluated with
  19596. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19597. postfix. The default value is "0".
  19598. @item streams, s
  19599. Specifies the streams to read. Several streams can be specified,
  19600. separated by "+". The source will then have as many outputs, in the
  19601. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19602. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19603. respectively the default (best suited) video and audio stream. Default
  19604. is "dv", or "da" if the filter is called as "amovie".
  19605. @item stream_index, si
  19606. Specifies the index of the video stream to read. If the value is -1,
  19607. the most suitable video stream will be automatically selected. The default
  19608. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19609. audio instead of video.
  19610. @item loop
  19611. Specifies how many times to read the stream in sequence.
  19612. If the value is 0, the stream will be looped infinitely.
  19613. Default value is "1".
  19614. Note that when the movie is looped the source timestamps are not
  19615. changed, so it will generate non monotonically increasing timestamps.
  19616. @item discontinuity
  19617. Specifies the time difference between frames above which the point is
  19618. considered a timestamp discontinuity which is removed by adjusting the later
  19619. timestamps.
  19620. @end table
  19621. It allows overlaying a second video on top of the main input of
  19622. a filtergraph, as shown in this graph:
  19623. @example
  19624. input -----------> deltapts0 --> overlay --> output
  19625. ^
  19626. |
  19627. movie --> scale--> deltapts1 -------+
  19628. @end example
  19629. @subsection Examples
  19630. @itemize
  19631. @item
  19632. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19633. on top of the input labelled "in":
  19634. @example
  19635. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19636. [in] setpts=PTS-STARTPTS [main];
  19637. [main][over] overlay=16:16 [out]
  19638. @end example
  19639. @item
  19640. Read from a video4linux2 device, and overlay it on top of the input
  19641. labelled "in":
  19642. @example
  19643. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19644. [in] setpts=PTS-STARTPTS [main];
  19645. [main][over] overlay=16:16 [out]
  19646. @end example
  19647. @item
  19648. Read the first video stream and the audio stream with id 0x81 from
  19649. dvd.vob; the video is connected to the pad named "video" and the audio is
  19650. connected to the pad named "audio":
  19651. @example
  19652. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19653. @end example
  19654. @end itemize
  19655. @subsection Commands
  19656. Both movie and amovie support the following commands:
  19657. @table @option
  19658. @item seek
  19659. Perform seek using "av_seek_frame".
  19660. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19661. @itemize
  19662. @item
  19663. @var{stream_index}: If stream_index is -1, a default
  19664. stream is selected, and @var{timestamp} is automatically converted
  19665. from AV_TIME_BASE units to the stream specific time_base.
  19666. @item
  19667. @var{timestamp}: Timestamp in AVStream.time_base units
  19668. or, if no stream is specified, in AV_TIME_BASE units.
  19669. @item
  19670. @var{flags}: Flags which select direction and seeking mode.
  19671. @end itemize
  19672. @item get_duration
  19673. Get movie duration in AV_TIME_BASE units.
  19674. @end table
  19675. @c man end MULTIMEDIA SOURCES