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.

23315 lines
621KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. 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
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. 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
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. 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
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @item m
  1384. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1385. @end table
  1386. @subsection Commands
  1387. This filter supports the following commands:
  1388. @table @option
  1389. @item s
  1390. Change denoise strength. Argument is single float number.
  1391. Syntax for the command is : "@var{s}"
  1392. @item o
  1393. Change output mode.
  1394. Syntax for the command is : "i", "o" or "n" string.
  1395. @end table
  1396. @section anull
  1397. Pass the audio source unchanged to the output.
  1398. @section apad
  1399. Pad the end of an audio stream with silence.
  1400. This can be used together with @command{ffmpeg} @option{-shortest} to
  1401. extend audio streams to the same length as the video stream.
  1402. A description of the accepted options follows.
  1403. @table @option
  1404. @item packet_size
  1405. Set silence packet size. Default value is 4096.
  1406. @item pad_len
  1407. Set the number of samples of silence to add to the end. After the
  1408. value is reached, the stream is terminated. This option is mutually
  1409. exclusive with @option{whole_len}.
  1410. @item whole_len
  1411. Set the minimum total number of samples in the output audio stream. If
  1412. the value is longer than the input audio length, silence is added to
  1413. the end, until the value is reached. This option is mutually exclusive
  1414. with @option{pad_len}.
  1415. @item pad_dur
  1416. Specify the duration of samples of silence to add. See
  1417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1418. for the accepted syntax. Used only if set to non-zero value.
  1419. @item whole_dur
  1420. Specify the minimum total duration in the output audio stream. See
  1421. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1422. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1423. the input audio length, silence is added to the end, until the value is reached.
  1424. This option is mutually exclusive with @option{pad_dur}
  1425. @end table
  1426. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1427. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1428. the input stream indefinitely.
  1429. @subsection Examples
  1430. @itemize
  1431. @item
  1432. Add 1024 samples of silence to the end of the input:
  1433. @example
  1434. apad=pad_len=1024
  1435. @end example
  1436. @item
  1437. Make sure the audio output will contain at least 10000 samples, pad
  1438. the input with silence if required:
  1439. @example
  1440. apad=whole_len=10000
  1441. @end example
  1442. @item
  1443. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1444. video stream will always result the shortest and will be converted
  1445. until the end in the output file when using the @option{shortest}
  1446. option:
  1447. @example
  1448. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1449. @end example
  1450. @end itemize
  1451. @section aphaser
  1452. Add a phasing effect to the input audio.
  1453. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1454. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1455. A description of the accepted parameters follows.
  1456. @table @option
  1457. @item in_gain
  1458. Set input gain. Default is 0.4.
  1459. @item out_gain
  1460. Set output gain. Default is 0.74
  1461. @item delay
  1462. Set delay in milliseconds. Default is 3.0.
  1463. @item decay
  1464. Set decay. Default is 0.4.
  1465. @item speed
  1466. Set modulation speed in Hz. Default is 0.5.
  1467. @item type
  1468. Set modulation type. Default is triangular.
  1469. It accepts the following values:
  1470. @table @samp
  1471. @item triangular, t
  1472. @item sinusoidal, s
  1473. @end table
  1474. @end table
  1475. @section apulsator
  1476. Audio pulsator is something between an autopanner and a tremolo.
  1477. But it can produce funny stereo effects as well. Pulsator changes the volume
  1478. of the left and right channel based on a LFO (low frequency oscillator) with
  1479. different waveforms and shifted phases.
  1480. This filter have the ability to define an offset between left and right
  1481. channel. An offset of 0 means that both LFO shapes match each other.
  1482. The left and right channel are altered equally - a conventional tremolo.
  1483. An offset of 50% means that the shape of the right channel is exactly shifted
  1484. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1485. an autopanner. At 1 both curves match again. Every setting in between moves the
  1486. phase shift gapless between all stages and produces some "bypassing" sounds with
  1487. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1488. the 0.5) the faster the signal passes from the left to the right speaker.
  1489. The filter accepts the following options:
  1490. @table @option
  1491. @item level_in
  1492. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1493. @item level_out
  1494. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1495. @item mode
  1496. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1497. sawup or sawdown. Default is sine.
  1498. @item amount
  1499. Set modulation. Define how much of original signal is affected by the LFO.
  1500. @item offset_l
  1501. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1502. @item offset_r
  1503. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1504. @item width
  1505. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1506. @item timing
  1507. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1508. @item bpm
  1509. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1510. is set to bpm.
  1511. @item ms
  1512. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1513. is set to ms.
  1514. @item hz
  1515. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1516. if timing is set to hz.
  1517. @end table
  1518. @anchor{aresample}
  1519. @section aresample
  1520. Resample the input audio to the specified parameters, using the
  1521. libswresample library. If none are specified then the filter will
  1522. automatically convert between its input and output.
  1523. This filter is also able to stretch/squeeze the audio data to make it match
  1524. the timestamps or to inject silence / cut out audio to make it match the
  1525. timestamps, do a combination of both or do neither.
  1526. The filter accepts the syntax
  1527. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1528. expresses a sample rate and @var{resampler_options} is a list of
  1529. @var{key}=@var{value} pairs, separated by ":". See the
  1530. @ref{Resampler Options,,"Resampler Options" section in the
  1531. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1532. for the complete list of supported options.
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. Resample the input audio to 44100Hz:
  1537. @example
  1538. aresample=44100
  1539. @end example
  1540. @item
  1541. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1542. samples per second compensation:
  1543. @example
  1544. aresample=async=1000
  1545. @end example
  1546. @end itemize
  1547. @section areverse
  1548. Reverse an audio clip.
  1549. Warning: This filter requires memory to buffer the entire clip, so trimming
  1550. is suggested.
  1551. @subsection Examples
  1552. @itemize
  1553. @item
  1554. Take the first 5 seconds of a clip, and reverse it.
  1555. @example
  1556. atrim=end=5,areverse
  1557. @end example
  1558. @end itemize
  1559. @section asetnsamples
  1560. Set the number of samples per each output audio frame.
  1561. The last output packet may contain a different number of samples, as
  1562. the filter will flush all the remaining samples when the input audio
  1563. signals its end.
  1564. The filter accepts the following options:
  1565. @table @option
  1566. @item nb_out_samples, n
  1567. Set the number of frames per each output audio frame. The number is
  1568. intended as the number of samples @emph{per each channel}.
  1569. Default value is 1024.
  1570. @item pad, p
  1571. If set to 1, the filter will pad the last audio frame with zeroes, so
  1572. that the last frame will contain the same number of samples as the
  1573. previous ones. Default value is 1.
  1574. @end table
  1575. For example, to set the number of per-frame samples to 1234 and
  1576. disable padding for the last frame, use:
  1577. @example
  1578. asetnsamples=n=1234:p=0
  1579. @end example
  1580. @section asetrate
  1581. Set the sample rate without altering the PCM data.
  1582. This will result in a change of speed and pitch.
  1583. The filter accepts the following options:
  1584. @table @option
  1585. @item sample_rate, r
  1586. Set the output sample rate. Default is 44100 Hz.
  1587. @end table
  1588. @section ashowinfo
  1589. Show a line containing various information for each input audio frame.
  1590. The input audio is not modified.
  1591. The shown line contains a sequence of key/value pairs of the form
  1592. @var{key}:@var{value}.
  1593. The following values are shown in the output:
  1594. @table @option
  1595. @item n
  1596. The (sequential) number of the input frame, starting from 0.
  1597. @item pts
  1598. The presentation timestamp of the input frame, in time base units; the time base
  1599. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1600. @item pts_time
  1601. The presentation timestamp of the input frame in seconds.
  1602. @item pos
  1603. position of the frame in the input stream, -1 if this information in
  1604. unavailable and/or meaningless (for example in case of synthetic audio)
  1605. @item fmt
  1606. The sample format.
  1607. @item chlayout
  1608. The channel layout.
  1609. @item rate
  1610. The sample rate for the audio frame.
  1611. @item nb_samples
  1612. The number of samples (per channel) in the frame.
  1613. @item checksum
  1614. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1615. audio, the data is treated as if all the planes were concatenated.
  1616. @item plane_checksums
  1617. A list of Adler-32 checksums for each data plane.
  1618. @end table
  1619. @section asoftclip
  1620. Apply audio soft clipping.
  1621. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1622. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1623. This filter accepts the following options:
  1624. @table @option
  1625. @item type
  1626. Set type of soft-clipping.
  1627. It accepts the following values:
  1628. @table @option
  1629. @item tanh
  1630. @item atan
  1631. @item cubic
  1632. @item exp
  1633. @item alg
  1634. @item quintic
  1635. @item sin
  1636. @end table
  1637. @item param
  1638. Set additional parameter which controls sigmoid function.
  1639. @end table
  1640. @section asr
  1641. Automatic Speech Recognition
  1642. This filter uses PocketSphinx for speech recognition. To enable
  1643. compilation of this filter, you need to configure FFmpeg with
  1644. @code{--enable-pocketsphinx}.
  1645. It accepts the following options:
  1646. @table @option
  1647. @item rate
  1648. Set sampling rate of input audio. Defaults is @code{16000}.
  1649. This need to match speech models, otherwise one will get poor results.
  1650. @item hmm
  1651. Set dictionary containing acoustic model files.
  1652. @item dict
  1653. Set pronunciation dictionary.
  1654. @item lm
  1655. Set language model file.
  1656. @item lmctl
  1657. Set language model set.
  1658. @item lmname
  1659. Set which language model to use.
  1660. @item logfn
  1661. Set output for log messages.
  1662. @end table
  1663. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1664. @anchor{astats}
  1665. @section astats
  1666. Display time domain statistical information about the audio channels.
  1667. Statistics are calculated and displayed for each audio channel and,
  1668. where applicable, an overall figure is also given.
  1669. It accepts the following option:
  1670. @table @option
  1671. @item length
  1672. Short window length in seconds, used for peak and trough RMS measurement.
  1673. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1674. @item metadata
  1675. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1676. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1677. disabled.
  1678. Available keys for each channel are:
  1679. DC_offset
  1680. Min_level
  1681. Max_level
  1682. Min_difference
  1683. Max_difference
  1684. Mean_difference
  1685. RMS_difference
  1686. Peak_level
  1687. RMS_peak
  1688. RMS_trough
  1689. Crest_factor
  1690. Flat_factor
  1691. Peak_count
  1692. Bit_depth
  1693. Dynamic_range
  1694. Zero_crossings
  1695. Zero_crossings_rate
  1696. Number_of_NaNs
  1697. Number_of_Infs
  1698. Number_of_denormals
  1699. and for Overall:
  1700. DC_offset
  1701. Min_level
  1702. Max_level
  1703. Min_difference
  1704. Max_difference
  1705. Mean_difference
  1706. RMS_difference
  1707. Peak_level
  1708. RMS_level
  1709. RMS_peak
  1710. RMS_trough
  1711. Flat_factor
  1712. Peak_count
  1713. Bit_depth
  1714. Number_of_samples
  1715. Number_of_NaNs
  1716. Number_of_Infs
  1717. Number_of_denormals
  1718. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1719. this @code{lavfi.astats.Overall.Peak_count}.
  1720. For description what each key means read below.
  1721. @item reset
  1722. Set number of frame after which stats are going to be recalculated.
  1723. Default is disabled.
  1724. @item measure_perchannel
  1725. Select the entries which need to be measured per channel. The metadata keys can
  1726. be used as flags, default is @option{all} which measures everything.
  1727. @option{none} disables all per channel measurement.
  1728. @item measure_overall
  1729. Select the entries which need to be measured overall. The metadata keys can
  1730. be used as flags, default is @option{all} which measures everything.
  1731. @option{none} disables all overall measurement.
  1732. @end table
  1733. A description of each shown parameter follows:
  1734. @table @option
  1735. @item DC offset
  1736. Mean amplitude displacement from zero.
  1737. @item Min level
  1738. Minimal sample level.
  1739. @item Max level
  1740. Maximal sample level.
  1741. @item Min difference
  1742. Minimal difference between two consecutive samples.
  1743. @item Max difference
  1744. Maximal difference between two consecutive samples.
  1745. @item Mean difference
  1746. Mean difference between two consecutive samples.
  1747. The average of each difference between two consecutive samples.
  1748. @item RMS difference
  1749. Root Mean Square difference between two consecutive samples.
  1750. @item Peak level dB
  1751. @item RMS level dB
  1752. Standard peak and RMS level measured in dBFS.
  1753. @item RMS peak dB
  1754. @item RMS trough dB
  1755. Peak and trough values for RMS level measured over a short window.
  1756. @item Crest factor
  1757. Standard ratio of peak to RMS level (note: not in dB).
  1758. @item Flat factor
  1759. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1760. (i.e. either @var{Min level} or @var{Max level}).
  1761. @item Peak count
  1762. Number of occasions (not the number of samples) that the signal attained either
  1763. @var{Min level} or @var{Max level}.
  1764. @item Bit depth
  1765. Overall bit depth of audio. Number of bits used for each sample.
  1766. @item Dynamic range
  1767. Measured dynamic range of audio in dB.
  1768. @item Zero crossings
  1769. Number of points where the waveform crosses the zero level axis.
  1770. @item Zero crossings rate
  1771. Rate of Zero crossings and number of audio samples.
  1772. @end table
  1773. @section atempo
  1774. Adjust audio tempo.
  1775. The filter accepts exactly one parameter, the audio tempo. If not
  1776. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1777. be in the [0.5, 100.0] range.
  1778. Note that tempo greater than 2 will skip some samples rather than
  1779. blend them in. If for any reason this is a concern it is always
  1780. possible to daisy-chain several instances of atempo to achieve the
  1781. desired product tempo.
  1782. @subsection Examples
  1783. @itemize
  1784. @item
  1785. Slow down audio to 80% tempo:
  1786. @example
  1787. atempo=0.8
  1788. @end example
  1789. @item
  1790. To speed up audio to 300% tempo:
  1791. @example
  1792. atempo=3
  1793. @end example
  1794. @item
  1795. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1796. @example
  1797. atempo=sqrt(3),atempo=sqrt(3)
  1798. @end example
  1799. @end itemize
  1800. @section atrim
  1801. Trim the input so that the output contains one continuous subpart of the input.
  1802. It accepts the following parameters:
  1803. @table @option
  1804. @item start
  1805. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1806. sample with the timestamp @var{start} will be the first sample in the output.
  1807. @item end
  1808. Specify time of the first audio sample that will be dropped, i.e. the
  1809. audio sample immediately preceding the one with the timestamp @var{end} will be
  1810. the last sample in the output.
  1811. @item start_pts
  1812. Same as @var{start}, except this option sets the start timestamp in samples
  1813. instead of seconds.
  1814. @item end_pts
  1815. Same as @var{end}, except this option sets the end timestamp in samples instead
  1816. of seconds.
  1817. @item duration
  1818. The maximum duration of the output in seconds.
  1819. @item start_sample
  1820. The number of the first sample that should be output.
  1821. @item end_sample
  1822. The number of the first sample that should be dropped.
  1823. @end table
  1824. @option{start}, @option{end}, and @option{duration} are expressed as time
  1825. duration specifications; see
  1826. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1827. Note that the first two sets of the start/end options and the @option{duration}
  1828. option look at the frame timestamp, while the _sample options simply count the
  1829. samples that pass through the filter. So start/end_pts and start/end_sample will
  1830. give different results when the timestamps are wrong, inexact or do not start at
  1831. zero. Also note that this filter does not modify the timestamps. If you wish
  1832. to have the output timestamps start at zero, insert the asetpts filter after the
  1833. atrim filter.
  1834. If multiple start or end options are set, this filter tries to be greedy and
  1835. keep all samples that match at least one of the specified constraints. To keep
  1836. only the part that matches all the constraints at once, chain multiple atrim
  1837. filters.
  1838. The defaults are such that all the input is kept. So it is possible to set e.g.
  1839. just the end values to keep everything before the specified time.
  1840. Examples:
  1841. @itemize
  1842. @item
  1843. Drop everything except the second minute of input:
  1844. @example
  1845. ffmpeg -i INPUT -af atrim=60:120
  1846. @end example
  1847. @item
  1848. Keep only the first 1000 samples:
  1849. @example
  1850. ffmpeg -i INPUT -af atrim=end_sample=1000
  1851. @end example
  1852. @end itemize
  1853. @section bandpass
  1854. Apply a two-pole Butterworth band-pass filter with central
  1855. frequency @var{frequency}, and (3dB-point) band-width width.
  1856. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1857. instead of the default: constant 0dB peak gain.
  1858. The filter roll off at 6dB per octave (20dB per decade).
  1859. The filter accepts the following options:
  1860. @table @option
  1861. @item frequency, f
  1862. Set the filter's central frequency. Default is @code{3000}.
  1863. @item csg
  1864. Constant skirt gain if set to 1. Defaults to 0.
  1865. @item width_type, t
  1866. Set method to specify band-width of filter.
  1867. @table @option
  1868. @item h
  1869. Hz
  1870. @item q
  1871. Q-Factor
  1872. @item o
  1873. octave
  1874. @item s
  1875. slope
  1876. @item k
  1877. kHz
  1878. @end table
  1879. @item width, w
  1880. Specify the band-width of a filter in width_type units.
  1881. @item channels, c
  1882. Specify which channels to filter, by default all available are filtered.
  1883. @end table
  1884. @subsection Commands
  1885. This filter supports the following commands:
  1886. @table @option
  1887. @item frequency, f
  1888. Change bandpass frequency.
  1889. Syntax for the command is : "@var{frequency}"
  1890. @item width_type, t
  1891. Change bandpass width_type.
  1892. Syntax for the command is : "@var{width_type}"
  1893. @item width, w
  1894. Change bandpass width.
  1895. Syntax for the command is : "@var{width}"
  1896. @end table
  1897. @section bandreject
  1898. Apply a two-pole Butterworth band-reject filter with central
  1899. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1900. The filter roll off at 6dB per octave (20dB per decade).
  1901. The filter accepts the following options:
  1902. @table @option
  1903. @item frequency, f
  1904. Set the filter's central frequency. Default is @code{3000}.
  1905. @item width_type, t
  1906. Set method to specify band-width of filter.
  1907. @table @option
  1908. @item h
  1909. Hz
  1910. @item q
  1911. Q-Factor
  1912. @item o
  1913. octave
  1914. @item s
  1915. slope
  1916. @item k
  1917. kHz
  1918. @end table
  1919. @item width, w
  1920. Specify the band-width of a filter in width_type units.
  1921. @item channels, c
  1922. Specify which channels to filter, by default all available are filtered.
  1923. @end table
  1924. @subsection Commands
  1925. This filter supports the following commands:
  1926. @table @option
  1927. @item frequency, f
  1928. Change bandreject frequency.
  1929. Syntax for the command is : "@var{frequency}"
  1930. @item width_type, t
  1931. Change bandreject width_type.
  1932. Syntax for the command is : "@var{width_type}"
  1933. @item width, w
  1934. Change bandreject width.
  1935. Syntax for the command is : "@var{width}"
  1936. @end table
  1937. @section bass, lowshelf
  1938. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1939. shelving filter with a response similar to that of a standard
  1940. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1941. The filter accepts the following options:
  1942. @table @option
  1943. @item gain, g
  1944. Give the gain at 0 Hz. Its useful range is about -20
  1945. (for a large cut) to +20 (for a large boost).
  1946. Beware of clipping when using a positive gain.
  1947. @item frequency, f
  1948. Set the filter's central frequency and so can be used
  1949. to extend or reduce the frequency range to be boosted or cut.
  1950. The default value is @code{100} Hz.
  1951. @item width_type, t
  1952. Set method to specify band-width of filter.
  1953. @table @option
  1954. @item h
  1955. Hz
  1956. @item q
  1957. Q-Factor
  1958. @item o
  1959. octave
  1960. @item s
  1961. slope
  1962. @item k
  1963. kHz
  1964. @end table
  1965. @item width, w
  1966. Determine how steep is the filter's shelf transition.
  1967. @item channels, c
  1968. Specify which channels to filter, by default all available are filtered.
  1969. @end table
  1970. @subsection Commands
  1971. This filter supports the following commands:
  1972. @table @option
  1973. @item frequency, f
  1974. Change bass frequency.
  1975. Syntax for the command is : "@var{frequency}"
  1976. @item width_type, t
  1977. Change bass width_type.
  1978. Syntax for the command is : "@var{width_type}"
  1979. @item width, w
  1980. Change bass width.
  1981. Syntax for the command is : "@var{width}"
  1982. @item gain, g
  1983. Change bass gain.
  1984. Syntax for the command is : "@var{gain}"
  1985. @end table
  1986. @section biquad
  1987. Apply a biquad IIR filter with the given coefficients.
  1988. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1989. are the numerator and denominator coefficients respectively.
  1990. and @var{channels}, @var{c} specify which channels to filter, by default all
  1991. available are filtered.
  1992. @subsection Commands
  1993. This filter supports the following commands:
  1994. @table @option
  1995. @item a0
  1996. @item a1
  1997. @item a2
  1998. @item b0
  1999. @item b1
  2000. @item b2
  2001. Change biquad parameter.
  2002. Syntax for the command is : "@var{value}"
  2003. @end table
  2004. @section bs2b
  2005. Bauer stereo to binaural transformation, which improves headphone listening of
  2006. stereo audio records.
  2007. To enable compilation of this filter you need to configure FFmpeg with
  2008. @code{--enable-libbs2b}.
  2009. It accepts the following parameters:
  2010. @table @option
  2011. @item profile
  2012. Pre-defined crossfeed level.
  2013. @table @option
  2014. @item default
  2015. Default level (fcut=700, feed=50).
  2016. @item cmoy
  2017. Chu Moy circuit (fcut=700, feed=60).
  2018. @item jmeier
  2019. Jan Meier circuit (fcut=650, feed=95).
  2020. @end table
  2021. @item fcut
  2022. Cut frequency (in Hz).
  2023. @item feed
  2024. Feed level (in Hz).
  2025. @end table
  2026. @section channelmap
  2027. Remap input channels to new locations.
  2028. It accepts the following parameters:
  2029. @table @option
  2030. @item map
  2031. Map channels from input to output. The argument is a '|'-separated list of
  2032. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2033. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2034. channel (e.g. FL for front left) or its index in the input channel layout.
  2035. @var{out_channel} is the name of the output channel or its index in the output
  2036. channel layout. If @var{out_channel} is not given then it is implicitly an
  2037. index, starting with zero and increasing by one for each mapping.
  2038. @item channel_layout
  2039. The channel layout of the output stream.
  2040. @end table
  2041. If no mapping is present, the filter will implicitly map input channels to
  2042. output channels, preserving indices.
  2043. @subsection Examples
  2044. @itemize
  2045. @item
  2046. For example, assuming a 5.1+downmix input MOV file,
  2047. @example
  2048. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2049. @end example
  2050. will create an output WAV file tagged as stereo from the downmix channels of
  2051. the input.
  2052. @item
  2053. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2054. @example
  2055. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2056. @end example
  2057. @end itemize
  2058. @section channelsplit
  2059. Split each channel from an input audio stream into a separate output stream.
  2060. It accepts the following parameters:
  2061. @table @option
  2062. @item channel_layout
  2063. The channel layout of the input stream. The default is "stereo".
  2064. @item channels
  2065. A channel layout describing the channels to be extracted as separate output streams
  2066. or "all" to extract each input channel as a separate stream. The default is "all".
  2067. Choosing channels not present in channel layout in the input will result in an error.
  2068. @end table
  2069. @subsection Examples
  2070. @itemize
  2071. @item
  2072. For example, assuming a stereo input MP3 file,
  2073. @example
  2074. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2075. @end example
  2076. will create an output Matroska file with two audio streams, one containing only
  2077. the left channel and the other the right channel.
  2078. @item
  2079. Split a 5.1 WAV file into per-channel files:
  2080. @example
  2081. ffmpeg -i in.wav -filter_complex
  2082. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2083. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2084. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2085. side_right.wav
  2086. @end example
  2087. @item
  2088. Extract only LFE from a 5.1 WAV file:
  2089. @example
  2090. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2091. -map '[LFE]' lfe.wav
  2092. @end example
  2093. @end itemize
  2094. @section chorus
  2095. Add a chorus effect to the audio.
  2096. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2097. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2098. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2099. The modulation depth defines the range the modulated delay is played before or after
  2100. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2101. sound tuned around the original one, like in a chorus where some vocals are slightly
  2102. off key.
  2103. It accepts the following parameters:
  2104. @table @option
  2105. @item in_gain
  2106. Set input gain. Default is 0.4.
  2107. @item out_gain
  2108. Set output gain. Default is 0.4.
  2109. @item delays
  2110. Set delays. A typical delay is around 40ms to 60ms.
  2111. @item decays
  2112. Set decays.
  2113. @item speeds
  2114. Set speeds.
  2115. @item depths
  2116. Set depths.
  2117. @end table
  2118. @subsection Examples
  2119. @itemize
  2120. @item
  2121. A single delay:
  2122. @example
  2123. chorus=0.7:0.9:55:0.4:0.25:2
  2124. @end example
  2125. @item
  2126. Two delays:
  2127. @example
  2128. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2129. @end example
  2130. @item
  2131. Fuller sounding chorus with three delays:
  2132. @example
  2133. 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
  2134. @end example
  2135. @end itemize
  2136. @section compand
  2137. Compress or expand the audio's dynamic range.
  2138. It accepts the following parameters:
  2139. @table @option
  2140. @item attacks
  2141. @item decays
  2142. A list of times in seconds for each channel over which the instantaneous level
  2143. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2144. increase of volume and @var{decays} refers to decrease of volume. For most
  2145. situations, the attack time (response to the audio getting louder) should be
  2146. shorter than the decay time, because the human ear is more sensitive to sudden
  2147. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2148. a typical value for decay is 0.8 seconds.
  2149. If specified number of attacks & decays is lower than number of channels, the last
  2150. set attack/decay will be used for all remaining channels.
  2151. @item points
  2152. A list of points for the transfer function, specified in dB relative to the
  2153. maximum possible signal amplitude. Each key points list must be defined using
  2154. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2155. @code{x0/y0 x1/y1 x2/y2 ....}
  2156. The input values must be in strictly increasing order but the transfer function
  2157. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2158. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2159. function are @code{-70/-70|-60/-20|1/0}.
  2160. @item soft-knee
  2161. Set the curve radius in dB for all joints. It defaults to 0.01.
  2162. @item gain
  2163. Set the additional gain in dB to be applied at all points on the transfer
  2164. function. This allows for easy adjustment of the overall gain.
  2165. It defaults to 0.
  2166. @item volume
  2167. Set an initial volume, in dB, to be assumed for each channel when filtering
  2168. starts. This permits the user to supply a nominal level initially, so that, for
  2169. example, a very large gain is not applied to initial signal levels before the
  2170. companding has begun to operate. A typical value for audio which is initially
  2171. quiet is -90 dB. It defaults to 0.
  2172. @item delay
  2173. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2174. delayed before being fed to the volume adjuster. Specifying a delay
  2175. approximately equal to the attack/decay times allows the filter to effectively
  2176. operate in predictive rather than reactive mode. It defaults to 0.
  2177. @end table
  2178. @subsection Examples
  2179. @itemize
  2180. @item
  2181. Make music with both quiet and loud passages suitable for listening to in a
  2182. noisy environment:
  2183. @example
  2184. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2185. @end example
  2186. Another example for audio with whisper and explosion parts:
  2187. @example
  2188. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2189. @end example
  2190. @item
  2191. A noise gate for when the noise is at a lower level than the signal:
  2192. @example
  2193. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2194. @end example
  2195. @item
  2196. Here is another noise gate, this time for when the noise is at a higher level
  2197. than the signal (making it, in some ways, similar to squelch):
  2198. @example
  2199. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2200. @end example
  2201. @item
  2202. 2:1 compression starting at -6dB:
  2203. @example
  2204. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2205. @end example
  2206. @item
  2207. 2:1 compression starting at -9dB:
  2208. @example
  2209. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2210. @end example
  2211. @item
  2212. 2:1 compression starting at -12dB:
  2213. @example
  2214. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2215. @end example
  2216. @item
  2217. 2:1 compression starting at -18dB:
  2218. @example
  2219. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2220. @end example
  2221. @item
  2222. 3:1 compression starting at -15dB:
  2223. @example
  2224. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2225. @end example
  2226. @item
  2227. Compressor/Gate:
  2228. @example
  2229. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2230. @end example
  2231. @item
  2232. Expander:
  2233. @example
  2234. 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
  2235. @end example
  2236. @item
  2237. Hard limiter at -6dB:
  2238. @example
  2239. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2240. @end example
  2241. @item
  2242. Hard limiter at -12dB:
  2243. @example
  2244. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2245. @end example
  2246. @item
  2247. Hard noise gate at -35 dB:
  2248. @example
  2249. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2250. @end example
  2251. @item
  2252. Soft limiter:
  2253. @example
  2254. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2255. @end example
  2256. @end itemize
  2257. @section compensationdelay
  2258. Compensation Delay Line is a metric based delay to compensate differing
  2259. positions of microphones or speakers.
  2260. For example, you have recorded guitar with two microphones placed in
  2261. different location. Because the front of sound wave has fixed speed in
  2262. normal conditions, the phasing of microphones can vary and depends on
  2263. their location and interposition. The best sound mix can be achieved when
  2264. these microphones are in phase (synchronized). Note that distance of
  2265. ~30 cm between microphones makes one microphone to capture signal in
  2266. antiphase to another microphone. That makes the final mix sounding moody.
  2267. This filter helps to solve phasing problems by adding different delays
  2268. to each microphone track and make them synchronized.
  2269. The best result can be reached when you take one track as base and
  2270. synchronize other tracks one by one with it.
  2271. Remember that synchronization/delay tolerance depends on sample rate, too.
  2272. Higher sample rates will give more tolerance.
  2273. It accepts the following parameters:
  2274. @table @option
  2275. @item mm
  2276. Set millimeters distance. This is compensation distance for fine tuning.
  2277. Default is 0.
  2278. @item cm
  2279. Set cm distance. This is compensation distance for tightening distance setup.
  2280. Default is 0.
  2281. @item m
  2282. Set meters distance. This is compensation distance for hard distance setup.
  2283. Default is 0.
  2284. @item dry
  2285. Set dry amount. Amount of unprocessed (dry) signal.
  2286. Default is 0.
  2287. @item wet
  2288. Set wet amount. Amount of processed (wet) signal.
  2289. Default is 1.
  2290. @item temp
  2291. Set temperature degree in Celsius. This is the temperature of the environment.
  2292. Default is 20.
  2293. @end table
  2294. @section crossfeed
  2295. Apply headphone crossfeed filter.
  2296. Crossfeed is the process of blending the left and right channels of stereo
  2297. audio recording.
  2298. It is mainly used to reduce extreme stereo separation of low frequencies.
  2299. The intent is to produce more speaker like sound to the listener.
  2300. The filter accepts the following options:
  2301. @table @option
  2302. @item strength
  2303. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2304. This sets gain of low shelf filter for side part of stereo image.
  2305. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2306. @item range
  2307. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2308. This sets cut off frequency of low shelf filter. Default is cut off near
  2309. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2310. @item level_in
  2311. Set input gain. Default is 0.9.
  2312. @item level_out
  2313. Set output gain. Default is 1.
  2314. @end table
  2315. @section crystalizer
  2316. Simple algorithm to expand audio dynamic range.
  2317. The filter accepts the following options:
  2318. @table @option
  2319. @item i
  2320. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2321. (unchanged sound) to 10.0 (maximum effect).
  2322. @item c
  2323. Enable clipping. By default is enabled.
  2324. @end table
  2325. @section dcshift
  2326. Apply a DC shift to the audio.
  2327. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2328. in the recording chain) from the audio. The effect of a DC offset is reduced
  2329. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2330. a signal has a DC offset.
  2331. @table @option
  2332. @item shift
  2333. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2334. the audio.
  2335. @item limitergain
  2336. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2337. used to prevent clipping.
  2338. @end table
  2339. @section drmeter
  2340. Measure audio dynamic range.
  2341. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2342. is found in transition material. And anything less that 8 have very poor dynamics
  2343. and is very compressed.
  2344. The filter accepts the following options:
  2345. @table @option
  2346. @item length
  2347. Set window length in seconds used to split audio into segments of equal length.
  2348. Default is 3 seconds.
  2349. @end table
  2350. @section dynaudnorm
  2351. Dynamic Audio Normalizer.
  2352. This filter applies a certain amount of gain to the input audio in order
  2353. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2354. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2355. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2356. This allows for applying extra gain to the "quiet" sections of the audio
  2357. while avoiding distortions or clipping the "loud" sections. In other words:
  2358. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2359. sections, in the sense that the volume of each section is brought to the
  2360. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2361. this goal *without* applying "dynamic range compressing". It will retain 100%
  2362. of the dynamic range *within* each section of the audio file.
  2363. @table @option
  2364. @item f
  2365. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2366. Default is 500 milliseconds.
  2367. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2368. referred to as frames. This is required, because a peak magnitude has no
  2369. meaning for just a single sample value. Instead, we need to determine the
  2370. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2371. normalizer would simply use the peak magnitude of the complete file, the
  2372. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2373. frame. The length of a frame is specified in milliseconds. By default, the
  2374. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2375. been found to give good results with most files.
  2376. Note that the exact frame length, in number of samples, will be determined
  2377. automatically, based on the sampling rate of the individual input audio file.
  2378. @item g
  2379. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2380. number. Default is 31.
  2381. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2382. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2383. is specified in frames, centered around the current frame. For the sake of
  2384. simplicity, this must be an odd number. Consequently, the default value of 31
  2385. takes into account the current frame, as well as the 15 preceding frames and
  2386. the 15 subsequent frames. Using a larger window results in a stronger
  2387. smoothing effect and thus in less gain variation, i.e. slower gain
  2388. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2389. effect and thus in more gain variation, i.e. faster gain adaptation.
  2390. In other words, the more you increase this value, the more the Dynamic Audio
  2391. Normalizer will behave like a "traditional" normalization filter. On the
  2392. contrary, the more you decrease this value, the more the Dynamic Audio
  2393. Normalizer will behave like a dynamic range compressor.
  2394. @item p
  2395. Set the target peak value. This specifies the highest permissible magnitude
  2396. level for the normalized audio input. This filter will try to approach the
  2397. target peak magnitude as closely as possible, but at the same time it also
  2398. makes sure that the normalized signal will never exceed the peak magnitude.
  2399. A frame's maximum local gain factor is imposed directly by the target peak
  2400. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2401. It is not recommended to go above this value.
  2402. @item m
  2403. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2404. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2405. factor for each input frame, i.e. the maximum gain factor that does not
  2406. result in clipping or distortion. The maximum gain factor is determined by
  2407. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2408. additionally bounds the frame's maximum gain factor by a predetermined
  2409. (global) maximum gain factor. This is done in order to avoid excessive gain
  2410. factors in "silent" or almost silent frames. By default, the maximum gain
  2411. factor is 10.0, For most inputs the default value should be sufficient and
  2412. it usually is not recommended to increase this value. Though, for input
  2413. with an extremely low overall volume level, it may be necessary to allow even
  2414. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2415. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2416. Instead, a "sigmoid" threshold function will be applied. This way, the
  2417. gain factors will smoothly approach the threshold value, but never exceed that
  2418. value.
  2419. @item r
  2420. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2421. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2422. This means that the maximum local gain factor for each frame is defined
  2423. (only) by the frame's highest magnitude sample. This way, the samples can
  2424. be amplified as much as possible without exceeding the maximum signal
  2425. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2426. Normalizer can also take into account the frame's root mean square,
  2427. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2428. determine the power of a time-varying signal. It is therefore considered
  2429. that the RMS is a better approximation of the "perceived loudness" than
  2430. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2431. frames to a constant RMS value, a uniform "perceived loudness" can be
  2432. established. If a target RMS value has been specified, a frame's local gain
  2433. factor is defined as the factor that would result in exactly that RMS value.
  2434. Note, however, that the maximum local gain factor is still restricted by the
  2435. frame's highest magnitude sample, in order to prevent clipping.
  2436. @item n
  2437. Enable channels coupling. By default is enabled.
  2438. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2439. amount. This means the same gain factor will be applied to all channels, i.e.
  2440. the maximum possible gain factor is determined by the "loudest" channel.
  2441. However, in some recordings, it may happen that the volume of the different
  2442. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2443. In this case, this option can be used to disable the channel coupling. This way,
  2444. the gain factor will be determined independently for each channel, depending
  2445. only on the individual channel's highest magnitude sample. This allows for
  2446. harmonizing the volume of the different channels.
  2447. @item c
  2448. Enable DC bias correction. By default is disabled.
  2449. An audio signal (in the time domain) is a sequence of sample values.
  2450. In the Dynamic Audio Normalizer these sample values are represented in the
  2451. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2452. audio signal, or "waveform", should be centered around the zero point.
  2453. That means if we calculate the mean value of all samples in a file, or in a
  2454. single frame, then the result should be 0.0 or at least very close to that
  2455. value. If, however, there is a significant deviation of the mean value from
  2456. 0.0, in either positive or negative direction, this is referred to as a
  2457. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2458. Audio Normalizer provides optional DC bias correction.
  2459. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2460. the mean value, or "DC correction" offset, of each input frame and subtract
  2461. that value from all of the frame's sample values which ensures those samples
  2462. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2463. boundaries, the DC correction offset values will be interpolated smoothly
  2464. between neighbouring frames.
  2465. @item b
  2466. Enable alternative boundary mode. By default is disabled.
  2467. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2468. around each frame. This includes the preceding frames as well as the
  2469. subsequent frames. However, for the "boundary" frames, located at the very
  2470. beginning and at the very end of the audio file, not all neighbouring
  2471. frames are available. In particular, for the first few frames in the audio
  2472. file, the preceding frames are not known. And, similarly, for the last few
  2473. frames in the audio file, the subsequent frames are not known. Thus, the
  2474. question arises which gain factors should be assumed for the missing frames
  2475. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2476. to deal with this situation. The default boundary mode assumes a gain factor
  2477. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2478. "fade out" at the beginning and at the end of the input, respectively.
  2479. @item s
  2480. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2481. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2482. compression. This means that signal peaks will not be pruned and thus the
  2483. full dynamic range will be retained within each local neighbourhood. However,
  2484. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2485. normalization algorithm with a more "traditional" compression.
  2486. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2487. (thresholding) function. If (and only if) the compression feature is enabled,
  2488. all input frames will be processed by a soft knee thresholding function prior
  2489. to the actual normalization process. Put simply, the thresholding function is
  2490. going to prune all samples whose magnitude exceeds a certain threshold value.
  2491. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2492. value. Instead, the threshold value will be adjusted for each individual
  2493. frame.
  2494. In general, smaller parameters result in stronger compression, and vice versa.
  2495. Values below 3.0 are not recommended, because audible distortion may appear.
  2496. @end table
  2497. @section earwax
  2498. Make audio easier to listen to on headphones.
  2499. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2500. so that when listened to on headphones the stereo image is moved from
  2501. inside your head (standard for headphones) to outside and in front of
  2502. the listener (standard for speakers).
  2503. Ported from SoX.
  2504. @section equalizer
  2505. Apply a two-pole peaking equalisation (EQ) filter. With this
  2506. filter, the signal-level at and around a selected frequency can
  2507. be increased or decreased, whilst (unlike bandpass and bandreject
  2508. filters) that at all other frequencies is unchanged.
  2509. In order to produce complex equalisation curves, this filter can
  2510. be given several times, each with a different central frequency.
  2511. The filter accepts the following options:
  2512. @table @option
  2513. @item frequency, f
  2514. Set the filter's central frequency in Hz.
  2515. @item width_type, t
  2516. Set method to specify band-width of filter.
  2517. @table @option
  2518. @item h
  2519. Hz
  2520. @item q
  2521. Q-Factor
  2522. @item o
  2523. octave
  2524. @item s
  2525. slope
  2526. @item k
  2527. kHz
  2528. @end table
  2529. @item width, w
  2530. Specify the band-width of a filter in width_type units.
  2531. @item gain, g
  2532. Set the required gain or attenuation in dB.
  2533. Beware of clipping when using a positive gain.
  2534. @item channels, c
  2535. Specify which channels to filter, by default all available are filtered.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2541. @example
  2542. equalizer=f=1000:t=h:width=200:g=-10
  2543. @end example
  2544. @item
  2545. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2546. @example
  2547. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2548. @end example
  2549. @end itemize
  2550. @subsection Commands
  2551. This filter supports the following commands:
  2552. @table @option
  2553. @item frequency, f
  2554. Change equalizer frequency.
  2555. Syntax for the command is : "@var{frequency}"
  2556. @item width_type, t
  2557. Change equalizer width_type.
  2558. Syntax for the command is : "@var{width_type}"
  2559. @item width, w
  2560. Change equalizer width.
  2561. Syntax for the command is : "@var{width}"
  2562. @item gain, g
  2563. Change equalizer gain.
  2564. Syntax for the command is : "@var{gain}"
  2565. @end table
  2566. @section extrastereo
  2567. Linearly increases the difference between left and right channels which
  2568. adds some sort of "live" effect to playback.
  2569. The filter accepts the following options:
  2570. @table @option
  2571. @item m
  2572. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2573. (average of both channels), with 1.0 sound will be unchanged, with
  2574. -1.0 left and right channels will be swapped.
  2575. @item c
  2576. Enable clipping. By default is enabled.
  2577. @end table
  2578. @section firequalizer
  2579. Apply FIR Equalization using arbitrary frequency response.
  2580. The filter accepts the following option:
  2581. @table @option
  2582. @item gain
  2583. Set gain curve equation (in dB). The expression can contain variables:
  2584. @table @option
  2585. @item f
  2586. the evaluated frequency
  2587. @item sr
  2588. sample rate
  2589. @item ch
  2590. channel number, set to 0 when multichannels evaluation is disabled
  2591. @item chid
  2592. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2593. multichannels evaluation is disabled
  2594. @item chs
  2595. number of channels
  2596. @item chlayout
  2597. channel_layout, see libavutil/channel_layout.h
  2598. @end table
  2599. and functions:
  2600. @table @option
  2601. @item gain_interpolate(f)
  2602. interpolate gain on frequency f based on gain_entry
  2603. @item cubic_interpolate(f)
  2604. same as gain_interpolate, but smoother
  2605. @end table
  2606. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2607. @item gain_entry
  2608. Set gain entry for gain_interpolate function. The expression can
  2609. contain functions:
  2610. @table @option
  2611. @item entry(f, g)
  2612. store gain entry at frequency f with value g
  2613. @end table
  2614. This option is also available as command.
  2615. @item delay
  2616. Set filter delay in seconds. Higher value means more accurate.
  2617. Default is @code{0.01}.
  2618. @item accuracy
  2619. Set filter accuracy in Hz. Lower value means more accurate.
  2620. Default is @code{5}.
  2621. @item wfunc
  2622. Set window function. Acceptable values are:
  2623. @table @option
  2624. @item rectangular
  2625. rectangular window, useful when gain curve is already smooth
  2626. @item hann
  2627. hann window (default)
  2628. @item hamming
  2629. hamming window
  2630. @item blackman
  2631. blackman window
  2632. @item nuttall3
  2633. 3-terms continuous 1st derivative nuttall window
  2634. @item mnuttall3
  2635. minimum 3-terms discontinuous nuttall window
  2636. @item nuttall
  2637. 4-terms continuous 1st derivative nuttall window
  2638. @item bnuttall
  2639. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2640. @item bharris
  2641. blackman-harris window
  2642. @item tukey
  2643. tukey window
  2644. @end table
  2645. @item fixed
  2646. If enabled, use fixed number of audio samples. This improves speed when
  2647. filtering with large delay. Default is disabled.
  2648. @item multi
  2649. Enable multichannels evaluation on gain. Default is disabled.
  2650. @item zero_phase
  2651. Enable zero phase mode by subtracting timestamp to compensate delay.
  2652. Default is disabled.
  2653. @item scale
  2654. Set scale used by gain. Acceptable values are:
  2655. @table @option
  2656. @item linlin
  2657. linear frequency, linear gain
  2658. @item linlog
  2659. linear frequency, logarithmic (in dB) gain (default)
  2660. @item loglin
  2661. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2662. @item loglog
  2663. logarithmic frequency, logarithmic gain
  2664. @end table
  2665. @item dumpfile
  2666. Set file for dumping, suitable for gnuplot.
  2667. @item dumpscale
  2668. Set scale for dumpfile. Acceptable values are same with scale option.
  2669. Default is linlog.
  2670. @item fft2
  2671. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2672. Default is disabled.
  2673. @item min_phase
  2674. Enable minimum phase impulse response. Default is disabled.
  2675. @end table
  2676. @subsection Examples
  2677. @itemize
  2678. @item
  2679. lowpass at 1000 Hz:
  2680. @example
  2681. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2682. @end example
  2683. @item
  2684. lowpass at 1000 Hz with gain_entry:
  2685. @example
  2686. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2687. @end example
  2688. @item
  2689. custom equalization:
  2690. @example
  2691. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2692. @end example
  2693. @item
  2694. higher delay with zero phase to compensate delay:
  2695. @example
  2696. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2697. @end example
  2698. @item
  2699. lowpass on left channel, highpass on right channel:
  2700. @example
  2701. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2702. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2703. @end example
  2704. @end itemize
  2705. @section flanger
  2706. Apply a flanging effect to the audio.
  2707. The filter accepts the following options:
  2708. @table @option
  2709. @item delay
  2710. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2711. @item depth
  2712. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2713. @item regen
  2714. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2715. Default value is 0.
  2716. @item width
  2717. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2718. Default value is 71.
  2719. @item speed
  2720. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2721. @item shape
  2722. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2723. Default value is @var{sinusoidal}.
  2724. @item phase
  2725. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2726. Default value is 25.
  2727. @item interp
  2728. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2729. Default is @var{linear}.
  2730. @end table
  2731. @section haas
  2732. Apply Haas effect to audio.
  2733. Note that this makes most sense to apply on mono signals.
  2734. With this filter applied to mono signals it give some directionality and
  2735. stretches its stereo image.
  2736. The filter accepts the following options:
  2737. @table @option
  2738. @item level_in
  2739. Set input level. By default is @var{1}, or 0dB
  2740. @item level_out
  2741. Set output level. By default is @var{1}, or 0dB.
  2742. @item side_gain
  2743. Set gain applied to side part of signal. By default is @var{1}.
  2744. @item middle_source
  2745. Set kind of middle source. Can be one of the following:
  2746. @table @samp
  2747. @item left
  2748. Pick left channel.
  2749. @item right
  2750. Pick right channel.
  2751. @item mid
  2752. Pick middle part signal of stereo image.
  2753. @item side
  2754. Pick side part signal of stereo image.
  2755. @end table
  2756. @item middle_phase
  2757. Change middle phase. By default is disabled.
  2758. @item left_delay
  2759. Set left channel delay. By default is @var{2.05} milliseconds.
  2760. @item left_balance
  2761. Set left channel balance. By default is @var{-1}.
  2762. @item left_gain
  2763. Set left channel gain. By default is @var{1}.
  2764. @item left_phase
  2765. Change left phase. By default is disabled.
  2766. @item right_delay
  2767. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2768. @item right_balance
  2769. Set right channel balance. By default is @var{1}.
  2770. @item right_gain
  2771. Set right channel gain. By default is @var{1}.
  2772. @item right_phase
  2773. Change right phase. By default is enabled.
  2774. @end table
  2775. @section hdcd
  2776. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2777. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2778. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2779. of HDCD, and detects the Transient Filter flag.
  2780. @example
  2781. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2782. @end example
  2783. When using the filter with wav, note the default encoding for wav is 16-bit,
  2784. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2785. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2786. @example
  2787. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2788. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2789. @end example
  2790. The filter accepts the following options:
  2791. @table @option
  2792. @item disable_autoconvert
  2793. Disable any automatic format conversion or resampling in the filter graph.
  2794. @item process_stereo
  2795. Process the stereo channels together. If target_gain does not match between
  2796. channels, consider it invalid and use the last valid target_gain.
  2797. @item cdt_ms
  2798. Set the code detect timer period in ms.
  2799. @item force_pe
  2800. Always extend peaks above -3dBFS even if PE isn't signaled.
  2801. @item analyze_mode
  2802. Replace audio with a solid tone and adjust the amplitude to signal some
  2803. specific aspect of the decoding process. The output file can be loaded in
  2804. an audio editor alongside the original to aid analysis.
  2805. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2806. Modes are:
  2807. @table @samp
  2808. @item 0, off
  2809. Disabled
  2810. @item 1, lle
  2811. Gain adjustment level at each sample
  2812. @item 2, pe
  2813. Samples where peak extend occurs
  2814. @item 3, cdt
  2815. Samples where the code detect timer is active
  2816. @item 4, tgm
  2817. Samples where the target gain does not match between channels
  2818. @end table
  2819. @end table
  2820. @section headphone
  2821. Apply head-related transfer functions (HRTFs) to create virtual
  2822. loudspeakers around the user for binaural listening via headphones.
  2823. The HRIRs are provided via additional streams, for each channel
  2824. one stereo input stream is needed.
  2825. The filter accepts the following options:
  2826. @table @option
  2827. @item map
  2828. Set mapping of input streams for convolution.
  2829. The argument is a '|'-separated list of channel names in order as they
  2830. are given as additional stream inputs for filter.
  2831. This also specify number of input streams. Number of input streams
  2832. must be not less than number of channels in first stream plus one.
  2833. @item gain
  2834. Set gain applied to audio. Value is in dB. Default is 0.
  2835. @item type
  2836. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2837. processing audio in time domain which is slow.
  2838. @var{freq} is processing audio in frequency domain which is fast.
  2839. Default is @var{freq}.
  2840. @item lfe
  2841. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2842. @item size
  2843. Set size of frame in number of samples which will be processed at once.
  2844. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2845. @item hrir
  2846. Set format of hrir stream.
  2847. Default value is @var{stereo}. Alternative value is @var{multich}.
  2848. If value is set to @var{stereo}, number of additional streams should
  2849. be greater or equal to number of input channels in first input stream.
  2850. Also each additional stream should have stereo number of channels.
  2851. If value is set to @var{multich}, number of additional streams should
  2852. be exactly one. Also number of input channels of additional stream
  2853. should be equal or greater than twice number of channels of first input
  2854. stream.
  2855. @end table
  2856. @subsection Examples
  2857. @itemize
  2858. @item
  2859. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2860. each amovie filter use stereo file with IR coefficients as input.
  2861. The files give coefficients for each position of virtual loudspeaker:
  2862. @example
  2863. ffmpeg -i input.wav
  2864. -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"
  2865. output.wav
  2866. @end example
  2867. @item
  2868. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2869. but now in @var{multich} @var{hrir} format.
  2870. @example
  2871. 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"
  2872. output.wav
  2873. @end example
  2874. @end itemize
  2875. @section highpass
  2876. Apply a high-pass filter with 3dB point frequency.
  2877. The filter can be either single-pole, or double-pole (the default).
  2878. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item frequency, f
  2882. Set frequency in Hz. Default is 3000.
  2883. @item poles, p
  2884. Set number of poles. Default is 2.
  2885. @item width_type, t
  2886. Set method to specify band-width of filter.
  2887. @table @option
  2888. @item h
  2889. Hz
  2890. @item q
  2891. Q-Factor
  2892. @item o
  2893. octave
  2894. @item s
  2895. slope
  2896. @item k
  2897. kHz
  2898. @end table
  2899. @item width, w
  2900. Specify the band-width of a filter in width_type units.
  2901. Applies only to double-pole filter.
  2902. The default is 0.707q and gives a Butterworth response.
  2903. @item channels, c
  2904. Specify which channels to filter, by default all available are filtered.
  2905. @end table
  2906. @subsection Commands
  2907. This filter supports the following commands:
  2908. @table @option
  2909. @item frequency, f
  2910. Change highpass frequency.
  2911. Syntax for the command is : "@var{frequency}"
  2912. @item width_type, t
  2913. Change highpass width_type.
  2914. Syntax for the command is : "@var{width_type}"
  2915. @item width, w
  2916. Change highpass width.
  2917. Syntax for the command is : "@var{width}"
  2918. @end table
  2919. @section join
  2920. Join multiple input streams into one multi-channel stream.
  2921. It accepts the following parameters:
  2922. @table @option
  2923. @item inputs
  2924. The number of input streams. It defaults to 2.
  2925. @item channel_layout
  2926. The desired output channel layout. It defaults to stereo.
  2927. @item map
  2928. Map channels from inputs to output. The argument is a '|'-separated list of
  2929. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2930. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2931. can be either the name of the input channel (e.g. FL for front left) or its
  2932. index in the specified input stream. @var{out_channel} is the name of the output
  2933. channel.
  2934. @end table
  2935. The filter will attempt to guess the mappings when they are not specified
  2936. explicitly. It does so by first trying to find an unused matching input channel
  2937. and if that fails it picks the first unused input channel.
  2938. Join 3 inputs (with properly set channel layouts):
  2939. @example
  2940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2941. @end example
  2942. Build a 5.1 output from 6 single-channel streams:
  2943. @example
  2944. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2945. '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'
  2946. out
  2947. @end example
  2948. @section ladspa
  2949. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2950. To enable compilation of this filter you need to configure FFmpeg with
  2951. @code{--enable-ladspa}.
  2952. @table @option
  2953. @item file, f
  2954. Specifies the name of LADSPA plugin library to load. If the environment
  2955. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2956. each one of the directories specified by the colon separated list in
  2957. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2958. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2959. @file{/usr/lib/ladspa/}.
  2960. @item plugin, p
  2961. Specifies the plugin within the library. Some libraries contain only
  2962. one plugin, but others contain many of them. If this is not set filter
  2963. will list all available plugins within the specified library.
  2964. @item controls, c
  2965. Set the '|' separated list of controls which are zero or more floating point
  2966. values that determine the behavior of the loaded plugin (for example delay,
  2967. threshold or gain).
  2968. Controls need to be defined using the following syntax:
  2969. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2970. @var{valuei} is the value set on the @var{i}-th control.
  2971. Alternatively they can be also defined using the following syntax:
  2972. @var{value0}|@var{value1}|@var{value2}|..., where
  2973. @var{valuei} is the value set on the @var{i}-th control.
  2974. If @option{controls} is set to @code{help}, all available controls and
  2975. their valid ranges are printed.
  2976. @item sample_rate, s
  2977. Specify the sample rate, default to 44100. Only used if plugin have
  2978. zero inputs.
  2979. @item nb_samples, n
  2980. Set the number of samples per channel per each output frame, default
  2981. is 1024. Only used if plugin have zero inputs.
  2982. @item duration, d
  2983. Set the minimum duration of the sourced audio. See
  2984. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2985. for the accepted syntax.
  2986. Note that the resulting duration may be greater than the specified duration,
  2987. as the generated audio is always cut at the end of a complete frame.
  2988. If not specified, or the expressed duration is negative, the audio is
  2989. supposed to be generated forever.
  2990. Only used if plugin have zero inputs.
  2991. @end table
  2992. @subsection Examples
  2993. @itemize
  2994. @item
  2995. List all available plugins within amp (LADSPA example plugin) library:
  2996. @example
  2997. ladspa=file=amp
  2998. @end example
  2999. @item
  3000. List all available controls and their valid ranges for @code{vcf_notch}
  3001. plugin from @code{VCF} library:
  3002. @example
  3003. ladspa=f=vcf:p=vcf_notch:c=help
  3004. @end example
  3005. @item
  3006. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3007. plugin library:
  3008. @example
  3009. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3010. @end example
  3011. @item
  3012. Add reverberation to the audio using TAP-plugins
  3013. (Tom's Audio Processing plugins):
  3014. @example
  3015. ladspa=file=tap_reverb:tap_reverb
  3016. @end example
  3017. @item
  3018. Generate white noise, with 0.2 amplitude:
  3019. @example
  3020. ladspa=file=cmt:noise_source_white:c=c0=.2
  3021. @end example
  3022. @item
  3023. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3024. @code{C* Audio Plugin Suite} (CAPS) library:
  3025. @example
  3026. ladspa=file=caps:Click:c=c1=20'
  3027. @end example
  3028. @item
  3029. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3030. @example
  3031. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3032. @end example
  3033. @item
  3034. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3035. @code{SWH Plugins} collection:
  3036. @example
  3037. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3038. @end example
  3039. @item
  3040. Attenuate low frequencies using Multiband EQ from Steve Harris
  3041. @code{SWH Plugins} collection:
  3042. @example
  3043. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3044. @end example
  3045. @item
  3046. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3047. (CAPS) library:
  3048. @example
  3049. ladspa=caps:Narrower
  3050. @end example
  3051. @item
  3052. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3053. @example
  3054. ladspa=caps:White:.2
  3055. @end example
  3056. @item
  3057. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3058. @example
  3059. ladspa=caps:Fractal:c=c1=1
  3060. @end example
  3061. @item
  3062. Dynamic volume normalization using @code{VLevel} plugin:
  3063. @example
  3064. ladspa=vlevel-ladspa:vlevel_mono
  3065. @end example
  3066. @end itemize
  3067. @subsection Commands
  3068. This filter supports the following commands:
  3069. @table @option
  3070. @item cN
  3071. Modify the @var{N}-th control value.
  3072. If the specified value is not valid, it is ignored and prior one is kept.
  3073. @end table
  3074. @section loudnorm
  3075. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3076. Support for both single pass (livestreams, files) and double pass (files) modes.
  3077. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3078. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3079. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3080. The filter accepts the following options:
  3081. @table @option
  3082. @item I, i
  3083. Set integrated loudness target.
  3084. Range is -70.0 - -5.0. Default value is -24.0.
  3085. @item LRA, lra
  3086. Set loudness range target.
  3087. Range is 1.0 - 20.0. Default value is 7.0.
  3088. @item TP, tp
  3089. Set maximum true peak.
  3090. Range is -9.0 - +0.0. Default value is -2.0.
  3091. @item measured_I, measured_i
  3092. Measured IL of input file.
  3093. Range is -99.0 - +0.0.
  3094. @item measured_LRA, measured_lra
  3095. Measured LRA of input file.
  3096. Range is 0.0 - 99.0.
  3097. @item measured_TP, measured_tp
  3098. Measured true peak of input file.
  3099. Range is -99.0 - +99.0.
  3100. @item measured_thresh
  3101. Measured threshold of input file.
  3102. Range is -99.0 - +0.0.
  3103. @item offset
  3104. Set offset gain. Gain is applied before the true-peak limiter.
  3105. Range is -99.0 - +99.0. Default is +0.0.
  3106. @item linear
  3107. Normalize linearly if possible.
  3108. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3109. to be specified in order to use this mode.
  3110. Options are true or false. Default is true.
  3111. @item dual_mono
  3112. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3113. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3114. If set to @code{true}, this option will compensate for this effect.
  3115. Multi-channel input files are not affected by this option.
  3116. Options are true or false. Default is false.
  3117. @item print_format
  3118. Set print format for stats. Options are summary, json, or none.
  3119. Default value is none.
  3120. @end table
  3121. @section lowpass
  3122. Apply a low-pass filter with 3dB point frequency.
  3123. The filter can be either single-pole or double-pole (the default).
  3124. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3125. The filter accepts the following options:
  3126. @table @option
  3127. @item frequency, f
  3128. Set frequency in Hz. Default is 500.
  3129. @item poles, p
  3130. Set number of poles. Default is 2.
  3131. @item width_type, t
  3132. Set method to specify band-width of filter.
  3133. @table @option
  3134. @item h
  3135. Hz
  3136. @item q
  3137. Q-Factor
  3138. @item o
  3139. octave
  3140. @item s
  3141. slope
  3142. @item k
  3143. kHz
  3144. @end table
  3145. @item width, w
  3146. Specify the band-width of a filter in width_type units.
  3147. Applies only to double-pole filter.
  3148. The default is 0.707q and gives a Butterworth response.
  3149. @item channels, c
  3150. Specify which channels to filter, by default all available are filtered.
  3151. @end table
  3152. @subsection Examples
  3153. @itemize
  3154. @item
  3155. Lowpass only LFE channel, it LFE is not present it does nothing:
  3156. @example
  3157. lowpass=c=LFE
  3158. @end example
  3159. @end itemize
  3160. @subsection Commands
  3161. This filter supports the following commands:
  3162. @table @option
  3163. @item frequency, f
  3164. Change lowpass frequency.
  3165. Syntax for the command is : "@var{frequency}"
  3166. @item width_type, t
  3167. Change lowpass width_type.
  3168. Syntax for the command is : "@var{width_type}"
  3169. @item width, w
  3170. Change lowpass width.
  3171. Syntax for the command is : "@var{width}"
  3172. @end table
  3173. @section lv2
  3174. Load a LV2 (LADSPA Version 2) plugin.
  3175. To enable compilation of this filter you need to configure FFmpeg with
  3176. @code{--enable-lv2}.
  3177. @table @option
  3178. @item plugin, p
  3179. Specifies the plugin URI. You may need to escape ':'.
  3180. @item controls, c
  3181. Set the '|' separated list of controls which are zero or more floating point
  3182. values that determine the behavior of the loaded plugin (for example delay,
  3183. threshold or gain).
  3184. If @option{controls} is set to @code{help}, all available controls and
  3185. their valid ranges are printed.
  3186. @item sample_rate, s
  3187. Specify the sample rate, default to 44100. Only used if plugin have
  3188. zero inputs.
  3189. @item nb_samples, n
  3190. Set the number of samples per channel per each output frame, default
  3191. is 1024. Only used if plugin have zero inputs.
  3192. @item duration, d
  3193. Set the minimum duration of the sourced audio. See
  3194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3195. for the accepted syntax.
  3196. Note that the resulting duration may be greater than the specified duration,
  3197. as the generated audio is always cut at the end of a complete frame.
  3198. If not specified, or the expressed duration is negative, the audio is
  3199. supposed to be generated forever.
  3200. Only used if plugin have zero inputs.
  3201. @end table
  3202. @subsection Examples
  3203. @itemize
  3204. @item
  3205. Apply bass enhancer plugin from Calf:
  3206. @example
  3207. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3208. @end example
  3209. @item
  3210. Apply vinyl plugin from Calf:
  3211. @example
  3212. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3213. @end example
  3214. @item
  3215. Apply bit crusher plugin from ArtyFX:
  3216. @example
  3217. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3218. @end example
  3219. @end itemize
  3220. @section mcompand
  3221. Multiband Compress or expand the audio's dynamic range.
  3222. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3223. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3224. response when absent compander action.
  3225. It accepts the following parameters:
  3226. @table @option
  3227. @item args
  3228. This option syntax is:
  3229. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3230. For explanation of each item refer to compand filter documentation.
  3231. @end table
  3232. @anchor{pan}
  3233. @section pan
  3234. Mix channels with specific gain levels. The filter accepts the output
  3235. channel layout followed by a set of channels definitions.
  3236. This filter is also designed to efficiently remap the channels of an audio
  3237. stream.
  3238. The filter accepts parameters of the form:
  3239. "@var{l}|@var{outdef}|@var{outdef}|..."
  3240. @table @option
  3241. @item l
  3242. output channel layout or number of channels
  3243. @item outdef
  3244. output channel specification, of the form:
  3245. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3246. @item out_name
  3247. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3248. number (c0, c1, etc.)
  3249. @item gain
  3250. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3251. @item in_name
  3252. input channel to use, see out_name for details; it is not possible to mix
  3253. named and numbered input channels
  3254. @end table
  3255. If the `=' in a channel specification is replaced by `<', then the gains for
  3256. that specification will be renormalized so that the total is 1, thus
  3257. avoiding clipping noise.
  3258. @subsection Mixing examples
  3259. For example, if you want to down-mix from stereo to mono, but with a bigger
  3260. factor for the left channel:
  3261. @example
  3262. pan=1c|c0=0.9*c0+0.1*c1
  3263. @end example
  3264. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3265. 7-channels surround:
  3266. @example
  3267. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3268. @end example
  3269. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3270. that should be preferred (see "-ac" option) unless you have very specific
  3271. needs.
  3272. @subsection Remapping examples
  3273. The channel remapping will be effective if, and only if:
  3274. @itemize
  3275. @item gain coefficients are zeroes or ones,
  3276. @item only one input per channel output,
  3277. @end itemize
  3278. If all these conditions are satisfied, the filter will notify the user ("Pure
  3279. channel mapping detected"), and use an optimized and lossless method to do the
  3280. remapping.
  3281. For example, if you have a 5.1 source and want a stereo audio stream by
  3282. dropping the extra channels:
  3283. @example
  3284. pan="stereo| c0=FL | c1=FR"
  3285. @end example
  3286. Given the same source, you can also switch front left and front right channels
  3287. and keep the input channel layout:
  3288. @example
  3289. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3290. @end example
  3291. If the input is a stereo audio stream, you can mute the front left channel (and
  3292. still keep the stereo channel layout) with:
  3293. @example
  3294. pan="stereo|c1=c1"
  3295. @end example
  3296. Still with a stereo audio stream input, you can copy the right channel in both
  3297. front left and right:
  3298. @example
  3299. pan="stereo| c0=FR | c1=FR"
  3300. @end example
  3301. @section replaygain
  3302. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3303. outputs it unchanged.
  3304. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3305. @section resample
  3306. Convert the audio sample format, sample rate and channel layout. It is
  3307. not meant to be used directly.
  3308. @section rubberband
  3309. Apply time-stretching and pitch-shifting with librubberband.
  3310. To enable compilation of this filter, you need to configure FFmpeg with
  3311. @code{--enable-librubberband}.
  3312. The filter accepts the following options:
  3313. @table @option
  3314. @item tempo
  3315. Set tempo scale factor.
  3316. @item pitch
  3317. Set pitch scale factor.
  3318. @item transients
  3319. Set transients detector.
  3320. Possible values are:
  3321. @table @var
  3322. @item crisp
  3323. @item mixed
  3324. @item smooth
  3325. @end table
  3326. @item detector
  3327. Set detector.
  3328. Possible values are:
  3329. @table @var
  3330. @item compound
  3331. @item percussive
  3332. @item soft
  3333. @end table
  3334. @item phase
  3335. Set phase.
  3336. Possible values are:
  3337. @table @var
  3338. @item laminar
  3339. @item independent
  3340. @end table
  3341. @item window
  3342. Set processing window size.
  3343. Possible values are:
  3344. @table @var
  3345. @item standard
  3346. @item short
  3347. @item long
  3348. @end table
  3349. @item smoothing
  3350. Set smoothing.
  3351. Possible values are:
  3352. @table @var
  3353. @item off
  3354. @item on
  3355. @end table
  3356. @item formant
  3357. Enable formant preservation when shift pitching.
  3358. Possible values are:
  3359. @table @var
  3360. @item shifted
  3361. @item preserved
  3362. @end table
  3363. @item pitchq
  3364. Set pitch quality.
  3365. Possible values are:
  3366. @table @var
  3367. @item quality
  3368. @item speed
  3369. @item consistency
  3370. @end table
  3371. @item channels
  3372. Set channels.
  3373. Possible values are:
  3374. @table @var
  3375. @item apart
  3376. @item together
  3377. @end table
  3378. @end table
  3379. @section sidechaincompress
  3380. This filter acts like normal compressor but has the ability to compress
  3381. detected signal using second input signal.
  3382. It needs two input streams and returns one output stream.
  3383. First input stream will be processed depending on second stream signal.
  3384. The filtered signal then can be filtered with other filters in later stages of
  3385. processing. See @ref{pan} and @ref{amerge} filter.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item level_in
  3389. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3390. @item mode
  3391. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3392. Default is @code{downward}.
  3393. @item threshold
  3394. If a signal of second stream raises above this level it will affect the gain
  3395. reduction of first stream.
  3396. By default is 0.125. Range is between 0.00097563 and 1.
  3397. @item ratio
  3398. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3399. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3400. Default is 2. Range is between 1 and 20.
  3401. @item attack
  3402. Amount of milliseconds the signal has to rise above the threshold before gain
  3403. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3404. @item release
  3405. Amount of milliseconds the signal has to fall below the threshold before
  3406. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3407. @item makeup
  3408. Set the amount by how much signal will be amplified after processing.
  3409. Default is 1. Range is from 1 to 64.
  3410. @item knee
  3411. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3412. Default is 2.82843. Range is between 1 and 8.
  3413. @item link
  3414. Choose if the @code{average} level between all channels of side-chain stream
  3415. or the louder(@code{maximum}) channel of side-chain stream affects the
  3416. reduction. Default is @code{average}.
  3417. @item detection
  3418. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3419. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3420. @item level_sc
  3421. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3422. @item mix
  3423. How much to use compressed signal in output. Default is 1.
  3424. Range is between 0 and 1.
  3425. @end table
  3426. @subsection Examples
  3427. @itemize
  3428. @item
  3429. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3430. depending on the signal of 2nd input and later compressed signal to be
  3431. merged with 2nd input:
  3432. @example
  3433. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3434. @end example
  3435. @end itemize
  3436. @section sidechaingate
  3437. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3438. filter the detected signal before sending it to the gain reduction stage.
  3439. Normally a gate uses the full range signal to detect a level above the
  3440. threshold.
  3441. For example: If you cut all lower frequencies from your sidechain signal
  3442. the gate will decrease the volume of your track only if not enough highs
  3443. appear. With this technique you are able to reduce the resonation of a
  3444. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3445. guitar.
  3446. It needs two input streams and returns one output stream.
  3447. First input stream will be processed depending on second stream signal.
  3448. The filter accepts the following options:
  3449. @table @option
  3450. @item level_in
  3451. Set input level before filtering.
  3452. Default is 1. Allowed range is from 0.015625 to 64.
  3453. @item mode
  3454. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3455. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3456. will be amplified, expanding dynamic range in upward direction.
  3457. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3458. @item range
  3459. Set the level of gain reduction when the signal is below the threshold.
  3460. Default is 0.06125. Allowed range is from 0 to 1.
  3461. Setting this to 0 disables reduction and then filter behaves like expander.
  3462. @item threshold
  3463. If a signal rises above this level the gain reduction is released.
  3464. Default is 0.125. Allowed range is from 0 to 1.
  3465. @item ratio
  3466. Set a ratio about which the signal is reduced.
  3467. Default is 2. Allowed range is from 1 to 9000.
  3468. @item attack
  3469. Amount of milliseconds the signal has to rise above the threshold before gain
  3470. reduction stops.
  3471. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3472. @item release
  3473. Amount of milliseconds the signal has to fall below the threshold before the
  3474. reduction is increased again. Default is 250 milliseconds.
  3475. Allowed range is from 0.01 to 9000.
  3476. @item makeup
  3477. Set amount of amplification of signal after processing.
  3478. Default is 1. Allowed range is from 1 to 64.
  3479. @item knee
  3480. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3481. Default is 2.828427125. Allowed range is from 1 to 8.
  3482. @item detection
  3483. Choose if exact signal should be taken for detection or an RMS like one.
  3484. Default is rms. Can be peak or rms.
  3485. @item link
  3486. Choose if the average level between all channels or the louder channel affects
  3487. the reduction.
  3488. Default is average. Can be average or maximum.
  3489. @item level_sc
  3490. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3491. @end table
  3492. @section silencedetect
  3493. Detect silence in an audio stream.
  3494. This filter logs a message when it detects that the input audio volume is less
  3495. or equal to a noise tolerance value for a duration greater or equal to the
  3496. minimum detected noise duration.
  3497. The printed times and duration are expressed in seconds.
  3498. The filter accepts the following options:
  3499. @table @option
  3500. @item noise, n
  3501. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3502. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3503. @item duration, d
  3504. Set silence duration until notification (default is 2 seconds).
  3505. @item mono, m
  3506. Process each channel separately, instead of combined. By default is disabled.
  3507. @end table
  3508. @subsection Examples
  3509. @itemize
  3510. @item
  3511. Detect 5 seconds of silence with -50dB noise tolerance:
  3512. @example
  3513. silencedetect=n=-50dB:d=5
  3514. @end example
  3515. @item
  3516. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3517. tolerance in @file{silence.mp3}:
  3518. @example
  3519. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3520. @end example
  3521. @end itemize
  3522. @section silenceremove
  3523. Remove silence from the beginning, middle or end of the audio.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item start_periods
  3527. This value is used to indicate if audio should be trimmed at beginning of
  3528. the audio. A value of zero indicates no silence should be trimmed from the
  3529. beginning. When specifying a non-zero value, it trims audio up until it
  3530. finds non-silence. Normally, when trimming silence from beginning of audio
  3531. the @var{start_periods} will be @code{1} but it can be increased to higher
  3532. values to trim all audio up to specific count of non-silence periods.
  3533. Default value is @code{0}.
  3534. @item start_duration
  3535. Specify the amount of time that non-silence must be detected before it stops
  3536. trimming audio. By increasing the duration, bursts of noises can be treated
  3537. as silence and trimmed off. Default value is @code{0}.
  3538. @item start_threshold
  3539. This indicates what sample value should be treated as silence. For digital
  3540. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3541. you may wish to increase the value to account for background noise.
  3542. Can be specified in dB (in case "dB" is appended to the specified value)
  3543. or amplitude ratio. Default value is @code{0}.
  3544. @item start_silence
  3545. Specify max duration of silence at beginning that will be kept after
  3546. trimming. Default is 0, which is equal to trimming all samples detected
  3547. as silence.
  3548. @item start_mode
  3549. Specify mode of detection of silence end in start of multi-channel audio.
  3550. Can be @var{any} or @var{all}. Default is @var{any}.
  3551. With @var{any}, any sample that is detected as non-silence will cause
  3552. stopped trimming of silence.
  3553. With @var{all}, only if all channels are detected as non-silence will cause
  3554. stopped trimming of silence.
  3555. @item stop_periods
  3556. Set the count for trimming silence from the end of audio.
  3557. To remove silence from the middle of a file, specify a @var{stop_periods}
  3558. that is negative. This value is then treated as a positive value and is
  3559. used to indicate the effect should restart processing as specified by
  3560. @var{start_periods}, making it suitable for removing periods of silence
  3561. in the middle of the audio.
  3562. Default value is @code{0}.
  3563. @item stop_duration
  3564. Specify a duration of silence that must exist before audio is not copied any
  3565. more. By specifying a higher duration, silence that is wanted can be left in
  3566. the audio.
  3567. Default value is @code{0}.
  3568. @item stop_threshold
  3569. This is the same as @option{start_threshold} but for trimming silence from
  3570. the end of audio.
  3571. Can be specified in dB (in case "dB" is appended to the specified value)
  3572. or amplitude ratio. Default value is @code{0}.
  3573. @item stop_silence
  3574. Specify max duration of silence at end that will be kept after
  3575. trimming. Default is 0, which is equal to trimming all samples detected
  3576. as silence.
  3577. @item stop_mode
  3578. Specify mode of detection of silence start in end of multi-channel audio.
  3579. Can be @var{any} or @var{all}. Default is @var{any}.
  3580. With @var{any}, any sample that is detected as non-silence will cause
  3581. stopped trimming of silence.
  3582. With @var{all}, only if all channels are detected as non-silence will cause
  3583. stopped trimming of silence.
  3584. @item detection
  3585. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3586. and works better with digital silence which is exactly 0.
  3587. Default value is @code{rms}.
  3588. @item window
  3589. Set duration in number of seconds used to calculate size of window in number
  3590. of samples for detecting silence.
  3591. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3592. @end table
  3593. @subsection Examples
  3594. @itemize
  3595. @item
  3596. The following example shows how this filter can be used to start a recording
  3597. that does not contain the delay at the start which usually occurs between
  3598. pressing the record button and the start of the performance:
  3599. @example
  3600. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3601. @end example
  3602. @item
  3603. Trim all silence encountered from beginning to end where there is more than 1
  3604. second of silence in audio:
  3605. @example
  3606. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3607. @end example
  3608. @end itemize
  3609. @section sofalizer
  3610. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3611. loudspeakers around the user for binaural listening via headphones (audio
  3612. formats up to 9 channels supported).
  3613. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3614. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3615. Austrian Academy of Sciences.
  3616. To enable compilation of this filter you need to configure FFmpeg with
  3617. @code{--enable-libmysofa}.
  3618. The filter accepts the following options:
  3619. @table @option
  3620. @item sofa
  3621. Set the SOFA file used for rendering.
  3622. @item gain
  3623. Set gain applied to audio. Value is in dB. Default is 0.
  3624. @item rotation
  3625. Set rotation of virtual loudspeakers in deg. Default is 0.
  3626. @item elevation
  3627. Set elevation of virtual speakers in deg. Default is 0.
  3628. @item radius
  3629. Set distance in meters between loudspeakers and the listener with near-field
  3630. HRTFs. Default is 1.
  3631. @item type
  3632. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3633. processing audio in time domain which is slow.
  3634. @var{freq} is processing audio in frequency domain which is fast.
  3635. Default is @var{freq}.
  3636. @item speakers
  3637. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3638. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3639. Each virtual loudspeaker is described with short channel name following with
  3640. azimuth and elevation in degrees.
  3641. Each virtual loudspeaker description is separated by '|'.
  3642. For example to override front left and front right channel positions use:
  3643. 'speakers=FL 45 15|FR 345 15'.
  3644. Descriptions with unrecognised channel names are ignored.
  3645. @item lfegain
  3646. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3647. @item framesize
  3648. Set custom frame size in number of samples. Default is 1024.
  3649. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3650. is set to @var{freq}.
  3651. @item normalize
  3652. Should all IRs be normalized upon importing SOFA file.
  3653. By default is enabled.
  3654. @item interpolate
  3655. Should nearest IRs be interpolated with neighbor IRs if exact position
  3656. does not match. By default is disabled.
  3657. @item minphase
  3658. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3659. @item anglestep
  3660. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3661. @item radstep
  3662. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3663. @end table
  3664. @subsection Examples
  3665. @itemize
  3666. @item
  3667. Using ClubFritz6 sofa file:
  3668. @example
  3669. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3670. @end example
  3671. @item
  3672. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3673. @example
  3674. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3675. @end example
  3676. @item
  3677. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3678. and also with custom gain:
  3679. @example
  3680. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3681. @end example
  3682. @end itemize
  3683. @section stereotools
  3684. This filter has some handy utilities to manage stereo signals, for converting
  3685. M/S stereo recordings to L/R signal while having control over the parameters
  3686. or spreading the stereo image of master track.
  3687. The filter accepts the following options:
  3688. @table @option
  3689. @item level_in
  3690. Set input level before filtering for both channels. Defaults is 1.
  3691. Allowed range is from 0.015625 to 64.
  3692. @item level_out
  3693. Set output level after filtering for both channels. Defaults is 1.
  3694. Allowed range is from 0.015625 to 64.
  3695. @item balance_in
  3696. Set input balance between both channels. Default is 0.
  3697. Allowed range is from -1 to 1.
  3698. @item balance_out
  3699. Set output balance between both channels. Default is 0.
  3700. Allowed range is from -1 to 1.
  3701. @item softclip
  3702. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3703. clipping. Disabled by default.
  3704. @item mutel
  3705. Mute the left channel. Disabled by default.
  3706. @item muter
  3707. Mute the right channel. Disabled by default.
  3708. @item phasel
  3709. Change the phase of the left channel. Disabled by default.
  3710. @item phaser
  3711. Change the phase of the right channel. Disabled by default.
  3712. @item mode
  3713. Set stereo mode. Available values are:
  3714. @table @samp
  3715. @item lr>lr
  3716. Left/Right to Left/Right, this is default.
  3717. @item lr>ms
  3718. Left/Right to Mid/Side.
  3719. @item ms>lr
  3720. Mid/Side to Left/Right.
  3721. @item lr>ll
  3722. Left/Right to Left/Left.
  3723. @item lr>rr
  3724. Left/Right to Right/Right.
  3725. @item lr>l+r
  3726. Left/Right to Left + Right.
  3727. @item lr>rl
  3728. Left/Right to Right/Left.
  3729. @item ms>ll
  3730. Mid/Side to Left/Left.
  3731. @item ms>rr
  3732. Mid/Side to Right/Right.
  3733. @end table
  3734. @item slev
  3735. Set level of side signal. Default is 1.
  3736. Allowed range is from 0.015625 to 64.
  3737. @item sbal
  3738. Set balance of side signal. Default is 0.
  3739. Allowed range is from -1 to 1.
  3740. @item mlev
  3741. Set level of the middle signal. Default is 1.
  3742. Allowed range is from 0.015625 to 64.
  3743. @item mpan
  3744. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3745. @item base
  3746. Set stereo base between mono and inversed channels. Default is 0.
  3747. Allowed range is from -1 to 1.
  3748. @item delay
  3749. Set delay in milliseconds how much to delay left from right channel and
  3750. vice versa. Default is 0. Allowed range is from -20 to 20.
  3751. @item sclevel
  3752. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3753. @item phase
  3754. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3755. @item bmode_in, bmode_out
  3756. Set balance mode for balance_in/balance_out option.
  3757. Can be one of the following:
  3758. @table @samp
  3759. @item balance
  3760. Classic balance mode. Attenuate one channel at time.
  3761. Gain is raised up to 1.
  3762. @item amplitude
  3763. Similar as classic mode above but gain is raised up to 2.
  3764. @item power
  3765. Equal power distribution, from -6dB to +6dB range.
  3766. @end table
  3767. @end table
  3768. @subsection Examples
  3769. @itemize
  3770. @item
  3771. Apply karaoke like effect:
  3772. @example
  3773. stereotools=mlev=0.015625
  3774. @end example
  3775. @item
  3776. Convert M/S signal to L/R:
  3777. @example
  3778. "stereotools=mode=ms>lr"
  3779. @end example
  3780. @end itemize
  3781. @section stereowiden
  3782. This filter enhance the stereo effect by suppressing signal common to both
  3783. channels and by delaying the signal of left into right and vice versa,
  3784. thereby widening the stereo effect.
  3785. The filter accepts the following options:
  3786. @table @option
  3787. @item delay
  3788. Time in milliseconds of the delay of left signal into right and vice versa.
  3789. Default is 20 milliseconds.
  3790. @item feedback
  3791. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3792. effect of left signal in right output and vice versa which gives widening
  3793. effect. Default is 0.3.
  3794. @item crossfeed
  3795. Cross feed of left into right with inverted phase. This helps in suppressing
  3796. the mono. If the value is 1 it will cancel all the signal common to both
  3797. channels. Default is 0.3.
  3798. @item drymix
  3799. Set level of input signal of original channel. Default is 0.8.
  3800. @end table
  3801. @section superequalizer
  3802. Apply 18 band equalizer.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item 1b
  3806. Set 65Hz band gain.
  3807. @item 2b
  3808. Set 92Hz band gain.
  3809. @item 3b
  3810. Set 131Hz band gain.
  3811. @item 4b
  3812. Set 185Hz band gain.
  3813. @item 5b
  3814. Set 262Hz band gain.
  3815. @item 6b
  3816. Set 370Hz band gain.
  3817. @item 7b
  3818. Set 523Hz band gain.
  3819. @item 8b
  3820. Set 740Hz band gain.
  3821. @item 9b
  3822. Set 1047Hz band gain.
  3823. @item 10b
  3824. Set 1480Hz band gain.
  3825. @item 11b
  3826. Set 2093Hz band gain.
  3827. @item 12b
  3828. Set 2960Hz band gain.
  3829. @item 13b
  3830. Set 4186Hz band gain.
  3831. @item 14b
  3832. Set 5920Hz band gain.
  3833. @item 15b
  3834. Set 8372Hz band gain.
  3835. @item 16b
  3836. Set 11840Hz band gain.
  3837. @item 17b
  3838. Set 16744Hz band gain.
  3839. @item 18b
  3840. Set 20000Hz band gain.
  3841. @end table
  3842. @section surround
  3843. Apply audio surround upmix filter.
  3844. This filter allows to produce multichannel output from audio stream.
  3845. The filter accepts the following options:
  3846. @table @option
  3847. @item chl_out
  3848. Set output channel layout. By default, this is @var{5.1}.
  3849. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3850. for the required syntax.
  3851. @item chl_in
  3852. Set input channel layout. By default, this is @var{stereo}.
  3853. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3854. for the required syntax.
  3855. @item level_in
  3856. Set input volume level. By default, this is @var{1}.
  3857. @item level_out
  3858. Set output volume level. By default, this is @var{1}.
  3859. @item lfe
  3860. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3861. @item lfe_low
  3862. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3863. @item lfe_high
  3864. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3865. @item lfe_mode
  3866. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3867. In @var{add} mode, LFE channel is created from input audio and added to output.
  3868. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3869. also all non-LFE output channels are subtracted with output LFE channel.
  3870. @item angle
  3871. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3872. Default is @var{90}.
  3873. @item fc_in
  3874. Set front center input volume. By default, this is @var{1}.
  3875. @item fc_out
  3876. Set front center output volume. By default, this is @var{1}.
  3877. @item fl_in
  3878. Set front left input volume. By default, this is @var{1}.
  3879. @item fl_out
  3880. Set front left output volume. By default, this is @var{1}.
  3881. @item fr_in
  3882. Set front right input volume. By default, this is @var{1}.
  3883. @item fr_out
  3884. Set front right output volume. By default, this is @var{1}.
  3885. @item sl_in
  3886. Set side left input volume. By default, this is @var{1}.
  3887. @item sl_out
  3888. Set side left output volume. By default, this is @var{1}.
  3889. @item sr_in
  3890. Set side right input volume. By default, this is @var{1}.
  3891. @item sr_out
  3892. Set side right output volume. By default, this is @var{1}.
  3893. @item bl_in
  3894. Set back left input volume. By default, this is @var{1}.
  3895. @item bl_out
  3896. Set back left output volume. By default, this is @var{1}.
  3897. @item br_in
  3898. Set back right input volume. By default, this is @var{1}.
  3899. @item br_out
  3900. Set back right output volume. By default, this is @var{1}.
  3901. @item bc_in
  3902. Set back center input volume. By default, this is @var{1}.
  3903. @item bc_out
  3904. Set back center output volume. By default, this is @var{1}.
  3905. @item lfe_in
  3906. Set LFE input volume. By default, this is @var{1}.
  3907. @item lfe_out
  3908. Set LFE output volume. By default, this is @var{1}.
  3909. @item allx
  3910. Set spread usage of stereo image across X axis for all channels.
  3911. @item ally
  3912. Set spread usage of stereo image across Y axis for all channels.
  3913. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3914. Set spread usage of stereo image across X axis for each channel.
  3915. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3916. Set spread usage of stereo image across Y axis for each channel.
  3917. @item win_size
  3918. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3919. @item win_func
  3920. Set window function.
  3921. It accepts the following values:
  3922. @table @samp
  3923. @item rect
  3924. @item bartlett
  3925. @item hann, hanning
  3926. @item hamming
  3927. @item blackman
  3928. @item welch
  3929. @item flattop
  3930. @item bharris
  3931. @item bnuttall
  3932. @item bhann
  3933. @item sine
  3934. @item nuttall
  3935. @item lanczos
  3936. @item gauss
  3937. @item tukey
  3938. @item dolph
  3939. @item cauchy
  3940. @item parzen
  3941. @item poisson
  3942. @item bohman
  3943. @end table
  3944. Default is @code{hann}.
  3945. @item overlap
  3946. Set window overlap. If set to 1, the recommended overlap for selected
  3947. window function will be picked. Default is @code{0.5}.
  3948. @end table
  3949. @section treble, highshelf
  3950. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3951. shelving filter with a response similar to that of a standard
  3952. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3953. The filter accepts the following options:
  3954. @table @option
  3955. @item gain, g
  3956. Give the gain at whichever is the lower of ~22 kHz and the
  3957. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3958. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3959. @item frequency, f
  3960. Set the filter's central frequency and so can be used
  3961. to extend or reduce the frequency range to be boosted or cut.
  3962. The default value is @code{3000} Hz.
  3963. @item width_type, t
  3964. Set method to specify band-width of filter.
  3965. @table @option
  3966. @item h
  3967. Hz
  3968. @item q
  3969. Q-Factor
  3970. @item o
  3971. octave
  3972. @item s
  3973. slope
  3974. @item k
  3975. kHz
  3976. @end table
  3977. @item width, w
  3978. Determine how steep is the filter's shelf transition.
  3979. @item channels, c
  3980. Specify which channels to filter, by default all available are filtered.
  3981. @end table
  3982. @subsection Commands
  3983. This filter supports the following commands:
  3984. @table @option
  3985. @item frequency, f
  3986. Change treble frequency.
  3987. Syntax for the command is : "@var{frequency}"
  3988. @item width_type, t
  3989. Change treble width_type.
  3990. Syntax for the command is : "@var{width_type}"
  3991. @item width, w
  3992. Change treble width.
  3993. Syntax for the command is : "@var{width}"
  3994. @item gain, g
  3995. Change treble gain.
  3996. Syntax for the command is : "@var{gain}"
  3997. @end table
  3998. @section tremolo
  3999. Sinusoidal amplitude modulation.
  4000. The filter accepts the following options:
  4001. @table @option
  4002. @item f
  4003. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4004. (20 Hz or lower) will result in a tremolo effect.
  4005. This filter may also be used as a ring modulator by specifying
  4006. a modulation frequency higher than 20 Hz.
  4007. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4008. @item d
  4009. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4010. Default value is 0.5.
  4011. @end table
  4012. @section vibrato
  4013. Sinusoidal phase modulation.
  4014. The filter accepts the following options:
  4015. @table @option
  4016. @item f
  4017. Modulation frequency in Hertz.
  4018. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4019. @item d
  4020. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4021. Default value is 0.5.
  4022. @end table
  4023. @section volume
  4024. Adjust the input audio volume.
  4025. It accepts the following parameters:
  4026. @table @option
  4027. @item volume
  4028. Set audio volume expression.
  4029. Output values are clipped to the maximum value.
  4030. The output audio volume is given by the relation:
  4031. @example
  4032. @var{output_volume} = @var{volume} * @var{input_volume}
  4033. @end example
  4034. The default value for @var{volume} is "1.0".
  4035. @item precision
  4036. This parameter represents the mathematical precision.
  4037. It determines which input sample formats will be allowed, which affects the
  4038. precision of the volume scaling.
  4039. @table @option
  4040. @item fixed
  4041. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4042. @item float
  4043. 32-bit floating-point; this limits input sample format to FLT. (default)
  4044. @item double
  4045. 64-bit floating-point; this limits input sample format to DBL.
  4046. @end table
  4047. @item replaygain
  4048. Choose the behaviour on encountering ReplayGain side data in input frames.
  4049. @table @option
  4050. @item drop
  4051. Remove ReplayGain side data, ignoring its contents (the default).
  4052. @item ignore
  4053. Ignore ReplayGain side data, but leave it in the frame.
  4054. @item track
  4055. Prefer the track gain, if present.
  4056. @item album
  4057. Prefer the album gain, if present.
  4058. @end table
  4059. @item replaygain_preamp
  4060. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4061. Default value for @var{replaygain_preamp} is 0.0.
  4062. @item eval
  4063. Set when the volume expression is evaluated.
  4064. It accepts the following values:
  4065. @table @samp
  4066. @item once
  4067. only evaluate expression once during the filter initialization, or
  4068. when the @samp{volume} command is sent
  4069. @item frame
  4070. evaluate expression for each incoming frame
  4071. @end table
  4072. Default value is @samp{once}.
  4073. @end table
  4074. The volume expression can contain the following parameters.
  4075. @table @option
  4076. @item n
  4077. frame number (starting at zero)
  4078. @item nb_channels
  4079. number of channels
  4080. @item nb_consumed_samples
  4081. number of samples consumed by the filter
  4082. @item nb_samples
  4083. number of samples in the current frame
  4084. @item pos
  4085. original frame position in the file
  4086. @item pts
  4087. frame PTS
  4088. @item sample_rate
  4089. sample rate
  4090. @item startpts
  4091. PTS at start of stream
  4092. @item startt
  4093. time at start of stream
  4094. @item t
  4095. frame time
  4096. @item tb
  4097. timestamp timebase
  4098. @item volume
  4099. last set volume value
  4100. @end table
  4101. Note that when @option{eval} is set to @samp{once} only the
  4102. @var{sample_rate} and @var{tb} variables are available, all other
  4103. variables will evaluate to NAN.
  4104. @subsection Commands
  4105. This filter supports the following commands:
  4106. @table @option
  4107. @item volume
  4108. Modify the volume expression.
  4109. The command accepts the same syntax of the corresponding option.
  4110. If the specified expression is not valid, it is kept at its current
  4111. value.
  4112. @item replaygain_noclip
  4113. Prevent clipping by limiting the gain applied.
  4114. Default value for @var{replaygain_noclip} is 1.
  4115. @end table
  4116. @subsection Examples
  4117. @itemize
  4118. @item
  4119. Halve the input audio volume:
  4120. @example
  4121. volume=volume=0.5
  4122. volume=volume=1/2
  4123. volume=volume=-6.0206dB
  4124. @end example
  4125. In all the above example the named key for @option{volume} can be
  4126. omitted, for example like in:
  4127. @example
  4128. volume=0.5
  4129. @end example
  4130. @item
  4131. Increase input audio power by 6 decibels using fixed-point precision:
  4132. @example
  4133. volume=volume=6dB:precision=fixed
  4134. @end example
  4135. @item
  4136. Fade volume after time 10 with an annihilation period of 5 seconds:
  4137. @example
  4138. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4139. @end example
  4140. @end itemize
  4141. @section volumedetect
  4142. Detect the volume of the input video.
  4143. The filter has no parameters. The input is not modified. Statistics about
  4144. the volume will be printed in the log when the input stream end is reached.
  4145. In particular it will show the mean volume (root mean square), maximum
  4146. volume (on a per-sample basis), and the beginning of a histogram of the
  4147. registered volume values (from the maximum value to a cumulated 1/1000 of
  4148. the samples).
  4149. All volumes are in decibels relative to the maximum PCM value.
  4150. @subsection Examples
  4151. Here is an excerpt of the output:
  4152. @example
  4153. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4154. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4155. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4156. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4157. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4158. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4159. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4160. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4161. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4162. @end example
  4163. It means that:
  4164. @itemize
  4165. @item
  4166. The mean square energy is approximately -27 dB, or 10^-2.7.
  4167. @item
  4168. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4169. @item
  4170. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4171. @end itemize
  4172. In other words, raising the volume by +4 dB does not cause any clipping,
  4173. raising it by +5 dB causes clipping for 6 samples, etc.
  4174. @c man end AUDIO FILTERS
  4175. @chapter Audio Sources
  4176. @c man begin AUDIO SOURCES
  4177. Below is a description of the currently available audio sources.
  4178. @section abuffer
  4179. Buffer audio frames, and make them available to the filter chain.
  4180. This source is mainly intended for a programmatic use, in particular
  4181. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4182. It accepts the following parameters:
  4183. @table @option
  4184. @item time_base
  4185. The timebase which will be used for timestamps of submitted frames. It must be
  4186. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4187. @item sample_rate
  4188. The sample rate of the incoming audio buffers.
  4189. @item sample_fmt
  4190. The sample format of the incoming audio buffers.
  4191. Either a sample format name or its corresponding integer representation from
  4192. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4193. @item channel_layout
  4194. The channel layout of the incoming audio buffers.
  4195. Either a channel layout name from channel_layout_map in
  4196. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4197. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4198. @item channels
  4199. The number of channels of the incoming audio buffers.
  4200. If both @var{channels} and @var{channel_layout} are specified, then they
  4201. must be consistent.
  4202. @end table
  4203. @subsection Examples
  4204. @example
  4205. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4206. @end example
  4207. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4208. Since the sample format with name "s16p" corresponds to the number
  4209. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4210. equivalent to:
  4211. @example
  4212. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4213. @end example
  4214. @section aevalsrc
  4215. Generate an audio signal specified by an expression.
  4216. This source accepts in input one or more expressions (one for each
  4217. channel), which are evaluated and used to generate a corresponding
  4218. audio signal.
  4219. This source accepts the following options:
  4220. @table @option
  4221. @item exprs
  4222. Set the '|'-separated expressions list for each separate channel. In case the
  4223. @option{channel_layout} option is not specified, the selected channel layout
  4224. depends on the number of provided expressions. Otherwise the last
  4225. specified expression is applied to the remaining output channels.
  4226. @item channel_layout, c
  4227. Set the channel layout. The number of channels in the specified layout
  4228. must be equal to the number of specified expressions.
  4229. @item duration, d
  4230. Set the minimum duration of the sourced audio. See
  4231. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4232. for the accepted syntax.
  4233. Note that the resulting duration may be greater than the specified
  4234. duration, as the generated audio is always cut at the end of a
  4235. complete frame.
  4236. If not specified, or the expressed duration is negative, the audio is
  4237. supposed to be generated forever.
  4238. @item nb_samples, n
  4239. Set the number of samples per channel per each output frame,
  4240. default to 1024.
  4241. @item sample_rate, s
  4242. Specify the sample rate, default to 44100.
  4243. @end table
  4244. Each expression in @var{exprs} can contain the following constants:
  4245. @table @option
  4246. @item n
  4247. number of the evaluated sample, starting from 0
  4248. @item t
  4249. time of the evaluated sample expressed in seconds, starting from 0
  4250. @item s
  4251. sample rate
  4252. @end table
  4253. @subsection Examples
  4254. @itemize
  4255. @item
  4256. Generate silence:
  4257. @example
  4258. aevalsrc=0
  4259. @end example
  4260. @item
  4261. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4262. 8000 Hz:
  4263. @example
  4264. aevalsrc="sin(440*2*PI*t):s=8000"
  4265. @end example
  4266. @item
  4267. Generate a two channels signal, specify the channel layout (Front
  4268. Center + Back Center) explicitly:
  4269. @example
  4270. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4271. @end example
  4272. @item
  4273. Generate white noise:
  4274. @example
  4275. aevalsrc="-2+random(0)"
  4276. @end example
  4277. @item
  4278. Generate an amplitude modulated signal:
  4279. @example
  4280. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4281. @end example
  4282. @item
  4283. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4284. @example
  4285. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4286. @end example
  4287. @end itemize
  4288. @section anullsrc
  4289. The null audio source, return unprocessed audio frames. It is mainly useful
  4290. as a template and to be employed in analysis / debugging tools, or as
  4291. the source for filters which ignore the input data (for example the sox
  4292. synth filter).
  4293. This source accepts the following options:
  4294. @table @option
  4295. @item channel_layout, cl
  4296. Specifies the channel layout, and can be either an integer or a string
  4297. representing a channel layout. The default value of @var{channel_layout}
  4298. is "stereo".
  4299. Check the channel_layout_map definition in
  4300. @file{libavutil/channel_layout.c} for the mapping between strings and
  4301. channel layout values.
  4302. @item sample_rate, r
  4303. Specifies the sample rate, and defaults to 44100.
  4304. @item nb_samples, n
  4305. Set the number of samples per requested frames.
  4306. @end table
  4307. @subsection Examples
  4308. @itemize
  4309. @item
  4310. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4311. @example
  4312. anullsrc=r=48000:cl=4
  4313. @end example
  4314. @item
  4315. Do the same operation with a more obvious syntax:
  4316. @example
  4317. anullsrc=r=48000:cl=mono
  4318. @end example
  4319. @end itemize
  4320. All the parameters need to be explicitly defined.
  4321. @section flite
  4322. Synthesize a voice utterance using the libflite library.
  4323. To enable compilation of this filter you need to configure FFmpeg with
  4324. @code{--enable-libflite}.
  4325. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4326. The filter accepts the following options:
  4327. @table @option
  4328. @item list_voices
  4329. If set to 1, list the names of the available voices and exit
  4330. immediately. Default value is 0.
  4331. @item nb_samples, n
  4332. Set the maximum number of samples per frame. Default value is 512.
  4333. @item textfile
  4334. Set the filename containing the text to speak.
  4335. @item text
  4336. Set the text to speak.
  4337. @item voice, v
  4338. Set the voice to use for the speech synthesis. Default value is
  4339. @code{kal}. See also the @var{list_voices} option.
  4340. @end table
  4341. @subsection Examples
  4342. @itemize
  4343. @item
  4344. Read from file @file{speech.txt}, and synthesize the text using the
  4345. standard flite voice:
  4346. @example
  4347. flite=textfile=speech.txt
  4348. @end example
  4349. @item
  4350. Read the specified text selecting the @code{slt} voice:
  4351. @example
  4352. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4353. @end example
  4354. @item
  4355. Input text to ffmpeg:
  4356. @example
  4357. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4358. @end example
  4359. @item
  4360. Make @file{ffplay} speak the specified text, using @code{flite} and
  4361. the @code{lavfi} device:
  4362. @example
  4363. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4364. @end example
  4365. @end itemize
  4366. For more information about libflite, check:
  4367. @url{http://www.festvox.org/flite/}
  4368. @section anoisesrc
  4369. Generate a noise audio signal.
  4370. The filter accepts the following options:
  4371. @table @option
  4372. @item sample_rate, r
  4373. Specify the sample rate. Default value is 48000 Hz.
  4374. @item amplitude, a
  4375. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4376. is 1.0.
  4377. @item duration, d
  4378. Specify the duration of the generated audio stream. Not specifying this option
  4379. results in noise with an infinite length.
  4380. @item color, colour, c
  4381. Specify the color of noise. Available noise colors are white, pink, brown,
  4382. blue and violet. Default color is white.
  4383. @item seed, s
  4384. Specify a value used to seed the PRNG.
  4385. @item nb_samples, n
  4386. Set the number of samples per each output frame, default is 1024.
  4387. @end table
  4388. @subsection Examples
  4389. @itemize
  4390. @item
  4391. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4392. @example
  4393. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4394. @end example
  4395. @end itemize
  4396. @section hilbert
  4397. Generate odd-tap Hilbert transform FIR coefficients.
  4398. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4399. the signal by 90 degrees.
  4400. This is used in many matrix coding schemes and for analytic signal generation.
  4401. The process is often written as a multiplication by i (or j), the imaginary unit.
  4402. The filter accepts the following options:
  4403. @table @option
  4404. @item sample_rate, s
  4405. Set sample rate, default is 44100.
  4406. @item taps, t
  4407. Set length of FIR filter, default is 22051.
  4408. @item nb_samples, n
  4409. Set number of samples per each frame.
  4410. @item win_func, w
  4411. Set window function to be used when generating FIR coefficients.
  4412. @end table
  4413. @section sinc
  4414. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4415. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item sample_rate, r
  4419. Set sample rate, default is 44100.
  4420. @item nb_samples, n
  4421. Set number of samples per each frame. Default is 1024.
  4422. @item hp
  4423. Set high-pass frequency. Default is 0.
  4424. @item lp
  4425. Set low-pass frequency. Default is 0.
  4426. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4427. is higher than 0 then filter will create band-pass filter coefficients,
  4428. otherwise band-reject filter coefficients.
  4429. @item phase
  4430. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4431. @item beta
  4432. Set Kaiser window beta.
  4433. @item att
  4434. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4435. @item round
  4436. Enable rounding, by default is disabled.
  4437. @item hptaps
  4438. Set number of taps for high-pass filter.
  4439. @item lptaps
  4440. Set number of taps for low-pass filter.
  4441. @end table
  4442. @section sine
  4443. Generate an audio signal made of a sine wave with amplitude 1/8.
  4444. The audio signal is bit-exact.
  4445. The filter accepts the following options:
  4446. @table @option
  4447. @item frequency, f
  4448. Set the carrier frequency. Default is 440 Hz.
  4449. @item beep_factor, b
  4450. Enable a periodic beep every second with frequency @var{beep_factor} times
  4451. the carrier frequency. Default is 0, meaning the beep is disabled.
  4452. @item sample_rate, r
  4453. Specify the sample rate, default is 44100.
  4454. @item duration, d
  4455. Specify the duration of the generated audio stream.
  4456. @item samples_per_frame
  4457. Set the number of samples per output frame.
  4458. The expression can contain the following constants:
  4459. @table @option
  4460. @item n
  4461. The (sequential) number of the output audio frame, starting from 0.
  4462. @item pts
  4463. The PTS (Presentation TimeStamp) of the output audio frame,
  4464. expressed in @var{TB} units.
  4465. @item t
  4466. The PTS of the output audio frame, expressed in seconds.
  4467. @item TB
  4468. The timebase of the output audio frames.
  4469. @end table
  4470. Default is @code{1024}.
  4471. @end table
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Generate a simple 440 Hz sine wave:
  4476. @example
  4477. sine
  4478. @end example
  4479. @item
  4480. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4481. @example
  4482. sine=220:4:d=5
  4483. sine=f=220:b=4:d=5
  4484. sine=frequency=220:beep_factor=4:duration=5
  4485. @end example
  4486. @item
  4487. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4488. pattern:
  4489. @example
  4490. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4491. @end example
  4492. @end itemize
  4493. @c man end AUDIO SOURCES
  4494. @chapter Audio Sinks
  4495. @c man begin AUDIO SINKS
  4496. Below is a description of the currently available audio sinks.
  4497. @section abuffersink
  4498. Buffer audio frames, and make them available to the end of filter chain.
  4499. This sink is mainly intended for programmatic use, in particular
  4500. through the interface defined in @file{libavfilter/buffersink.h}
  4501. or the options system.
  4502. It accepts a pointer to an AVABufferSinkContext structure, which
  4503. defines the incoming buffers' formats, to be passed as the opaque
  4504. parameter to @code{avfilter_init_filter} for initialization.
  4505. @section anullsink
  4506. Null audio sink; do absolutely nothing with the input audio. It is
  4507. mainly useful as a template and for use in analysis / debugging
  4508. tools.
  4509. @c man end AUDIO SINKS
  4510. @chapter Video Filters
  4511. @c man begin VIDEO FILTERS
  4512. When you configure your FFmpeg build, you can disable any of the
  4513. existing filters using @code{--disable-filters}.
  4514. The configure output will show the video filters included in your
  4515. build.
  4516. Below is a description of the currently available video filters.
  4517. @section alphaextract
  4518. Extract the alpha component from the input as a grayscale video. This
  4519. is especially useful with the @var{alphamerge} filter.
  4520. @section alphamerge
  4521. Add or replace the alpha component of the primary input with the
  4522. grayscale value of a second input. This is intended for use with
  4523. @var{alphaextract} to allow the transmission or storage of frame
  4524. sequences that have alpha in a format that doesn't support an alpha
  4525. channel.
  4526. For example, to reconstruct full frames from a normal YUV-encoded video
  4527. and a separate video created with @var{alphaextract}, you might use:
  4528. @example
  4529. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4530. @end example
  4531. Since this filter is designed for reconstruction, it operates on frame
  4532. sequences without considering timestamps, and terminates when either
  4533. input reaches end of stream. This will cause problems if your encoding
  4534. pipeline drops frames. If you're trying to apply an image as an
  4535. overlay to a video stream, consider the @var{overlay} filter instead.
  4536. @section amplify
  4537. Amplify differences between current pixel and pixels of adjacent frames in
  4538. same pixel location.
  4539. This filter accepts the following options:
  4540. @table @option
  4541. @item radius
  4542. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4543. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4544. @item factor
  4545. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4546. @item threshold
  4547. Set threshold for difference amplification. Any difference greater or equal to
  4548. this value will not alter source pixel. Default is 10.
  4549. Allowed range is from 0 to 65535.
  4550. @item tolerance
  4551. Set tolerance for difference amplification. Any difference lower to
  4552. this value will not alter source pixel. Default is 0.
  4553. Allowed range is from 0 to 65535.
  4554. @item low
  4555. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4556. This option controls maximum possible value that will decrease source pixel value.
  4557. @item high
  4558. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4559. This option controls maximum possible value that will increase source pixel value.
  4560. @item planes
  4561. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4562. @end table
  4563. @section ass
  4564. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4565. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4566. Substation Alpha) subtitles files.
  4567. This filter accepts the following option in addition to the common options from
  4568. the @ref{subtitles} filter:
  4569. @table @option
  4570. @item shaping
  4571. Set the shaping engine
  4572. Available values are:
  4573. @table @samp
  4574. @item auto
  4575. The default libass shaping engine, which is the best available.
  4576. @item simple
  4577. Fast, font-agnostic shaper that can do only substitutions
  4578. @item complex
  4579. Slower shaper using OpenType for substitutions and positioning
  4580. @end table
  4581. The default is @code{auto}.
  4582. @end table
  4583. @section atadenoise
  4584. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4585. The filter accepts the following options:
  4586. @table @option
  4587. @item 0a
  4588. Set threshold A for 1st plane. Default is 0.02.
  4589. Valid range is 0 to 0.3.
  4590. @item 0b
  4591. Set threshold B for 1st plane. Default is 0.04.
  4592. Valid range is 0 to 5.
  4593. @item 1a
  4594. Set threshold A for 2nd plane. Default is 0.02.
  4595. Valid range is 0 to 0.3.
  4596. @item 1b
  4597. Set threshold B for 2nd plane. Default is 0.04.
  4598. Valid range is 0 to 5.
  4599. @item 2a
  4600. Set threshold A for 3rd plane. Default is 0.02.
  4601. Valid range is 0 to 0.3.
  4602. @item 2b
  4603. Set threshold B for 3rd plane. Default is 0.04.
  4604. Valid range is 0 to 5.
  4605. Threshold A is designed to react on abrupt changes in the input signal and
  4606. threshold B is designed to react on continuous changes in the input signal.
  4607. @item s
  4608. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4609. number in range [5, 129].
  4610. @item p
  4611. Set what planes of frame filter will use for averaging. Default is all.
  4612. @end table
  4613. @section avgblur
  4614. Apply average blur filter.
  4615. The filter accepts the following options:
  4616. @table @option
  4617. @item sizeX
  4618. Set horizontal radius size.
  4619. @item planes
  4620. Set which planes to filter. By default all planes are filtered.
  4621. @item sizeY
  4622. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4623. Default is @code{0}.
  4624. @end table
  4625. @section bbox
  4626. Compute the bounding box for the non-black pixels in the input frame
  4627. luminance plane.
  4628. This filter computes the bounding box containing all the pixels with a
  4629. luminance value greater than the minimum allowed value.
  4630. The parameters describing the bounding box are printed on the filter
  4631. log.
  4632. The filter accepts the following option:
  4633. @table @option
  4634. @item min_val
  4635. Set the minimal luminance value. Default is @code{16}.
  4636. @end table
  4637. @section bitplanenoise
  4638. Show and measure bit plane noise.
  4639. The filter accepts the following options:
  4640. @table @option
  4641. @item bitplane
  4642. Set which plane to analyze. Default is @code{1}.
  4643. @item filter
  4644. Filter out noisy pixels from @code{bitplane} set above.
  4645. Default is disabled.
  4646. @end table
  4647. @section blackdetect
  4648. Detect video intervals that are (almost) completely black. Can be
  4649. useful to detect chapter transitions, commercials, or invalid
  4650. recordings. Output lines contains the time for the start, end and
  4651. duration of the detected black interval expressed in seconds.
  4652. In order to display the output lines, you need to set the loglevel at
  4653. least to the AV_LOG_INFO value.
  4654. The filter accepts the following options:
  4655. @table @option
  4656. @item black_min_duration, d
  4657. Set the minimum detected black duration expressed in seconds. It must
  4658. be a non-negative floating point number.
  4659. Default value is 2.0.
  4660. @item picture_black_ratio_th, pic_th
  4661. Set the threshold for considering a picture "black".
  4662. Express the minimum value for the ratio:
  4663. @example
  4664. @var{nb_black_pixels} / @var{nb_pixels}
  4665. @end example
  4666. for which a picture is considered black.
  4667. Default value is 0.98.
  4668. @item pixel_black_th, pix_th
  4669. Set the threshold for considering a pixel "black".
  4670. The threshold expresses the maximum pixel luminance value for which a
  4671. pixel is considered "black". The provided value is scaled according to
  4672. the following equation:
  4673. @example
  4674. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4675. @end example
  4676. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4677. the input video format, the range is [0-255] for YUV full-range
  4678. formats and [16-235] for YUV non full-range formats.
  4679. Default value is 0.10.
  4680. @end table
  4681. The following example sets the maximum pixel threshold to the minimum
  4682. value, and detects only black intervals of 2 or more seconds:
  4683. @example
  4684. blackdetect=d=2:pix_th=0.00
  4685. @end example
  4686. @section blackframe
  4687. Detect frames that are (almost) completely black. Can be useful to
  4688. detect chapter transitions or commercials. Output lines consist of
  4689. the frame number of the detected frame, the percentage of blackness,
  4690. the position in the file if known or -1 and the timestamp in seconds.
  4691. In order to display the output lines, you need to set the loglevel at
  4692. least to the AV_LOG_INFO value.
  4693. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4694. The value represents the percentage of pixels in the picture that
  4695. are below the threshold value.
  4696. It accepts the following parameters:
  4697. @table @option
  4698. @item amount
  4699. The percentage of the pixels that have to be below the threshold; it defaults to
  4700. @code{98}.
  4701. @item threshold, thresh
  4702. The threshold below which a pixel value is considered black; it defaults to
  4703. @code{32}.
  4704. @end table
  4705. @section blend, tblend
  4706. Blend two video frames into each other.
  4707. The @code{blend} filter takes two input streams and outputs one
  4708. stream, the first input is the "top" layer and second input is
  4709. "bottom" layer. By default, the output terminates when the longest input terminates.
  4710. The @code{tblend} (time blend) filter takes two consecutive frames
  4711. from one single stream, and outputs the result obtained by blending
  4712. the new frame on top of the old frame.
  4713. A description of the accepted options follows.
  4714. @table @option
  4715. @item c0_mode
  4716. @item c1_mode
  4717. @item c2_mode
  4718. @item c3_mode
  4719. @item all_mode
  4720. Set blend mode for specific pixel component or all pixel components in case
  4721. of @var{all_mode}. Default value is @code{normal}.
  4722. Available values for component modes are:
  4723. @table @samp
  4724. @item addition
  4725. @item grainmerge
  4726. @item and
  4727. @item average
  4728. @item burn
  4729. @item darken
  4730. @item difference
  4731. @item grainextract
  4732. @item divide
  4733. @item dodge
  4734. @item freeze
  4735. @item exclusion
  4736. @item extremity
  4737. @item glow
  4738. @item hardlight
  4739. @item hardmix
  4740. @item heat
  4741. @item lighten
  4742. @item linearlight
  4743. @item multiply
  4744. @item multiply128
  4745. @item negation
  4746. @item normal
  4747. @item or
  4748. @item overlay
  4749. @item phoenix
  4750. @item pinlight
  4751. @item reflect
  4752. @item screen
  4753. @item softlight
  4754. @item subtract
  4755. @item vividlight
  4756. @item xor
  4757. @end table
  4758. @item c0_opacity
  4759. @item c1_opacity
  4760. @item c2_opacity
  4761. @item c3_opacity
  4762. @item all_opacity
  4763. Set blend opacity for specific pixel component or all pixel components in case
  4764. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4765. @item c0_expr
  4766. @item c1_expr
  4767. @item c2_expr
  4768. @item c3_expr
  4769. @item all_expr
  4770. Set blend expression for specific pixel component or all pixel components in case
  4771. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4772. The expressions can use the following variables:
  4773. @table @option
  4774. @item N
  4775. The sequential number of the filtered frame, starting from @code{0}.
  4776. @item X
  4777. @item Y
  4778. the coordinates of the current sample
  4779. @item W
  4780. @item H
  4781. the width and height of currently filtered plane
  4782. @item SW
  4783. @item SH
  4784. Width and height scale for the plane being filtered. It is the
  4785. ratio between the dimensions of the current plane to the luma plane,
  4786. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4787. the luma plane and @code{0.5,0.5} for the chroma planes.
  4788. @item T
  4789. Time of the current frame, expressed in seconds.
  4790. @item TOP, A
  4791. Value of pixel component at current location for first video frame (top layer).
  4792. @item BOTTOM, B
  4793. Value of pixel component at current location for second video frame (bottom layer).
  4794. @end table
  4795. @end table
  4796. The @code{blend} filter also supports the @ref{framesync} options.
  4797. @subsection Examples
  4798. @itemize
  4799. @item
  4800. Apply transition from bottom layer to top layer in first 10 seconds:
  4801. @example
  4802. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4803. @end example
  4804. @item
  4805. Apply linear horizontal transition from top layer to bottom layer:
  4806. @example
  4807. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4808. @end example
  4809. @item
  4810. Apply 1x1 checkerboard effect:
  4811. @example
  4812. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4813. @end example
  4814. @item
  4815. Apply uncover left effect:
  4816. @example
  4817. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4818. @end example
  4819. @item
  4820. Apply uncover down effect:
  4821. @example
  4822. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4823. @end example
  4824. @item
  4825. Apply uncover up-left effect:
  4826. @example
  4827. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4828. @end example
  4829. @item
  4830. Split diagonally video and shows top and bottom layer on each side:
  4831. @example
  4832. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4833. @end example
  4834. @item
  4835. Display differences between the current and the previous frame:
  4836. @example
  4837. tblend=all_mode=grainextract
  4838. @end example
  4839. @end itemize
  4840. @section bm3d
  4841. Denoise frames using Block-Matching 3D algorithm.
  4842. The filter accepts the following options.
  4843. @table @option
  4844. @item sigma
  4845. Set denoising strength. Default value is 1.
  4846. Allowed range is from 0 to 999.9.
  4847. The denoising algorithm is very sensitive to sigma, so adjust it
  4848. according to the source.
  4849. @item block
  4850. Set local patch size. This sets dimensions in 2D.
  4851. @item bstep
  4852. Set sliding step for processing blocks. Default value is 4.
  4853. Allowed range is from 1 to 64.
  4854. Smaller values allows processing more reference blocks and is slower.
  4855. @item group
  4856. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4857. When set to 1, no block matching is done. Larger values allows more blocks
  4858. in single group.
  4859. Allowed range is from 1 to 256.
  4860. @item range
  4861. Set radius for search block matching. Default is 9.
  4862. Allowed range is from 1 to INT32_MAX.
  4863. @item mstep
  4864. Set step between two search locations for block matching. Default is 1.
  4865. Allowed range is from 1 to 64. Smaller is slower.
  4866. @item thmse
  4867. Set threshold of mean square error for block matching. Valid range is 0 to
  4868. INT32_MAX.
  4869. @item hdthr
  4870. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4871. Larger values results in stronger hard-thresholding filtering in frequency
  4872. domain.
  4873. @item estim
  4874. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4875. Default is @code{basic}.
  4876. @item ref
  4877. If enabled, filter will use 2nd stream for block matching.
  4878. Default is disabled for @code{basic} value of @var{estim} option,
  4879. and always enabled if value of @var{estim} is @code{final}.
  4880. @item planes
  4881. Set planes to filter. Default is all available except alpha.
  4882. @end table
  4883. @subsection Examples
  4884. @itemize
  4885. @item
  4886. Basic filtering with bm3d:
  4887. @example
  4888. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4889. @end example
  4890. @item
  4891. Same as above, but filtering only luma:
  4892. @example
  4893. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4894. @end example
  4895. @item
  4896. Same as above, but with both estimation modes:
  4897. @example
  4898. 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
  4899. @end example
  4900. @item
  4901. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4902. @example
  4903. 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
  4904. @end example
  4905. @end itemize
  4906. @section boxblur
  4907. Apply a boxblur algorithm to the input video.
  4908. It accepts the following parameters:
  4909. @table @option
  4910. @item luma_radius, lr
  4911. @item luma_power, lp
  4912. @item chroma_radius, cr
  4913. @item chroma_power, cp
  4914. @item alpha_radius, ar
  4915. @item alpha_power, ap
  4916. @end table
  4917. A description of the accepted options follows.
  4918. @table @option
  4919. @item luma_radius, lr
  4920. @item chroma_radius, cr
  4921. @item alpha_radius, ar
  4922. Set an expression for the box radius in pixels used for blurring the
  4923. corresponding input plane.
  4924. The radius value must be a non-negative number, and must not be
  4925. greater than the value of the expression @code{min(w,h)/2} for the
  4926. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4927. planes.
  4928. Default value for @option{luma_radius} is "2". If not specified,
  4929. @option{chroma_radius} and @option{alpha_radius} default to the
  4930. corresponding value set for @option{luma_radius}.
  4931. The expressions can contain the following constants:
  4932. @table @option
  4933. @item w
  4934. @item h
  4935. The input width and height in pixels.
  4936. @item cw
  4937. @item ch
  4938. The input chroma image width and height in pixels.
  4939. @item hsub
  4940. @item vsub
  4941. The horizontal and vertical chroma subsample values. For example, for the
  4942. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4943. @end table
  4944. @item luma_power, lp
  4945. @item chroma_power, cp
  4946. @item alpha_power, ap
  4947. Specify how many times the boxblur filter is applied to the
  4948. corresponding plane.
  4949. Default value for @option{luma_power} is 2. If not specified,
  4950. @option{chroma_power} and @option{alpha_power} default to the
  4951. corresponding value set for @option{luma_power}.
  4952. A value of 0 will disable the effect.
  4953. @end table
  4954. @subsection Examples
  4955. @itemize
  4956. @item
  4957. Apply a boxblur filter with the luma, chroma, and alpha radii
  4958. set to 2:
  4959. @example
  4960. boxblur=luma_radius=2:luma_power=1
  4961. boxblur=2:1
  4962. @end example
  4963. @item
  4964. Set the luma radius to 2, and alpha and chroma radius to 0:
  4965. @example
  4966. boxblur=2:1:cr=0:ar=0
  4967. @end example
  4968. @item
  4969. Set the luma and chroma radii to a fraction of the video dimension:
  4970. @example
  4971. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4972. @end example
  4973. @end itemize
  4974. @section bwdif
  4975. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4976. Deinterlacing Filter").
  4977. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4978. interpolation algorithms.
  4979. It accepts the following parameters:
  4980. @table @option
  4981. @item mode
  4982. The interlacing mode to adopt. It accepts one of the following values:
  4983. @table @option
  4984. @item 0, send_frame
  4985. Output one frame for each frame.
  4986. @item 1, send_field
  4987. Output one frame for each field.
  4988. @end table
  4989. The default value is @code{send_field}.
  4990. @item parity
  4991. The picture field parity assumed for the input interlaced video. It accepts one
  4992. of the following values:
  4993. @table @option
  4994. @item 0, tff
  4995. Assume the top field is first.
  4996. @item 1, bff
  4997. Assume the bottom field is first.
  4998. @item -1, auto
  4999. Enable automatic detection of field parity.
  5000. @end table
  5001. The default value is @code{auto}.
  5002. If the interlacing is unknown or the decoder does not export this information,
  5003. top field first will be assumed.
  5004. @item deint
  5005. Specify which frames to deinterlace. Accept one of the following
  5006. values:
  5007. @table @option
  5008. @item 0, all
  5009. Deinterlace all frames.
  5010. @item 1, interlaced
  5011. Only deinterlace frames marked as interlaced.
  5012. @end table
  5013. The default value is @code{all}.
  5014. @end table
  5015. @section chromahold
  5016. Remove all color information for all colors except for certain one.
  5017. The filter accepts the following options:
  5018. @table @option
  5019. @item color
  5020. The color which will not be replaced with neutral chroma.
  5021. @item similarity
  5022. Similarity percentage with the above color.
  5023. 0.01 matches only the exact key color, while 1.0 matches everything.
  5024. @item blend
  5025. Blend percentage.
  5026. 0.0 makes pixels either fully gray, or not gray at all.
  5027. Higher values result in more preserved color.
  5028. @item yuv
  5029. Signals that the color passed is already in YUV instead of RGB.
  5030. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5031. This can be used to pass exact YUV values as hexadecimal numbers.
  5032. @end table
  5033. @section chromakey
  5034. YUV colorspace color/chroma keying.
  5035. The filter accepts the following options:
  5036. @table @option
  5037. @item color
  5038. The color which will be replaced with transparency.
  5039. @item similarity
  5040. Similarity percentage with the key color.
  5041. 0.01 matches only the exact key color, while 1.0 matches everything.
  5042. @item blend
  5043. Blend percentage.
  5044. 0.0 makes pixels either fully transparent, or not transparent at all.
  5045. Higher values result in semi-transparent pixels, with a higher transparency
  5046. the more similar the pixels color is to the key color.
  5047. @item yuv
  5048. Signals that the color passed is already in YUV instead of RGB.
  5049. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5050. This can be used to pass exact YUV values as hexadecimal numbers.
  5051. @end table
  5052. @subsection Examples
  5053. @itemize
  5054. @item
  5055. Make every green pixel in the input image transparent:
  5056. @example
  5057. ffmpeg -i input.png -vf chromakey=green out.png
  5058. @end example
  5059. @item
  5060. Overlay a greenscreen-video on top of a static black background.
  5061. @example
  5062. 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
  5063. @end example
  5064. @end itemize
  5065. @section chromashift
  5066. Shift chroma pixels horizontally and/or vertically.
  5067. The filter accepts the following options:
  5068. @table @option
  5069. @item cbh
  5070. Set amount to shift chroma-blue horizontally.
  5071. @item cbv
  5072. Set amount to shift chroma-blue vertically.
  5073. @item crh
  5074. Set amount to shift chroma-red horizontally.
  5075. @item crv
  5076. Set amount to shift chroma-red vertically.
  5077. @item edge
  5078. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5079. @end table
  5080. @section ciescope
  5081. Display CIE color diagram with pixels overlaid onto it.
  5082. The filter accepts the following options:
  5083. @table @option
  5084. @item system
  5085. Set color system.
  5086. @table @samp
  5087. @item ntsc, 470m
  5088. @item ebu, 470bg
  5089. @item smpte
  5090. @item 240m
  5091. @item apple
  5092. @item widergb
  5093. @item cie1931
  5094. @item rec709, hdtv
  5095. @item uhdtv, rec2020
  5096. @end table
  5097. @item cie
  5098. Set CIE system.
  5099. @table @samp
  5100. @item xyy
  5101. @item ucs
  5102. @item luv
  5103. @end table
  5104. @item gamuts
  5105. Set what gamuts to draw.
  5106. See @code{system} option for available values.
  5107. @item size, s
  5108. Set ciescope size, by default set to 512.
  5109. @item intensity, i
  5110. Set intensity used to map input pixel values to CIE diagram.
  5111. @item contrast
  5112. Set contrast used to draw tongue colors that are out of active color system gamut.
  5113. @item corrgamma
  5114. Correct gamma displayed on scope, by default enabled.
  5115. @item showwhite
  5116. Show white point on CIE diagram, by default disabled.
  5117. @item gamma
  5118. Set input gamma. Used only with XYZ input color space.
  5119. @end table
  5120. @section codecview
  5121. Visualize information exported by some codecs.
  5122. Some codecs can export information through frames using side-data or other
  5123. means. For example, some MPEG based codecs export motion vectors through the
  5124. @var{export_mvs} flag in the codec @option{flags2} option.
  5125. The filter accepts the following option:
  5126. @table @option
  5127. @item mv
  5128. Set motion vectors to visualize.
  5129. Available flags for @var{mv} are:
  5130. @table @samp
  5131. @item pf
  5132. forward predicted MVs of P-frames
  5133. @item bf
  5134. forward predicted MVs of B-frames
  5135. @item bb
  5136. backward predicted MVs of B-frames
  5137. @end table
  5138. @item qp
  5139. Display quantization parameters using the chroma planes.
  5140. @item mv_type, mvt
  5141. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5142. Available flags for @var{mv_type} are:
  5143. @table @samp
  5144. @item fp
  5145. forward predicted MVs
  5146. @item bp
  5147. backward predicted MVs
  5148. @end table
  5149. @item frame_type, ft
  5150. Set frame type to visualize motion vectors of.
  5151. Available flags for @var{frame_type} are:
  5152. @table @samp
  5153. @item if
  5154. intra-coded frames (I-frames)
  5155. @item pf
  5156. predicted frames (P-frames)
  5157. @item bf
  5158. bi-directionally predicted frames (B-frames)
  5159. @end table
  5160. @end table
  5161. @subsection Examples
  5162. @itemize
  5163. @item
  5164. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5165. @example
  5166. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5167. @end example
  5168. @item
  5169. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5170. @example
  5171. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5172. @end example
  5173. @end itemize
  5174. @section colorbalance
  5175. Modify intensity of primary colors (red, green and blue) of input frames.
  5176. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5177. regions for the red-cyan, green-magenta or blue-yellow balance.
  5178. A positive adjustment value shifts the balance towards the primary color, a negative
  5179. value towards the complementary color.
  5180. The filter accepts the following options:
  5181. @table @option
  5182. @item rs
  5183. @item gs
  5184. @item bs
  5185. Adjust red, green and blue shadows (darkest pixels).
  5186. @item rm
  5187. @item gm
  5188. @item bm
  5189. Adjust red, green and blue midtones (medium pixels).
  5190. @item rh
  5191. @item gh
  5192. @item bh
  5193. Adjust red, green and blue highlights (brightest pixels).
  5194. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5195. @end table
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Add red color cast to shadows:
  5200. @example
  5201. colorbalance=rs=.3
  5202. @end example
  5203. @end itemize
  5204. @section colorkey
  5205. RGB colorspace color keying.
  5206. The filter accepts the following options:
  5207. @table @option
  5208. @item color
  5209. The color which will be replaced with transparency.
  5210. @item similarity
  5211. Similarity percentage with the key color.
  5212. 0.01 matches only the exact key color, while 1.0 matches everything.
  5213. @item blend
  5214. Blend percentage.
  5215. 0.0 makes pixels either fully transparent, or not transparent at all.
  5216. Higher values result in semi-transparent pixels, with a higher transparency
  5217. the more similar the pixels color is to the key color.
  5218. @end table
  5219. @subsection Examples
  5220. @itemize
  5221. @item
  5222. Make every green pixel in the input image transparent:
  5223. @example
  5224. ffmpeg -i input.png -vf colorkey=green out.png
  5225. @end example
  5226. @item
  5227. Overlay a greenscreen-video on top of a static background image.
  5228. @example
  5229. 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
  5230. @end example
  5231. @end itemize
  5232. @section colorhold
  5233. Remove all color information for all RGB colors except for certain one.
  5234. The filter accepts the following options:
  5235. @table @option
  5236. @item color
  5237. The color which will not be replaced with neutral gray.
  5238. @item similarity
  5239. Similarity percentage with the above color.
  5240. 0.01 matches only the exact key color, while 1.0 matches everything.
  5241. @item blend
  5242. Blend percentage. 0.0 makes pixels fully gray.
  5243. Higher values result in more preserved color.
  5244. @end table
  5245. @section colorlevels
  5246. Adjust video input frames using levels.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item rimin
  5250. @item gimin
  5251. @item bimin
  5252. @item aimin
  5253. Adjust red, green, blue and alpha input black point.
  5254. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5255. @item rimax
  5256. @item gimax
  5257. @item bimax
  5258. @item aimax
  5259. Adjust red, green, blue and alpha input white point.
  5260. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5261. Input levels are used to lighten highlights (bright tones), darken shadows
  5262. (dark tones), change the balance of bright and dark tones.
  5263. @item romin
  5264. @item gomin
  5265. @item bomin
  5266. @item aomin
  5267. Adjust red, green, blue and alpha output black point.
  5268. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5269. @item romax
  5270. @item gomax
  5271. @item bomax
  5272. @item aomax
  5273. Adjust red, green, blue and alpha output white point.
  5274. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5275. Output levels allows manual selection of a constrained output level range.
  5276. @end table
  5277. @subsection Examples
  5278. @itemize
  5279. @item
  5280. Make video output darker:
  5281. @example
  5282. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5283. @end example
  5284. @item
  5285. Increase contrast:
  5286. @example
  5287. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5288. @end example
  5289. @item
  5290. Make video output lighter:
  5291. @example
  5292. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5293. @end example
  5294. @item
  5295. Increase brightness:
  5296. @example
  5297. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5298. @end example
  5299. @end itemize
  5300. @section colorchannelmixer
  5301. Adjust video input frames by re-mixing color channels.
  5302. This filter modifies a color channel by adding the values associated to
  5303. the other channels of the same pixels. For example if the value to
  5304. modify is red, the output value will be:
  5305. @example
  5306. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5307. @end example
  5308. The filter accepts the following options:
  5309. @table @option
  5310. @item rr
  5311. @item rg
  5312. @item rb
  5313. @item ra
  5314. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5315. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5316. @item gr
  5317. @item gg
  5318. @item gb
  5319. @item ga
  5320. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5321. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5322. @item br
  5323. @item bg
  5324. @item bb
  5325. @item ba
  5326. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5327. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5328. @item ar
  5329. @item ag
  5330. @item ab
  5331. @item aa
  5332. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5333. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5334. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5335. @end table
  5336. @subsection Examples
  5337. @itemize
  5338. @item
  5339. Convert source to grayscale:
  5340. @example
  5341. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5342. @end example
  5343. @item
  5344. Simulate sepia tones:
  5345. @example
  5346. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5347. @end example
  5348. @end itemize
  5349. @section colormatrix
  5350. Convert color matrix.
  5351. The filter accepts the following options:
  5352. @table @option
  5353. @item src
  5354. @item dst
  5355. Specify the source and destination color matrix. Both values must be
  5356. specified.
  5357. The accepted values are:
  5358. @table @samp
  5359. @item bt709
  5360. BT.709
  5361. @item fcc
  5362. FCC
  5363. @item bt601
  5364. BT.601
  5365. @item bt470
  5366. BT.470
  5367. @item bt470bg
  5368. BT.470BG
  5369. @item smpte170m
  5370. SMPTE-170M
  5371. @item smpte240m
  5372. SMPTE-240M
  5373. @item bt2020
  5374. BT.2020
  5375. @end table
  5376. @end table
  5377. For example to convert from BT.601 to SMPTE-240M, use the command:
  5378. @example
  5379. colormatrix=bt601:smpte240m
  5380. @end example
  5381. @section colorspace
  5382. Convert colorspace, transfer characteristics or color primaries.
  5383. Input video needs to have an even size.
  5384. The filter accepts the following options:
  5385. @table @option
  5386. @anchor{all}
  5387. @item all
  5388. Specify all color properties at once.
  5389. The accepted values are:
  5390. @table @samp
  5391. @item bt470m
  5392. BT.470M
  5393. @item bt470bg
  5394. BT.470BG
  5395. @item bt601-6-525
  5396. BT.601-6 525
  5397. @item bt601-6-625
  5398. BT.601-6 625
  5399. @item bt709
  5400. BT.709
  5401. @item smpte170m
  5402. SMPTE-170M
  5403. @item smpte240m
  5404. SMPTE-240M
  5405. @item bt2020
  5406. BT.2020
  5407. @end table
  5408. @anchor{space}
  5409. @item space
  5410. Specify output colorspace.
  5411. The accepted values are:
  5412. @table @samp
  5413. @item bt709
  5414. BT.709
  5415. @item fcc
  5416. FCC
  5417. @item bt470bg
  5418. BT.470BG or BT.601-6 625
  5419. @item smpte170m
  5420. SMPTE-170M or BT.601-6 525
  5421. @item smpte240m
  5422. SMPTE-240M
  5423. @item ycgco
  5424. YCgCo
  5425. @item bt2020ncl
  5426. BT.2020 with non-constant luminance
  5427. @end table
  5428. @anchor{trc}
  5429. @item trc
  5430. Specify output transfer characteristics.
  5431. The accepted values are:
  5432. @table @samp
  5433. @item bt709
  5434. BT.709
  5435. @item bt470m
  5436. BT.470M
  5437. @item bt470bg
  5438. BT.470BG
  5439. @item gamma22
  5440. Constant gamma of 2.2
  5441. @item gamma28
  5442. Constant gamma of 2.8
  5443. @item smpte170m
  5444. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5445. @item smpte240m
  5446. SMPTE-240M
  5447. @item srgb
  5448. SRGB
  5449. @item iec61966-2-1
  5450. iec61966-2-1
  5451. @item iec61966-2-4
  5452. iec61966-2-4
  5453. @item xvycc
  5454. xvycc
  5455. @item bt2020-10
  5456. BT.2020 for 10-bits content
  5457. @item bt2020-12
  5458. BT.2020 for 12-bits content
  5459. @end table
  5460. @anchor{primaries}
  5461. @item primaries
  5462. Specify output color primaries.
  5463. The accepted values are:
  5464. @table @samp
  5465. @item bt709
  5466. BT.709
  5467. @item bt470m
  5468. BT.470M
  5469. @item bt470bg
  5470. BT.470BG or BT.601-6 625
  5471. @item smpte170m
  5472. SMPTE-170M or BT.601-6 525
  5473. @item smpte240m
  5474. SMPTE-240M
  5475. @item film
  5476. film
  5477. @item smpte431
  5478. SMPTE-431
  5479. @item smpte432
  5480. SMPTE-432
  5481. @item bt2020
  5482. BT.2020
  5483. @item jedec-p22
  5484. JEDEC P22 phosphors
  5485. @end table
  5486. @anchor{range}
  5487. @item range
  5488. Specify output color range.
  5489. The accepted values are:
  5490. @table @samp
  5491. @item tv
  5492. TV (restricted) range
  5493. @item mpeg
  5494. MPEG (restricted) range
  5495. @item pc
  5496. PC (full) range
  5497. @item jpeg
  5498. JPEG (full) range
  5499. @end table
  5500. @item format
  5501. Specify output color format.
  5502. The accepted values are:
  5503. @table @samp
  5504. @item yuv420p
  5505. YUV 4:2:0 planar 8-bits
  5506. @item yuv420p10
  5507. YUV 4:2:0 planar 10-bits
  5508. @item yuv420p12
  5509. YUV 4:2:0 planar 12-bits
  5510. @item yuv422p
  5511. YUV 4:2:2 planar 8-bits
  5512. @item yuv422p10
  5513. YUV 4:2:2 planar 10-bits
  5514. @item yuv422p12
  5515. YUV 4:2:2 planar 12-bits
  5516. @item yuv444p
  5517. YUV 4:4:4 planar 8-bits
  5518. @item yuv444p10
  5519. YUV 4:4:4 planar 10-bits
  5520. @item yuv444p12
  5521. YUV 4:4:4 planar 12-bits
  5522. @end table
  5523. @item fast
  5524. Do a fast conversion, which skips gamma/primary correction. This will take
  5525. significantly less CPU, but will be mathematically incorrect. To get output
  5526. compatible with that produced by the colormatrix filter, use fast=1.
  5527. @item dither
  5528. Specify dithering mode.
  5529. The accepted values are:
  5530. @table @samp
  5531. @item none
  5532. No dithering
  5533. @item fsb
  5534. Floyd-Steinberg dithering
  5535. @end table
  5536. @item wpadapt
  5537. Whitepoint adaptation mode.
  5538. The accepted values are:
  5539. @table @samp
  5540. @item bradford
  5541. Bradford whitepoint adaptation
  5542. @item vonkries
  5543. von Kries whitepoint adaptation
  5544. @item identity
  5545. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5546. @end table
  5547. @item iall
  5548. Override all input properties at once. Same accepted values as @ref{all}.
  5549. @item ispace
  5550. Override input colorspace. Same accepted values as @ref{space}.
  5551. @item iprimaries
  5552. Override input color primaries. Same accepted values as @ref{primaries}.
  5553. @item itrc
  5554. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5555. @item irange
  5556. Override input color range. Same accepted values as @ref{range}.
  5557. @end table
  5558. The filter converts the transfer characteristics, color space and color
  5559. primaries to the specified user values. The output value, if not specified,
  5560. is set to a default value based on the "all" property. If that property is
  5561. also not specified, the filter will log an error. The output color range and
  5562. format default to the same value as the input color range and format. The
  5563. input transfer characteristics, color space, color primaries and color range
  5564. should be set on the input data. If any of these are missing, the filter will
  5565. log an error and no conversion will take place.
  5566. For example to convert the input to SMPTE-240M, use the command:
  5567. @example
  5568. colorspace=smpte240m
  5569. @end example
  5570. @section convolution
  5571. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5572. The filter accepts the following options:
  5573. @table @option
  5574. @item 0m
  5575. @item 1m
  5576. @item 2m
  5577. @item 3m
  5578. Set matrix for each plane.
  5579. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5580. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5581. @item 0rdiv
  5582. @item 1rdiv
  5583. @item 2rdiv
  5584. @item 3rdiv
  5585. Set multiplier for calculated value for each plane.
  5586. If unset or 0, it will be sum of all matrix elements.
  5587. @item 0bias
  5588. @item 1bias
  5589. @item 2bias
  5590. @item 3bias
  5591. Set bias for each plane. This value is added to the result of the multiplication.
  5592. Useful for making the overall image brighter or darker. Default is 0.0.
  5593. @item 0mode
  5594. @item 1mode
  5595. @item 2mode
  5596. @item 3mode
  5597. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5598. Default is @var{square}.
  5599. @end table
  5600. @subsection Examples
  5601. @itemize
  5602. @item
  5603. Apply sharpen:
  5604. @example
  5605. 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"
  5606. @end example
  5607. @item
  5608. Apply blur:
  5609. @example
  5610. 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"
  5611. @end example
  5612. @item
  5613. Apply edge enhance:
  5614. @example
  5615. 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"
  5616. @end example
  5617. @item
  5618. Apply edge detect:
  5619. @example
  5620. 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"
  5621. @end example
  5622. @item
  5623. Apply laplacian edge detector which includes diagonals:
  5624. @example
  5625. 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"
  5626. @end example
  5627. @item
  5628. Apply emboss:
  5629. @example
  5630. 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"
  5631. @end example
  5632. @end itemize
  5633. @section convolve
  5634. Apply 2D convolution of video stream in frequency domain using second stream
  5635. as impulse.
  5636. The filter accepts the following options:
  5637. @table @option
  5638. @item planes
  5639. Set which planes to process.
  5640. @item impulse
  5641. Set which impulse video frames will be processed, can be @var{first}
  5642. or @var{all}. Default is @var{all}.
  5643. @end table
  5644. The @code{convolve} filter also supports the @ref{framesync} options.
  5645. @section copy
  5646. Copy the input video source unchanged to the output. This is mainly useful for
  5647. testing purposes.
  5648. @anchor{coreimage}
  5649. @section coreimage
  5650. Video filtering on GPU using Apple's CoreImage API on OSX.
  5651. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5652. processed by video hardware. However, software-based OpenGL implementations
  5653. exist which means there is no guarantee for hardware processing. It depends on
  5654. the respective OSX.
  5655. There are many filters and image generators provided by Apple that come with a
  5656. large variety of options. The filter has to be referenced by its name along
  5657. with its options.
  5658. The coreimage filter accepts the following options:
  5659. @table @option
  5660. @item list_filters
  5661. List all available filters and generators along with all their respective
  5662. options as well as possible minimum and maximum values along with the default
  5663. values.
  5664. @example
  5665. list_filters=true
  5666. @end example
  5667. @item filter
  5668. Specify all filters by their respective name and options.
  5669. Use @var{list_filters} to determine all valid filter names and options.
  5670. Numerical options are specified by a float value and are automatically clamped
  5671. to their respective value range. Vector and color options have to be specified
  5672. by a list of space separated float values. Character escaping has to be done.
  5673. A special option name @code{default} is available to use default options for a
  5674. filter.
  5675. It is required to specify either @code{default} or at least one of the filter options.
  5676. All omitted options are used with their default values.
  5677. The syntax of the filter string is as follows:
  5678. @example
  5679. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5680. @end example
  5681. @item output_rect
  5682. Specify a rectangle where the output of the filter chain is copied into the
  5683. input image. It is given by a list of space separated float values:
  5684. @example
  5685. output_rect=x\ y\ width\ height
  5686. @end example
  5687. If not given, the output rectangle equals the dimensions of the input image.
  5688. The output rectangle is automatically cropped at the borders of the input
  5689. image. Negative values are valid for each component.
  5690. @example
  5691. output_rect=25\ 25\ 100\ 100
  5692. @end example
  5693. @end table
  5694. Several filters can be chained for successive processing without GPU-HOST
  5695. transfers allowing for fast processing of complex filter chains.
  5696. Currently, only filters with zero (generators) or exactly one (filters) input
  5697. image and one output image are supported. Also, transition filters are not yet
  5698. usable as intended.
  5699. Some filters generate output images with additional padding depending on the
  5700. respective filter kernel. The padding is automatically removed to ensure the
  5701. filter output has the same size as the input image.
  5702. For image generators, the size of the output image is determined by the
  5703. previous output image of the filter chain or the input image of the whole
  5704. filterchain, respectively. The generators do not use the pixel information of
  5705. this image to generate their output. However, the generated output is
  5706. blended onto this image, resulting in partial or complete coverage of the
  5707. output image.
  5708. The @ref{coreimagesrc} video source can be used for generating input images
  5709. which are directly fed into the filter chain. By using it, providing input
  5710. images by another video source or an input video is not required.
  5711. @subsection Examples
  5712. @itemize
  5713. @item
  5714. List all filters available:
  5715. @example
  5716. coreimage=list_filters=true
  5717. @end example
  5718. @item
  5719. Use the CIBoxBlur filter with default options to blur an image:
  5720. @example
  5721. coreimage=filter=CIBoxBlur@@default
  5722. @end example
  5723. @item
  5724. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5725. its center at 100x100 and a radius of 50 pixels:
  5726. @example
  5727. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5728. @end example
  5729. @item
  5730. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5731. given as complete and escaped command-line for Apple's standard bash shell:
  5732. @example
  5733. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5734. @end example
  5735. @end itemize
  5736. @section crop
  5737. Crop the input video to given dimensions.
  5738. It accepts the following parameters:
  5739. @table @option
  5740. @item w, out_w
  5741. The width of the output video. It defaults to @code{iw}.
  5742. This expression is evaluated only once during the filter
  5743. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5744. @item h, out_h
  5745. The height of the output video. It defaults to @code{ih}.
  5746. This expression is evaluated only once during the filter
  5747. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5748. @item x
  5749. The horizontal position, in the input video, of the left edge of the output
  5750. video. It defaults to @code{(in_w-out_w)/2}.
  5751. This expression is evaluated per-frame.
  5752. @item y
  5753. The vertical position, in the input video, of the top edge of the output video.
  5754. It defaults to @code{(in_h-out_h)/2}.
  5755. This expression is evaluated per-frame.
  5756. @item keep_aspect
  5757. If set to 1 will force the output display aspect ratio
  5758. to be the same of the input, by changing the output sample aspect
  5759. ratio. It defaults to 0.
  5760. @item exact
  5761. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5762. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5763. It defaults to 0.
  5764. @end table
  5765. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5766. expressions containing the following constants:
  5767. @table @option
  5768. @item x
  5769. @item y
  5770. The computed values for @var{x} and @var{y}. They are evaluated for
  5771. each new frame.
  5772. @item in_w
  5773. @item in_h
  5774. The input width and height.
  5775. @item iw
  5776. @item ih
  5777. These are the same as @var{in_w} and @var{in_h}.
  5778. @item out_w
  5779. @item out_h
  5780. The output (cropped) width and height.
  5781. @item ow
  5782. @item oh
  5783. These are the same as @var{out_w} and @var{out_h}.
  5784. @item a
  5785. same as @var{iw} / @var{ih}
  5786. @item sar
  5787. input sample aspect ratio
  5788. @item dar
  5789. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5790. @item hsub
  5791. @item vsub
  5792. horizontal and vertical chroma subsample values. For example for the
  5793. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5794. @item n
  5795. The number of the input frame, starting from 0.
  5796. @item pos
  5797. the position in the file of the input frame, NAN if unknown
  5798. @item t
  5799. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5800. @end table
  5801. The expression for @var{out_w} may depend on the value of @var{out_h},
  5802. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5803. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5804. evaluated after @var{out_w} and @var{out_h}.
  5805. The @var{x} and @var{y} parameters specify the expressions for the
  5806. position of the top-left corner of the output (non-cropped) area. They
  5807. are evaluated for each frame. If the evaluated value is not valid, it
  5808. is approximated to the nearest valid value.
  5809. The expression for @var{x} may depend on @var{y}, and the expression
  5810. for @var{y} may depend on @var{x}.
  5811. @subsection Examples
  5812. @itemize
  5813. @item
  5814. Crop area with size 100x100 at position (12,34).
  5815. @example
  5816. crop=100:100:12:34
  5817. @end example
  5818. Using named options, the example above becomes:
  5819. @example
  5820. crop=w=100:h=100:x=12:y=34
  5821. @end example
  5822. @item
  5823. Crop the central input area with size 100x100:
  5824. @example
  5825. crop=100:100
  5826. @end example
  5827. @item
  5828. Crop the central input area with size 2/3 of the input video:
  5829. @example
  5830. crop=2/3*in_w:2/3*in_h
  5831. @end example
  5832. @item
  5833. Crop the input video central square:
  5834. @example
  5835. crop=out_w=in_h
  5836. crop=in_h
  5837. @end example
  5838. @item
  5839. Delimit the rectangle with the top-left corner placed at position
  5840. 100:100 and the right-bottom corner corresponding to the right-bottom
  5841. corner of the input image.
  5842. @example
  5843. crop=in_w-100:in_h-100:100:100
  5844. @end example
  5845. @item
  5846. Crop 10 pixels from the left and right borders, and 20 pixels from
  5847. the top and bottom borders
  5848. @example
  5849. crop=in_w-2*10:in_h-2*20
  5850. @end example
  5851. @item
  5852. Keep only the bottom right quarter of the input image:
  5853. @example
  5854. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5855. @end example
  5856. @item
  5857. Crop height for getting Greek harmony:
  5858. @example
  5859. crop=in_w:1/PHI*in_w
  5860. @end example
  5861. @item
  5862. Apply trembling effect:
  5863. @example
  5864. 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)
  5865. @end example
  5866. @item
  5867. Apply erratic camera effect depending on timestamp:
  5868. @example
  5869. 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)"
  5870. @end example
  5871. @item
  5872. Set x depending on the value of y:
  5873. @example
  5874. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5875. @end example
  5876. @end itemize
  5877. @subsection Commands
  5878. This filter supports the following commands:
  5879. @table @option
  5880. @item w, out_w
  5881. @item h, out_h
  5882. @item x
  5883. @item y
  5884. Set width/height of the output video and the horizontal/vertical position
  5885. in the input video.
  5886. The command accepts the same syntax of the corresponding option.
  5887. If the specified expression is not valid, it is kept at its current
  5888. value.
  5889. @end table
  5890. @section cropdetect
  5891. Auto-detect the crop size.
  5892. It calculates the necessary cropping parameters and prints the
  5893. recommended parameters via the logging system. The detected dimensions
  5894. correspond to the non-black area of the input video.
  5895. It accepts the following parameters:
  5896. @table @option
  5897. @item limit
  5898. Set higher black value threshold, which can be optionally specified
  5899. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5900. value greater to the set value is considered non-black. It defaults to 24.
  5901. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5902. on the bitdepth of the pixel format.
  5903. @item round
  5904. The value which the width/height should be divisible by. It defaults to
  5905. 16. The offset is automatically adjusted to center the video. Use 2 to
  5906. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5907. encoding to most video codecs.
  5908. @item reset_count, reset
  5909. Set the counter that determines after how many frames cropdetect will
  5910. reset the previously detected largest video area and start over to
  5911. detect the current optimal crop area. Default value is 0.
  5912. This can be useful when channel logos distort the video area. 0
  5913. indicates 'never reset', and returns the largest area encountered during
  5914. playback.
  5915. @end table
  5916. @anchor{cue}
  5917. @section cue
  5918. Delay video filtering until a given wallclock timestamp. The filter first
  5919. passes on @option{preroll} amount of frames, then it buffers at most
  5920. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5921. it forwards the buffered frames and also any subsequent frames coming in its
  5922. input.
  5923. The filter can be used synchronize the output of multiple ffmpeg processes for
  5924. realtime output devices like decklink. By putting the delay in the filtering
  5925. chain and pre-buffering frames the process can pass on data to output almost
  5926. immediately after the target wallclock timestamp is reached.
  5927. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5928. some use cases.
  5929. @table @option
  5930. @item cue
  5931. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5932. @item preroll
  5933. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5934. @item buffer
  5935. The maximum duration of content to buffer before waiting for the cue expressed
  5936. in seconds. Default is 0.
  5937. @end table
  5938. @anchor{curves}
  5939. @section curves
  5940. Apply color adjustments using curves.
  5941. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5942. component (red, green and blue) has its values defined by @var{N} key points
  5943. tied from each other using a smooth curve. The x-axis represents the pixel
  5944. values from the input frame, and the y-axis the new pixel values to be set for
  5945. the output frame.
  5946. By default, a component curve is defined by the two points @var{(0;0)} and
  5947. @var{(1;1)}. This creates a straight line where each original pixel value is
  5948. "adjusted" to its own value, which means no change to the image.
  5949. The filter allows you to redefine these two points and add some more. A new
  5950. curve (using a natural cubic spline interpolation) will be define to pass
  5951. smoothly through all these new coordinates. The new defined points needs to be
  5952. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5953. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5954. the vector spaces, the values will be clipped accordingly.
  5955. The filter accepts the following options:
  5956. @table @option
  5957. @item preset
  5958. Select one of the available color presets. This option can be used in addition
  5959. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5960. options takes priority on the preset values.
  5961. Available presets are:
  5962. @table @samp
  5963. @item none
  5964. @item color_negative
  5965. @item cross_process
  5966. @item darker
  5967. @item increase_contrast
  5968. @item lighter
  5969. @item linear_contrast
  5970. @item medium_contrast
  5971. @item negative
  5972. @item strong_contrast
  5973. @item vintage
  5974. @end table
  5975. Default is @code{none}.
  5976. @item master, m
  5977. Set the master key points. These points will define a second pass mapping. It
  5978. is sometimes called a "luminance" or "value" mapping. It can be used with
  5979. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5980. post-processing LUT.
  5981. @item red, r
  5982. Set the key points for the red component.
  5983. @item green, g
  5984. Set the key points for the green component.
  5985. @item blue, b
  5986. Set the key points for the blue component.
  5987. @item all
  5988. Set the key points for all components (not including master).
  5989. Can be used in addition to the other key points component
  5990. options. In this case, the unset component(s) will fallback on this
  5991. @option{all} setting.
  5992. @item psfile
  5993. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5994. @item plot
  5995. Save Gnuplot script of the curves in specified file.
  5996. @end table
  5997. To avoid some filtergraph syntax conflicts, each key points list need to be
  5998. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5999. @subsection Examples
  6000. @itemize
  6001. @item
  6002. Increase slightly the middle level of blue:
  6003. @example
  6004. curves=blue='0/0 0.5/0.58 1/1'
  6005. @end example
  6006. @item
  6007. Vintage effect:
  6008. @example
  6009. 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'
  6010. @end example
  6011. Here we obtain the following coordinates for each components:
  6012. @table @var
  6013. @item red
  6014. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6015. @item green
  6016. @code{(0;0) (0.50;0.48) (1;1)}
  6017. @item blue
  6018. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6019. @end table
  6020. @item
  6021. The previous example can also be achieved with the associated built-in preset:
  6022. @example
  6023. curves=preset=vintage
  6024. @end example
  6025. @item
  6026. Or simply:
  6027. @example
  6028. curves=vintage
  6029. @end example
  6030. @item
  6031. Use a Photoshop preset and redefine the points of the green component:
  6032. @example
  6033. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6034. @end example
  6035. @item
  6036. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6037. and @command{gnuplot}:
  6038. @example
  6039. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6040. gnuplot -p /tmp/curves.plt
  6041. @end example
  6042. @end itemize
  6043. @section datascope
  6044. Video data analysis filter.
  6045. This filter shows hexadecimal pixel values of part of video.
  6046. The filter accepts the following options:
  6047. @table @option
  6048. @item size, s
  6049. Set output video size.
  6050. @item x
  6051. Set x offset from where to pick pixels.
  6052. @item y
  6053. Set y offset from where to pick pixels.
  6054. @item mode
  6055. Set scope mode, can be one of the following:
  6056. @table @samp
  6057. @item mono
  6058. Draw hexadecimal pixel values with white color on black background.
  6059. @item color
  6060. Draw hexadecimal pixel values with input video pixel color on black
  6061. background.
  6062. @item color2
  6063. Draw hexadecimal pixel values on color background picked from input video,
  6064. the text color is picked in such way so its always visible.
  6065. @end table
  6066. @item axis
  6067. Draw rows and columns numbers on left and top of video.
  6068. @item opacity
  6069. Set background opacity.
  6070. @end table
  6071. @section dctdnoiz
  6072. Denoise frames using 2D DCT (frequency domain filtering).
  6073. This filter is not designed for real time.
  6074. The filter accepts the following options:
  6075. @table @option
  6076. @item sigma, s
  6077. Set the noise sigma constant.
  6078. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6079. coefficient (absolute value) below this threshold with be dropped.
  6080. If you need a more advanced filtering, see @option{expr}.
  6081. Default is @code{0}.
  6082. @item overlap
  6083. Set number overlapping pixels for each block. Since the filter can be slow, you
  6084. may want to reduce this value, at the cost of a less effective filter and the
  6085. risk of various artefacts.
  6086. If the overlapping value doesn't permit processing the whole input width or
  6087. height, a warning will be displayed and according borders won't be denoised.
  6088. Default value is @var{blocksize}-1, which is the best possible setting.
  6089. @item expr, e
  6090. Set the coefficient factor expression.
  6091. For each coefficient of a DCT block, this expression will be evaluated as a
  6092. multiplier value for the coefficient.
  6093. If this is option is set, the @option{sigma} option will be ignored.
  6094. The absolute value of the coefficient can be accessed through the @var{c}
  6095. variable.
  6096. @item n
  6097. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6098. @var{blocksize}, which is the width and height of the processed blocks.
  6099. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6100. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6101. on the speed processing. Also, a larger block size does not necessarily means a
  6102. better de-noising.
  6103. @end table
  6104. @subsection Examples
  6105. Apply a denoise with a @option{sigma} of @code{4.5}:
  6106. @example
  6107. dctdnoiz=4.5
  6108. @end example
  6109. The same operation can be achieved using the expression system:
  6110. @example
  6111. dctdnoiz=e='gte(c, 4.5*3)'
  6112. @end example
  6113. Violent denoise using a block size of @code{16x16}:
  6114. @example
  6115. dctdnoiz=15:n=4
  6116. @end example
  6117. @section deband
  6118. Remove banding artifacts from input video.
  6119. It works by replacing banded pixels with average value of referenced pixels.
  6120. The filter accepts the following options:
  6121. @table @option
  6122. @item 1thr
  6123. @item 2thr
  6124. @item 3thr
  6125. @item 4thr
  6126. Set banding detection threshold for each plane. Default is 0.02.
  6127. Valid range is 0.00003 to 0.5.
  6128. If difference between current pixel and reference pixel is less than threshold,
  6129. it will be considered as banded.
  6130. @item range, r
  6131. Banding detection range in pixels. Default is 16. If positive, random number
  6132. in range 0 to set value will be used. If negative, exact absolute value
  6133. will be used.
  6134. The range defines square of four pixels around current pixel.
  6135. @item direction, d
  6136. Set direction in radians from which four pixel will be compared. If positive,
  6137. random direction from 0 to set direction will be picked. If negative, exact of
  6138. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6139. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6140. column.
  6141. @item blur, b
  6142. If enabled, current pixel is compared with average value of all four
  6143. surrounding pixels. The default is enabled. If disabled current pixel is
  6144. compared with all four surrounding pixels. The pixel is considered banded
  6145. if only all four differences with surrounding pixels are less than threshold.
  6146. @item coupling, c
  6147. If enabled, current pixel is changed if and only if all pixel components are banded,
  6148. e.g. banding detection threshold is triggered for all color components.
  6149. The default is disabled.
  6150. @end table
  6151. @section deblock
  6152. Remove blocking artifacts from input video.
  6153. The filter accepts the following options:
  6154. @table @option
  6155. @item filter
  6156. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6157. This controls what kind of deblocking is applied.
  6158. @item block
  6159. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6160. @item alpha
  6161. @item beta
  6162. @item gamma
  6163. @item delta
  6164. Set blocking detection thresholds. Allowed range is 0 to 1.
  6165. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6166. Using higher threshold gives more deblocking strength.
  6167. Setting @var{alpha} controls threshold detection at exact edge of block.
  6168. Remaining options controls threshold detection near the edge. Each one for
  6169. below/above or left/right. Setting any of those to @var{0} disables
  6170. deblocking.
  6171. @item planes
  6172. Set planes to filter. Default is to filter all available planes.
  6173. @end table
  6174. @subsection Examples
  6175. @itemize
  6176. @item
  6177. Deblock using weak filter and block size of 4 pixels.
  6178. @example
  6179. deblock=filter=weak:block=4
  6180. @end example
  6181. @item
  6182. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6183. deblocking more edges.
  6184. @example
  6185. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6186. @end example
  6187. @item
  6188. Similar as above, but filter only first plane.
  6189. @example
  6190. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6191. @end example
  6192. @item
  6193. Similar as above, but filter only second and third plane.
  6194. @example
  6195. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6196. @end example
  6197. @end itemize
  6198. @anchor{decimate}
  6199. @section decimate
  6200. Drop duplicated frames at regular intervals.
  6201. The filter accepts the following options:
  6202. @table @option
  6203. @item cycle
  6204. Set the number of frames from which one will be dropped. Setting this to
  6205. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6206. Default is @code{5}.
  6207. @item dupthresh
  6208. Set the threshold for duplicate detection. If the difference metric for a frame
  6209. is less than or equal to this value, then it is declared as duplicate. Default
  6210. is @code{1.1}
  6211. @item scthresh
  6212. Set scene change threshold. Default is @code{15}.
  6213. @item blockx
  6214. @item blocky
  6215. Set the size of the x and y-axis blocks used during metric calculations.
  6216. Larger blocks give better noise suppression, but also give worse detection of
  6217. small movements. Must be a power of two. Default is @code{32}.
  6218. @item ppsrc
  6219. Mark main input as a pre-processed input and activate clean source input
  6220. stream. This allows the input to be pre-processed with various filters to help
  6221. the metrics calculation while keeping the frame selection lossless. When set to
  6222. @code{1}, the first stream is for the pre-processed input, and the second
  6223. stream is the clean source from where the kept frames are chosen. Default is
  6224. @code{0}.
  6225. @item chroma
  6226. Set whether or not chroma is considered in the metric calculations. Default is
  6227. @code{1}.
  6228. @end table
  6229. @section deconvolve
  6230. Apply 2D deconvolution of video stream in frequency domain using second stream
  6231. as impulse.
  6232. The filter accepts the following options:
  6233. @table @option
  6234. @item planes
  6235. Set which planes to process.
  6236. @item impulse
  6237. Set which impulse video frames will be processed, can be @var{first}
  6238. or @var{all}. Default is @var{all}.
  6239. @item noise
  6240. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6241. and height are not same and not power of 2 or if stream prior to convolving
  6242. had noise.
  6243. @end table
  6244. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6245. @section dedot
  6246. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6247. It accepts the following options:
  6248. @table @option
  6249. @item m
  6250. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6251. @var{rainbows} for cross-color reduction.
  6252. @item lt
  6253. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6254. @item tl
  6255. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6256. @item tc
  6257. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6258. @item ct
  6259. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6260. @end table
  6261. @section deflate
  6262. Apply deflate effect to the video.
  6263. This filter replaces the pixel by the local(3x3) average by taking into account
  6264. only values lower than the pixel.
  6265. It accepts the following options:
  6266. @table @option
  6267. @item threshold0
  6268. @item threshold1
  6269. @item threshold2
  6270. @item threshold3
  6271. Limit the maximum change for each plane, default is 65535.
  6272. If 0, plane will remain unchanged.
  6273. @end table
  6274. @section deflicker
  6275. Remove temporal frame luminance variations.
  6276. It accepts the following options:
  6277. @table @option
  6278. @item size, s
  6279. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6280. @item mode, m
  6281. Set averaging mode to smooth temporal luminance variations.
  6282. Available values are:
  6283. @table @samp
  6284. @item am
  6285. Arithmetic mean
  6286. @item gm
  6287. Geometric mean
  6288. @item hm
  6289. Harmonic mean
  6290. @item qm
  6291. Quadratic mean
  6292. @item cm
  6293. Cubic mean
  6294. @item pm
  6295. Power mean
  6296. @item median
  6297. Median
  6298. @end table
  6299. @item bypass
  6300. Do not actually modify frame. Useful when one only wants metadata.
  6301. @end table
  6302. @section dejudder
  6303. Remove judder produced by partially interlaced telecined content.
  6304. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6305. source was partially telecined content then the output of @code{pullup,dejudder}
  6306. will have a variable frame rate. May change the recorded frame rate of the
  6307. container. Aside from that change, this filter will not affect constant frame
  6308. rate video.
  6309. The option available in this filter is:
  6310. @table @option
  6311. @item cycle
  6312. Specify the length of the window over which the judder repeats.
  6313. Accepts any integer greater than 1. Useful values are:
  6314. @table @samp
  6315. @item 4
  6316. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6317. @item 5
  6318. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6319. @item 20
  6320. If a mixture of the two.
  6321. @end table
  6322. The default is @samp{4}.
  6323. @end table
  6324. @section delogo
  6325. Suppress a TV station logo by a simple interpolation of the surrounding
  6326. pixels. Just set a rectangle covering the logo and watch it disappear
  6327. (and sometimes something even uglier appear - your mileage may vary).
  6328. It accepts the following parameters:
  6329. @table @option
  6330. @item x
  6331. @item y
  6332. Specify the top left corner coordinates of the logo. They must be
  6333. specified.
  6334. @item w
  6335. @item h
  6336. Specify the width and height of the logo to clear. They must be
  6337. specified.
  6338. @item band, t
  6339. Specify the thickness of the fuzzy edge of the rectangle (added to
  6340. @var{w} and @var{h}). The default value is 1. This option is
  6341. deprecated, setting higher values should no longer be necessary and
  6342. is not recommended.
  6343. @item show
  6344. When set to 1, a green rectangle is drawn on the screen to simplify
  6345. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6346. The default value is 0.
  6347. The rectangle is drawn on the outermost pixels which will be (partly)
  6348. replaced with interpolated values. The values of the next pixels
  6349. immediately outside this rectangle in each direction will be used to
  6350. compute the interpolated pixel values inside the rectangle.
  6351. @end table
  6352. @subsection Examples
  6353. @itemize
  6354. @item
  6355. Set a rectangle covering the area with top left corner coordinates 0,0
  6356. and size 100x77, and a band of size 10:
  6357. @example
  6358. delogo=x=0:y=0:w=100:h=77:band=10
  6359. @end example
  6360. @end itemize
  6361. @section derain
  6362. Remove the rain in the input image/video by applying the derain methods based on
  6363. convolutional neural networks. Supported models:
  6364. @itemize
  6365. @item
  6366. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6367. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6368. @end itemize
  6369. Training scripts as well as scripts for model generation are provided in
  6370. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6371. The filter accepts the following options:
  6372. @table @option
  6373. @item dnn_backend
  6374. Specify which DNN backend to use for model loading and execution. This option accepts
  6375. the following values:
  6376. @table @samp
  6377. @item native
  6378. Native implementation of DNN loading and execution.
  6379. @end table
  6380. Default value is @samp{native}.
  6381. @item model
  6382. Set path to model file specifying network architecture and its parameters.
  6383. Note that different backends use different file formats. TensorFlow backend
  6384. can load files for both formats, while native backend can load files for only
  6385. its format.
  6386. @end table
  6387. @section deshake
  6388. Attempt to fix small changes in horizontal and/or vertical shift. This
  6389. filter helps remove camera shake from hand-holding a camera, bumping a
  6390. tripod, moving on a vehicle, etc.
  6391. The filter accepts the following options:
  6392. @table @option
  6393. @item x
  6394. @item y
  6395. @item w
  6396. @item h
  6397. Specify a rectangular area where to limit the search for motion
  6398. vectors.
  6399. If desired the search for motion vectors can be limited to a
  6400. rectangular area of the frame defined by its top left corner, width
  6401. and height. These parameters have the same meaning as the drawbox
  6402. filter which can be used to visualise the position of the bounding
  6403. box.
  6404. This is useful when simultaneous movement of subjects within the frame
  6405. might be confused for camera motion by the motion vector search.
  6406. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6407. then the full frame is used. This allows later options to be set
  6408. without specifying the bounding box for the motion vector search.
  6409. Default - search the whole frame.
  6410. @item rx
  6411. @item ry
  6412. Specify the maximum extent of movement in x and y directions in the
  6413. range 0-64 pixels. Default 16.
  6414. @item edge
  6415. Specify how to generate pixels to fill blanks at the edge of the
  6416. frame. Available values are:
  6417. @table @samp
  6418. @item blank, 0
  6419. Fill zeroes at blank locations
  6420. @item original, 1
  6421. Original image at blank locations
  6422. @item clamp, 2
  6423. Extruded edge value at blank locations
  6424. @item mirror, 3
  6425. Mirrored edge at blank locations
  6426. @end table
  6427. Default value is @samp{mirror}.
  6428. @item blocksize
  6429. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6430. default 8.
  6431. @item contrast
  6432. Specify the contrast threshold for blocks. Only blocks with more than
  6433. the specified contrast (difference between darkest and lightest
  6434. pixels) will be considered. Range 1-255, default 125.
  6435. @item search
  6436. Specify the search strategy. Available values are:
  6437. @table @samp
  6438. @item exhaustive, 0
  6439. Set exhaustive search
  6440. @item less, 1
  6441. Set less exhaustive search.
  6442. @end table
  6443. Default value is @samp{exhaustive}.
  6444. @item filename
  6445. If set then a detailed log of the motion search is written to the
  6446. specified file.
  6447. @end table
  6448. @section despill
  6449. Remove unwanted contamination of foreground colors, caused by reflected color of
  6450. greenscreen or bluescreen.
  6451. This filter accepts the following options:
  6452. @table @option
  6453. @item type
  6454. Set what type of despill to use.
  6455. @item mix
  6456. Set how spillmap will be generated.
  6457. @item expand
  6458. Set how much to get rid of still remaining spill.
  6459. @item red
  6460. Controls amount of red in spill area.
  6461. @item green
  6462. Controls amount of green in spill area.
  6463. Should be -1 for greenscreen.
  6464. @item blue
  6465. Controls amount of blue in spill area.
  6466. Should be -1 for bluescreen.
  6467. @item brightness
  6468. Controls brightness of spill area, preserving colors.
  6469. @item alpha
  6470. Modify alpha from generated spillmap.
  6471. @end table
  6472. @section detelecine
  6473. Apply an exact inverse of the telecine operation. It requires a predefined
  6474. pattern specified using the pattern option which must be the same as that passed
  6475. to the telecine filter.
  6476. This filter accepts the following options:
  6477. @table @option
  6478. @item first_field
  6479. @table @samp
  6480. @item top, t
  6481. top field first
  6482. @item bottom, b
  6483. bottom field first
  6484. The default value is @code{top}.
  6485. @end table
  6486. @item pattern
  6487. A string of numbers representing the pulldown pattern you wish to apply.
  6488. The default value is @code{23}.
  6489. @item start_frame
  6490. A number representing position of the first frame with respect to the telecine
  6491. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6492. @end table
  6493. @section dilation
  6494. Apply dilation effect to the video.
  6495. This filter replaces the pixel by the local(3x3) maximum.
  6496. It accepts the following options:
  6497. @table @option
  6498. @item threshold0
  6499. @item threshold1
  6500. @item threshold2
  6501. @item threshold3
  6502. Limit the maximum change for each plane, default is 65535.
  6503. If 0, plane will remain unchanged.
  6504. @item coordinates
  6505. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6506. pixels are used.
  6507. Flags to local 3x3 coordinates maps like this:
  6508. 1 2 3
  6509. 4 5
  6510. 6 7 8
  6511. @end table
  6512. @section displace
  6513. Displace pixels as indicated by second and third input stream.
  6514. It takes three input streams and outputs one stream, the first input is the
  6515. source, and second and third input are displacement maps.
  6516. The second input specifies how much to displace pixels along the
  6517. x-axis, while the third input specifies how much to displace pixels
  6518. along the y-axis.
  6519. If one of displacement map streams terminates, last frame from that
  6520. displacement map will be used.
  6521. Note that once generated, displacements maps can be reused over and over again.
  6522. A description of the accepted options follows.
  6523. @table @option
  6524. @item edge
  6525. Set displace behavior for pixels that are out of range.
  6526. Available values are:
  6527. @table @samp
  6528. @item blank
  6529. Missing pixels are replaced by black pixels.
  6530. @item smear
  6531. Adjacent pixels will spread out to replace missing pixels.
  6532. @item wrap
  6533. Out of range pixels are wrapped so they point to pixels of other side.
  6534. @item mirror
  6535. Out of range pixels will be replaced with mirrored pixels.
  6536. @end table
  6537. Default is @samp{smear}.
  6538. @end table
  6539. @subsection Examples
  6540. @itemize
  6541. @item
  6542. Add ripple effect to rgb input of video size hd720:
  6543. @example
  6544. 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
  6545. @end example
  6546. @item
  6547. Add wave effect to rgb input of video size hd720:
  6548. @example
  6549. 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
  6550. @end example
  6551. @end itemize
  6552. @section drawbox
  6553. Draw a colored box on the input image.
  6554. It accepts the following parameters:
  6555. @table @option
  6556. @item x
  6557. @item y
  6558. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6559. @item width, w
  6560. @item height, h
  6561. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6562. the input width and height. It defaults to 0.
  6563. @item color, c
  6564. Specify the color of the box to write. For the general syntax of this option,
  6565. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6566. value @code{invert} is used, the box edge color is the same as the
  6567. video with inverted luma.
  6568. @item thickness, t
  6569. The expression which sets the thickness of the box edge.
  6570. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6571. See below for the list of accepted constants.
  6572. @item replace
  6573. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6574. will overwrite the video's color and alpha pixels.
  6575. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6576. @end table
  6577. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6578. following constants:
  6579. @table @option
  6580. @item dar
  6581. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6582. @item hsub
  6583. @item vsub
  6584. horizontal and vertical chroma subsample values. For example for the
  6585. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6586. @item in_h, ih
  6587. @item in_w, iw
  6588. The input width and height.
  6589. @item sar
  6590. The input sample aspect ratio.
  6591. @item x
  6592. @item y
  6593. The x and y offset coordinates where the box is drawn.
  6594. @item w
  6595. @item h
  6596. The width and height of the drawn box.
  6597. @item t
  6598. The thickness of the drawn box.
  6599. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6600. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6601. @end table
  6602. @subsection Examples
  6603. @itemize
  6604. @item
  6605. Draw a black box around the edge of the input image:
  6606. @example
  6607. drawbox
  6608. @end example
  6609. @item
  6610. Draw a box with color red and an opacity of 50%:
  6611. @example
  6612. drawbox=10:20:200:60:red@@0.5
  6613. @end example
  6614. The previous example can be specified as:
  6615. @example
  6616. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6617. @end example
  6618. @item
  6619. Fill the box with pink color:
  6620. @example
  6621. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6622. @end example
  6623. @item
  6624. Draw a 2-pixel red 2.40:1 mask:
  6625. @example
  6626. 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
  6627. @end example
  6628. @end itemize
  6629. @section drawgrid
  6630. Draw a grid on the input image.
  6631. It accepts the following parameters:
  6632. @table @option
  6633. @item x
  6634. @item y
  6635. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6636. @item width, w
  6637. @item height, h
  6638. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6639. input width and height, respectively, minus @code{thickness}, so image gets
  6640. framed. Default to 0.
  6641. @item color, c
  6642. Specify the color of the grid. For the general syntax of this option,
  6643. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6644. value @code{invert} is used, the grid color is the same as the
  6645. video with inverted luma.
  6646. @item thickness, t
  6647. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6648. See below for the list of accepted constants.
  6649. @item replace
  6650. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6651. will overwrite the video's color and alpha pixels.
  6652. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6653. @end table
  6654. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6655. following constants:
  6656. @table @option
  6657. @item dar
  6658. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6659. @item hsub
  6660. @item vsub
  6661. horizontal and vertical chroma subsample values. For example for the
  6662. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6663. @item in_h, ih
  6664. @item in_w, iw
  6665. The input grid cell width and height.
  6666. @item sar
  6667. The input sample aspect ratio.
  6668. @item x
  6669. @item y
  6670. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6671. @item w
  6672. @item h
  6673. The width and height of the drawn cell.
  6674. @item t
  6675. The thickness of the drawn cell.
  6676. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6677. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6678. @end table
  6679. @subsection Examples
  6680. @itemize
  6681. @item
  6682. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6683. @example
  6684. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6685. @end example
  6686. @item
  6687. Draw a white 3x3 grid with an opacity of 50%:
  6688. @example
  6689. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6690. @end example
  6691. @end itemize
  6692. @anchor{drawtext}
  6693. @section drawtext
  6694. Draw a text string or text from a specified file on top of a video, using the
  6695. libfreetype library.
  6696. To enable compilation of this filter, you need to configure FFmpeg with
  6697. @code{--enable-libfreetype}.
  6698. To enable default font fallback and the @var{font} option you need to
  6699. configure FFmpeg with @code{--enable-libfontconfig}.
  6700. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6701. @code{--enable-libfribidi}.
  6702. @subsection Syntax
  6703. It accepts the following parameters:
  6704. @table @option
  6705. @item box
  6706. Used to draw a box around text using the background color.
  6707. The value must be either 1 (enable) or 0 (disable).
  6708. The default value of @var{box} is 0.
  6709. @item boxborderw
  6710. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6711. The default value of @var{boxborderw} is 0.
  6712. @item boxcolor
  6713. The color to be used for drawing box around text. For the syntax of this
  6714. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6715. The default value of @var{boxcolor} is "white".
  6716. @item line_spacing
  6717. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6718. The default value of @var{line_spacing} is 0.
  6719. @item borderw
  6720. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6721. The default value of @var{borderw} is 0.
  6722. @item bordercolor
  6723. Set the color to be used for drawing border around text. For the syntax of this
  6724. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6725. The default value of @var{bordercolor} is "black".
  6726. @item expansion
  6727. Select how the @var{text} is expanded. Can be either @code{none},
  6728. @code{strftime} (deprecated) or
  6729. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6730. below for details.
  6731. @item basetime
  6732. Set a start time for the count. Value is in microseconds. Only applied
  6733. in the deprecated strftime expansion mode. To emulate in normal expansion
  6734. mode use the @code{pts} function, supplying the start time (in seconds)
  6735. as the second argument.
  6736. @item fix_bounds
  6737. If true, check and fix text coords to avoid clipping.
  6738. @item fontcolor
  6739. The color to be used for drawing fonts. For the syntax of this option, check
  6740. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6741. The default value of @var{fontcolor} is "black".
  6742. @item fontcolor_expr
  6743. String which is expanded the same way as @var{text} to obtain dynamic
  6744. @var{fontcolor} value. By default this option has empty value and is not
  6745. processed. When this option is set, it overrides @var{fontcolor} option.
  6746. @item font
  6747. The font family to be used for drawing text. By default Sans.
  6748. @item fontfile
  6749. The font file to be used for drawing text. The path must be included.
  6750. This parameter is mandatory if the fontconfig support is disabled.
  6751. @item alpha
  6752. Draw the text applying alpha blending. The value can
  6753. be a number between 0.0 and 1.0.
  6754. The expression accepts the same variables @var{x, y} as well.
  6755. The default value is 1.
  6756. Please see @var{fontcolor_expr}.
  6757. @item fontsize
  6758. The font size to be used for drawing text.
  6759. The default value of @var{fontsize} is 16.
  6760. @item text_shaping
  6761. If set to 1, attempt to shape the text (for example, reverse the order of
  6762. right-to-left text and join Arabic characters) before drawing it.
  6763. Otherwise, just draw the text exactly as given.
  6764. By default 1 (if supported).
  6765. @item ft_load_flags
  6766. The flags to be used for loading the fonts.
  6767. The flags map the corresponding flags supported by libfreetype, and are
  6768. a combination of the following values:
  6769. @table @var
  6770. @item default
  6771. @item no_scale
  6772. @item no_hinting
  6773. @item render
  6774. @item no_bitmap
  6775. @item vertical_layout
  6776. @item force_autohint
  6777. @item crop_bitmap
  6778. @item pedantic
  6779. @item ignore_global_advance_width
  6780. @item no_recurse
  6781. @item ignore_transform
  6782. @item monochrome
  6783. @item linear_design
  6784. @item no_autohint
  6785. @end table
  6786. Default value is "default".
  6787. For more information consult the documentation for the FT_LOAD_*
  6788. libfreetype flags.
  6789. @item shadowcolor
  6790. The color to be used for drawing a shadow behind the drawn text. For the
  6791. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6792. ffmpeg-utils manual,ffmpeg-utils}.
  6793. The default value of @var{shadowcolor} is "black".
  6794. @item shadowx
  6795. @item shadowy
  6796. The x and y offsets for the text shadow position with respect to the
  6797. position of the text. They can be either positive or negative
  6798. values. The default value for both is "0".
  6799. @item start_number
  6800. The starting frame number for the n/frame_num variable. The default value
  6801. is "0".
  6802. @item tabsize
  6803. The size in number of spaces to use for rendering the tab.
  6804. Default value is 4.
  6805. @item timecode
  6806. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6807. format. It can be used with or without text parameter. @var{timecode_rate}
  6808. option must be specified.
  6809. @item timecode_rate, rate, r
  6810. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6811. integer. Minimum value is "1".
  6812. Drop-frame timecode is supported for frame rates 30 & 60.
  6813. @item tc24hmax
  6814. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6815. Default is 0 (disabled).
  6816. @item text
  6817. The text string to be drawn. The text must be a sequence of UTF-8
  6818. encoded characters.
  6819. This parameter is mandatory if no file is specified with the parameter
  6820. @var{textfile}.
  6821. @item textfile
  6822. A text file containing text to be drawn. The text must be a sequence
  6823. of UTF-8 encoded characters.
  6824. This parameter is mandatory if no text string is specified with the
  6825. parameter @var{text}.
  6826. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6827. @item reload
  6828. If set to 1, the @var{textfile} will be reloaded before each frame.
  6829. Be sure to update it atomically, or it may be read partially, or even fail.
  6830. @item x
  6831. @item y
  6832. The expressions which specify the offsets where text will be drawn
  6833. within the video frame. They are relative to the top/left border of the
  6834. output image.
  6835. The default value of @var{x} and @var{y} is "0".
  6836. See below for the list of accepted constants and functions.
  6837. @end table
  6838. The parameters for @var{x} and @var{y} are expressions containing the
  6839. following constants and functions:
  6840. @table @option
  6841. @item dar
  6842. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6843. @item hsub
  6844. @item vsub
  6845. horizontal and vertical chroma subsample values. For example for the
  6846. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6847. @item line_h, lh
  6848. the height of each text line
  6849. @item main_h, h, H
  6850. the input height
  6851. @item main_w, w, W
  6852. the input width
  6853. @item max_glyph_a, ascent
  6854. the maximum distance from the baseline to the highest/upper grid
  6855. coordinate used to place a glyph outline point, for all the rendered
  6856. glyphs.
  6857. It is a positive value, due to the grid's orientation with the Y axis
  6858. upwards.
  6859. @item max_glyph_d, descent
  6860. the maximum distance from the baseline to the lowest grid coordinate
  6861. used to place a glyph outline point, for all the rendered glyphs.
  6862. This is a negative value, due to the grid's orientation, with the Y axis
  6863. upwards.
  6864. @item max_glyph_h
  6865. maximum glyph height, that is the maximum height for all the glyphs
  6866. contained in the rendered text, it is equivalent to @var{ascent} -
  6867. @var{descent}.
  6868. @item max_glyph_w
  6869. maximum glyph width, that is the maximum width for all the glyphs
  6870. contained in the rendered text
  6871. @item n
  6872. the number of input frame, starting from 0
  6873. @item rand(min, max)
  6874. return a random number included between @var{min} and @var{max}
  6875. @item sar
  6876. The input sample aspect ratio.
  6877. @item t
  6878. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6879. @item text_h, th
  6880. the height of the rendered text
  6881. @item text_w, tw
  6882. the width of the rendered text
  6883. @item x
  6884. @item y
  6885. the x and y offset coordinates where the text is drawn.
  6886. These parameters allow the @var{x} and @var{y} expressions to refer
  6887. to each other, so you can for example specify @code{y=x/dar}.
  6888. @item pict_type
  6889. A one character description of the current frame's picture type.
  6890. @end table
  6891. @anchor{drawtext_expansion}
  6892. @subsection Text expansion
  6893. If @option{expansion} is set to @code{strftime},
  6894. the filter recognizes strftime() sequences in the provided text and
  6895. expands them accordingly. Check the documentation of strftime(). This
  6896. feature is deprecated.
  6897. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6898. If @option{expansion} is set to @code{normal} (which is the default),
  6899. the following expansion mechanism is used.
  6900. The backslash character @samp{\}, followed by any character, always expands to
  6901. the second character.
  6902. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6903. braces is a function name, possibly followed by arguments separated by ':'.
  6904. If the arguments contain special characters or delimiters (':' or '@}'),
  6905. they should be escaped.
  6906. Note that they probably must also be escaped as the value for the
  6907. @option{text} option in the filter argument string and as the filter
  6908. argument in the filtergraph description, and possibly also for the shell,
  6909. that makes up to four levels of escaping; using a text file avoids these
  6910. problems.
  6911. The following functions are available:
  6912. @table @command
  6913. @item expr, e
  6914. The expression evaluation result.
  6915. It must take one argument specifying the expression to be evaluated,
  6916. which accepts the same constants and functions as the @var{x} and
  6917. @var{y} values. Note that not all constants should be used, for
  6918. example the text size is not known when evaluating the expression, so
  6919. the constants @var{text_w} and @var{text_h} will have an undefined
  6920. value.
  6921. @item expr_int_format, eif
  6922. Evaluate the expression's value and output as formatted integer.
  6923. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6924. The second argument specifies the output format. Allowed values are @samp{x},
  6925. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6926. @code{printf} function.
  6927. The third parameter is optional and sets the number of positions taken by the output.
  6928. It can be used to add padding with zeros from the left.
  6929. @item gmtime
  6930. The time at which the filter is running, expressed in UTC.
  6931. It can accept an argument: a strftime() format string.
  6932. @item localtime
  6933. The time at which the filter is running, expressed in the local time zone.
  6934. It can accept an argument: a strftime() format string.
  6935. @item metadata
  6936. Frame metadata. Takes one or two arguments.
  6937. The first argument is mandatory and specifies the metadata key.
  6938. The second argument is optional and specifies a default value, used when the
  6939. metadata key is not found or empty.
  6940. Available metadata can be identified by inspecting entries
  6941. starting with TAG included within each frame section
  6942. printed by running @code{ffprobe -show_frames}.
  6943. String metadata generated in filters leading to
  6944. the drawtext filter are also available.
  6945. @item n, frame_num
  6946. The frame number, starting from 0.
  6947. @item pict_type
  6948. A one character description of the current picture type.
  6949. @item pts
  6950. The timestamp of the current frame.
  6951. It can take up to three arguments.
  6952. The first argument is the format of the timestamp; it defaults to @code{flt}
  6953. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6954. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6955. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6956. @code{localtime} stands for the timestamp of the frame formatted as
  6957. local time zone time.
  6958. The second argument is an offset added to the timestamp.
  6959. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6960. supplied to present the hour part of the formatted timestamp in 24h format
  6961. (00-23).
  6962. If the format is set to @code{localtime} or @code{gmtime},
  6963. a third argument may be supplied: a strftime() format string.
  6964. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6965. @end table
  6966. @subsection Commands
  6967. This filter supports altering parameters via commands:
  6968. @table @option
  6969. @item reinit
  6970. Alter existing filter parameters.
  6971. Syntax for the argument is the same as for filter invocation, e.g.
  6972. @example
  6973. fontsize=56:fontcolor=green:text='Hello World'
  6974. @end example
  6975. Full filter invocation with sendcmd would look like this:
  6976. @example
  6977. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  6978. @end example
  6979. @end table
  6980. If the entire argument can't be parsed or applied as valid values then the filter will
  6981. continue with its existing parameters.
  6982. @subsection Examples
  6983. @itemize
  6984. @item
  6985. Draw "Test Text" with font FreeSerif, using the default values for the
  6986. optional parameters.
  6987. @example
  6988. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6989. @end example
  6990. @item
  6991. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6992. and y=50 (counting from the top-left corner of the screen), text is
  6993. yellow with a red box around it. Both the text and the box have an
  6994. opacity of 20%.
  6995. @example
  6996. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6997. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6998. @end example
  6999. Note that the double quotes are not necessary if spaces are not used
  7000. within the parameter list.
  7001. @item
  7002. Show the text at the center of the video frame:
  7003. @example
  7004. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7005. @end example
  7006. @item
  7007. Show the text at a random position, switching to a new position every 30 seconds:
  7008. @example
  7009. 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)"
  7010. @end example
  7011. @item
  7012. Show a text line sliding from right to left in the last row of the video
  7013. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7014. with no newlines.
  7015. @example
  7016. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7017. @end example
  7018. @item
  7019. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7020. @example
  7021. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7022. @end example
  7023. @item
  7024. Draw a single green letter "g", at the center of the input video.
  7025. The glyph baseline is placed at half screen height.
  7026. @example
  7027. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7028. @end example
  7029. @item
  7030. Show text for 1 second every 3 seconds:
  7031. @example
  7032. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7033. @end example
  7034. @item
  7035. Use fontconfig to set the font. Note that the colons need to be escaped.
  7036. @example
  7037. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7038. @end example
  7039. @item
  7040. Print the date of a real-time encoding (see strftime(3)):
  7041. @example
  7042. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7043. @end example
  7044. @item
  7045. Show text fading in and out (appearing/disappearing):
  7046. @example
  7047. #!/bin/sh
  7048. DS=1.0 # display start
  7049. DE=10.0 # display end
  7050. FID=1.5 # fade in duration
  7051. FOD=5 # fade out duration
  7052. 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 @}"
  7053. @end example
  7054. @item
  7055. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7056. and the @option{fontsize} value are included in the @option{y} offset.
  7057. @example
  7058. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7059. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7060. @end example
  7061. @end itemize
  7062. For more information about libfreetype, check:
  7063. @url{http://www.freetype.org/}.
  7064. For more information about fontconfig, check:
  7065. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7066. For more information about libfribidi, check:
  7067. @url{http://fribidi.org/}.
  7068. @section edgedetect
  7069. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7070. The filter accepts the following options:
  7071. @table @option
  7072. @item low
  7073. @item high
  7074. Set low and high threshold values used by the Canny thresholding
  7075. algorithm.
  7076. The high threshold selects the "strong" edge pixels, which are then
  7077. connected through 8-connectivity with the "weak" edge pixels selected
  7078. by the low threshold.
  7079. @var{low} and @var{high} threshold values must be chosen in the range
  7080. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7081. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7082. is @code{50/255}.
  7083. @item mode
  7084. Define the drawing mode.
  7085. @table @samp
  7086. @item wires
  7087. Draw white/gray wires on black background.
  7088. @item colormix
  7089. Mix the colors to create a paint/cartoon effect.
  7090. @item canny
  7091. Apply Canny edge detector on all selected planes.
  7092. @end table
  7093. Default value is @var{wires}.
  7094. @item planes
  7095. Select planes for filtering. By default all available planes are filtered.
  7096. @end table
  7097. @subsection Examples
  7098. @itemize
  7099. @item
  7100. Standard edge detection with custom values for the hysteresis thresholding:
  7101. @example
  7102. edgedetect=low=0.1:high=0.4
  7103. @end example
  7104. @item
  7105. Painting effect without thresholding:
  7106. @example
  7107. edgedetect=mode=colormix:high=0
  7108. @end example
  7109. @end itemize
  7110. @section eq
  7111. Set brightness, contrast, saturation and approximate gamma adjustment.
  7112. The filter accepts the following options:
  7113. @table @option
  7114. @item contrast
  7115. Set the contrast expression. The value must be a float value in range
  7116. @code{-2.0} to @code{2.0}. The default value is "1".
  7117. @item brightness
  7118. Set the brightness expression. The value must be a float value in
  7119. range @code{-1.0} to @code{1.0}. The default value is "0".
  7120. @item saturation
  7121. Set the saturation expression. The value must be a float in
  7122. range @code{0.0} to @code{3.0}. The default value is "1".
  7123. @item gamma
  7124. Set the gamma expression. The value must be a float in range
  7125. @code{0.1} to @code{10.0}. The default value is "1".
  7126. @item gamma_r
  7127. Set the gamma expression for red. The value must be a float in
  7128. range @code{0.1} to @code{10.0}. The default value is "1".
  7129. @item gamma_g
  7130. Set the gamma expression for green. The value must be a float in range
  7131. @code{0.1} to @code{10.0}. The default value is "1".
  7132. @item gamma_b
  7133. Set the gamma expression for blue. The value must be a float in range
  7134. @code{0.1} to @code{10.0}. The default value is "1".
  7135. @item gamma_weight
  7136. Set the gamma weight expression. It can be used to reduce the effect
  7137. of a high gamma value on bright image areas, e.g. keep them from
  7138. getting overamplified and just plain white. The value must be a float
  7139. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7140. gamma correction all the way down while @code{1.0} leaves it at its
  7141. full strength. Default is "1".
  7142. @item eval
  7143. Set when the expressions for brightness, contrast, saturation and
  7144. gamma expressions are evaluated.
  7145. It accepts the following values:
  7146. @table @samp
  7147. @item init
  7148. only evaluate expressions once during the filter initialization or
  7149. when a command is processed
  7150. @item frame
  7151. evaluate expressions for each incoming frame
  7152. @end table
  7153. Default value is @samp{init}.
  7154. @end table
  7155. The expressions accept the following parameters:
  7156. @table @option
  7157. @item n
  7158. frame count of the input frame starting from 0
  7159. @item pos
  7160. byte position of the corresponding packet in the input file, NAN if
  7161. unspecified
  7162. @item r
  7163. frame rate of the input video, NAN if the input frame rate is unknown
  7164. @item t
  7165. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7166. @end table
  7167. @subsection Commands
  7168. The filter supports the following commands:
  7169. @table @option
  7170. @item contrast
  7171. Set the contrast expression.
  7172. @item brightness
  7173. Set the brightness expression.
  7174. @item saturation
  7175. Set the saturation expression.
  7176. @item gamma
  7177. Set the gamma expression.
  7178. @item gamma_r
  7179. Set the gamma_r expression.
  7180. @item gamma_g
  7181. Set gamma_g expression.
  7182. @item gamma_b
  7183. Set gamma_b expression.
  7184. @item gamma_weight
  7185. Set gamma_weight expression.
  7186. The command accepts the same syntax of the corresponding option.
  7187. If the specified expression is not valid, it is kept at its current
  7188. value.
  7189. @end table
  7190. @section erosion
  7191. Apply erosion effect to the video.
  7192. This filter replaces the pixel by the local(3x3) minimum.
  7193. It accepts the following options:
  7194. @table @option
  7195. @item threshold0
  7196. @item threshold1
  7197. @item threshold2
  7198. @item threshold3
  7199. Limit the maximum change for each plane, default is 65535.
  7200. If 0, plane will remain unchanged.
  7201. @item coordinates
  7202. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7203. pixels are used.
  7204. Flags to local 3x3 coordinates maps like this:
  7205. 1 2 3
  7206. 4 5
  7207. 6 7 8
  7208. @end table
  7209. @section extractplanes
  7210. Extract color channel components from input video stream into
  7211. separate grayscale video streams.
  7212. The filter accepts the following option:
  7213. @table @option
  7214. @item planes
  7215. Set plane(s) to extract.
  7216. Available values for planes are:
  7217. @table @samp
  7218. @item y
  7219. @item u
  7220. @item v
  7221. @item a
  7222. @item r
  7223. @item g
  7224. @item b
  7225. @end table
  7226. Choosing planes not available in the input will result in an error.
  7227. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7228. with @code{y}, @code{u}, @code{v} planes at same time.
  7229. @end table
  7230. @subsection Examples
  7231. @itemize
  7232. @item
  7233. Extract luma, u and v color channel component from input video frame
  7234. into 3 grayscale outputs:
  7235. @example
  7236. 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
  7237. @end example
  7238. @end itemize
  7239. @section elbg
  7240. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7241. For each input image, the filter will compute the optimal mapping from
  7242. the input to the output given the codebook length, that is the number
  7243. of distinct output colors.
  7244. This filter accepts the following options.
  7245. @table @option
  7246. @item codebook_length, l
  7247. Set codebook length. The value must be a positive integer, and
  7248. represents the number of distinct output colors. Default value is 256.
  7249. @item nb_steps, n
  7250. Set the maximum number of iterations to apply for computing the optimal
  7251. mapping. The higher the value the better the result and the higher the
  7252. computation time. Default value is 1.
  7253. @item seed, s
  7254. Set a random seed, must be an integer included between 0 and
  7255. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7256. will try to use a good random seed on a best effort basis.
  7257. @item pal8
  7258. Set pal8 output pixel format. This option does not work with codebook
  7259. length greater than 256.
  7260. @end table
  7261. @section entropy
  7262. Measure graylevel entropy in histogram of color channels of video frames.
  7263. It accepts the following parameters:
  7264. @table @option
  7265. @item mode
  7266. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7267. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7268. between neighbour histogram values.
  7269. @end table
  7270. @section fade
  7271. Apply a fade-in/out effect to the input video.
  7272. It accepts the following parameters:
  7273. @table @option
  7274. @item type, t
  7275. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7276. effect.
  7277. Default is @code{in}.
  7278. @item start_frame, s
  7279. Specify the number of the frame to start applying the fade
  7280. effect at. Default is 0.
  7281. @item nb_frames, n
  7282. The number of frames that the fade effect lasts. At the end of the
  7283. fade-in effect, the output video will have the same intensity as the input video.
  7284. At the end of the fade-out transition, the output video will be filled with the
  7285. selected @option{color}.
  7286. Default is 25.
  7287. @item alpha
  7288. If set to 1, fade only alpha channel, if one exists on the input.
  7289. Default value is 0.
  7290. @item start_time, st
  7291. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7292. effect. If both start_frame and start_time are specified, the fade will start at
  7293. whichever comes last. Default is 0.
  7294. @item duration, d
  7295. The number of seconds for which the fade effect has to last. At the end of the
  7296. fade-in effect the output video will have the same intensity as the input video,
  7297. at the end of the fade-out transition the output video will be filled with the
  7298. selected @option{color}.
  7299. If both duration and nb_frames are specified, duration is used. Default is 0
  7300. (nb_frames is used by default).
  7301. @item color, c
  7302. Specify the color of the fade. Default is "black".
  7303. @end table
  7304. @subsection Examples
  7305. @itemize
  7306. @item
  7307. Fade in the first 30 frames of video:
  7308. @example
  7309. fade=in:0:30
  7310. @end example
  7311. The command above is equivalent to:
  7312. @example
  7313. fade=t=in:s=0:n=30
  7314. @end example
  7315. @item
  7316. Fade out the last 45 frames of a 200-frame video:
  7317. @example
  7318. fade=out:155:45
  7319. fade=type=out:start_frame=155:nb_frames=45
  7320. @end example
  7321. @item
  7322. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7323. @example
  7324. fade=in:0:25, fade=out:975:25
  7325. @end example
  7326. @item
  7327. Make the first 5 frames yellow, then fade in from frame 5-24:
  7328. @example
  7329. fade=in:5:20:color=yellow
  7330. @end example
  7331. @item
  7332. Fade in alpha over first 25 frames of video:
  7333. @example
  7334. fade=in:0:25:alpha=1
  7335. @end example
  7336. @item
  7337. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7338. @example
  7339. fade=t=in:st=5.5:d=0.5
  7340. @end example
  7341. @end itemize
  7342. @section fftfilt
  7343. Apply arbitrary expressions to samples in frequency domain
  7344. @table @option
  7345. @item dc_Y
  7346. Adjust the dc value (gain) of the luma plane of the image. The filter
  7347. accepts an integer value in range @code{0} to @code{1000}. The default
  7348. value is set to @code{0}.
  7349. @item dc_U
  7350. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7351. filter accepts an integer value in range @code{0} to @code{1000}. The
  7352. default value is set to @code{0}.
  7353. @item dc_V
  7354. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7355. filter accepts an integer value in range @code{0} to @code{1000}. The
  7356. default value is set to @code{0}.
  7357. @item weight_Y
  7358. Set the frequency domain weight expression for the luma plane.
  7359. @item weight_U
  7360. Set the frequency domain weight expression for the 1st chroma plane.
  7361. @item weight_V
  7362. Set the frequency domain weight expression for the 2nd chroma plane.
  7363. @item eval
  7364. Set when the expressions are evaluated.
  7365. It accepts the following values:
  7366. @table @samp
  7367. @item init
  7368. Only evaluate expressions once during the filter initialization.
  7369. @item frame
  7370. Evaluate expressions for each incoming frame.
  7371. @end table
  7372. Default value is @samp{init}.
  7373. The filter accepts the following variables:
  7374. @item X
  7375. @item Y
  7376. The coordinates of the current sample.
  7377. @item W
  7378. @item H
  7379. The width and height of the image.
  7380. @item N
  7381. The number of input frame, starting from 0.
  7382. @end table
  7383. @subsection Examples
  7384. @itemize
  7385. @item
  7386. High-pass:
  7387. @example
  7388. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7389. @end example
  7390. @item
  7391. Low-pass:
  7392. @example
  7393. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7394. @end example
  7395. @item
  7396. Sharpen:
  7397. @example
  7398. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7399. @end example
  7400. @item
  7401. Blur:
  7402. @example
  7403. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7404. @end example
  7405. @end itemize
  7406. @section fftdnoiz
  7407. Denoise frames using 3D FFT (frequency domain filtering).
  7408. The filter accepts the following options:
  7409. @table @option
  7410. @item sigma
  7411. Set the noise sigma constant. This sets denoising strength.
  7412. Default value is 1. Allowed range is from 0 to 30.
  7413. Using very high sigma with low overlap may give blocking artifacts.
  7414. @item amount
  7415. Set amount of denoising. By default all detected noise is reduced.
  7416. Default value is 1. Allowed range is from 0 to 1.
  7417. @item block
  7418. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7419. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7420. block size in pixels is 2^4 which is 16.
  7421. @item overlap
  7422. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7423. @item prev
  7424. Set number of previous frames to use for denoising. By default is set to 0.
  7425. @item next
  7426. Set number of next frames to to use for denoising. By default is set to 0.
  7427. @item planes
  7428. Set planes which will be filtered, by default are all available filtered
  7429. except alpha.
  7430. @end table
  7431. @section field
  7432. Extract a single field from an interlaced image using stride
  7433. arithmetic to avoid wasting CPU time. The output frames are marked as
  7434. non-interlaced.
  7435. The filter accepts the following options:
  7436. @table @option
  7437. @item type
  7438. Specify whether to extract the top (if the value is @code{0} or
  7439. @code{top}) or the bottom field (if the value is @code{1} or
  7440. @code{bottom}).
  7441. @end table
  7442. @section fieldhint
  7443. Create new frames by copying the top and bottom fields from surrounding frames
  7444. supplied as numbers by the hint file.
  7445. @table @option
  7446. @item hint
  7447. Set file containing hints: absolute/relative frame numbers.
  7448. There must be one line for each frame in a clip. Each line must contain two
  7449. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7450. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7451. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7452. for @code{relative} mode. First number tells from which frame to pick up top
  7453. field and second number tells from which frame to pick up bottom field.
  7454. If optionally followed by @code{+} output frame will be marked as interlaced,
  7455. else if followed by @code{-} output frame will be marked as progressive, else
  7456. it will be marked same as input frame.
  7457. If line starts with @code{#} or @code{;} that line is skipped.
  7458. @item mode
  7459. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7460. @end table
  7461. Example of first several lines of @code{hint} file for @code{relative} mode:
  7462. @example
  7463. 0,0 - # first frame
  7464. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7465. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7466. 1,0 -
  7467. 0,0 -
  7468. 0,0 -
  7469. 1,0 -
  7470. 1,0 -
  7471. 1,0 -
  7472. 0,0 -
  7473. 0,0 -
  7474. 1,0 -
  7475. 1,0 -
  7476. 1,0 -
  7477. 0,0 -
  7478. @end example
  7479. @section fieldmatch
  7480. Field matching filter for inverse telecine. It is meant to reconstruct the
  7481. progressive frames from a telecined stream. The filter does not drop duplicated
  7482. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7483. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7484. The separation of the field matching and the decimation is notably motivated by
  7485. the possibility of inserting a de-interlacing filter fallback between the two.
  7486. If the source has mixed telecined and real interlaced content,
  7487. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7488. But these remaining combed frames will be marked as interlaced, and thus can be
  7489. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7490. In addition to the various configuration options, @code{fieldmatch} can take an
  7491. optional second stream, activated through the @option{ppsrc} option. If
  7492. enabled, the frames reconstruction will be based on the fields and frames from
  7493. this second stream. This allows the first input to be pre-processed in order to
  7494. help the various algorithms of the filter, while keeping the output lossless
  7495. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7496. or brightness/contrast adjustments can help.
  7497. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7498. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7499. which @code{fieldmatch} is based on. While the semantic and usage are very
  7500. close, some behaviour and options names can differ.
  7501. The @ref{decimate} filter currently only works for constant frame rate input.
  7502. If your input has mixed telecined (30fps) and progressive content with a lower
  7503. framerate like 24fps use the following filterchain to produce the necessary cfr
  7504. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7505. The filter accepts the following options:
  7506. @table @option
  7507. @item order
  7508. Specify the assumed field order of the input stream. Available values are:
  7509. @table @samp
  7510. @item auto
  7511. Auto detect parity (use FFmpeg's internal parity value).
  7512. @item bff
  7513. Assume bottom field first.
  7514. @item tff
  7515. Assume top field first.
  7516. @end table
  7517. Note that it is sometimes recommended not to trust the parity announced by the
  7518. stream.
  7519. Default value is @var{auto}.
  7520. @item mode
  7521. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7522. sense that it won't risk creating jerkiness due to duplicate frames when
  7523. possible, but if there are bad edits or blended fields it will end up
  7524. outputting combed frames when a good match might actually exist. On the other
  7525. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7526. but will almost always find a good frame if there is one. The other values are
  7527. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7528. jerkiness and creating duplicate frames versus finding good matches in sections
  7529. with bad edits, orphaned fields, blended fields, etc.
  7530. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7531. Available values are:
  7532. @table @samp
  7533. @item pc
  7534. 2-way matching (p/c)
  7535. @item pc_n
  7536. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7537. @item pc_u
  7538. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7539. @item pc_n_ub
  7540. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7541. still combed (p/c + n + u/b)
  7542. @item pcn
  7543. 3-way matching (p/c/n)
  7544. @item pcn_ub
  7545. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7546. detected as combed (p/c/n + u/b)
  7547. @end table
  7548. The parenthesis at the end indicate the matches that would be used for that
  7549. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7550. @var{top}).
  7551. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7552. the slowest.
  7553. Default value is @var{pc_n}.
  7554. @item ppsrc
  7555. Mark the main input stream as a pre-processed input, and enable the secondary
  7556. input stream as the clean source to pick the fields from. See the filter
  7557. introduction for more details. It is similar to the @option{clip2} feature from
  7558. VFM/TFM.
  7559. Default value is @code{0} (disabled).
  7560. @item field
  7561. Set the field to match from. It is recommended to set this to the same value as
  7562. @option{order} unless you experience matching failures with that setting. In
  7563. certain circumstances changing the field that is used to match from can have a
  7564. large impact on matching performance. Available values are:
  7565. @table @samp
  7566. @item auto
  7567. Automatic (same value as @option{order}).
  7568. @item bottom
  7569. Match from the bottom field.
  7570. @item top
  7571. Match from the top field.
  7572. @end table
  7573. Default value is @var{auto}.
  7574. @item mchroma
  7575. Set whether or not chroma is included during the match comparisons. In most
  7576. cases it is recommended to leave this enabled. You should set this to @code{0}
  7577. only if your clip has bad chroma problems such as heavy rainbowing or other
  7578. artifacts. Setting this to @code{0} could also be used to speed things up at
  7579. the cost of some accuracy.
  7580. Default value is @code{1}.
  7581. @item y0
  7582. @item y1
  7583. These define an exclusion band which excludes the lines between @option{y0} and
  7584. @option{y1} from being included in the field matching decision. An exclusion
  7585. band can be used to ignore subtitles, a logo, or other things that may
  7586. interfere with the matching. @option{y0} sets the starting scan line and
  7587. @option{y1} sets the ending line; all lines in between @option{y0} and
  7588. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7589. @option{y0} and @option{y1} to the same value will disable the feature.
  7590. @option{y0} and @option{y1} defaults to @code{0}.
  7591. @item scthresh
  7592. Set the scene change detection threshold as a percentage of maximum change on
  7593. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7594. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7595. @option{scthresh} is @code{[0.0, 100.0]}.
  7596. Default value is @code{12.0}.
  7597. @item combmatch
  7598. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7599. account the combed scores of matches when deciding what match to use as the
  7600. final match. Available values are:
  7601. @table @samp
  7602. @item none
  7603. No final matching based on combed scores.
  7604. @item sc
  7605. Combed scores are only used when a scene change is detected.
  7606. @item full
  7607. Use combed scores all the time.
  7608. @end table
  7609. Default is @var{sc}.
  7610. @item combdbg
  7611. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7612. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7613. Available values are:
  7614. @table @samp
  7615. @item none
  7616. No forced calculation.
  7617. @item pcn
  7618. Force p/c/n calculations.
  7619. @item pcnub
  7620. Force p/c/n/u/b calculations.
  7621. @end table
  7622. Default value is @var{none}.
  7623. @item cthresh
  7624. This is the area combing threshold used for combed frame detection. This
  7625. essentially controls how "strong" or "visible" combing must be to be detected.
  7626. Larger values mean combing must be more visible and smaller values mean combing
  7627. can be less visible or strong and still be detected. Valid settings are from
  7628. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7629. be detected as combed). This is basically a pixel difference value. A good
  7630. range is @code{[8, 12]}.
  7631. Default value is @code{9}.
  7632. @item chroma
  7633. Sets whether or not chroma is considered in the combed frame decision. Only
  7634. disable this if your source has chroma problems (rainbowing, etc.) that are
  7635. causing problems for the combed frame detection with chroma enabled. Actually,
  7636. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7637. where there is chroma only combing in the source.
  7638. Default value is @code{0}.
  7639. @item blockx
  7640. @item blocky
  7641. Respectively set the x-axis and y-axis size of the window used during combed
  7642. frame detection. This has to do with the size of the area in which
  7643. @option{combpel} pixels are required to be detected as combed for a frame to be
  7644. declared combed. See the @option{combpel} parameter description for more info.
  7645. Possible values are any number that is a power of 2 starting at 4 and going up
  7646. to 512.
  7647. Default value is @code{16}.
  7648. @item combpel
  7649. The number of combed pixels inside any of the @option{blocky} by
  7650. @option{blockx} size blocks on the frame for the frame to be detected as
  7651. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7652. setting controls "how much" combing there must be in any localized area (a
  7653. window defined by the @option{blockx} and @option{blocky} settings) on the
  7654. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7655. which point no frames will ever be detected as combed). This setting is known
  7656. as @option{MI} in TFM/VFM vocabulary.
  7657. Default value is @code{80}.
  7658. @end table
  7659. @anchor{p/c/n/u/b meaning}
  7660. @subsection p/c/n/u/b meaning
  7661. @subsubsection p/c/n
  7662. We assume the following telecined stream:
  7663. @example
  7664. Top fields: 1 2 2 3 4
  7665. Bottom fields: 1 2 3 4 4
  7666. @end example
  7667. The numbers correspond to the progressive frame the fields relate to. Here, the
  7668. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7669. When @code{fieldmatch} is configured to run a matching from bottom
  7670. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7671. @example
  7672. Input stream:
  7673. T 1 2 2 3 4
  7674. B 1 2 3 4 4 <-- matching reference
  7675. Matches: c c n n c
  7676. Output stream:
  7677. T 1 2 3 4 4
  7678. B 1 2 3 4 4
  7679. @end example
  7680. As a result of the field matching, we can see that some frames get duplicated.
  7681. To perform a complete inverse telecine, you need to rely on a decimation filter
  7682. after this operation. See for instance the @ref{decimate} filter.
  7683. The same operation now matching from top fields (@option{field}=@var{top})
  7684. looks like this:
  7685. @example
  7686. Input stream:
  7687. T 1 2 2 3 4 <-- matching reference
  7688. B 1 2 3 4 4
  7689. Matches: c c p p c
  7690. Output stream:
  7691. T 1 2 2 3 4
  7692. B 1 2 2 3 4
  7693. @end example
  7694. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7695. basically, they refer to the frame and field of the opposite parity:
  7696. @itemize
  7697. @item @var{p} matches the field of the opposite parity in the previous frame
  7698. @item @var{c} matches the field of the opposite parity in the current frame
  7699. @item @var{n} matches the field of the opposite parity in the next frame
  7700. @end itemize
  7701. @subsubsection u/b
  7702. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7703. from the opposite parity flag. In the following examples, we assume that we are
  7704. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7705. 'x' is placed above and below each matched fields.
  7706. With bottom matching (@option{field}=@var{bottom}):
  7707. @example
  7708. Match: c p n b u
  7709. x x x x x
  7710. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7711. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7712. x x x x x
  7713. Output frames:
  7714. 2 1 2 2 2
  7715. 2 2 2 1 3
  7716. @end example
  7717. With top matching (@option{field}=@var{top}):
  7718. @example
  7719. Match: c p n b u
  7720. x x x x x
  7721. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7722. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7723. x x x x x
  7724. Output frames:
  7725. 2 2 2 1 2
  7726. 2 1 3 2 2
  7727. @end example
  7728. @subsection Examples
  7729. Simple IVTC of a top field first telecined stream:
  7730. @example
  7731. fieldmatch=order=tff:combmatch=none, decimate
  7732. @end example
  7733. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7734. @example
  7735. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7736. @end example
  7737. @section fieldorder
  7738. Transform the field order of the input video.
  7739. It accepts the following parameters:
  7740. @table @option
  7741. @item order
  7742. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7743. for bottom field first.
  7744. @end table
  7745. The default value is @samp{tff}.
  7746. The transformation is done by shifting the picture content up or down
  7747. by one line, and filling the remaining line with appropriate picture content.
  7748. This method is consistent with most broadcast field order converters.
  7749. If the input video is not flagged as being interlaced, or it is already
  7750. flagged as being of the required output field order, then this filter does
  7751. not alter the incoming video.
  7752. It is very useful when converting to or from PAL DV material,
  7753. which is bottom field first.
  7754. For example:
  7755. @example
  7756. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7757. @end example
  7758. @section fifo, afifo
  7759. Buffer input images and send them when they are requested.
  7760. It is mainly useful when auto-inserted by the libavfilter
  7761. framework.
  7762. It does not take parameters.
  7763. @section fillborders
  7764. Fill borders of the input video, without changing video stream dimensions.
  7765. Sometimes video can have garbage at the four edges and you may not want to
  7766. crop video input to keep size multiple of some number.
  7767. This filter accepts the following options:
  7768. @table @option
  7769. @item left
  7770. Number of pixels to fill from left border.
  7771. @item right
  7772. Number of pixels to fill from right border.
  7773. @item top
  7774. Number of pixels to fill from top border.
  7775. @item bottom
  7776. Number of pixels to fill from bottom border.
  7777. @item mode
  7778. Set fill mode.
  7779. It accepts the following values:
  7780. @table @samp
  7781. @item smear
  7782. fill pixels using outermost pixels
  7783. @item mirror
  7784. fill pixels using mirroring
  7785. @item fixed
  7786. fill pixels with constant value
  7787. @end table
  7788. Default is @var{smear}.
  7789. @item color
  7790. Set color for pixels in fixed mode. Default is @var{black}.
  7791. @end table
  7792. @section find_rect
  7793. Find a rectangular object
  7794. It accepts the following options:
  7795. @table @option
  7796. @item object
  7797. Filepath of the object image, needs to be in gray8.
  7798. @item threshold
  7799. Detection threshold, default is 0.5.
  7800. @item mipmaps
  7801. Number of mipmaps, default is 3.
  7802. @item xmin, ymin, xmax, ymax
  7803. Specifies the rectangle in which to search.
  7804. @end table
  7805. @subsection Examples
  7806. @itemize
  7807. @item
  7808. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7809. @example
  7810. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7811. @end example
  7812. @end itemize
  7813. @section cover_rect
  7814. Cover a rectangular object
  7815. It accepts the following options:
  7816. @table @option
  7817. @item cover
  7818. Filepath of the optional cover image, needs to be in yuv420.
  7819. @item mode
  7820. Set covering mode.
  7821. It accepts the following values:
  7822. @table @samp
  7823. @item cover
  7824. cover it by the supplied image
  7825. @item blur
  7826. cover it by interpolating the surrounding pixels
  7827. @end table
  7828. Default value is @var{blur}.
  7829. @end table
  7830. @subsection Examples
  7831. @itemize
  7832. @item
  7833. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7834. @example
  7835. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7836. @end example
  7837. @end itemize
  7838. @section floodfill
  7839. Flood area with values of same pixel components with another values.
  7840. It accepts the following options:
  7841. @table @option
  7842. @item x
  7843. Set pixel x coordinate.
  7844. @item y
  7845. Set pixel y coordinate.
  7846. @item s0
  7847. Set source #0 component value.
  7848. @item s1
  7849. Set source #1 component value.
  7850. @item s2
  7851. Set source #2 component value.
  7852. @item s3
  7853. Set source #3 component value.
  7854. @item d0
  7855. Set destination #0 component value.
  7856. @item d1
  7857. Set destination #1 component value.
  7858. @item d2
  7859. Set destination #2 component value.
  7860. @item d3
  7861. Set destination #3 component value.
  7862. @end table
  7863. @anchor{format}
  7864. @section format
  7865. Convert the input video to one of the specified pixel formats.
  7866. Libavfilter will try to pick one that is suitable as input to
  7867. the next filter.
  7868. It accepts the following parameters:
  7869. @table @option
  7870. @item pix_fmts
  7871. A '|'-separated list of pixel format names, such as
  7872. "pix_fmts=yuv420p|monow|rgb24".
  7873. @end table
  7874. @subsection Examples
  7875. @itemize
  7876. @item
  7877. Convert the input video to the @var{yuv420p} format
  7878. @example
  7879. format=pix_fmts=yuv420p
  7880. @end example
  7881. Convert the input video to any of the formats in the list
  7882. @example
  7883. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7884. @end example
  7885. @end itemize
  7886. @anchor{fps}
  7887. @section fps
  7888. Convert the video to specified constant frame rate by duplicating or dropping
  7889. frames as necessary.
  7890. It accepts the following parameters:
  7891. @table @option
  7892. @item fps
  7893. The desired output frame rate. The default is @code{25}.
  7894. @item start_time
  7895. Assume the first PTS should be the given value, in seconds. This allows for
  7896. padding/trimming at the start of stream. By default, no assumption is made
  7897. about the first frame's expected PTS, so no padding or trimming is done.
  7898. For example, this could be set to 0 to pad the beginning with duplicates of
  7899. the first frame if a video stream starts after the audio stream or to trim any
  7900. frames with a negative PTS.
  7901. @item round
  7902. Timestamp (PTS) rounding method.
  7903. Possible values are:
  7904. @table @option
  7905. @item zero
  7906. round towards 0
  7907. @item inf
  7908. round away from 0
  7909. @item down
  7910. round towards -infinity
  7911. @item up
  7912. round towards +infinity
  7913. @item near
  7914. round to nearest
  7915. @end table
  7916. The default is @code{near}.
  7917. @item eof_action
  7918. Action performed when reading the last frame.
  7919. Possible values are:
  7920. @table @option
  7921. @item round
  7922. Use same timestamp rounding method as used for other frames.
  7923. @item pass
  7924. Pass through last frame if input duration has not been reached yet.
  7925. @end table
  7926. The default is @code{round}.
  7927. @end table
  7928. Alternatively, the options can be specified as a flat string:
  7929. @var{fps}[:@var{start_time}[:@var{round}]].
  7930. See also the @ref{setpts} filter.
  7931. @subsection Examples
  7932. @itemize
  7933. @item
  7934. A typical usage in order to set the fps to 25:
  7935. @example
  7936. fps=fps=25
  7937. @end example
  7938. @item
  7939. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7940. @example
  7941. fps=fps=film:round=near
  7942. @end example
  7943. @end itemize
  7944. @section framepack
  7945. Pack two different video streams into a stereoscopic video, setting proper
  7946. metadata on supported codecs. The two views should have the same size and
  7947. framerate and processing will stop when the shorter video ends. Please note
  7948. that you may conveniently adjust view properties with the @ref{scale} and
  7949. @ref{fps} filters.
  7950. It accepts the following parameters:
  7951. @table @option
  7952. @item format
  7953. The desired packing format. Supported values are:
  7954. @table @option
  7955. @item sbs
  7956. The views are next to each other (default).
  7957. @item tab
  7958. The views are on top of each other.
  7959. @item lines
  7960. The views are packed by line.
  7961. @item columns
  7962. The views are packed by column.
  7963. @item frameseq
  7964. The views are temporally interleaved.
  7965. @end table
  7966. @end table
  7967. Some examples:
  7968. @example
  7969. # Convert left and right views into a frame-sequential video
  7970. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7971. # Convert views into a side-by-side video with the same output resolution as the input
  7972. 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
  7973. @end example
  7974. @section framerate
  7975. Change the frame rate by interpolating new video output frames from the source
  7976. frames.
  7977. This filter is not designed to function correctly with interlaced media. If
  7978. you wish to change the frame rate of interlaced media then you are required
  7979. to deinterlace before this filter and re-interlace after this filter.
  7980. A description of the accepted options follows.
  7981. @table @option
  7982. @item fps
  7983. Specify the output frames per second. This option can also be specified
  7984. as a value alone. The default is @code{50}.
  7985. @item interp_start
  7986. Specify the start of a range where the output frame will be created as a
  7987. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7988. the default is @code{15}.
  7989. @item interp_end
  7990. Specify the end of a range where the output frame will be created as a
  7991. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7992. the default is @code{240}.
  7993. @item scene
  7994. Specify the level at which a scene change is detected as a value between
  7995. 0 and 100 to indicate a new scene; a low value reflects a low
  7996. probability for the current frame to introduce a new scene, while a higher
  7997. value means the current frame is more likely to be one.
  7998. The default is @code{8.2}.
  7999. @item flags
  8000. Specify flags influencing the filter process.
  8001. Available value for @var{flags} is:
  8002. @table @option
  8003. @item scene_change_detect, scd
  8004. Enable scene change detection using the value of the option @var{scene}.
  8005. This flag is enabled by default.
  8006. @end table
  8007. @end table
  8008. @section framestep
  8009. Select one frame every N-th frame.
  8010. This filter accepts the following option:
  8011. @table @option
  8012. @item step
  8013. Select frame after every @code{step} frames.
  8014. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8015. @end table
  8016. @section freezedetect
  8017. Detect frozen video.
  8018. This filter logs a message and sets frame metadata when it detects that the
  8019. input video has no significant change in content during a specified duration.
  8020. Video freeze detection calculates the mean average absolute difference of all
  8021. the components of video frames and compares it to a noise floor.
  8022. The printed times and duration are expressed in seconds. The
  8023. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8024. whose timestamp equals or exceeds the detection duration and it contains the
  8025. timestamp of the first frame of the freeze. The
  8026. @code{lavfi.freezedetect.freeze_duration} and
  8027. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8028. after the freeze.
  8029. The filter accepts the following options:
  8030. @table @option
  8031. @item noise, n
  8032. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8033. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8034. 0.001.
  8035. @item duration, d
  8036. Set freeze duration until notification (default is 2 seconds).
  8037. @end table
  8038. @anchor{frei0r}
  8039. @section frei0r
  8040. Apply a frei0r effect to the input video.
  8041. To enable the compilation of this filter, you need to install the frei0r
  8042. header and configure FFmpeg with @code{--enable-frei0r}.
  8043. It accepts the following parameters:
  8044. @table @option
  8045. @item filter_name
  8046. The name of the frei0r effect to load. If the environment variable
  8047. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8048. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8049. Otherwise, the standard frei0r paths are searched, in this order:
  8050. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8051. @file{/usr/lib/frei0r-1/}.
  8052. @item filter_params
  8053. A '|'-separated list of parameters to pass to the frei0r effect.
  8054. @end table
  8055. A frei0r effect parameter can be a boolean (its value is either
  8056. "y" or "n"), a double, a color (specified as
  8057. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8058. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8059. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8060. a position (specified as @var{X}/@var{Y}, where
  8061. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8062. The number and types of parameters depend on the loaded effect. If an
  8063. effect parameter is not specified, the default value is set.
  8064. @subsection Examples
  8065. @itemize
  8066. @item
  8067. Apply the distort0r effect, setting the first two double parameters:
  8068. @example
  8069. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8070. @end example
  8071. @item
  8072. Apply the colordistance effect, taking a color as the first parameter:
  8073. @example
  8074. frei0r=colordistance:0.2/0.3/0.4
  8075. frei0r=colordistance:violet
  8076. frei0r=colordistance:0x112233
  8077. @end example
  8078. @item
  8079. Apply the perspective effect, specifying the top left and top right image
  8080. positions:
  8081. @example
  8082. frei0r=perspective:0.2/0.2|0.8/0.2
  8083. @end example
  8084. @end itemize
  8085. For more information, see
  8086. @url{http://frei0r.dyne.org}
  8087. @section fspp
  8088. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8089. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8090. processing filter, one of them is performed once per block, not per pixel.
  8091. This allows for much higher speed.
  8092. The filter accepts the following options:
  8093. @table @option
  8094. @item quality
  8095. Set quality. This option defines the number of levels for averaging. It accepts
  8096. an integer in the range 4-5. Default value is @code{4}.
  8097. @item qp
  8098. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8099. If not set, the filter will use the QP from the video stream (if available).
  8100. @item strength
  8101. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8102. more details but also more artifacts, while higher values make the image smoother
  8103. but also blurrier. Default value is @code{0} − PSNR optimal.
  8104. @item use_bframe_qp
  8105. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8106. option may cause flicker since the B-Frames have often larger QP. Default is
  8107. @code{0} (not enabled).
  8108. @end table
  8109. @section gblur
  8110. Apply Gaussian blur filter.
  8111. The filter accepts the following options:
  8112. @table @option
  8113. @item sigma
  8114. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8115. @item steps
  8116. Set number of steps for Gaussian approximation. Default is @code{1}.
  8117. @item planes
  8118. Set which planes to filter. By default all planes are filtered.
  8119. @item sigmaV
  8120. Set vertical sigma, if negative it will be same as @code{sigma}.
  8121. Default is @code{-1}.
  8122. @end table
  8123. @section geq
  8124. Apply generic equation to each pixel.
  8125. The filter accepts the following options:
  8126. @table @option
  8127. @item lum_expr, lum
  8128. Set the luminance expression.
  8129. @item cb_expr, cb
  8130. Set the chrominance blue expression.
  8131. @item cr_expr, cr
  8132. Set the chrominance red expression.
  8133. @item alpha_expr, a
  8134. Set the alpha expression.
  8135. @item red_expr, r
  8136. Set the red expression.
  8137. @item green_expr, g
  8138. Set the green expression.
  8139. @item blue_expr, b
  8140. Set the blue expression.
  8141. @end table
  8142. The colorspace is selected according to the specified options. If one
  8143. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8144. options is specified, the filter will automatically select a YCbCr
  8145. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8146. @option{blue_expr} options is specified, it will select an RGB
  8147. colorspace.
  8148. If one of the chrominance expression is not defined, it falls back on the other
  8149. one. If no alpha expression is specified it will evaluate to opaque value.
  8150. If none of chrominance expressions are specified, they will evaluate
  8151. to the luminance expression.
  8152. The expressions can use the following variables and functions:
  8153. @table @option
  8154. @item N
  8155. The sequential number of the filtered frame, starting from @code{0}.
  8156. @item X
  8157. @item Y
  8158. The coordinates of the current sample.
  8159. @item W
  8160. @item H
  8161. The width and height of the image.
  8162. @item SW
  8163. @item SH
  8164. Width and height scale depending on the currently filtered plane. It is the
  8165. ratio between the corresponding luma plane number of pixels and the current
  8166. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8167. @code{0.5,0.5} for chroma planes.
  8168. @item T
  8169. Time of the current frame, expressed in seconds.
  8170. @item p(x, y)
  8171. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8172. plane.
  8173. @item lum(x, y)
  8174. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8175. plane.
  8176. @item cb(x, y)
  8177. Return the value of the pixel at location (@var{x},@var{y}) of the
  8178. blue-difference chroma plane. Return 0 if there is no such plane.
  8179. @item cr(x, y)
  8180. Return the value of the pixel at location (@var{x},@var{y}) of the
  8181. red-difference chroma plane. Return 0 if there is no such plane.
  8182. @item r(x, y)
  8183. @item g(x, y)
  8184. @item b(x, y)
  8185. Return the value of the pixel at location (@var{x},@var{y}) of the
  8186. red/green/blue component. Return 0 if there is no such component.
  8187. @item alpha(x, y)
  8188. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8189. plane. Return 0 if there is no such plane.
  8190. @end table
  8191. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8192. automatically clipped to the closer edge.
  8193. @subsection Examples
  8194. @itemize
  8195. @item
  8196. Flip the image horizontally:
  8197. @example
  8198. geq=p(W-X\,Y)
  8199. @end example
  8200. @item
  8201. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8202. wavelength of 100 pixels:
  8203. @example
  8204. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8205. @end example
  8206. @item
  8207. Generate a fancy enigmatic moving light:
  8208. @example
  8209. 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
  8210. @end example
  8211. @item
  8212. Generate a quick emboss effect:
  8213. @example
  8214. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8215. @end example
  8216. @item
  8217. Modify RGB components depending on pixel position:
  8218. @example
  8219. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8220. @end example
  8221. @item
  8222. Create a radial gradient that is the same size as the input (also see
  8223. the @ref{vignette} filter):
  8224. @example
  8225. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8226. @end example
  8227. @end itemize
  8228. @section gradfun
  8229. Fix the banding artifacts that are sometimes introduced into nearly flat
  8230. regions by truncation to 8-bit color depth.
  8231. Interpolate the gradients that should go where the bands are, and
  8232. dither them.
  8233. It is designed for playback only. Do not use it prior to
  8234. lossy compression, because compression tends to lose the dither and
  8235. bring back the bands.
  8236. It accepts the following parameters:
  8237. @table @option
  8238. @item strength
  8239. The maximum amount by which the filter will change any one pixel. This is also
  8240. the threshold for detecting nearly flat regions. Acceptable values range from
  8241. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8242. valid range.
  8243. @item radius
  8244. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8245. gradients, but also prevents the filter from modifying the pixels near detailed
  8246. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8247. values will be clipped to the valid range.
  8248. @end table
  8249. Alternatively, the options can be specified as a flat string:
  8250. @var{strength}[:@var{radius}]
  8251. @subsection Examples
  8252. @itemize
  8253. @item
  8254. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8255. @example
  8256. gradfun=3.5:8
  8257. @end example
  8258. @item
  8259. Specify radius, omitting the strength (which will fall-back to the default
  8260. value):
  8261. @example
  8262. gradfun=radius=8
  8263. @end example
  8264. @end itemize
  8265. @section graphmonitor, agraphmonitor
  8266. Show various filtergraph stats.
  8267. With this filter one can debug complete filtergraph.
  8268. Especially issues with links filling with queued frames.
  8269. The filter accepts the following options:
  8270. @table @option
  8271. @item size, s
  8272. Set video output size. Default is @var{hd720}.
  8273. @item opacity, o
  8274. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8275. @item mode, m
  8276. Set output mode, can be @var{fulll} or @var{compact}.
  8277. In @var{compact} mode only filters with some queued frames have displayed stats.
  8278. @item flags, f
  8279. Set flags which enable which stats are shown in video.
  8280. Available values for flags are:
  8281. @table @samp
  8282. @item queue
  8283. Display number of queued frames in each link.
  8284. @item frame_count_in
  8285. Display number of frames taken from filter.
  8286. @item frame_count_out
  8287. Display number of frames given out from filter.
  8288. @item pts
  8289. Display current filtered frame pts.
  8290. @item time
  8291. Display current filtered frame time.
  8292. @item timebase
  8293. Display time base for filter link.
  8294. @item format
  8295. Display used format for filter link.
  8296. @item size
  8297. Display video size or number of audio channels in case of audio used by filter link.
  8298. @item rate
  8299. Display video frame rate or sample rate in case of audio used by filter link.
  8300. @end table
  8301. @item rate, r
  8302. Set upper limit for video rate of output stream, Default value is @var{25}.
  8303. This guarantee that output video frame rate will not be higher than this value.
  8304. @end table
  8305. @section greyedge
  8306. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8307. and corrects the scene colors accordingly.
  8308. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8309. The filter accepts the following options:
  8310. @table @option
  8311. @item difford
  8312. The order of differentiation to be applied on the scene. Must be chosen in the range
  8313. [0,2] and default value is 1.
  8314. @item minknorm
  8315. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8316. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8317. max value instead of calculating Minkowski distance.
  8318. @item sigma
  8319. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8320. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8321. can't be equal to 0 if @var{difford} is greater than 0.
  8322. @end table
  8323. @subsection Examples
  8324. @itemize
  8325. @item
  8326. Grey Edge:
  8327. @example
  8328. greyedge=difford=1:minknorm=5:sigma=2
  8329. @end example
  8330. @item
  8331. Max Edge:
  8332. @example
  8333. greyedge=difford=1:minknorm=0:sigma=2
  8334. @end example
  8335. @end itemize
  8336. @anchor{haldclut}
  8337. @section haldclut
  8338. Apply a Hald CLUT to a video stream.
  8339. First input is the video stream to process, and second one is the Hald CLUT.
  8340. The Hald CLUT input can be a simple picture or a complete video stream.
  8341. The filter accepts the following options:
  8342. @table @option
  8343. @item shortest
  8344. Force termination when the shortest input terminates. Default is @code{0}.
  8345. @item repeatlast
  8346. Continue applying the last CLUT after the end of the stream. A value of
  8347. @code{0} disable the filter after the last frame of the CLUT is reached.
  8348. Default is @code{1}.
  8349. @end table
  8350. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8351. filters share the same internals).
  8352. This filter also supports the @ref{framesync} options.
  8353. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8354. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8355. @subsection Workflow examples
  8356. @subsubsection Hald CLUT video stream
  8357. Generate an identity Hald CLUT stream altered with various effects:
  8358. @example
  8359. 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
  8360. @end example
  8361. Note: make sure you use a lossless codec.
  8362. Then use it with @code{haldclut} to apply it on some random stream:
  8363. @example
  8364. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8365. @end example
  8366. The Hald CLUT will be applied to the 10 first seconds (duration of
  8367. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8368. to the remaining frames of the @code{mandelbrot} stream.
  8369. @subsubsection Hald CLUT with preview
  8370. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8371. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8372. biggest possible square starting at the top left of the picture. The remaining
  8373. padding pixels (bottom or right) will be ignored. This area can be used to add
  8374. a preview of the Hald CLUT.
  8375. Typically, the following generated Hald CLUT will be supported by the
  8376. @code{haldclut} filter:
  8377. @example
  8378. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8379. pad=iw+320 [padded_clut];
  8380. smptebars=s=320x256, split [a][b];
  8381. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8382. [main][b] overlay=W-320" -frames:v 1 clut.png
  8383. @end example
  8384. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8385. bars are displayed on the right-top, and below the same color bars processed by
  8386. the color changes.
  8387. Then, the effect of this Hald CLUT can be visualized with:
  8388. @example
  8389. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8390. @end example
  8391. @section hflip
  8392. Flip the input video horizontally.
  8393. For example, to horizontally flip the input video with @command{ffmpeg}:
  8394. @example
  8395. ffmpeg -i in.avi -vf "hflip" out.avi
  8396. @end example
  8397. @section histeq
  8398. This filter applies a global color histogram equalization on a
  8399. per-frame basis.
  8400. It can be used to correct video that has a compressed range of pixel
  8401. intensities. The filter redistributes the pixel intensities to
  8402. equalize their distribution across the intensity range. It may be
  8403. viewed as an "automatically adjusting contrast filter". This filter is
  8404. useful only for correcting degraded or poorly captured source
  8405. video.
  8406. The filter accepts the following options:
  8407. @table @option
  8408. @item strength
  8409. Determine the amount of equalization to be applied. As the strength
  8410. is reduced, the distribution of pixel intensities more-and-more
  8411. approaches that of the input frame. The value must be a float number
  8412. in the range [0,1] and defaults to 0.200.
  8413. @item intensity
  8414. Set the maximum intensity that can generated and scale the output
  8415. values appropriately. The strength should be set as desired and then
  8416. the intensity can be limited if needed to avoid washing-out. The value
  8417. must be a float number in the range [0,1] and defaults to 0.210.
  8418. @item antibanding
  8419. Set the antibanding level. If enabled the filter will randomly vary
  8420. the luminance of output pixels by a small amount to avoid banding of
  8421. the histogram. Possible values are @code{none}, @code{weak} or
  8422. @code{strong}. It defaults to @code{none}.
  8423. @end table
  8424. @section histogram
  8425. Compute and draw a color distribution histogram for the input video.
  8426. The computed histogram is a representation of the color component
  8427. distribution in an image.
  8428. Standard histogram displays the color components distribution in an image.
  8429. Displays color graph for each color component. Shows distribution of
  8430. the Y, U, V, A or R, G, B components, depending on input format, in the
  8431. current frame. Below each graph a color component scale meter is shown.
  8432. The filter accepts the following options:
  8433. @table @option
  8434. @item level_height
  8435. Set height of level. Default value is @code{200}.
  8436. Allowed range is [50, 2048].
  8437. @item scale_height
  8438. Set height of color scale. Default value is @code{12}.
  8439. Allowed range is [0, 40].
  8440. @item display_mode
  8441. Set display mode.
  8442. It accepts the following values:
  8443. @table @samp
  8444. @item stack
  8445. Per color component graphs are placed below each other.
  8446. @item parade
  8447. Per color component graphs are placed side by side.
  8448. @item overlay
  8449. Presents information identical to that in the @code{parade}, except
  8450. that the graphs representing color components are superimposed directly
  8451. over one another.
  8452. @end table
  8453. Default is @code{stack}.
  8454. @item levels_mode
  8455. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8456. Default is @code{linear}.
  8457. @item components
  8458. Set what color components to display.
  8459. Default is @code{7}.
  8460. @item fgopacity
  8461. Set foreground opacity. Default is @code{0.7}.
  8462. @item bgopacity
  8463. Set background opacity. Default is @code{0.5}.
  8464. @end table
  8465. @subsection Examples
  8466. @itemize
  8467. @item
  8468. Calculate and draw histogram:
  8469. @example
  8470. ffplay -i input -vf histogram
  8471. @end example
  8472. @end itemize
  8473. @anchor{hqdn3d}
  8474. @section hqdn3d
  8475. This is a high precision/quality 3d denoise filter. It aims to reduce
  8476. image noise, producing smooth images and making still images really
  8477. still. It should enhance compressibility.
  8478. It accepts the following optional parameters:
  8479. @table @option
  8480. @item luma_spatial
  8481. A non-negative floating point number which specifies spatial luma strength.
  8482. It defaults to 4.0.
  8483. @item chroma_spatial
  8484. A non-negative floating point number which specifies spatial chroma strength.
  8485. It defaults to 3.0*@var{luma_spatial}/4.0.
  8486. @item luma_tmp
  8487. A floating point number which specifies luma temporal strength. It defaults to
  8488. 6.0*@var{luma_spatial}/4.0.
  8489. @item chroma_tmp
  8490. A floating point number which specifies chroma temporal strength. It defaults to
  8491. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8492. @end table
  8493. @anchor{hwdownload}
  8494. @section hwdownload
  8495. Download hardware frames to system memory.
  8496. The input must be in hardware frames, and the output a non-hardware format.
  8497. Not all formats will be supported on the output - it may be necessary to insert
  8498. an additional @option{format} filter immediately following in the graph to get
  8499. the output in a supported format.
  8500. @section hwmap
  8501. Map hardware frames to system memory or to another device.
  8502. This filter has several different modes of operation; which one is used depends
  8503. on the input and output formats:
  8504. @itemize
  8505. @item
  8506. Hardware frame input, normal frame output
  8507. Map the input frames to system memory and pass them to the output. If the
  8508. original hardware frame is later required (for example, after overlaying
  8509. something else on part of it), the @option{hwmap} filter can be used again
  8510. in the next mode to retrieve it.
  8511. @item
  8512. Normal frame input, hardware frame output
  8513. If the input is actually a software-mapped hardware frame, then unmap it -
  8514. that is, return the original hardware frame.
  8515. Otherwise, a device must be provided. Create new hardware surfaces on that
  8516. device for the output, then map them back to the software format at the input
  8517. and give those frames to the preceding filter. This will then act like the
  8518. @option{hwupload} filter, but may be able to avoid an additional copy when
  8519. the input is already in a compatible format.
  8520. @item
  8521. Hardware frame input and output
  8522. A device must be supplied for the output, either directly or with the
  8523. @option{derive_device} option. The input and output devices must be of
  8524. different types and compatible - the exact meaning of this is
  8525. system-dependent, but typically it means that they must refer to the same
  8526. underlying hardware context (for example, refer to the same graphics card).
  8527. If the input frames were originally created on the output device, then unmap
  8528. to retrieve the original frames.
  8529. Otherwise, map the frames to the output device - create new hardware frames
  8530. on the output corresponding to the frames on the input.
  8531. @end itemize
  8532. The following additional parameters are accepted:
  8533. @table @option
  8534. @item mode
  8535. Set the frame mapping mode. Some combination of:
  8536. @table @var
  8537. @item read
  8538. The mapped frame should be readable.
  8539. @item write
  8540. The mapped frame should be writeable.
  8541. @item overwrite
  8542. The mapping will always overwrite the entire frame.
  8543. This may improve performance in some cases, as the original contents of the
  8544. frame need not be loaded.
  8545. @item direct
  8546. The mapping must not involve any copying.
  8547. Indirect mappings to copies of frames are created in some cases where either
  8548. direct mapping is not possible or it would have unexpected properties.
  8549. Setting this flag ensures that the mapping is direct and will fail if that is
  8550. not possible.
  8551. @end table
  8552. Defaults to @var{read+write} if not specified.
  8553. @item derive_device @var{type}
  8554. Rather than using the device supplied at initialisation, instead derive a new
  8555. device of type @var{type} from the device the input frames exist on.
  8556. @item reverse
  8557. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8558. and map them back to the source. This may be necessary in some cases where
  8559. a mapping in one direction is required but only the opposite direction is
  8560. supported by the devices being used.
  8561. This option is dangerous - it may break the preceding filter in undefined
  8562. ways if there are any additional constraints on that filter's output.
  8563. Do not use it without fully understanding the implications of its use.
  8564. @end table
  8565. @anchor{hwupload}
  8566. @section hwupload
  8567. Upload system memory frames to hardware surfaces.
  8568. The device to upload to must be supplied when the filter is initialised. If
  8569. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8570. option.
  8571. @anchor{hwupload_cuda}
  8572. @section hwupload_cuda
  8573. Upload system memory frames to a CUDA device.
  8574. It accepts the following optional parameters:
  8575. @table @option
  8576. @item device
  8577. The number of the CUDA device to use
  8578. @end table
  8579. @section hqx
  8580. Apply a high-quality magnification filter designed for pixel art. This filter
  8581. was originally created by Maxim Stepin.
  8582. It accepts the following option:
  8583. @table @option
  8584. @item n
  8585. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8586. @code{hq3x} and @code{4} for @code{hq4x}.
  8587. Default is @code{3}.
  8588. @end table
  8589. @section hstack
  8590. Stack input videos horizontally.
  8591. All streams must be of same pixel format and of same height.
  8592. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8593. to create same output.
  8594. The filter accept the following option:
  8595. @table @option
  8596. @item inputs
  8597. Set number of input streams. Default is 2.
  8598. @item shortest
  8599. If set to 1, force the output to terminate when the shortest input
  8600. terminates. Default value is 0.
  8601. @end table
  8602. @section hue
  8603. Modify the hue and/or the saturation of the input.
  8604. It accepts the following parameters:
  8605. @table @option
  8606. @item h
  8607. Specify the hue angle as a number of degrees. It accepts an expression,
  8608. and defaults to "0".
  8609. @item s
  8610. Specify the saturation in the [-10,10] range. It accepts an expression and
  8611. defaults to "1".
  8612. @item H
  8613. Specify the hue angle as a number of radians. It accepts an
  8614. expression, and defaults to "0".
  8615. @item b
  8616. Specify the brightness in the [-10,10] range. It accepts an expression and
  8617. defaults to "0".
  8618. @end table
  8619. @option{h} and @option{H} are mutually exclusive, and can't be
  8620. specified at the same time.
  8621. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8622. expressions containing the following constants:
  8623. @table @option
  8624. @item n
  8625. frame count of the input frame starting from 0
  8626. @item pts
  8627. presentation timestamp of the input frame expressed in time base units
  8628. @item r
  8629. frame rate of the input video, NAN if the input frame rate is unknown
  8630. @item t
  8631. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8632. @item tb
  8633. time base of the input video
  8634. @end table
  8635. @subsection Examples
  8636. @itemize
  8637. @item
  8638. Set the hue to 90 degrees and the saturation to 1.0:
  8639. @example
  8640. hue=h=90:s=1
  8641. @end example
  8642. @item
  8643. Same command but expressing the hue in radians:
  8644. @example
  8645. hue=H=PI/2:s=1
  8646. @end example
  8647. @item
  8648. Rotate hue and make the saturation swing between 0
  8649. and 2 over a period of 1 second:
  8650. @example
  8651. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8652. @end example
  8653. @item
  8654. Apply a 3 seconds saturation fade-in effect starting at 0:
  8655. @example
  8656. hue="s=min(t/3\,1)"
  8657. @end example
  8658. The general fade-in expression can be written as:
  8659. @example
  8660. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8661. @end example
  8662. @item
  8663. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8664. @example
  8665. hue="s=max(0\, min(1\, (8-t)/3))"
  8666. @end example
  8667. The general fade-out expression can be written as:
  8668. @example
  8669. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8670. @end example
  8671. @end itemize
  8672. @subsection Commands
  8673. This filter supports the following commands:
  8674. @table @option
  8675. @item b
  8676. @item s
  8677. @item h
  8678. @item H
  8679. Modify the hue and/or the saturation and/or brightness of the input video.
  8680. The command accepts the same syntax of the corresponding option.
  8681. If the specified expression is not valid, it is kept at its current
  8682. value.
  8683. @end table
  8684. @section hysteresis
  8685. Grow first stream into second stream by connecting components.
  8686. This makes it possible to build more robust edge masks.
  8687. This filter accepts the following options:
  8688. @table @option
  8689. @item planes
  8690. Set which planes will be processed as bitmap, unprocessed planes will be
  8691. copied from first stream.
  8692. By default value 0xf, all planes will be processed.
  8693. @item threshold
  8694. Set threshold which is used in filtering. If pixel component value is higher than
  8695. this value filter algorithm for connecting components is activated.
  8696. By default value is 0.
  8697. @end table
  8698. @section idet
  8699. Detect video interlacing type.
  8700. This filter tries to detect if the input frames are interlaced, progressive,
  8701. top or bottom field first. It will also try to detect fields that are
  8702. repeated between adjacent frames (a sign of telecine).
  8703. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8704. Multiple frame detection incorporates the classification history of previous frames.
  8705. The filter will log these metadata values:
  8706. @table @option
  8707. @item single.current_frame
  8708. Detected type of current frame using single-frame detection. One of:
  8709. ``tff'' (top field first), ``bff'' (bottom field first),
  8710. ``progressive'', or ``undetermined''
  8711. @item single.tff
  8712. Cumulative number of frames detected as top field first using single-frame detection.
  8713. @item multiple.tff
  8714. Cumulative number of frames detected as top field first using multiple-frame detection.
  8715. @item single.bff
  8716. Cumulative number of frames detected as bottom field first using single-frame detection.
  8717. @item multiple.current_frame
  8718. Detected type of current frame using multiple-frame detection. One of:
  8719. ``tff'' (top field first), ``bff'' (bottom field first),
  8720. ``progressive'', or ``undetermined''
  8721. @item multiple.bff
  8722. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8723. @item single.progressive
  8724. Cumulative number of frames detected as progressive using single-frame detection.
  8725. @item multiple.progressive
  8726. Cumulative number of frames detected as progressive using multiple-frame detection.
  8727. @item single.undetermined
  8728. Cumulative number of frames that could not be classified using single-frame detection.
  8729. @item multiple.undetermined
  8730. Cumulative number of frames that could not be classified using multiple-frame detection.
  8731. @item repeated.current_frame
  8732. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8733. @item repeated.neither
  8734. Cumulative number of frames with no repeated field.
  8735. @item repeated.top
  8736. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8737. @item repeated.bottom
  8738. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8739. @end table
  8740. The filter accepts the following options:
  8741. @table @option
  8742. @item intl_thres
  8743. Set interlacing threshold.
  8744. @item prog_thres
  8745. Set progressive threshold.
  8746. @item rep_thres
  8747. Threshold for repeated field detection.
  8748. @item half_life
  8749. Number of frames after which a given frame's contribution to the
  8750. statistics is halved (i.e., it contributes only 0.5 to its
  8751. classification). The default of 0 means that all frames seen are given
  8752. full weight of 1.0 forever.
  8753. @item analyze_interlaced_flag
  8754. When this is not 0 then idet will use the specified number of frames to determine
  8755. if the interlaced flag is accurate, it will not count undetermined frames.
  8756. If the flag is found to be accurate it will be used without any further
  8757. computations, if it is found to be inaccurate it will be cleared without any
  8758. further computations. This allows inserting the idet filter as a low computational
  8759. method to clean up the interlaced flag
  8760. @end table
  8761. @section il
  8762. Deinterleave or interleave fields.
  8763. This filter allows one to process interlaced images fields without
  8764. deinterlacing them. Deinterleaving splits the input frame into 2
  8765. fields (so called half pictures). Odd lines are moved to the top
  8766. half of the output image, even lines to the bottom half.
  8767. You can process (filter) them independently and then re-interleave them.
  8768. The filter accepts the following options:
  8769. @table @option
  8770. @item luma_mode, l
  8771. @item chroma_mode, c
  8772. @item alpha_mode, a
  8773. Available values for @var{luma_mode}, @var{chroma_mode} and
  8774. @var{alpha_mode} are:
  8775. @table @samp
  8776. @item none
  8777. Do nothing.
  8778. @item deinterleave, d
  8779. Deinterleave fields, placing one above the other.
  8780. @item interleave, i
  8781. Interleave fields. Reverse the effect of deinterleaving.
  8782. @end table
  8783. Default value is @code{none}.
  8784. @item luma_swap, ls
  8785. @item chroma_swap, cs
  8786. @item alpha_swap, as
  8787. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8788. @end table
  8789. @section inflate
  8790. Apply inflate effect to the video.
  8791. This filter replaces the pixel by the local(3x3) average by taking into account
  8792. only values higher than the pixel.
  8793. It accepts the following options:
  8794. @table @option
  8795. @item threshold0
  8796. @item threshold1
  8797. @item threshold2
  8798. @item threshold3
  8799. Limit the maximum change for each plane, default is 65535.
  8800. If 0, plane will remain unchanged.
  8801. @end table
  8802. @section interlace
  8803. Simple interlacing filter from progressive contents. This interleaves upper (or
  8804. lower) lines from odd frames with lower (or upper) lines from even frames,
  8805. halving the frame rate and preserving image height.
  8806. @example
  8807. Original Original New Frame
  8808. Frame 'j' Frame 'j+1' (tff)
  8809. ========== =========== ==================
  8810. Line 0 --------------------> Frame 'j' Line 0
  8811. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8812. Line 2 ---------------------> Frame 'j' Line 2
  8813. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8814. ... ... ...
  8815. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8816. @end example
  8817. It accepts the following optional parameters:
  8818. @table @option
  8819. @item scan
  8820. This determines whether the interlaced frame is taken from the even
  8821. (tff - default) or odd (bff) lines of the progressive frame.
  8822. @item lowpass
  8823. Vertical lowpass filter to avoid twitter interlacing and
  8824. reduce moire patterns.
  8825. @table @samp
  8826. @item 0, off
  8827. Disable vertical lowpass filter
  8828. @item 1, linear
  8829. Enable linear filter (default)
  8830. @item 2, complex
  8831. Enable complex filter. This will slightly less reduce twitter and moire
  8832. but better retain detail and subjective sharpness impression.
  8833. @end table
  8834. @end table
  8835. @section kerndeint
  8836. Deinterlace input video by applying Donald Graft's adaptive kernel
  8837. deinterling. Work on interlaced parts of a video to produce
  8838. progressive frames.
  8839. The description of the accepted parameters follows.
  8840. @table @option
  8841. @item thresh
  8842. Set the threshold which affects the filter's tolerance when
  8843. determining if a pixel line must be processed. It must be an integer
  8844. in the range [0,255] and defaults to 10. A value of 0 will result in
  8845. applying the process on every pixels.
  8846. @item map
  8847. Paint pixels exceeding the threshold value to white if set to 1.
  8848. Default is 0.
  8849. @item order
  8850. Set the fields order. Swap fields if set to 1, leave fields alone if
  8851. 0. Default is 0.
  8852. @item sharp
  8853. Enable additional sharpening if set to 1. Default is 0.
  8854. @item twoway
  8855. Enable twoway sharpening if set to 1. Default is 0.
  8856. @end table
  8857. @subsection Examples
  8858. @itemize
  8859. @item
  8860. Apply default values:
  8861. @example
  8862. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8863. @end example
  8864. @item
  8865. Enable additional sharpening:
  8866. @example
  8867. kerndeint=sharp=1
  8868. @end example
  8869. @item
  8870. Paint processed pixels in white:
  8871. @example
  8872. kerndeint=map=1
  8873. @end example
  8874. @end itemize
  8875. @section lagfun
  8876. Slowly update darker pixels.
  8877. This filter makes short flashes of light appear longer.
  8878. This filter accepts the following options:
  8879. @table @option
  8880. @item decay
  8881. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8882. @item planes
  8883. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8884. @end table
  8885. @section lenscorrection
  8886. Correct radial lens distortion
  8887. This filter can be used to correct for radial distortion as can result from the use
  8888. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8889. one can use tools available for example as part of opencv or simply trial-and-error.
  8890. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8891. and extract the k1 and k2 coefficients from the resulting matrix.
  8892. Note that effectively the same filter is available in the open-source tools Krita and
  8893. Digikam from the KDE project.
  8894. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8895. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8896. brightness distribution, so you may want to use both filters together in certain
  8897. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8898. be applied before or after lens correction.
  8899. @subsection Options
  8900. The filter accepts the following options:
  8901. @table @option
  8902. @item cx
  8903. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8904. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8905. width. Default is 0.5.
  8906. @item cy
  8907. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8908. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8909. height. Default is 0.5.
  8910. @item k1
  8911. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8912. no correction. Default is 0.
  8913. @item k2
  8914. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8915. 0 means no correction. Default is 0.
  8916. @end table
  8917. The formula that generates the correction is:
  8918. @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)
  8919. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8920. distances from the focal point in the source and target images, respectively.
  8921. @section lensfun
  8922. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8923. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8924. to apply the lens correction. The filter will load the lensfun database and
  8925. query it to find the corresponding camera and lens entries in the database. As
  8926. long as these entries can be found with the given options, the filter can
  8927. perform corrections on frames. Note that incomplete strings will result in the
  8928. filter choosing the best match with the given options, and the filter will
  8929. output the chosen camera and lens models (logged with level "info"). You must
  8930. provide the make, camera model, and lens model as they are required.
  8931. The filter accepts the following options:
  8932. @table @option
  8933. @item make
  8934. The make of the camera (for example, "Canon"). This option is required.
  8935. @item model
  8936. The model of the camera (for example, "Canon EOS 100D"). This option is
  8937. required.
  8938. @item lens_model
  8939. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8940. option is required.
  8941. @item mode
  8942. The type of correction to apply. The following values are valid options:
  8943. @table @samp
  8944. @item vignetting
  8945. Enables fixing lens vignetting.
  8946. @item geometry
  8947. Enables fixing lens geometry. This is the default.
  8948. @item subpixel
  8949. Enables fixing chromatic aberrations.
  8950. @item vig_geo
  8951. Enables fixing lens vignetting and lens geometry.
  8952. @item vig_subpixel
  8953. Enables fixing lens vignetting and chromatic aberrations.
  8954. @item distortion
  8955. Enables fixing both lens geometry and chromatic aberrations.
  8956. @item all
  8957. Enables all possible corrections.
  8958. @end table
  8959. @item focal_length
  8960. The focal length of the image/video (zoom; expected constant for video). For
  8961. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8962. range should be chosen when using that lens. Default 18.
  8963. @item aperture
  8964. The aperture of the image/video (expected constant for video). Note that
  8965. aperture is only used for vignetting correction. Default 3.5.
  8966. @item focus_distance
  8967. The focus distance of the image/video (expected constant for video). Note that
  8968. focus distance is only used for vignetting and only slightly affects the
  8969. vignetting correction process. If unknown, leave it at the default value (which
  8970. is 1000).
  8971. @item scale
  8972. The scale factor which is applied after transformation. After correction the
  8973. video is no longer necessarily rectangular. This parameter controls how much of
  8974. the resulting image is visible. The value 0 means that a value will be chosen
  8975. automatically such that there is little or no unmapped area in the output
  8976. image. 1.0 means that no additional scaling is done. Lower values may result
  8977. in more of the corrected image being visible, while higher values may avoid
  8978. unmapped areas in the output.
  8979. @item target_geometry
  8980. The target geometry of the output image/video. The following values are valid
  8981. options:
  8982. @table @samp
  8983. @item rectilinear (default)
  8984. @item fisheye
  8985. @item panoramic
  8986. @item equirectangular
  8987. @item fisheye_orthographic
  8988. @item fisheye_stereographic
  8989. @item fisheye_equisolid
  8990. @item fisheye_thoby
  8991. @end table
  8992. @item reverse
  8993. Apply the reverse of image correction (instead of correcting distortion, apply
  8994. it).
  8995. @item interpolation
  8996. The type of interpolation used when correcting distortion. The following values
  8997. are valid options:
  8998. @table @samp
  8999. @item nearest
  9000. @item linear (default)
  9001. @item lanczos
  9002. @end table
  9003. @end table
  9004. @subsection Examples
  9005. @itemize
  9006. @item
  9007. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9008. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9009. aperture of "8.0".
  9010. @example
  9011. 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
  9012. @end example
  9013. @item
  9014. Apply the same as before, but only for the first 5 seconds of video.
  9015. @example
  9016. 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
  9017. @end example
  9018. @end itemize
  9019. @section libvmaf
  9020. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9021. score between two input videos.
  9022. The obtained VMAF score is printed through the logging system.
  9023. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9024. After installing the library it can be enabled using:
  9025. @code{./configure --enable-libvmaf --enable-version3}.
  9026. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9027. The filter has following options:
  9028. @table @option
  9029. @item model_path
  9030. Set the model path which is to be used for SVM.
  9031. Default value: @code{"vmaf_v0.6.1.pkl"}
  9032. @item log_path
  9033. Set the file path to be used to store logs.
  9034. @item log_fmt
  9035. Set the format of the log file (xml or json).
  9036. @item enable_transform
  9037. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9038. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9039. Default value: @code{false}
  9040. @item phone_model
  9041. Invokes the phone model which will generate VMAF scores higher than in the
  9042. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9043. @item psnr
  9044. Enables computing psnr along with vmaf.
  9045. @item ssim
  9046. Enables computing ssim along with vmaf.
  9047. @item ms_ssim
  9048. Enables computing ms_ssim along with vmaf.
  9049. @item pool
  9050. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9051. @item n_threads
  9052. Set number of threads to be used when computing vmaf.
  9053. @item n_subsample
  9054. Set interval for frame subsampling used when computing vmaf.
  9055. @item enable_conf_interval
  9056. Enables confidence interval.
  9057. @end table
  9058. This filter also supports the @ref{framesync} options.
  9059. On the below examples the input file @file{main.mpg} being processed is
  9060. compared with the reference file @file{ref.mpg}.
  9061. @example
  9062. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9063. @end example
  9064. Example with options:
  9065. @example
  9066. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9067. @end example
  9068. @section limiter
  9069. Limits the pixel components values to the specified range [min, max].
  9070. The filter accepts the following options:
  9071. @table @option
  9072. @item min
  9073. Lower bound. Defaults to the lowest allowed value for the input.
  9074. @item max
  9075. Upper bound. Defaults to the highest allowed value for the input.
  9076. @item planes
  9077. Specify which planes will be processed. Defaults to all available.
  9078. @end table
  9079. @section loop
  9080. Loop video frames.
  9081. The filter accepts the following options:
  9082. @table @option
  9083. @item loop
  9084. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9085. Default is 0.
  9086. @item size
  9087. Set maximal size in number of frames. Default is 0.
  9088. @item start
  9089. Set first frame of loop. Default is 0.
  9090. @end table
  9091. @subsection Examples
  9092. @itemize
  9093. @item
  9094. Loop single first frame infinitely:
  9095. @example
  9096. loop=loop=-1:size=1:start=0
  9097. @end example
  9098. @item
  9099. Loop single first frame 10 times:
  9100. @example
  9101. loop=loop=10:size=1:start=0
  9102. @end example
  9103. @item
  9104. Loop 10 first frames 5 times:
  9105. @example
  9106. loop=loop=5:size=10:start=0
  9107. @end example
  9108. @end itemize
  9109. @section lut1d
  9110. Apply a 1D LUT to an input video.
  9111. The filter accepts the following options:
  9112. @table @option
  9113. @item file
  9114. Set the 1D LUT file name.
  9115. Currently supported formats:
  9116. @table @samp
  9117. @item cube
  9118. Iridas
  9119. @item csp
  9120. cineSpace
  9121. @end table
  9122. @item interp
  9123. Select interpolation mode.
  9124. Available values are:
  9125. @table @samp
  9126. @item nearest
  9127. Use values from the nearest defined point.
  9128. @item linear
  9129. Interpolate values using the linear interpolation.
  9130. @item cosine
  9131. Interpolate values using the cosine interpolation.
  9132. @item cubic
  9133. Interpolate values using the cubic interpolation.
  9134. @item spline
  9135. Interpolate values using the spline interpolation.
  9136. @end table
  9137. @end table
  9138. @anchor{lut3d}
  9139. @section lut3d
  9140. Apply a 3D LUT to an input video.
  9141. The filter accepts the following options:
  9142. @table @option
  9143. @item file
  9144. Set the 3D LUT file name.
  9145. Currently supported formats:
  9146. @table @samp
  9147. @item 3dl
  9148. AfterEffects
  9149. @item cube
  9150. Iridas
  9151. @item dat
  9152. DaVinci
  9153. @item m3d
  9154. Pandora
  9155. @item csp
  9156. cineSpace
  9157. @end table
  9158. @item interp
  9159. Select interpolation mode.
  9160. Available values are:
  9161. @table @samp
  9162. @item nearest
  9163. Use values from the nearest defined point.
  9164. @item trilinear
  9165. Interpolate values using the 8 points defining a cube.
  9166. @item tetrahedral
  9167. Interpolate values using a tetrahedron.
  9168. @end table
  9169. @end table
  9170. @section lumakey
  9171. Turn certain luma values into transparency.
  9172. The filter accepts the following options:
  9173. @table @option
  9174. @item threshold
  9175. Set the luma which will be used as base for transparency.
  9176. Default value is @code{0}.
  9177. @item tolerance
  9178. Set the range of luma values to be keyed out.
  9179. Default value is @code{0}.
  9180. @item softness
  9181. Set the range of softness. Default value is @code{0}.
  9182. Use this to control gradual transition from zero to full transparency.
  9183. @end table
  9184. @section lut, lutrgb, lutyuv
  9185. Compute a look-up table for binding each pixel component input value
  9186. to an output value, and apply it to the input video.
  9187. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9188. to an RGB input video.
  9189. These filters accept the following parameters:
  9190. @table @option
  9191. @item c0
  9192. set first pixel component expression
  9193. @item c1
  9194. set second pixel component expression
  9195. @item c2
  9196. set third pixel component expression
  9197. @item c3
  9198. set fourth pixel component expression, corresponds to the alpha component
  9199. @item r
  9200. set red component expression
  9201. @item g
  9202. set green component expression
  9203. @item b
  9204. set blue component expression
  9205. @item a
  9206. alpha component expression
  9207. @item y
  9208. set Y/luminance component expression
  9209. @item u
  9210. set U/Cb component expression
  9211. @item v
  9212. set V/Cr component expression
  9213. @end table
  9214. Each of them specifies the expression to use for computing the lookup table for
  9215. the corresponding pixel component values.
  9216. The exact component associated to each of the @var{c*} options depends on the
  9217. format in input.
  9218. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9219. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9220. The expressions can contain the following constants and functions:
  9221. @table @option
  9222. @item w
  9223. @item h
  9224. The input width and height.
  9225. @item val
  9226. The input value for the pixel component.
  9227. @item clipval
  9228. The input value, clipped to the @var{minval}-@var{maxval} range.
  9229. @item maxval
  9230. The maximum value for the pixel component.
  9231. @item minval
  9232. The minimum value for the pixel component.
  9233. @item negval
  9234. The negated value for the pixel component value, clipped to the
  9235. @var{minval}-@var{maxval} range; it corresponds to the expression
  9236. "maxval-clipval+minval".
  9237. @item clip(val)
  9238. The computed value in @var{val}, clipped to the
  9239. @var{minval}-@var{maxval} range.
  9240. @item gammaval(gamma)
  9241. The computed gamma correction value of the pixel component value,
  9242. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9243. expression
  9244. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9245. @end table
  9246. All expressions default to "val".
  9247. @subsection Examples
  9248. @itemize
  9249. @item
  9250. Negate input video:
  9251. @example
  9252. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9253. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9254. @end example
  9255. The above is the same as:
  9256. @example
  9257. lutrgb="r=negval:g=negval:b=negval"
  9258. lutyuv="y=negval:u=negval:v=negval"
  9259. @end example
  9260. @item
  9261. Negate luminance:
  9262. @example
  9263. lutyuv=y=negval
  9264. @end example
  9265. @item
  9266. Remove chroma components, turning the video into a graytone image:
  9267. @example
  9268. lutyuv="u=128:v=128"
  9269. @end example
  9270. @item
  9271. Apply a luma burning effect:
  9272. @example
  9273. lutyuv="y=2*val"
  9274. @end example
  9275. @item
  9276. Remove green and blue components:
  9277. @example
  9278. lutrgb="g=0:b=0"
  9279. @end example
  9280. @item
  9281. Set a constant alpha channel value on input:
  9282. @example
  9283. format=rgba,lutrgb=a="maxval-minval/2"
  9284. @end example
  9285. @item
  9286. Correct luminance gamma by a factor of 0.5:
  9287. @example
  9288. lutyuv=y=gammaval(0.5)
  9289. @end example
  9290. @item
  9291. Discard least significant bits of luma:
  9292. @example
  9293. lutyuv=y='bitand(val, 128+64+32)'
  9294. @end example
  9295. @item
  9296. Technicolor like effect:
  9297. @example
  9298. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9299. @end example
  9300. @end itemize
  9301. @section lut2, tlut2
  9302. The @code{lut2} filter takes two input streams and outputs one
  9303. stream.
  9304. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9305. from one single stream.
  9306. This filter accepts the following parameters:
  9307. @table @option
  9308. @item c0
  9309. set first pixel component expression
  9310. @item c1
  9311. set second pixel component expression
  9312. @item c2
  9313. set third pixel component expression
  9314. @item c3
  9315. set fourth pixel component expression, corresponds to the alpha component
  9316. @item d
  9317. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9318. which means bit depth is automatically picked from first input format.
  9319. @end table
  9320. Each of them specifies the expression to use for computing the lookup table for
  9321. the corresponding pixel component values.
  9322. The exact component associated to each of the @var{c*} options depends on the
  9323. format in inputs.
  9324. The expressions can contain the following constants:
  9325. @table @option
  9326. @item w
  9327. @item h
  9328. The input width and height.
  9329. @item x
  9330. The first input value for the pixel component.
  9331. @item y
  9332. The second input value for the pixel component.
  9333. @item bdx
  9334. The first input video bit depth.
  9335. @item bdy
  9336. The second input video bit depth.
  9337. @end table
  9338. All expressions default to "x".
  9339. @subsection Examples
  9340. @itemize
  9341. @item
  9342. Highlight differences between two RGB video streams:
  9343. @example
  9344. 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)'
  9345. @end example
  9346. @item
  9347. Highlight differences between two YUV video streams:
  9348. @example
  9349. 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)'
  9350. @end example
  9351. @item
  9352. Show max difference between two video streams:
  9353. @example
  9354. 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)))'
  9355. @end example
  9356. @end itemize
  9357. @section maskedclamp
  9358. Clamp the first input stream with the second input and third input stream.
  9359. Returns the value of first stream to be between second input
  9360. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9361. This filter accepts the following options:
  9362. @table @option
  9363. @item undershoot
  9364. Default value is @code{0}.
  9365. @item overshoot
  9366. Default value is @code{0}.
  9367. @item planes
  9368. Set which planes will be processed as bitmap, unprocessed planes will be
  9369. copied from first stream.
  9370. By default value 0xf, all planes will be processed.
  9371. @end table
  9372. @section maskedmerge
  9373. Merge the first input stream with the second input stream using per pixel
  9374. weights in the third input stream.
  9375. A value of 0 in the third stream pixel component means that pixel component
  9376. from first stream is returned unchanged, while maximum value (eg. 255 for
  9377. 8-bit videos) means that pixel component from second stream is returned
  9378. unchanged. Intermediate values define the amount of merging between both
  9379. input stream's pixel components.
  9380. This filter accepts the following options:
  9381. @table @option
  9382. @item planes
  9383. Set which planes will be processed as bitmap, unprocessed planes will be
  9384. copied from first stream.
  9385. By default value 0xf, all planes will be processed.
  9386. @end table
  9387. @section maskfun
  9388. Create mask from input video.
  9389. For example it is useful to create motion masks after @code{tblend} filter.
  9390. This filter accepts the following options:
  9391. @table @option
  9392. @item low
  9393. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9394. @item high
  9395. Set high threshold. Any pixel component higher than this value will be set to max value
  9396. allowed for current pixel format.
  9397. @item planes
  9398. Set planes to filter, by default all available planes are filtered.
  9399. @item fill
  9400. Fill all frame pixels with this value.
  9401. @item sum
  9402. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9403. average, output frame will be completely filled with value set by @var{fill} option.
  9404. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9405. @end table
  9406. @section mcdeint
  9407. Apply motion-compensation deinterlacing.
  9408. It needs one field per frame as input and must thus be used together
  9409. with yadif=1/3 or equivalent.
  9410. This filter accepts the following options:
  9411. @table @option
  9412. @item mode
  9413. Set the deinterlacing mode.
  9414. It accepts one of the following values:
  9415. @table @samp
  9416. @item fast
  9417. @item medium
  9418. @item slow
  9419. use iterative motion estimation
  9420. @item extra_slow
  9421. like @samp{slow}, but use multiple reference frames.
  9422. @end table
  9423. Default value is @samp{fast}.
  9424. @item parity
  9425. Set the picture field parity assumed for the input video. It must be
  9426. one of the following values:
  9427. @table @samp
  9428. @item 0, tff
  9429. assume top field first
  9430. @item 1, bff
  9431. assume bottom field first
  9432. @end table
  9433. Default value is @samp{bff}.
  9434. @item qp
  9435. Set per-block quantization parameter (QP) used by the internal
  9436. encoder.
  9437. Higher values should result in a smoother motion vector field but less
  9438. optimal individual vectors. Default value is 1.
  9439. @end table
  9440. @section mergeplanes
  9441. Merge color channel components from several video streams.
  9442. The filter accepts up to 4 input streams, and merge selected input
  9443. planes to the output video.
  9444. This filter accepts the following options:
  9445. @table @option
  9446. @item mapping
  9447. Set input to output plane mapping. Default is @code{0}.
  9448. The mappings is specified as a bitmap. It should be specified as a
  9449. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9450. mapping for the first plane of the output stream. 'A' sets the number of
  9451. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9452. corresponding input to use (from 0 to 3). The rest of the mappings is
  9453. similar, 'Bb' describes the mapping for the output stream second
  9454. plane, 'Cc' describes the mapping for the output stream third plane and
  9455. 'Dd' describes the mapping for the output stream fourth plane.
  9456. @item format
  9457. Set output pixel format. Default is @code{yuva444p}.
  9458. @end table
  9459. @subsection Examples
  9460. @itemize
  9461. @item
  9462. Merge three gray video streams of same width and height into single video stream:
  9463. @example
  9464. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9465. @end example
  9466. @item
  9467. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9468. @example
  9469. [a0][a1]mergeplanes=0x00010210:yuva444p
  9470. @end example
  9471. @item
  9472. Swap Y and A plane in yuva444p stream:
  9473. @example
  9474. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9475. @end example
  9476. @item
  9477. Swap U and V plane in yuv420p stream:
  9478. @example
  9479. format=yuv420p,mergeplanes=0x000201:yuv420p
  9480. @end example
  9481. @item
  9482. Cast a rgb24 clip to yuv444p:
  9483. @example
  9484. format=rgb24,mergeplanes=0x000102:yuv444p
  9485. @end example
  9486. @end itemize
  9487. @section mestimate
  9488. Estimate and export motion vectors using block matching algorithms.
  9489. Motion vectors are stored in frame side data to be used by other filters.
  9490. This filter accepts the following options:
  9491. @table @option
  9492. @item method
  9493. Specify the motion estimation method. Accepts one of the following values:
  9494. @table @samp
  9495. @item esa
  9496. Exhaustive search algorithm.
  9497. @item tss
  9498. Three step search algorithm.
  9499. @item tdls
  9500. Two dimensional logarithmic search algorithm.
  9501. @item ntss
  9502. New three step search algorithm.
  9503. @item fss
  9504. Four step search algorithm.
  9505. @item ds
  9506. Diamond search algorithm.
  9507. @item hexbs
  9508. Hexagon-based search algorithm.
  9509. @item epzs
  9510. Enhanced predictive zonal search algorithm.
  9511. @item umh
  9512. Uneven multi-hexagon search algorithm.
  9513. @end table
  9514. Default value is @samp{esa}.
  9515. @item mb_size
  9516. Macroblock size. Default @code{16}.
  9517. @item search_param
  9518. Search parameter. Default @code{7}.
  9519. @end table
  9520. @section midequalizer
  9521. Apply Midway Image Equalization effect using two video streams.
  9522. Midway Image Equalization adjusts a pair of images to have the same
  9523. histogram, while maintaining their dynamics as much as possible. It's
  9524. useful for e.g. matching exposures from a pair of stereo cameras.
  9525. This filter has two inputs and one output, which must be of same pixel format, but
  9526. may be of different sizes. The output of filter is first input adjusted with
  9527. midway histogram of both inputs.
  9528. This filter accepts the following option:
  9529. @table @option
  9530. @item planes
  9531. Set which planes to process. Default is @code{15}, which is all available planes.
  9532. @end table
  9533. @section minterpolate
  9534. Convert the video to specified frame rate using motion interpolation.
  9535. This filter accepts the following options:
  9536. @table @option
  9537. @item fps
  9538. 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}.
  9539. @item mi_mode
  9540. Motion interpolation mode. Following values are accepted:
  9541. @table @samp
  9542. @item dup
  9543. Duplicate previous or next frame for interpolating new ones.
  9544. @item blend
  9545. Blend source frames. Interpolated frame is mean of previous and next frames.
  9546. @item mci
  9547. Motion compensated interpolation. Following options are effective when this mode is selected:
  9548. @table @samp
  9549. @item mc_mode
  9550. Motion compensation mode. Following values are accepted:
  9551. @table @samp
  9552. @item obmc
  9553. Overlapped block motion compensation.
  9554. @item aobmc
  9555. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9556. @end table
  9557. Default mode is @samp{obmc}.
  9558. @item me_mode
  9559. Motion estimation mode. Following values are accepted:
  9560. @table @samp
  9561. @item bidir
  9562. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9563. @item bilat
  9564. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9565. @end table
  9566. Default mode is @samp{bilat}.
  9567. @item me
  9568. The algorithm to be used for motion estimation. Following values are accepted:
  9569. @table @samp
  9570. @item esa
  9571. Exhaustive search algorithm.
  9572. @item tss
  9573. Three step search algorithm.
  9574. @item tdls
  9575. Two dimensional logarithmic search algorithm.
  9576. @item ntss
  9577. New three step search algorithm.
  9578. @item fss
  9579. Four step search algorithm.
  9580. @item ds
  9581. Diamond search algorithm.
  9582. @item hexbs
  9583. Hexagon-based search algorithm.
  9584. @item epzs
  9585. Enhanced predictive zonal search algorithm.
  9586. @item umh
  9587. Uneven multi-hexagon search algorithm.
  9588. @end table
  9589. Default algorithm is @samp{epzs}.
  9590. @item mb_size
  9591. Macroblock size. Default @code{16}.
  9592. @item search_param
  9593. Motion estimation search parameter. Default @code{32}.
  9594. @item vsbmc
  9595. 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).
  9596. @end table
  9597. @end table
  9598. @item scd
  9599. 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:
  9600. @table @samp
  9601. @item none
  9602. Disable scene change detection.
  9603. @item fdiff
  9604. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9605. @end table
  9606. Default method is @samp{fdiff}.
  9607. @item scd_threshold
  9608. Scene change detection threshold. Default is @code{5.0}.
  9609. @end table
  9610. @section mix
  9611. Mix several video input streams into one video stream.
  9612. A description of the accepted options follows.
  9613. @table @option
  9614. @item nb_inputs
  9615. The number of inputs. If unspecified, it defaults to 2.
  9616. @item weights
  9617. Specify weight of each input video stream as sequence.
  9618. Each weight is separated by space. If number of weights
  9619. is smaller than number of @var{frames} last specified
  9620. weight will be used for all remaining unset weights.
  9621. @item scale
  9622. Specify scale, if it is set it will be multiplied with sum
  9623. of each weight multiplied with pixel values to give final destination
  9624. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9625. @item duration
  9626. Specify how end of stream is determined.
  9627. @table @samp
  9628. @item longest
  9629. The duration of the longest input. (default)
  9630. @item shortest
  9631. The duration of the shortest input.
  9632. @item first
  9633. The duration of the first input.
  9634. @end table
  9635. @end table
  9636. @section mpdecimate
  9637. Drop frames that do not differ greatly from the previous frame in
  9638. order to reduce frame rate.
  9639. The main use of this filter is for very-low-bitrate encoding
  9640. (e.g. streaming over dialup modem), but it could in theory be used for
  9641. fixing movies that were inverse-telecined incorrectly.
  9642. A description of the accepted options follows.
  9643. @table @option
  9644. @item max
  9645. Set the maximum number of consecutive frames which can be dropped (if
  9646. positive), or the minimum interval between dropped frames (if
  9647. negative). If the value is 0, the frame is dropped disregarding the
  9648. number of previous sequentially dropped frames.
  9649. Default value is 0.
  9650. @item hi
  9651. @item lo
  9652. @item frac
  9653. Set the dropping threshold values.
  9654. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9655. represent actual pixel value differences, so a threshold of 64
  9656. corresponds to 1 unit of difference for each pixel, or the same spread
  9657. out differently over the block.
  9658. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9659. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9660. meaning the whole image) differ by more than a threshold of @option{lo}.
  9661. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9662. 64*5, and default value for @option{frac} is 0.33.
  9663. @end table
  9664. @section negate
  9665. Negate (invert) the input video.
  9666. It accepts the following option:
  9667. @table @option
  9668. @item negate_alpha
  9669. With value 1, it negates the alpha component, if present. Default value is 0.
  9670. @end table
  9671. @anchor{nlmeans}
  9672. @section nlmeans
  9673. Denoise frames using Non-Local Means algorithm.
  9674. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9675. context similarity is defined by comparing their surrounding patches of size
  9676. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9677. around the pixel.
  9678. Note that the research area defines centers for patches, which means some
  9679. patches will be made of pixels outside that research area.
  9680. The filter accepts the following options.
  9681. @table @option
  9682. @item s
  9683. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9684. @item p
  9685. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9686. @item pc
  9687. Same as @option{p} but for chroma planes.
  9688. The default value is @var{0} and means automatic.
  9689. @item r
  9690. Set research size. Default is 15. Must be odd number in range [0, 99].
  9691. @item rc
  9692. Same as @option{r} but for chroma planes.
  9693. The default value is @var{0} and means automatic.
  9694. @end table
  9695. @section nnedi
  9696. Deinterlace video using neural network edge directed interpolation.
  9697. This filter accepts the following options:
  9698. @table @option
  9699. @item weights
  9700. Mandatory option, without binary file filter can not work.
  9701. Currently file can be found here:
  9702. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9703. @item deint
  9704. Set which frames to deinterlace, by default it is @code{all}.
  9705. Can be @code{all} or @code{interlaced}.
  9706. @item field
  9707. Set mode of operation.
  9708. Can be one of the following:
  9709. @table @samp
  9710. @item af
  9711. Use frame flags, both fields.
  9712. @item a
  9713. Use frame flags, single field.
  9714. @item t
  9715. Use top field only.
  9716. @item b
  9717. Use bottom field only.
  9718. @item tf
  9719. Use both fields, top first.
  9720. @item bf
  9721. Use both fields, bottom first.
  9722. @end table
  9723. @item planes
  9724. Set which planes to process, by default filter process all frames.
  9725. @item nsize
  9726. Set size of local neighborhood around each pixel, used by the predictor neural
  9727. network.
  9728. Can be one of the following:
  9729. @table @samp
  9730. @item s8x6
  9731. @item s16x6
  9732. @item s32x6
  9733. @item s48x6
  9734. @item s8x4
  9735. @item s16x4
  9736. @item s32x4
  9737. @end table
  9738. @item nns
  9739. Set the number of neurons in predictor neural network.
  9740. Can be one of the following:
  9741. @table @samp
  9742. @item n16
  9743. @item n32
  9744. @item n64
  9745. @item n128
  9746. @item n256
  9747. @end table
  9748. @item qual
  9749. Controls the number of different neural network predictions that are blended
  9750. together to compute the final output value. Can be @code{fast}, default or
  9751. @code{slow}.
  9752. @item etype
  9753. Set which set of weights to use in the predictor.
  9754. Can be one of the following:
  9755. @table @samp
  9756. @item a
  9757. weights trained to minimize absolute error
  9758. @item s
  9759. weights trained to minimize squared error
  9760. @end table
  9761. @item pscrn
  9762. Controls whether or not the prescreener neural network is used to decide
  9763. which pixels should be processed by the predictor neural network and which
  9764. can be handled by simple cubic interpolation.
  9765. The prescreener is trained to know whether cubic interpolation will be
  9766. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9767. The computational complexity of the prescreener nn is much less than that of
  9768. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9769. using the prescreener generally results in much faster processing.
  9770. The prescreener is pretty accurate, so the difference between using it and not
  9771. using it is almost always unnoticeable.
  9772. Can be one of the following:
  9773. @table @samp
  9774. @item none
  9775. @item original
  9776. @item new
  9777. @end table
  9778. Default is @code{new}.
  9779. @item fapprox
  9780. Set various debugging flags.
  9781. @end table
  9782. @section noformat
  9783. Force libavfilter not to use any of the specified pixel formats for the
  9784. input to the next filter.
  9785. It accepts the following parameters:
  9786. @table @option
  9787. @item pix_fmts
  9788. A '|'-separated list of pixel format names, such as
  9789. pix_fmts=yuv420p|monow|rgb24".
  9790. @end table
  9791. @subsection Examples
  9792. @itemize
  9793. @item
  9794. Force libavfilter to use a format different from @var{yuv420p} for the
  9795. input to the vflip filter:
  9796. @example
  9797. noformat=pix_fmts=yuv420p,vflip
  9798. @end example
  9799. @item
  9800. Convert the input video to any of the formats not contained in the list:
  9801. @example
  9802. noformat=yuv420p|yuv444p|yuv410p
  9803. @end example
  9804. @end itemize
  9805. @section noise
  9806. Add noise on video input frame.
  9807. The filter accepts the following options:
  9808. @table @option
  9809. @item all_seed
  9810. @item c0_seed
  9811. @item c1_seed
  9812. @item c2_seed
  9813. @item c3_seed
  9814. Set noise seed for specific pixel component or all pixel components in case
  9815. of @var{all_seed}. Default value is @code{123457}.
  9816. @item all_strength, alls
  9817. @item c0_strength, c0s
  9818. @item c1_strength, c1s
  9819. @item c2_strength, c2s
  9820. @item c3_strength, c3s
  9821. Set noise strength for specific pixel component or all pixel components in case
  9822. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9823. @item all_flags, allf
  9824. @item c0_flags, c0f
  9825. @item c1_flags, c1f
  9826. @item c2_flags, c2f
  9827. @item c3_flags, c3f
  9828. Set pixel component flags or set flags for all components if @var{all_flags}.
  9829. Available values for component flags are:
  9830. @table @samp
  9831. @item a
  9832. averaged temporal noise (smoother)
  9833. @item p
  9834. mix random noise with a (semi)regular pattern
  9835. @item t
  9836. temporal noise (noise pattern changes between frames)
  9837. @item u
  9838. uniform noise (gaussian otherwise)
  9839. @end table
  9840. @end table
  9841. @subsection Examples
  9842. Add temporal and uniform noise to input video:
  9843. @example
  9844. noise=alls=20:allf=t+u
  9845. @end example
  9846. @section normalize
  9847. Normalize RGB video (aka histogram stretching, contrast stretching).
  9848. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9849. For each channel of each frame, the filter computes the input range and maps
  9850. it linearly to the user-specified output range. The output range defaults
  9851. to the full dynamic range from pure black to pure white.
  9852. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9853. changes in brightness) caused when small dark or bright objects enter or leave
  9854. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9855. video camera, and, like a video camera, it may cause a period of over- or
  9856. under-exposure of the video.
  9857. The R,G,B channels can be normalized independently, which may cause some
  9858. color shifting, or linked together as a single channel, which prevents
  9859. color shifting. Linked normalization preserves hue. Independent normalization
  9860. does not, so it can be used to remove some color casts. Independent and linked
  9861. normalization can be combined in any ratio.
  9862. The normalize filter accepts the following options:
  9863. @table @option
  9864. @item blackpt
  9865. @item whitept
  9866. Colors which define the output range. The minimum input value is mapped to
  9867. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9868. The defaults are black and white respectively. Specifying white for
  9869. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9870. normalized video. Shades of grey can be used to reduce the dynamic range
  9871. (contrast). Specifying saturated colors here can create some interesting
  9872. effects.
  9873. @item smoothing
  9874. The number of previous frames to use for temporal smoothing. The input range
  9875. of each channel is smoothed using a rolling average over the current frame
  9876. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9877. smoothing).
  9878. @item independence
  9879. Controls the ratio of independent (color shifting) channel normalization to
  9880. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9881. independent. Defaults to 1.0 (fully independent).
  9882. @item strength
  9883. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9884. expensive no-op. Defaults to 1.0 (full strength).
  9885. @end table
  9886. @subsection Examples
  9887. Stretch video contrast to use the full dynamic range, with no temporal
  9888. smoothing; may flicker depending on the source content:
  9889. @example
  9890. normalize=blackpt=black:whitept=white:smoothing=0
  9891. @end example
  9892. As above, but with 50 frames of temporal smoothing; flicker should be
  9893. reduced, depending on the source content:
  9894. @example
  9895. normalize=blackpt=black:whitept=white:smoothing=50
  9896. @end example
  9897. As above, but with hue-preserving linked channel normalization:
  9898. @example
  9899. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9900. @end example
  9901. As above, but with half strength:
  9902. @example
  9903. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9904. @end example
  9905. Map the darkest input color to red, the brightest input color to cyan:
  9906. @example
  9907. normalize=blackpt=red:whitept=cyan
  9908. @end example
  9909. @section null
  9910. Pass the video source unchanged to the output.
  9911. @section ocr
  9912. Optical Character Recognition
  9913. This filter uses Tesseract for optical character recognition. To enable
  9914. compilation of this filter, you need to configure FFmpeg with
  9915. @code{--enable-libtesseract}.
  9916. It accepts the following options:
  9917. @table @option
  9918. @item datapath
  9919. Set datapath to tesseract data. Default is to use whatever was
  9920. set at installation.
  9921. @item language
  9922. Set language, default is "eng".
  9923. @item whitelist
  9924. Set character whitelist.
  9925. @item blacklist
  9926. Set character blacklist.
  9927. @end table
  9928. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9929. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  9930. @section ocv
  9931. Apply a video transform using libopencv.
  9932. To enable this filter, install the libopencv library and headers and
  9933. configure FFmpeg with @code{--enable-libopencv}.
  9934. It accepts the following parameters:
  9935. @table @option
  9936. @item filter_name
  9937. The name of the libopencv filter to apply.
  9938. @item filter_params
  9939. The parameters to pass to the libopencv filter. If not specified, the default
  9940. values are assumed.
  9941. @end table
  9942. Refer to the official libopencv documentation for more precise
  9943. information:
  9944. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9945. Several libopencv filters are supported; see the following subsections.
  9946. @anchor{dilate}
  9947. @subsection dilate
  9948. Dilate an image by using a specific structuring element.
  9949. It corresponds to the libopencv function @code{cvDilate}.
  9950. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9951. @var{struct_el} represents a structuring element, and has the syntax:
  9952. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9953. @var{cols} and @var{rows} represent the number of columns and rows of
  9954. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9955. point, and @var{shape} the shape for the structuring element. @var{shape}
  9956. must be "rect", "cross", "ellipse", or "custom".
  9957. If the value for @var{shape} is "custom", it must be followed by a
  9958. string of the form "=@var{filename}". The file with name
  9959. @var{filename} is assumed to represent a binary image, with each
  9960. printable character corresponding to a bright pixel. When a custom
  9961. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9962. or columns and rows of the read file are assumed instead.
  9963. The default value for @var{struct_el} is "3x3+0x0/rect".
  9964. @var{nb_iterations} specifies the number of times the transform is
  9965. applied to the image, and defaults to 1.
  9966. Some examples:
  9967. @example
  9968. # Use the default values
  9969. ocv=dilate
  9970. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9971. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9972. # Read the shape from the file diamond.shape, iterating two times.
  9973. # The file diamond.shape may contain a pattern of characters like this
  9974. # *
  9975. # ***
  9976. # *****
  9977. # ***
  9978. # *
  9979. # The specified columns and rows are ignored
  9980. # but the anchor point coordinates are not
  9981. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9982. @end example
  9983. @subsection erode
  9984. Erode an image by using a specific structuring element.
  9985. It corresponds to the libopencv function @code{cvErode}.
  9986. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9987. with the same syntax and semantics as the @ref{dilate} filter.
  9988. @subsection smooth
  9989. Smooth the input video.
  9990. The filter takes the following parameters:
  9991. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9992. @var{type} is the type of smooth filter to apply, and must be one of
  9993. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9994. or "bilateral". The default value is "gaussian".
  9995. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9996. depend on the smooth type. @var{param1} and
  9997. @var{param2} accept integer positive values or 0. @var{param3} and
  9998. @var{param4} accept floating point values.
  9999. The default value for @var{param1} is 3. The default value for the
  10000. other parameters is 0.
  10001. These parameters correspond to the parameters assigned to the
  10002. libopencv function @code{cvSmooth}.
  10003. @section oscilloscope
  10004. 2D Video Oscilloscope.
  10005. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10006. It accepts the following parameters:
  10007. @table @option
  10008. @item x
  10009. Set scope center x position.
  10010. @item y
  10011. Set scope center y position.
  10012. @item s
  10013. Set scope size, relative to frame diagonal.
  10014. @item t
  10015. Set scope tilt/rotation.
  10016. @item o
  10017. Set trace opacity.
  10018. @item tx
  10019. Set trace center x position.
  10020. @item ty
  10021. Set trace center y position.
  10022. @item tw
  10023. Set trace width, relative to width of frame.
  10024. @item th
  10025. Set trace height, relative to height of frame.
  10026. @item c
  10027. Set which components to trace. By default it traces first three components.
  10028. @item g
  10029. Draw trace grid. By default is enabled.
  10030. @item st
  10031. Draw some statistics. By default is enabled.
  10032. @item sc
  10033. Draw scope. By default is enabled.
  10034. @end table
  10035. @subsection Examples
  10036. @itemize
  10037. @item
  10038. Inspect full first row of video frame.
  10039. @example
  10040. oscilloscope=x=0.5:y=0:s=1
  10041. @end example
  10042. @item
  10043. Inspect full last row of video frame.
  10044. @example
  10045. oscilloscope=x=0.5:y=1:s=1
  10046. @end example
  10047. @item
  10048. Inspect full 5th line of video frame of height 1080.
  10049. @example
  10050. oscilloscope=x=0.5:y=5/1080:s=1
  10051. @end example
  10052. @item
  10053. Inspect full last column of video frame.
  10054. @example
  10055. oscilloscope=x=1:y=0.5:s=1:t=1
  10056. @end example
  10057. @end itemize
  10058. @anchor{overlay}
  10059. @section overlay
  10060. Overlay one video on top of another.
  10061. It takes two inputs and has one output. The first input is the "main"
  10062. video on which the second input is overlaid.
  10063. It accepts the following parameters:
  10064. A description of the accepted options follows.
  10065. @table @option
  10066. @item x
  10067. @item y
  10068. Set the expression for the x and y coordinates of the overlaid video
  10069. on the main video. Default value is "0" for both expressions. In case
  10070. the expression is invalid, it is set to a huge value (meaning that the
  10071. overlay will not be displayed within the output visible area).
  10072. @item eof_action
  10073. See @ref{framesync}.
  10074. @item eval
  10075. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10076. It accepts the following values:
  10077. @table @samp
  10078. @item init
  10079. only evaluate expressions once during the filter initialization or
  10080. when a command is processed
  10081. @item frame
  10082. evaluate expressions for each incoming frame
  10083. @end table
  10084. Default value is @samp{frame}.
  10085. @item shortest
  10086. See @ref{framesync}.
  10087. @item format
  10088. Set the format for the output video.
  10089. It accepts the following values:
  10090. @table @samp
  10091. @item yuv420
  10092. force YUV420 output
  10093. @item yuv422
  10094. force YUV422 output
  10095. @item yuv444
  10096. force YUV444 output
  10097. @item rgb
  10098. force packed RGB output
  10099. @item gbrp
  10100. force planar RGB output
  10101. @item auto
  10102. automatically pick format
  10103. @end table
  10104. Default value is @samp{yuv420}.
  10105. @item repeatlast
  10106. See @ref{framesync}.
  10107. @item alpha
  10108. Set format of alpha of the overlaid video, it can be @var{straight} or
  10109. @var{premultiplied}. Default is @var{straight}.
  10110. @end table
  10111. The @option{x}, and @option{y} expressions can contain the following
  10112. parameters.
  10113. @table @option
  10114. @item main_w, W
  10115. @item main_h, H
  10116. The main input width and height.
  10117. @item overlay_w, w
  10118. @item overlay_h, h
  10119. The overlay input width and height.
  10120. @item x
  10121. @item y
  10122. The computed values for @var{x} and @var{y}. They are evaluated for
  10123. each new frame.
  10124. @item hsub
  10125. @item vsub
  10126. horizontal and vertical chroma subsample values of the output
  10127. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10128. @var{vsub} is 1.
  10129. @item n
  10130. the number of input frame, starting from 0
  10131. @item pos
  10132. the position in the file of the input frame, NAN if unknown
  10133. @item t
  10134. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10135. @end table
  10136. This filter also supports the @ref{framesync} options.
  10137. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10138. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10139. when @option{eval} is set to @samp{init}.
  10140. Be aware that frames are taken from each input video in timestamp
  10141. order, hence, if their initial timestamps differ, it is a good idea
  10142. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10143. have them begin in the same zero timestamp, as the example for
  10144. the @var{movie} filter does.
  10145. You can chain together more overlays but you should test the
  10146. efficiency of such approach.
  10147. @subsection Commands
  10148. This filter supports the following commands:
  10149. @table @option
  10150. @item x
  10151. @item y
  10152. Modify the x and y of the overlay input.
  10153. The command accepts the same syntax of the corresponding option.
  10154. If the specified expression is not valid, it is kept at its current
  10155. value.
  10156. @end table
  10157. @subsection Examples
  10158. @itemize
  10159. @item
  10160. Draw the overlay at 10 pixels from the bottom right corner of the main
  10161. video:
  10162. @example
  10163. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10164. @end example
  10165. Using named options the example above becomes:
  10166. @example
  10167. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10168. @end example
  10169. @item
  10170. Insert a transparent PNG logo in the bottom left corner of the input,
  10171. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10172. @example
  10173. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10174. @end example
  10175. @item
  10176. Insert 2 different transparent PNG logos (second logo on bottom
  10177. right corner) using the @command{ffmpeg} tool:
  10178. @example
  10179. 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
  10180. @end example
  10181. @item
  10182. Add a transparent color layer on top of the main video; @code{WxH}
  10183. must specify the size of the main input to the overlay filter:
  10184. @example
  10185. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10186. @end example
  10187. @item
  10188. Play an original video and a filtered version (here with the deshake
  10189. filter) side by side using the @command{ffplay} tool:
  10190. @example
  10191. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10192. @end example
  10193. The above command is the same as:
  10194. @example
  10195. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10196. @end example
  10197. @item
  10198. Make a sliding overlay appearing from the left to the right top part of the
  10199. screen starting since time 2:
  10200. @example
  10201. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10202. @end example
  10203. @item
  10204. Compose output by putting two input videos side to side:
  10205. @example
  10206. ffmpeg -i left.avi -i right.avi -filter_complex "
  10207. nullsrc=size=200x100 [background];
  10208. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10209. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10210. [background][left] overlay=shortest=1 [background+left];
  10211. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10212. "
  10213. @end example
  10214. @item
  10215. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10216. @example
  10217. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10218. -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]'
  10219. masked.avi
  10220. @end example
  10221. @item
  10222. Chain several overlays in cascade:
  10223. @example
  10224. nullsrc=s=200x200 [bg];
  10225. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10226. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10227. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10228. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10229. [in3] null, [mid2] overlay=100:100 [out0]
  10230. @end example
  10231. @end itemize
  10232. @section owdenoise
  10233. Apply Overcomplete Wavelet denoiser.
  10234. The filter accepts the following options:
  10235. @table @option
  10236. @item depth
  10237. Set depth.
  10238. Larger depth values will denoise lower frequency components more, but
  10239. slow down filtering.
  10240. Must be an int in the range 8-16, default is @code{8}.
  10241. @item luma_strength, ls
  10242. Set luma strength.
  10243. Must be a double value in the range 0-1000, default is @code{1.0}.
  10244. @item chroma_strength, cs
  10245. Set chroma strength.
  10246. Must be a double value in the range 0-1000, default is @code{1.0}.
  10247. @end table
  10248. @anchor{pad}
  10249. @section pad
  10250. Add paddings to the input image, and place the original input at the
  10251. provided @var{x}, @var{y} coordinates.
  10252. It accepts the following parameters:
  10253. @table @option
  10254. @item width, w
  10255. @item height, h
  10256. Specify an expression for the size of the output image with the
  10257. paddings added. If the value for @var{width} or @var{height} is 0, the
  10258. corresponding input size is used for the output.
  10259. The @var{width} expression can reference the value set by the
  10260. @var{height} expression, and vice versa.
  10261. The default value of @var{width} and @var{height} is 0.
  10262. @item x
  10263. @item y
  10264. Specify the offsets to place the input image at within the padded area,
  10265. with respect to the top/left border of the output image.
  10266. The @var{x} expression can reference the value set by the @var{y}
  10267. expression, and vice versa.
  10268. The default value of @var{x} and @var{y} is 0.
  10269. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10270. so the input image is centered on the padded area.
  10271. @item color
  10272. Specify the color of the padded area. For the syntax of this option,
  10273. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10274. manual,ffmpeg-utils}.
  10275. The default value of @var{color} is "black".
  10276. @item eval
  10277. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10278. It accepts the following values:
  10279. @table @samp
  10280. @item init
  10281. Only evaluate expressions once during the filter initialization or when
  10282. a command is processed.
  10283. @item frame
  10284. Evaluate expressions for each incoming frame.
  10285. @end table
  10286. Default value is @samp{init}.
  10287. @item aspect
  10288. Pad to aspect instead to a resolution.
  10289. @end table
  10290. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10291. options are expressions containing the following constants:
  10292. @table @option
  10293. @item in_w
  10294. @item in_h
  10295. The input video width and height.
  10296. @item iw
  10297. @item ih
  10298. These are the same as @var{in_w} and @var{in_h}.
  10299. @item out_w
  10300. @item out_h
  10301. The output width and height (the size of the padded area), as
  10302. specified by the @var{width} and @var{height} expressions.
  10303. @item ow
  10304. @item oh
  10305. These are the same as @var{out_w} and @var{out_h}.
  10306. @item x
  10307. @item y
  10308. The x and y offsets as specified by the @var{x} and @var{y}
  10309. expressions, or NAN if not yet specified.
  10310. @item a
  10311. same as @var{iw} / @var{ih}
  10312. @item sar
  10313. input sample aspect ratio
  10314. @item dar
  10315. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10316. @item hsub
  10317. @item vsub
  10318. The horizontal and vertical chroma subsample values. For example for the
  10319. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10320. @end table
  10321. @subsection Examples
  10322. @itemize
  10323. @item
  10324. Add paddings with the color "violet" to the input video. The output video
  10325. size is 640x480, and the top-left corner of the input video is placed at
  10326. column 0, row 40
  10327. @example
  10328. pad=640:480:0:40:violet
  10329. @end example
  10330. The example above is equivalent to the following command:
  10331. @example
  10332. pad=width=640:height=480:x=0:y=40:color=violet
  10333. @end example
  10334. @item
  10335. Pad the input to get an output with dimensions increased by 3/2,
  10336. and put the input video at the center of the padded area:
  10337. @example
  10338. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10339. @end example
  10340. @item
  10341. Pad the input to get a squared output with size equal to the maximum
  10342. value between the input width and height, and put the input video at
  10343. the center of the padded area:
  10344. @example
  10345. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10346. @end example
  10347. @item
  10348. Pad the input to get a final w/h ratio of 16:9:
  10349. @example
  10350. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10351. @end example
  10352. @item
  10353. In case of anamorphic video, in order to set the output display aspect
  10354. correctly, it is necessary to use @var{sar} in the expression,
  10355. according to the relation:
  10356. @example
  10357. (ih * X / ih) * sar = output_dar
  10358. X = output_dar / sar
  10359. @end example
  10360. Thus the previous example needs to be modified to:
  10361. @example
  10362. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10363. @end example
  10364. @item
  10365. Double the output size and put the input video in the bottom-right
  10366. corner of the output padded area:
  10367. @example
  10368. pad="2*iw:2*ih:ow-iw:oh-ih"
  10369. @end example
  10370. @end itemize
  10371. @anchor{palettegen}
  10372. @section palettegen
  10373. Generate one palette for a whole video stream.
  10374. It accepts the following options:
  10375. @table @option
  10376. @item max_colors
  10377. Set the maximum number of colors to quantize in the palette.
  10378. Note: the palette will still contain 256 colors; the unused palette entries
  10379. will be black.
  10380. @item reserve_transparent
  10381. Create a palette of 255 colors maximum and reserve the last one for
  10382. transparency. Reserving the transparency color is useful for GIF optimization.
  10383. If not set, the maximum of colors in the palette will be 256. You probably want
  10384. to disable this option for a standalone image.
  10385. Set by default.
  10386. @item transparency_color
  10387. Set the color that will be used as background for transparency.
  10388. @item stats_mode
  10389. Set statistics mode.
  10390. It accepts the following values:
  10391. @table @samp
  10392. @item full
  10393. Compute full frame histograms.
  10394. @item diff
  10395. Compute histograms only for the part that differs from previous frame. This
  10396. might be relevant to give more importance to the moving part of your input if
  10397. the background is static.
  10398. @item single
  10399. Compute new histogram for each frame.
  10400. @end table
  10401. Default value is @var{full}.
  10402. @end table
  10403. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10404. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10405. color quantization of the palette. This information is also visible at
  10406. @var{info} logging level.
  10407. @subsection Examples
  10408. @itemize
  10409. @item
  10410. Generate a representative palette of a given video using @command{ffmpeg}:
  10411. @example
  10412. ffmpeg -i input.mkv -vf palettegen palette.png
  10413. @end example
  10414. @end itemize
  10415. @section paletteuse
  10416. Use a palette to downsample an input video stream.
  10417. The filter takes two inputs: one video stream and a palette. The palette must
  10418. be a 256 pixels image.
  10419. It accepts the following options:
  10420. @table @option
  10421. @item dither
  10422. Select dithering mode. Available algorithms are:
  10423. @table @samp
  10424. @item bayer
  10425. Ordered 8x8 bayer dithering (deterministic)
  10426. @item heckbert
  10427. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10428. Note: this dithering is sometimes considered "wrong" and is included as a
  10429. reference.
  10430. @item floyd_steinberg
  10431. Floyd and Steingberg dithering (error diffusion)
  10432. @item sierra2
  10433. Frankie Sierra dithering v2 (error diffusion)
  10434. @item sierra2_4a
  10435. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10436. @end table
  10437. Default is @var{sierra2_4a}.
  10438. @item bayer_scale
  10439. When @var{bayer} dithering is selected, this option defines the scale of the
  10440. pattern (how much the crosshatch pattern is visible). A low value means more
  10441. visible pattern for less banding, and higher value means less visible pattern
  10442. at the cost of more banding.
  10443. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10444. @item diff_mode
  10445. If set, define the zone to process
  10446. @table @samp
  10447. @item rectangle
  10448. Only the changing rectangle will be reprocessed. This is similar to GIF
  10449. cropping/offsetting compression mechanism. This option can be useful for speed
  10450. if only a part of the image is changing, and has use cases such as limiting the
  10451. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10452. moving scene (it leads to more deterministic output if the scene doesn't change
  10453. much, and as a result less moving noise and better GIF compression).
  10454. @end table
  10455. Default is @var{none}.
  10456. @item new
  10457. Take new palette for each output frame.
  10458. @item alpha_threshold
  10459. Sets the alpha threshold for transparency. Alpha values above this threshold
  10460. will be treated as completely opaque, and values below this threshold will be
  10461. treated as completely transparent.
  10462. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10463. @end table
  10464. @subsection Examples
  10465. @itemize
  10466. @item
  10467. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10468. using @command{ffmpeg}:
  10469. @example
  10470. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10471. @end example
  10472. @end itemize
  10473. @section perspective
  10474. Correct perspective of video not recorded perpendicular to the screen.
  10475. A description of the accepted parameters follows.
  10476. @table @option
  10477. @item x0
  10478. @item y0
  10479. @item x1
  10480. @item y1
  10481. @item x2
  10482. @item y2
  10483. @item x3
  10484. @item y3
  10485. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10486. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10487. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10488. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10489. then the corners of the source will be sent to the specified coordinates.
  10490. The expressions can use the following variables:
  10491. @table @option
  10492. @item W
  10493. @item H
  10494. the width and height of video frame.
  10495. @item in
  10496. Input frame count.
  10497. @item on
  10498. Output frame count.
  10499. @end table
  10500. @item interpolation
  10501. Set interpolation for perspective correction.
  10502. It accepts the following values:
  10503. @table @samp
  10504. @item linear
  10505. @item cubic
  10506. @end table
  10507. Default value is @samp{linear}.
  10508. @item sense
  10509. Set interpretation of coordinate options.
  10510. It accepts the following values:
  10511. @table @samp
  10512. @item 0, source
  10513. Send point in the source specified by the given coordinates to
  10514. the corners of the destination.
  10515. @item 1, destination
  10516. Send the corners of the source to the point in the destination specified
  10517. by the given coordinates.
  10518. Default value is @samp{source}.
  10519. @end table
  10520. @item eval
  10521. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10522. It accepts the following values:
  10523. @table @samp
  10524. @item init
  10525. only evaluate expressions once during the filter initialization or
  10526. when a command is processed
  10527. @item frame
  10528. evaluate expressions for each incoming frame
  10529. @end table
  10530. Default value is @samp{init}.
  10531. @end table
  10532. @section phase
  10533. Delay interlaced video by one field time so that the field order changes.
  10534. The intended use is to fix PAL movies that have been captured with the
  10535. opposite field order to the film-to-video transfer.
  10536. A description of the accepted parameters follows.
  10537. @table @option
  10538. @item mode
  10539. Set phase mode.
  10540. It accepts the following values:
  10541. @table @samp
  10542. @item t
  10543. Capture field order top-first, transfer bottom-first.
  10544. Filter will delay the bottom field.
  10545. @item b
  10546. Capture field order bottom-first, transfer top-first.
  10547. Filter will delay the top field.
  10548. @item p
  10549. Capture and transfer with the same field order. This mode only exists
  10550. for the documentation of the other options to refer to, but if you
  10551. actually select it, the filter will faithfully do nothing.
  10552. @item a
  10553. Capture field order determined automatically by field flags, transfer
  10554. opposite.
  10555. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10556. basis using field flags. If no field information is available,
  10557. then this works just like @samp{u}.
  10558. @item u
  10559. Capture unknown or varying, transfer opposite.
  10560. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10561. analyzing the images and selecting the alternative that produces best
  10562. match between the fields.
  10563. @item T
  10564. Capture top-first, transfer unknown or varying.
  10565. Filter selects among @samp{t} and @samp{p} using image analysis.
  10566. @item B
  10567. Capture bottom-first, transfer unknown or varying.
  10568. Filter selects among @samp{b} and @samp{p} using image analysis.
  10569. @item A
  10570. Capture determined by field flags, transfer unknown or varying.
  10571. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10572. image analysis. If no field information is available, then this works just
  10573. like @samp{U}. This is the default mode.
  10574. @item U
  10575. Both capture and transfer unknown or varying.
  10576. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10577. @end table
  10578. @end table
  10579. @section pixdesctest
  10580. Pixel format descriptor test filter, mainly useful for internal
  10581. testing. The output video should be equal to the input video.
  10582. For example:
  10583. @example
  10584. format=monow, pixdesctest
  10585. @end example
  10586. can be used to test the monowhite pixel format descriptor definition.
  10587. @section pixscope
  10588. Display sample values of color channels. Mainly useful for checking color
  10589. and levels. Minimum supported resolution is 640x480.
  10590. The filters accept the following options:
  10591. @table @option
  10592. @item x
  10593. Set scope X position, relative offset on X axis.
  10594. @item y
  10595. Set scope Y position, relative offset on Y axis.
  10596. @item w
  10597. Set scope width.
  10598. @item h
  10599. Set scope height.
  10600. @item o
  10601. Set window opacity. This window also holds statistics about pixel area.
  10602. @item wx
  10603. Set window X position, relative offset on X axis.
  10604. @item wy
  10605. Set window Y position, relative offset on Y axis.
  10606. @end table
  10607. @section pp
  10608. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10609. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10610. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10611. Each subfilter and some options have a short and a long name that can be used
  10612. interchangeably, i.e. dr/dering are the same.
  10613. The filters accept the following options:
  10614. @table @option
  10615. @item subfilters
  10616. Set postprocessing subfilters string.
  10617. @end table
  10618. All subfilters share common options to determine their scope:
  10619. @table @option
  10620. @item a/autoq
  10621. Honor the quality commands for this subfilter.
  10622. @item c/chrom
  10623. Do chrominance filtering, too (default).
  10624. @item y/nochrom
  10625. Do luminance filtering only (no chrominance).
  10626. @item n/noluma
  10627. Do chrominance filtering only (no luminance).
  10628. @end table
  10629. These options can be appended after the subfilter name, separated by a '|'.
  10630. Available subfilters are:
  10631. @table @option
  10632. @item hb/hdeblock[|difference[|flatness]]
  10633. Horizontal deblocking filter
  10634. @table @option
  10635. @item difference
  10636. Difference factor where higher values mean more deblocking (default: @code{32}).
  10637. @item flatness
  10638. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10639. @end table
  10640. @item vb/vdeblock[|difference[|flatness]]
  10641. Vertical deblocking filter
  10642. @table @option
  10643. @item difference
  10644. Difference factor where higher values mean more deblocking (default: @code{32}).
  10645. @item flatness
  10646. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10647. @end table
  10648. @item ha/hadeblock[|difference[|flatness]]
  10649. Accurate horizontal deblocking filter
  10650. @table @option
  10651. @item difference
  10652. Difference factor where higher values mean more deblocking (default: @code{32}).
  10653. @item flatness
  10654. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10655. @end table
  10656. @item va/vadeblock[|difference[|flatness]]
  10657. Accurate vertical deblocking filter
  10658. @table @option
  10659. @item difference
  10660. Difference factor where higher values mean more deblocking (default: @code{32}).
  10661. @item flatness
  10662. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10663. @end table
  10664. @end table
  10665. The horizontal and vertical deblocking filters share the difference and
  10666. flatness values so you cannot set different horizontal and vertical
  10667. thresholds.
  10668. @table @option
  10669. @item h1/x1hdeblock
  10670. Experimental horizontal deblocking filter
  10671. @item v1/x1vdeblock
  10672. Experimental vertical deblocking filter
  10673. @item dr/dering
  10674. Deringing filter
  10675. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10676. @table @option
  10677. @item threshold1
  10678. larger -> stronger filtering
  10679. @item threshold2
  10680. larger -> stronger filtering
  10681. @item threshold3
  10682. larger -> stronger filtering
  10683. @end table
  10684. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10685. @table @option
  10686. @item f/fullyrange
  10687. Stretch luminance to @code{0-255}.
  10688. @end table
  10689. @item lb/linblenddeint
  10690. Linear blend deinterlacing filter that deinterlaces the given block by
  10691. filtering all lines with a @code{(1 2 1)} filter.
  10692. @item li/linipoldeint
  10693. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10694. linearly interpolating every second line.
  10695. @item ci/cubicipoldeint
  10696. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10697. cubically interpolating every second line.
  10698. @item md/mediandeint
  10699. Median deinterlacing filter that deinterlaces the given block by applying a
  10700. median filter to every second line.
  10701. @item fd/ffmpegdeint
  10702. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10703. second line with a @code{(-1 4 2 4 -1)} filter.
  10704. @item l5/lowpass5
  10705. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10706. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10707. @item fq/forceQuant[|quantizer]
  10708. Overrides the quantizer table from the input with the constant quantizer you
  10709. specify.
  10710. @table @option
  10711. @item quantizer
  10712. Quantizer to use
  10713. @end table
  10714. @item de/default
  10715. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10716. @item fa/fast
  10717. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10718. @item ac
  10719. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10720. @end table
  10721. @subsection Examples
  10722. @itemize
  10723. @item
  10724. Apply horizontal and vertical deblocking, deringing and automatic
  10725. brightness/contrast:
  10726. @example
  10727. pp=hb/vb/dr/al
  10728. @end example
  10729. @item
  10730. Apply default filters without brightness/contrast correction:
  10731. @example
  10732. pp=de/-al
  10733. @end example
  10734. @item
  10735. Apply default filters and temporal denoiser:
  10736. @example
  10737. pp=default/tmpnoise|1|2|3
  10738. @end example
  10739. @item
  10740. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10741. automatically depending on available CPU time:
  10742. @example
  10743. pp=hb|y/vb|a
  10744. @end example
  10745. @end itemize
  10746. @section pp7
  10747. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10748. similar to spp = 6 with 7 point DCT, where only the center sample is
  10749. used after IDCT.
  10750. The filter accepts the following options:
  10751. @table @option
  10752. @item qp
  10753. Force a constant quantization parameter. It accepts an integer in range
  10754. 0 to 63. If not set, the filter will use the QP from the video stream
  10755. (if available).
  10756. @item mode
  10757. Set thresholding mode. Available modes are:
  10758. @table @samp
  10759. @item hard
  10760. Set hard thresholding.
  10761. @item soft
  10762. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10763. @item medium
  10764. Set medium thresholding (good results, default).
  10765. @end table
  10766. @end table
  10767. @section premultiply
  10768. Apply alpha premultiply effect to input video stream using first plane
  10769. of second stream as alpha.
  10770. Both streams must have same dimensions and same pixel format.
  10771. The filter accepts the following option:
  10772. @table @option
  10773. @item planes
  10774. Set which planes will be processed, unprocessed planes will be copied.
  10775. By default value 0xf, all planes will be processed.
  10776. @item inplace
  10777. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10778. @end table
  10779. @section prewitt
  10780. Apply prewitt operator to input video stream.
  10781. The filter accepts the following option:
  10782. @table @option
  10783. @item planes
  10784. Set which planes will be processed, unprocessed planes will be copied.
  10785. By default value 0xf, all planes will be processed.
  10786. @item scale
  10787. Set value which will be multiplied with filtered result.
  10788. @item delta
  10789. Set value which will be added to filtered result.
  10790. @end table
  10791. @anchor{program_opencl}
  10792. @section program_opencl
  10793. Filter video using an OpenCL program.
  10794. @table @option
  10795. @item source
  10796. OpenCL program source file.
  10797. @item kernel
  10798. Kernel name in program.
  10799. @item inputs
  10800. Number of inputs to the filter. Defaults to 1.
  10801. @item size, s
  10802. Size of output frames. Defaults to the same as the first input.
  10803. @end table
  10804. The program source file must contain a kernel function with the given name,
  10805. which will be run once for each plane of the output. Each run on a plane
  10806. gets enqueued as a separate 2D global NDRange with one work-item for each
  10807. pixel to be generated. The global ID offset for each work-item is therefore
  10808. the coordinates of a pixel in the destination image.
  10809. The kernel function needs to take the following arguments:
  10810. @itemize
  10811. @item
  10812. Destination image, @var{__write_only image2d_t}.
  10813. This image will become the output; the kernel should write all of it.
  10814. @item
  10815. Frame index, @var{unsigned int}.
  10816. This is a counter starting from zero and increasing by one for each frame.
  10817. @item
  10818. Source images, @var{__read_only image2d_t}.
  10819. These are the most recent images on each input. The kernel may read from
  10820. them to generate the output, but they can't be written to.
  10821. @end itemize
  10822. Example programs:
  10823. @itemize
  10824. @item
  10825. Copy the input to the output (output must be the same size as the input).
  10826. @verbatim
  10827. __kernel void copy(__write_only image2d_t destination,
  10828. unsigned int index,
  10829. __read_only image2d_t source)
  10830. {
  10831. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10832. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10833. float4 value = read_imagef(source, sampler, location);
  10834. write_imagef(destination, location, value);
  10835. }
  10836. @end verbatim
  10837. @item
  10838. Apply a simple transformation, rotating the input by an amount increasing
  10839. with the index counter. Pixel values are linearly interpolated by the
  10840. sampler, and the output need not have the same dimensions as the input.
  10841. @verbatim
  10842. __kernel void rotate_image(__write_only image2d_t dst,
  10843. unsigned int index,
  10844. __read_only image2d_t src)
  10845. {
  10846. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10847. CLK_FILTER_LINEAR);
  10848. float angle = (float)index / 100.0f;
  10849. float2 dst_dim = convert_float2(get_image_dim(dst));
  10850. float2 src_dim = convert_float2(get_image_dim(src));
  10851. float2 dst_cen = dst_dim / 2.0f;
  10852. float2 src_cen = src_dim / 2.0f;
  10853. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10854. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10855. float2 src_pos = {
  10856. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10857. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10858. };
  10859. src_pos = src_pos * src_dim / dst_dim;
  10860. float2 src_loc = src_pos + src_cen;
  10861. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10862. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10863. write_imagef(dst, dst_loc, 0.5f);
  10864. else
  10865. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10866. }
  10867. @end verbatim
  10868. @item
  10869. Blend two inputs together, with the amount of each input used varying
  10870. with the index counter.
  10871. @verbatim
  10872. __kernel void blend_images(__write_only image2d_t dst,
  10873. unsigned int index,
  10874. __read_only image2d_t src1,
  10875. __read_only image2d_t src2)
  10876. {
  10877. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10878. CLK_FILTER_LINEAR);
  10879. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10880. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10881. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10882. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10883. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10884. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10885. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10886. }
  10887. @end verbatim
  10888. @end itemize
  10889. @section pseudocolor
  10890. Alter frame colors in video with pseudocolors.
  10891. This filter accept the following options:
  10892. @table @option
  10893. @item c0
  10894. set pixel first component expression
  10895. @item c1
  10896. set pixel second component expression
  10897. @item c2
  10898. set pixel third component expression
  10899. @item c3
  10900. set pixel fourth component expression, corresponds to the alpha component
  10901. @item i
  10902. set component to use as base for altering colors
  10903. @end table
  10904. Each of them specifies the expression to use for computing the lookup table for
  10905. the corresponding pixel component values.
  10906. The expressions can contain the following constants and functions:
  10907. @table @option
  10908. @item w
  10909. @item h
  10910. The input width and height.
  10911. @item val
  10912. The input value for the pixel component.
  10913. @item ymin, umin, vmin, amin
  10914. The minimum allowed component value.
  10915. @item ymax, umax, vmax, amax
  10916. The maximum allowed component value.
  10917. @end table
  10918. All expressions default to "val".
  10919. @subsection Examples
  10920. @itemize
  10921. @item
  10922. Change too high luma values to gradient:
  10923. @example
  10924. 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'"
  10925. @end example
  10926. @end itemize
  10927. @section psnr
  10928. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10929. Ratio) between two input videos.
  10930. This filter takes in input two input videos, the first input is
  10931. considered the "main" source and is passed unchanged to the
  10932. output. The second input is used as a "reference" video for computing
  10933. the PSNR.
  10934. Both video inputs must have the same resolution and pixel format for
  10935. this filter to work correctly. Also it assumes that both inputs
  10936. have the same number of frames, which are compared one by one.
  10937. The obtained average PSNR is printed through the logging system.
  10938. The filter stores the accumulated MSE (mean squared error) of each
  10939. frame, and at the end of the processing it is averaged across all frames
  10940. equally, and the following formula is applied to obtain the PSNR:
  10941. @example
  10942. PSNR = 10*log10(MAX^2/MSE)
  10943. @end example
  10944. Where MAX is the average of the maximum values of each component of the
  10945. image.
  10946. The description of the accepted parameters follows.
  10947. @table @option
  10948. @item stats_file, f
  10949. If specified the filter will use the named file to save the PSNR of
  10950. each individual frame. When filename equals "-" the data is sent to
  10951. standard output.
  10952. @item stats_version
  10953. Specifies which version of the stats file format to use. Details of
  10954. each format are written below.
  10955. Default value is 1.
  10956. @item stats_add_max
  10957. Determines whether the max value is output to the stats log.
  10958. Default value is 0.
  10959. Requires stats_version >= 2. If this is set and stats_version < 2,
  10960. the filter will return an error.
  10961. @end table
  10962. This filter also supports the @ref{framesync} options.
  10963. The file printed if @var{stats_file} is selected, contains a sequence of
  10964. key/value pairs of the form @var{key}:@var{value} for each compared
  10965. couple of frames.
  10966. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10967. the list of per-frame-pair stats, with key value pairs following the frame
  10968. format with the following parameters:
  10969. @table @option
  10970. @item psnr_log_version
  10971. The version of the log file format. Will match @var{stats_version}.
  10972. @item fields
  10973. A comma separated list of the per-frame-pair parameters included in
  10974. the log.
  10975. @end table
  10976. A description of each shown per-frame-pair parameter follows:
  10977. @table @option
  10978. @item n
  10979. sequential number of the input frame, starting from 1
  10980. @item mse_avg
  10981. Mean Square Error pixel-by-pixel average difference of the compared
  10982. frames, averaged over all the image components.
  10983. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10984. Mean Square Error pixel-by-pixel average difference of the compared
  10985. frames for the component specified by the suffix.
  10986. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10987. Peak Signal to Noise ratio of the compared frames for the component
  10988. specified by the suffix.
  10989. @item max_avg, max_y, max_u, max_v
  10990. Maximum allowed value for each channel, and average over all
  10991. channels.
  10992. @end table
  10993. For example:
  10994. @example
  10995. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10996. [main][ref] psnr="stats_file=stats.log" [out]
  10997. @end example
  10998. On this example the input file being processed is compared with the
  10999. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11000. is stored in @file{stats.log}.
  11001. @anchor{pullup}
  11002. @section pullup
  11003. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11004. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11005. content.
  11006. The pullup filter is designed to take advantage of future context in making
  11007. its decisions. This filter is stateless in the sense that it does not lock
  11008. onto a pattern to follow, but it instead looks forward to the following
  11009. fields in order to identify matches and rebuild progressive frames.
  11010. To produce content with an even framerate, insert the fps filter after
  11011. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11012. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11013. The filter accepts the following options:
  11014. @table @option
  11015. @item jl
  11016. @item jr
  11017. @item jt
  11018. @item jb
  11019. These options set the amount of "junk" to ignore at the left, right, top, and
  11020. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11021. while top and bottom are in units of 2 lines.
  11022. The default is 8 pixels on each side.
  11023. @item sb
  11024. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11025. filter generating an occasional mismatched frame, but it may also cause an
  11026. excessive number of frames to be dropped during high motion sequences.
  11027. Conversely, setting it to -1 will make filter match fields more easily.
  11028. This may help processing of video where there is slight blurring between
  11029. the fields, but may also cause there to be interlaced frames in the output.
  11030. Default value is @code{0}.
  11031. @item mp
  11032. Set the metric plane to use. It accepts the following values:
  11033. @table @samp
  11034. @item l
  11035. Use luma plane.
  11036. @item u
  11037. Use chroma blue plane.
  11038. @item v
  11039. Use chroma red plane.
  11040. @end table
  11041. This option may be set to use chroma plane instead of the default luma plane
  11042. for doing filter's computations. This may improve accuracy on very clean
  11043. source material, but more likely will decrease accuracy, especially if there
  11044. is chroma noise (rainbow effect) or any grayscale video.
  11045. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11046. load and make pullup usable in realtime on slow machines.
  11047. @end table
  11048. For best results (without duplicated frames in the output file) it is
  11049. necessary to change the output frame rate. For example, to inverse
  11050. telecine NTSC input:
  11051. @example
  11052. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11053. @end example
  11054. @section qp
  11055. Change video quantization parameters (QP).
  11056. The filter accepts the following option:
  11057. @table @option
  11058. @item qp
  11059. Set expression for quantization parameter.
  11060. @end table
  11061. The expression is evaluated through the eval API and can contain, among others,
  11062. the following constants:
  11063. @table @var
  11064. @item known
  11065. 1 if index is not 129, 0 otherwise.
  11066. @item qp
  11067. Sequential index starting from -129 to 128.
  11068. @end table
  11069. @subsection Examples
  11070. @itemize
  11071. @item
  11072. Some equation like:
  11073. @example
  11074. qp=2+2*sin(PI*qp)
  11075. @end example
  11076. @end itemize
  11077. @section random
  11078. Flush video frames from internal cache of frames into a random order.
  11079. No frame is discarded.
  11080. Inspired by @ref{frei0r} nervous filter.
  11081. @table @option
  11082. @item frames
  11083. Set size in number of frames of internal cache, in range from @code{2} to
  11084. @code{512}. Default is @code{30}.
  11085. @item seed
  11086. Set seed for random number generator, must be an integer included between
  11087. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11088. less than @code{0}, the filter will try to use a good random seed on a
  11089. best effort basis.
  11090. @end table
  11091. @section readeia608
  11092. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11093. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11094. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11095. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11096. @table @option
  11097. @item lavfi.readeia608.X.cc
  11098. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11099. @item lavfi.readeia608.X.line
  11100. The number of the line on which the EIA-608 data was identified and read.
  11101. @end table
  11102. This filter accepts the following options:
  11103. @table @option
  11104. @item scan_min
  11105. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11106. @item scan_max
  11107. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11108. @item mac
  11109. Set minimal acceptable amplitude change for sync codes detection.
  11110. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11111. @item spw
  11112. Set the ratio of width reserved for sync code detection.
  11113. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11114. @item mhd
  11115. Set the max peaks height difference for sync code detection.
  11116. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11117. @item mpd
  11118. Set max peaks period difference for sync code detection.
  11119. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11120. @item msd
  11121. Set the first two max start code bits differences.
  11122. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11123. @item bhd
  11124. Set the minimum ratio of bits height compared to 3rd start code bit.
  11125. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11126. @item th_w
  11127. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11128. @item th_b
  11129. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11130. @item chp
  11131. Enable checking the parity bit. In the event of a parity error, the filter will output
  11132. @code{0x00} for that character. Default is false.
  11133. @end table
  11134. @subsection Examples
  11135. @itemize
  11136. @item
  11137. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11138. @example
  11139. 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
  11140. @end example
  11141. @end itemize
  11142. @section readvitc
  11143. Read vertical interval timecode (VITC) information from the top lines of a
  11144. video frame.
  11145. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11146. timecode value, if a valid timecode has been detected. Further metadata key
  11147. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11148. timecode data has been found or not.
  11149. This filter accepts the following options:
  11150. @table @option
  11151. @item scan_max
  11152. Set the maximum number of lines to scan for VITC data. If the value is set to
  11153. @code{-1} the full video frame is scanned. Default is @code{45}.
  11154. @item thr_b
  11155. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11156. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11157. @item thr_w
  11158. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11159. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11160. @end table
  11161. @subsection Examples
  11162. @itemize
  11163. @item
  11164. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11165. draw @code{--:--:--:--} as a placeholder:
  11166. @example
  11167. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11168. @end example
  11169. @end itemize
  11170. @section remap
  11171. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11172. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11173. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11174. value for pixel will be used for destination pixel.
  11175. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11176. will have Xmap/Ymap video stream dimensions.
  11177. Xmap and Ymap input video streams are 16bit depth, single channel.
  11178. @section removegrain
  11179. The removegrain filter is a spatial denoiser for progressive video.
  11180. @table @option
  11181. @item m0
  11182. Set mode for the first plane.
  11183. @item m1
  11184. Set mode for the second plane.
  11185. @item m2
  11186. Set mode for the third plane.
  11187. @item m3
  11188. Set mode for the fourth plane.
  11189. @end table
  11190. Range of mode is from 0 to 24. Description of each mode follows:
  11191. @table @var
  11192. @item 0
  11193. Leave input plane unchanged. Default.
  11194. @item 1
  11195. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11196. @item 2
  11197. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11198. @item 3
  11199. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11200. @item 4
  11201. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11202. This is equivalent to a median filter.
  11203. @item 5
  11204. Line-sensitive clipping giving the minimal change.
  11205. @item 6
  11206. Line-sensitive clipping, intermediate.
  11207. @item 7
  11208. Line-sensitive clipping, intermediate.
  11209. @item 8
  11210. Line-sensitive clipping, intermediate.
  11211. @item 9
  11212. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11213. @item 10
  11214. Replaces the target pixel with the closest neighbour.
  11215. @item 11
  11216. [1 2 1] horizontal and vertical kernel blur.
  11217. @item 12
  11218. Same as mode 11.
  11219. @item 13
  11220. Bob mode, interpolates top field from the line where the neighbours
  11221. pixels are the closest.
  11222. @item 14
  11223. Bob mode, interpolates bottom field from the line where the neighbours
  11224. pixels are the closest.
  11225. @item 15
  11226. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11227. interpolation formula.
  11228. @item 16
  11229. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11230. interpolation formula.
  11231. @item 17
  11232. Clips the pixel with the minimum and maximum of respectively the maximum and
  11233. minimum of each pair of opposite neighbour pixels.
  11234. @item 18
  11235. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11236. the current pixel is minimal.
  11237. @item 19
  11238. Replaces the pixel with the average of its 8 neighbours.
  11239. @item 20
  11240. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11241. @item 21
  11242. Clips pixels using the averages of opposite neighbour.
  11243. @item 22
  11244. Same as mode 21 but simpler and faster.
  11245. @item 23
  11246. Small edge and halo removal, but reputed useless.
  11247. @item 24
  11248. Similar as 23.
  11249. @end table
  11250. @section removelogo
  11251. Suppress a TV station logo, using an image file to determine which
  11252. pixels comprise the logo. It works by filling in the pixels that
  11253. comprise the logo with neighboring pixels.
  11254. The filter accepts the following options:
  11255. @table @option
  11256. @item filename, f
  11257. Set the filter bitmap file, which can be any image format supported by
  11258. libavformat. The width and height of the image file must match those of the
  11259. video stream being processed.
  11260. @end table
  11261. Pixels in the provided bitmap image with a value of zero are not
  11262. considered part of the logo, non-zero pixels are considered part of
  11263. the logo. If you use white (255) for the logo and black (0) for the
  11264. rest, you will be safe. For making the filter bitmap, it is
  11265. recommended to take a screen capture of a black frame with the logo
  11266. visible, and then using a threshold filter followed by the erode
  11267. filter once or twice.
  11268. If needed, little splotches can be fixed manually. Remember that if
  11269. logo pixels are not covered, the filter quality will be much
  11270. reduced. Marking too many pixels as part of the logo does not hurt as
  11271. much, but it will increase the amount of blurring needed to cover over
  11272. the image and will destroy more information than necessary, and extra
  11273. pixels will slow things down on a large logo.
  11274. @section repeatfields
  11275. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11276. fields based on its value.
  11277. @section reverse
  11278. Reverse a video clip.
  11279. Warning: This filter requires memory to buffer the entire clip, so trimming
  11280. is suggested.
  11281. @subsection Examples
  11282. @itemize
  11283. @item
  11284. Take the first 5 seconds of a clip, and reverse it.
  11285. @example
  11286. trim=end=5,reverse
  11287. @end example
  11288. @end itemize
  11289. @section rgbashift
  11290. Shift R/G/B/A pixels horizontally and/or vertically.
  11291. The filter accepts the following options:
  11292. @table @option
  11293. @item rh
  11294. Set amount to shift red horizontally.
  11295. @item rv
  11296. Set amount to shift red vertically.
  11297. @item gh
  11298. Set amount to shift green horizontally.
  11299. @item gv
  11300. Set amount to shift green vertically.
  11301. @item bh
  11302. Set amount to shift blue horizontally.
  11303. @item bv
  11304. Set amount to shift blue vertically.
  11305. @item ah
  11306. Set amount to shift alpha horizontally.
  11307. @item av
  11308. Set amount to shift alpha vertically.
  11309. @item edge
  11310. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11311. @end table
  11312. @section roberts
  11313. Apply roberts cross operator to input video stream.
  11314. The filter accepts the following option:
  11315. @table @option
  11316. @item planes
  11317. Set which planes will be processed, unprocessed planes will be copied.
  11318. By default value 0xf, all planes will be processed.
  11319. @item scale
  11320. Set value which will be multiplied with filtered result.
  11321. @item delta
  11322. Set value which will be added to filtered result.
  11323. @end table
  11324. @section rotate
  11325. Rotate video by an arbitrary angle expressed in radians.
  11326. The filter accepts the following options:
  11327. A description of the optional parameters follows.
  11328. @table @option
  11329. @item angle, a
  11330. Set an expression for the angle by which to rotate the input video
  11331. clockwise, expressed as a number of radians. A negative value will
  11332. result in a counter-clockwise rotation. By default it is set to "0".
  11333. This expression is evaluated for each frame.
  11334. @item out_w, ow
  11335. Set the output width expression, default value is "iw".
  11336. This expression is evaluated just once during configuration.
  11337. @item out_h, oh
  11338. Set the output height expression, default value is "ih".
  11339. This expression is evaluated just once during configuration.
  11340. @item bilinear
  11341. Enable bilinear interpolation if set to 1, a value of 0 disables
  11342. it. Default value is 1.
  11343. @item fillcolor, c
  11344. Set the color used to fill the output area not covered by the rotated
  11345. image. For the general syntax of this option, check the
  11346. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11347. If the special value "none" is selected then no
  11348. background is printed (useful for example if the background is never shown).
  11349. Default value is "black".
  11350. @end table
  11351. The expressions for the angle and the output size can contain the
  11352. following constants and functions:
  11353. @table @option
  11354. @item n
  11355. sequential number of the input frame, starting from 0. It is always NAN
  11356. before the first frame is filtered.
  11357. @item t
  11358. time in seconds of the input frame, it is set to 0 when the filter is
  11359. configured. It is always NAN before the first frame is filtered.
  11360. @item hsub
  11361. @item vsub
  11362. horizontal and vertical chroma subsample values. For example for the
  11363. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11364. @item in_w, iw
  11365. @item in_h, ih
  11366. the input video width and height
  11367. @item out_w, ow
  11368. @item out_h, oh
  11369. the output width and height, that is the size of the padded area as
  11370. specified by the @var{width} and @var{height} expressions
  11371. @item rotw(a)
  11372. @item roth(a)
  11373. the minimal width/height required for completely containing the input
  11374. video rotated by @var{a} radians.
  11375. These are only available when computing the @option{out_w} and
  11376. @option{out_h} expressions.
  11377. @end table
  11378. @subsection Examples
  11379. @itemize
  11380. @item
  11381. Rotate the input by PI/6 radians clockwise:
  11382. @example
  11383. rotate=PI/6
  11384. @end example
  11385. @item
  11386. Rotate the input by PI/6 radians counter-clockwise:
  11387. @example
  11388. rotate=-PI/6
  11389. @end example
  11390. @item
  11391. Rotate the input by 45 degrees clockwise:
  11392. @example
  11393. rotate=45*PI/180
  11394. @end example
  11395. @item
  11396. Apply a constant rotation with period T, starting from an angle of PI/3:
  11397. @example
  11398. rotate=PI/3+2*PI*t/T
  11399. @end example
  11400. @item
  11401. Make the input video rotation oscillating with a period of T
  11402. seconds and an amplitude of A radians:
  11403. @example
  11404. rotate=A*sin(2*PI/T*t)
  11405. @end example
  11406. @item
  11407. Rotate the video, output size is chosen so that the whole rotating
  11408. input video is always completely contained in the output:
  11409. @example
  11410. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11411. @end example
  11412. @item
  11413. Rotate the video, reduce the output size so that no background is ever
  11414. shown:
  11415. @example
  11416. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11417. @end example
  11418. @end itemize
  11419. @subsection Commands
  11420. The filter supports the following commands:
  11421. @table @option
  11422. @item a, angle
  11423. Set the angle expression.
  11424. The command accepts the same syntax of the corresponding option.
  11425. If the specified expression is not valid, it is kept at its current
  11426. value.
  11427. @end table
  11428. @section sab
  11429. Apply Shape Adaptive Blur.
  11430. The filter accepts the following options:
  11431. @table @option
  11432. @item luma_radius, lr
  11433. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11434. value is 1.0. A greater value will result in a more blurred image, and
  11435. in slower processing.
  11436. @item luma_pre_filter_radius, lpfr
  11437. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11438. value is 1.0.
  11439. @item luma_strength, ls
  11440. Set luma maximum difference between pixels to still be considered, must
  11441. be a value in the 0.1-100.0 range, default value is 1.0.
  11442. @item chroma_radius, cr
  11443. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11444. greater value will result in a more blurred image, and in slower
  11445. processing.
  11446. @item chroma_pre_filter_radius, cpfr
  11447. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11448. @item chroma_strength, cs
  11449. Set chroma maximum difference between pixels to still be considered,
  11450. must be a value in the -0.9-100.0 range.
  11451. @end table
  11452. Each chroma option value, if not explicitly specified, is set to the
  11453. corresponding luma option value.
  11454. @anchor{scale}
  11455. @section scale
  11456. Scale (resize) the input video, using the libswscale library.
  11457. The scale filter forces the output display aspect ratio to be the same
  11458. of the input, by changing the output sample aspect ratio.
  11459. If the input image format is different from the format requested by
  11460. the next filter, the scale filter will convert the input to the
  11461. requested format.
  11462. @subsection Options
  11463. The filter accepts the following options, or any of the options
  11464. supported by the libswscale scaler.
  11465. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11466. the complete list of scaler options.
  11467. @table @option
  11468. @item width, w
  11469. @item height, h
  11470. Set the output video dimension expression. Default value is the input
  11471. dimension.
  11472. If the @var{width} or @var{w} value is 0, the input width is used for
  11473. the output. If the @var{height} or @var{h} value is 0, the input height
  11474. is used for the output.
  11475. If one and only one of the values is -n with n >= 1, the scale filter
  11476. will use a value that maintains the aspect ratio of the input image,
  11477. calculated from the other specified dimension. After that it will,
  11478. however, make sure that the calculated dimension is divisible by n and
  11479. adjust the value if necessary.
  11480. If both values are -n with n >= 1, the behavior will be identical to
  11481. both values being set to 0 as previously detailed.
  11482. See below for the list of accepted constants for use in the dimension
  11483. expression.
  11484. @item eval
  11485. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11486. @table @samp
  11487. @item init
  11488. Only evaluate expressions once during the filter initialization or when a command is processed.
  11489. @item frame
  11490. Evaluate expressions for each incoming frame.
  11491. @end table
  11492. Default value is @samp{init}.
  11493. @item interl
  11494. Set the interlacing mode. It accepts the following values:
  11495. @table @samp
  11496. @item 1
  11497. Force interlaced aware scaling.
  11498. @item 0
  11499. Do not apply interlaced scaling.
  11500. @item -1
  11501. Select interlaced aware scaling depending on whether the source frames
  11502. are flagged as interlaced or not.
  11503. @end table
  11504. Default value is @samp{0}.
  11505. @item flags
  11506. Set libswscale scaling flags. See
  11507. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11508. complete list of values. If not explicitly specified the filter applies
  11509. the default flags.
  11510. @item param0, param1
  11511. Set libswscale input parameters for scaling algorithms that need them. See
  11512. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11513. complete documentation. If not explicitly specified the filter applies
  11514. empty parameters.
  11515. @item size, s
  11516. Set the video size. For the syntax of this option, check the
  11517. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11518. @item in_color_matrix
  11519. @item out_color_matrix
  11520. Set in/output YCbCr color space type.
  11521. This allows the autodetected value to be overridden as well as allows forcing
  11522. a specific value used for the output and encoder.
  11523. If not specified, the color space type depends on the pixel format.
  11524. Possible values:
  11525. @table @samp
  11526. @item auto
  11527. Choose automatically.
  11528. @item bt709
  11529. Format conforming to International Telecommunication Union (ITU)
  11530. Recommendation BT.709.
  11531. @item fcc
  11532. Set color space conforming to the United States Federal Communications
  11533. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11534. @item bt601
  11535. Set color space conforming to:
  11536. @itemize
  11537. @item
  11538. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11539. @item
  11540. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11541. @item
  11542. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11543. @end itemize
  11544. @item smpte240m
  11545. Set color space conforming to SMPTE ST 240:1999.
  11546. @end table
  11547. @item in_range
  11548. @item out_range
  11549. Set in/output YCbCr sample range.
  11550. This allows the autodetected value to be overridden as well as allows forcing
  11551. a specific value used for the output and encoder. If not specified, the
  11552. range depends on the pixel format. Possible values:
  11553. @table @samp
  11554. @item auto/unknown
  11555. Choose automatically.
  11556. @item jpeg/full/pc
  11557. Set full range (0-255 in case of 8-bit luma).
  11558. @item mpeg/limited/tv
  11559. Set "MPEG" range (16-235 in case of 8-bit luma).
  11560. @end table
  11561. @item force_original_aspect_ratio
  11562. Enable decreasing or increasing output video width or height if necessary to
  11563. keep the original aspect ratio. Possible values:
  11564. @table @samp
  11565. @item disable
  11566. Scale the video as specified and disable this feature.
  11567. @item decrease
  11568. The output video dimensions will automatically be decreased if needed.
  11569. @item increase
  11570. The output video dimensions will automatically be increased if needed.
  11571. @end table
  11572. One useful instance of this option is that when you know a specific device's
  11573. maximum allowed resolution, you can use this to limit the output video to
  11574. that, while retaining the aspect ratio. For example, device A allows
  11575. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11576. decrease) and specifying 1280x720 to the command line makes the output
  11577. 1280x533.
  11578. Please note that this is a different thing than specifying -1 for @option{w}
  11579. or @option{h}, you still need to specify the output resolution for this option
  11580. to work.
  11581. @end table
  11582. The values of the @option{w} and @option{h} options are expressions
  11583. containing the following constants:
  11584. @table @var
  11585. @item in_w
  11586. @item in_h
  11587. The input width and height
  11588. @item iw
  11589. @item ih
  11590. These are the same as @var{in_w} and @var{in_h}.
  11591. @item out_w
  11592. @item out_h
  11593. The output (scaled) width and height
  11594. @item ow
  11595. @item oh
  11596. These are the same as @var{out_w} and @var{out_h}
  11597. @item a
  11598. The same as @var{iw} / @var{ih}
  11599. @item sar
  11600. input sample aspect ratio
  11601. @item dar
  11602. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11603. @item hsub
  11604. @item vsub
  11605. horizontal and vertical input chroma subsample values. For example for the
  11606. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11607. @item ohsub
  11608. @item ovsub
  11609. horizontal and vertical output chroma subsample values. For example for the
  11610. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11611. @end table
  11612. @subsection Examples
  11613. @itemize
  11614. @item
  11615. Scale the input video to a size of 200x100
  11616. @example
  11617. scale=w=200:h=100
  11618. @end example
  11619. This is equivalent to:
  11620. @example
  11621. scale=200:100
  11622. @end example
  11623. or:
  11624. @example
  11625. scale=200x100
  11626. @end example
  11627. @item
  11628. Specify a size abbreviation for the output size:
  11629. @example
  11630. scale=qcif
  11631. @end example
  11632. which can also be written as:
  11633. @example
  11634. scale=size=qcif
  11635. @end example
  11636. @item
  11637. Scale the input to 2x:
  11638. @example
  11639. scale=w=2*iw:h=2*ih
  11640. @end example
  11641. @item
  11642. The above is the same as:
  11643. @example
  11644. scale=2*in_w:2*in_h
  11645. @end example
  11646. @item
  11647. Scale the input to 2x with forced interlaced scaling:
  11648. @example
  11649. scale=2*iw:2*ih:interl=1
  11650. @end example
  11651. @item
  11652. Scale the input to half size:
  11653. @example
  11654. scale=w=iw/2:h=ih/2
  11655. @end example
  11656. @item
  11657. Increase the width, and set the height to the same size:
  11658. @example
  11659. scale=3/2*iw:ow
  11660. @end example
  11661. @item
  11662. Seek Greek harmony:
  11663. @example
  11664. scale=iw:1/PHI*iw
  11665. scale=ih*PHI:ih
  11666. @end example
  11667. @item
  11668. Increase the height, and set the width to 3/2 of the height:
  11669. @example
  11670. scale=w=3/2*oh:h=3/5*ih
  11671. @end example
  11672. @item
  11673. Increase the size, making the size a multiple of the chroma
  11674. subsample values:
  11675. @example
  11676. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11677. @end example
  11678. @item
  11679. Increase the width to a maximum of 500 pixels,
  11680. keeping the same aspect ratio as the input:
  11681. @example
  11682. scale=w='min(500\, iw*3/2):h=-1'
  11683. @end example
  11684. @item
  11685. Make pixels square by combining scale and setsar:
  11686. @example
  11687. scale='trunc(ih*dar):ih',setsar=1/1
  11688. @end example
  11689. @item
  11690. Make pixels square by combining scale and setsar,
  11691. making sure the resulting resolution is even (required by some codecs):
  11692. @example
  11693. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11694. @end example
  11695. @end itemize
  11696. @subsection Commands
  11697. This filter supports the following commands:
  11698. @table @option
  11699. @item width, w
  11700. @item height, h
  11701. Set the output video dimension expression.
  11702. The command accepts the same syntax of the corresponding option.
  11703. If the specified expression is not valid, it is kept at its current
  11704. value.
  11705. @end table
  11706. @section scale_npp
  11707. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11708. format conversion on CUDA video frames. Setting the output width and height
  11709. works in the same way as for the @var{scale} filter.
  11710. The following additional options are accepted:
  11711. @table @option
  11712. @item format
  11713. The pixel format of the output CUDA frames. If set to the string "same" (the
  11714. default), the input format will be kept. Note that automatic format negotiation
  11715. and conversion is not yet supported for hardware frames
  11716. @item interp_algo
  11717. The interpolation algorithm used for resizing. One of the following:
  11718. @table @option
  11719. @item nn
  11720. Nearest neighbour.
  11721. @item linear
  11722. @item cubic
  11723. @item cubic2p_bspline
  11724. 2-parameter cubic (B=1, C=0)
  11725. @item cubic2p_catmullrom
  11726. 2-parameter cubic (B=0, C=1/2)
  11727. @item cubic2p_b05c03
  11728. 2-parameter cubic (B=1/2, C=3/10)
  11729. @item super
  11730. Supersampling
  11731. @item lanczos
  11732. @end table
  11733. @end table
  11734. @section scale2ref
  11735. Scale (resize) the input video, based on a reference video.
  11736. See the scale filter for available options, scale2ref supports the same but
  11737. uses the reference video instead of the main input as basis. scale2ref also
  11738. supports the following additional constants for the @option{w} and
  11739. @option{h} options:
  11740. @table @var
  11741. @item main_w
  11742. @item main_h
  11743. The main input video's width and height
  11744. @item main_a
  11745. The same as @var{main_w} / @var{main_h}
  11746. @item main_sar
  11747. The main input video's sample aspect ratio
  11748. @item main_dar, mdar
  11749. The main input video's display aspect ratio. Calculated from
  11750. @code{(main_w / main_h) * main_sar}.
  11751. @item main_hsub
  11752. @item main_vsub
  11753. The main input video's horizontal and vertical chroma subsample values.
  11754. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11755. is 1.
  11756. @end table
  11757. @subsection Examples
  11758. @itemize
  11759. @item
  11760. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11761. @example
  11762. 'scale2ref[b][a];[a][b]overlay'
  11763. @end example
  11764. @item
  11765. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11766. @example
  11767. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11768. @end example
  11769. @end itemize
  11770. @anchor{selectivecolor}
  11771. @section selectivecolor
  11772. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11773. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11774. by the "purity" of the color (that is, how saturated it already is).
  11775. This filter is similar to the Adobe Photoshop Selective Color tool.
  11776. The filter accepts the following options:
  11777. @table @option
  11778. @item correction_method
  11779. Select color correction method.
  11780. Available values are:
  11781. @table @samp
  11782. @item absolute
  11783. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11784. component value).
  11785. @item relative
  11786. Specified adjustments are relative to the original component value.
  11787. @end table
  11788. Default is @code{absolute}.
  11789. @item reds
  11790. Adjustments for red pixels (pixels where the red component is the maximum)
  11791. @item yellows
  11792. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11793. @item greens
  11794. Adjustments for green pixels (pixels where the green component is the maximum)
  11795. @item cyans
  11796. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11797. @item blues
  11798. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11799. @item magentas
  11800. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11801. @item whites
  11802. Adjustments for white pixels (pixels where all components are greater than 128)
  11803. @item neutrals
  11804. Adjustments for all pixels except pure black and pure white
  11805. @item blacks
  11806. Adjustments for black pixels (pixels where all components are lesser than 128)
  11807. @item psfile
  11808. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11809. @end table
  11810. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11811. 4 space separated floating point adjustment values in the [-1,1] range,
  11812. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11813. pixels of its range.
  11814. @subsection Examples
  11815. @itemize
  11816. @item
  11817. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11818. increase magenta by 27% in blue areas:
  11819. @example
  11820. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11821. @end example
  11822. @item
  11823. Use a Photoshop selective color preset:
  11824. @example
  11825. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11826. @end example
  11827. @end itemize
  11828. @anchor{separatefields}
  11829. @section separatefields
  11830. The @code{separatefields} takes a frame-based video input and splits
  11831. each frame into its components fields, producing a new half height clip
  11832. with twice the frame rate and twice the frame count.
  11833. This filter use field-dominance information in frame to decide which
  11834. of each pair of fields to place first in the output.
  11835. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11836. @section setdar, setsar
  11837. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11838. output video.
  11839. This is done by changing the specified Sample (aka Pixel) Aspect
  11840. Ratio, according to the following equation:
  11841. @example
  11842. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11843. @end example
  11844. Keep in mind that the @code{setdar} filter does not modify the pixel
  11845. dimensions of the video frame. Also, the display aspect ratio set by
  11846. this filter may be changed by later filters in the filterchain,
  11847. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11848. applied.
  11849. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11850. the filter output video.
  11851. Note that as a consequence of the application of this filter, the
  11852. output display aspect ratio will change according to the equation
  11853. above.
  11854. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11855. filter may be changed by later filters in the filterchain, e.g. if
  11856. another "setsar" or a "setdar" filter is applied.
  11857. It accepts the following parameters:
  11858. @table @option
  11859. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11860. Set the aspect ratio used by the filter.
  11861. The parameter can be a floating point number string, an expression, or
  11862. a string of the form @var{num}:@var{den}, where @var{num} and
  11863. @var{den} are the numerator and denominator of the aspect ratio. If
  11864. the parameter is not specified, it is assumed the value "0".
  11865. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11866. should be escaped.
  11867. @item max
  11868. Set the maximum integer value to use for expressing numerator and
  11869. denominator when reducing the expressed aspect ratio to a rational.
  11870. Default value is @code{100}.
  11871. @end table
  11872. The parameter @var{sar} is an expression containing
  11873. the following constants:
  11874. @table @option
  11875. @item E, PI, PHI
  11876. These are approximated values for the mathematical constants e
  11877. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11878. @item w, h
  11879. The input width and height.
  11880. @item a
  11881. These are the same as @var{w} / @var{h}.
  11882. @item sar
  11883. The input sample aspect ratio.
  11884. @item dar
  11885. The input display aspect ratio. It is the same as
  11886. (@var{w} / @var{h}) * @var{sar}.
  11887. @item hsub, vsub
  11888. Horizontal and vertical chroma subsample values. For example, for the
  11889. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11890. @end table
  11891. @subsection Examples
  11892. @itemize
  11893. @item
  11894. To change the display aspect ratio to 16:9, specify one of the following:
  11895. @example
  11896. setdar=dar=1.77777
  11897. setdar=dar=16/9
  11898. @end example
  11899. @item
  11900. To change the sample aspect ratio to 10:11, specify:
  11901. @example
  11902. setsar=sar=10/11
  11903. @end example
  11904. @item
  11905. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11906. 1000 in the aspect ratio reduction, use the command:
  11907. @example
  11908. setdar=ratio=16/9:max=1000
  11909. @end example
  11910. @end itemize
  11911. @anchor{setfield}
  11912. @section setfield
  11913. Force field for the output video frame.
  11914. The @code{setfield} filter marks the interlace type field for the
  11915. output frames. It does not change the input frame, but only sets the
  11916. corresponding property, which affects how the frame is treated by
  11917. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11918. The filter accepts the following options:
  11919. @table @option
  11920. @item mode
  11921. Available values are:
  11922. @table @samp
  11923. @item auto
  11924. Keep the same field property.
  11925. @item bff
  11926. Mark the frame as bottom-field-first.
  11927. @item tff
  11928. Mark the frame as top-field-first.
  11929. @item prog
  11930. Mark the frame as progressive.
  11931. @end table
  11932. @end table
  11933. @anchor{setparams}
  11934. @section setparams
  11935. Force frame parameter for the output video frame.
  11936. The @code{setparams} filter marks interlace and color range for the
  11937. output frames. It does not change the input frame, but only sets the
  11938. corresponding property, which affects how the frame is treated by
  11939. filters/encoders.
  11940. @table @option
  11941. @item field_mode
  11942. Available values are:
  11943. @table @samp
  11944. @item auto
  11945. Keep the same field property (default).
  11946. @item bff
  11947. Mark the frame as bottom-field-first.
  11948. @item tff
  11949. Mark the frame as top-field-first.
  11950. @item prog
  11951. Mark the frame as progressive.
  11952. @end table
  11953. @item range
  11954. Available values are:
  11955. @table @samp
  11956. @item auto
  11957. Keep the same color range property (default).
  11958. @item unspecified, unknown
  11959. Mark the frame as unspecified color range.
  11960. @item limited, tv, mpeg
  11961. Mark the frame as limited range.
  11962. @item full, pc, jpeg
  11963. Mark the frame as full range.
  11964. @end table
  11965. @item color_primaries
  11966. Set the color primaries.
  11967. Available values are:
  11968. @table @samp
  11969. @item auto
  11970. Keep the same color primaries property (default).
  11971. @item bt709
  11972. @item unknown
  11973. @item bt470m
  11974. @item bt470bg
  11975. @item smpte170m
  11976. @item smpte240m
  11977. @item film
  11978. @item bt2020
  11979. @item smpte428
  11980. @item smpte431
  11981. @item smpte432
  11982. @item jedec-p22
  11983. @end table
  11984. @item color_trc
  11985. Set the color transfer.
  11986. Available values are:
  11987. @table @samp
  11988. @item auto
  11989. Keep the same color trc property (default).
  11990. @item bt709
  11991. @item unknown
  11992. @item bt470m
  11993. @item bt470bg
  11994. @item smpte170m
  11995. @item smpte240m
  11996. @item linear
  11997. @item log100
  11998. @item log316
  11999. @item iec61966-2-4
  12000. @item bt1361e
  12001. @item iec61966-2-1
  12002. @item bt2020-10
  12003. @item bt2020-12
  12004. @item smpte2084
  12005. @item smpte428
  12006. @item arib-std-b67
  12007. @end table
  12008. @item colorspace
  12009. Set the colorspace.
  12010. Available values are:
  12011. @table @samp
  12012. @item auto
  12013. Keep the same colorspace property (default).
  12014. @item gbr
  12015. @item bt709
  12016. @item unknown
  12017. @item fcc
  12018. @item bt470bg
  12019. @item smpte170m
  12020. @item smpte240m
  12021. @item ycgco
  12022. @item bt2020nc
  12023. @item bt2020c
  12024. @item smpte2085
  12025. @item chroma-derived-nc
  12026. @item chroma-derived-c
  12027. @item ictcp
  12028. @end table
  12029. @end table
  12030. @section showinfo
  12031. Show a line containing various information for each input video frame.
  12032. The input video is not modified.
  12033. This filter supports the following options:
  12034. @table @option
  12035. @item checksum
  12036. Calculate checksums of each plane. By default enabled.
  12037. @end table
  12038. The shown line contains a sequence of key/value pairs of the form
  12039. @var{key}:@var{value}.
  12040. The following values are shown in the output:
  12041. @table @option
  12042. @item n
  12043. The (sequential) number of the input frame, starting from 0.
  12044. @item pts
  12045. The Presentation TimeStamp of the input frame, expressed as a number of
  12046. time base units. The time base unit depends on the filter input pad.
  12047. @item pts_time
  12048. The Presentation TimeStamp of the input frame, expressed as a number of
  12049. seconds.
  12050. @item pos
  12051. The position of the frame in the input stream, or -1 if this information is
  12052. unavailable and/or meaningless (for example in case of synthetic video).
  12053. @item fmt
  12054. The pixel format name.
  12055. @item sar
  12056. The sample aspect ratio of the input frame, expressed in the form
  12057. @var{num}/@var{den}.
  12058. @item s
  12059. The size of the input frame. For the syntax of this option, check the
  12060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12061. @item i
  12062. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12063. for bottom field first).
  12064. @item iskey
  12065. This is 1 if the frame is a key frame, 0 otherwise.
  12066. @item type
  12067. The picture type of the input frame ("I" for an I-frame, "P" for a
  12068. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12069. Also refer to the documentation of the @code{AVPictureType} enum and of
  12070. the @code{av_get_picture_type_char} function defined in
  12071. @file{libavutil/avutil.h}.
  12072. @item checksum
  12073. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12074. @item plane_checksum
  12075. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12076. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12077. @end table
  12078. @section showpalette
  12079. Displays the 256 colors palette of each frame. This filter is only relevant for
  12080. @var{pal8} pixel format frames.
  12081. It accepts the following option:
  12082. @table @option
  12083. @item s
  12084. Set the size of the box used to represent one palette color entry. Default is
  12085. @code{30} (for a @code{30x30} pixel box).
  12086. @end table
  12087. @section shuffleframes
  12088. Reorder and/or duplicate and/or drop video frames.
  12089. It accepts the following parameters:
  12090. @table @option
  12091. @item mapping
  12092. Set the destination indexes of input frames.
  12093. This is space or '|' separated list of indexes that maps input frames to output
  12094. frames. Number of indexes also sets maximal value that each index may have.
  12095. '-1' index have special meaning and that is to drop frame.
  12096. @end table
  12097. The first frame has the index 0. The default is to keep the input unchanged.
  12098. @subsection Examples
  12099. @itemize
  12100. @item
  12101. Swap second and third frame of every three frames of the input:
  12102. @example
  12103. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12104. @end example
  12105. @item
  12106. Swap 10th and 1st frame of every ten frames of the input:
  12107. @example
  12108. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12109. @end example
  12110. @end itemize
  12111. @section shuffleplanes
  12112. Reorder and/or duplicate video planes.
  12113. It accepts the following parameters:
  12114. @table @option
  12115. @item map0
  12116. The index of the input plane to be used as the first output plane.
  12117. @item map1
  12118. The index of the input plane to be used as the second output plane.
  12119. @item map2
  12120. The index of the input plane to be used as the third output plane.
  12121. @item map3
  12122. The index of the input plane to be used as the fourth output plane.
  12123. @end table
  12124. The first plane has the index 0. The default is to keep the input unchanged.
  12125. @subsection Examples
  12126. @itemize
  12127. @item
  12128. Swap the second and third planes of the input:
  12129. @example
  12130. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12131. @end example
  12132. @end itemize
  12133. @anchor{signalstats}
  12134. @section signalstats
  12135. Evaluate various visual metrics that assist in determining issues associated
  12136. with the digitization of analog video media.
  12137. By default the filter will log these metadata values:
  12138. @table @option
  12139. @item YMIN
  12140. Display the minimal Y value contained within the input frame. Expressed in
  12141. range of [0-255].
  12142. @item YLOW
  12143. Display the Y value at the 10% percentile within the input frame. Expressed in
  12144. range of [0-255].
  12145. @item YAVG
  12146. Display the average Y value within the input frame. Expressed in range of
  12147. [0-255].
  12148. @item YHIGH
  12149. Display the Y value at the 90% percentile within the input frame. Expressed in
  12150. range of [0-255].
  12151. @item YMAX
  12152. Display the maximum Y value contained within the input frame. Expressed in
  12153. range of [0-255].
  12154. @item UMIN
  12155. Display the minimal U value contained within the input frame. Expressed in
  12156. range of [0-255].
  12157. @item ULOW
  12158. Display the U value at the 10% percentile within the input frame. Expressed in
  12159. range of [0-255].
  12160. @item UAVG
  12161. Display the average U value within the input frame. Expressed in range of
  12162. [0-255].
  12163. @item UHIGH
  12164. Display the U value at the 90% percentile within the input frame. Expressed in
  12165. range of [0-255].
  12166. @item UMAX
  12167. Display the maximum U value contained within the input frame. Expressed in
  12168. range of [0-255].
  12169. @item VMIN
  12170. Display the minimal V value contained within the input frame. Expressed in
  12171. range of [0-255].
  12172. @item VLOW
  12173. Display the V value at the 10% percentile within the input frame. Expressed in
  12174. range of [0-255].
  12175. @item VAVG
  12176. Display the average V value within the input frame. Expressed in range of
  12177. [0-255].
  12178. @item VHIGH
  12179. Display the V value at the 90% percentile within the input frame. Expressed in
  12180. range of [0-255].
  12181. @item VMAX
  12182. Display the maximum V value contained within the input frame. Expressed in
  12183. range of [0-255].
  12184. @item SATMIN
  12185. Display the minimal saturation value contained within the input frame.
  12186. Expressed in range of [0-~181.02].
  12187. @item SATLOW
  12188. Display the saturation value at the 10% percentile within the input frame.
  12189. Expressed in range of [0-~181.02].
  12190. @item SATAVG
  12191. Display the average saturation value within the input frame. Expressed in range
  12192. of [0-~181.02].
  12193. @item SATHIGH
  12194. Display the saturation value at the 90% percentile within the input frame.
  12195. Expressed in range of [0-~181.02].
  12196. @item SATMAX
  12197. Display the maximum saturation value contained within the input frame.
  12198. Expressed in range of [0-~181.02].
  12199. @item HUEMED
  12200. Display the median value for hue within the input frame. Expressed in range of
  12201. [0-360].
  12202. @item HUEAVG
  12203. Display the average value for hue within the input frame. Expressed in range of
  12204. [0-360].
  12205. @item YDIF
  12206. Display the average of sample value difference between all values of the Y
  12207. plane in the current frame and corresponding values of the previous input frame.
  12208. Expressed in range of [0-255].
  12209. @item UDIF
  12210. Display the average of sample value difference between all values of the U
  12211. plane in the current frame and corresponding values of the previous input frame.
  12212. Expressed in range of [0-255].
  12213. @item VDIF
  12214. Display the average of sample value difference between all values of the V
  12215. plane in the current frame and corresponding values of the previous input frame.
  12216. Expressed in range of [0-255].
  12217. @item YBITDEPTH
  12218. Display bit depth of Y plane in current frame.
  12219. Expressed in range of [0-16].
  12220. @item UBITDEPTH
  12221. Display bit depth of U plane in current frame.
  12222. Expressed in range of [0-16].
  12223. @item VBITDEPTH
  12224. Display bit depth of V plane in current frame.
  12225. Expressed in range of [0-16].
  12226. @end table
  12227. The filter accepts the following options:
  12228. @table @option
  12229. @item stat
  12230. @item out
  12231. @option{stat} specify an additional form of image analysis.
  12232. @option{out} output video with the specified type of pixel highlighted.
  12233. Both options accept the following values:
  12234. @table @samp
  12235. @item tout
  12236. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12237. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12238. include the results of video dropouts, head clogs, or tape tracking issues.
  12239. @item vrep
  12240. Identify @var{vertical line repetition}. Vertical line repetition includes
  12241. similar rows of pixels within a frame. In born-digital video vertical line
  12242. repetition is common, but this pattern is uncommon in video digitized from an
  12243. analog source. When it occurs in video that results from the digitization of an
  12244. analog source it can indicate concealment from a dropout compensator.
  12245. @item brng
  12246. Identify pixels that fall outside of legal broadcast range.
  12247. @end table
  12248. @item color, c
  12249. Set the highlight color for the @option{out} option. The default color is
  12250. yellow.
  12251. @end table
  12252. @subsection Examples
  12253. @itemize
  12254. @item
  12255. Output data of various video metrics:
  12256. @example
  12257. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12258. @end example
  12259. @item
  12260. Output specific data about the minimum and maximum values of the Y plane per frame:
  12261. @example
  12262. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12263. @end example
  12264. @item
  12265. Playback video while highlighting pixels that are outside of broadcast range in red.
  12266. @example
  12267. ffplay example.mov -vf signalstats="out=brng:color=red"
  12268. @end example
  12269. @item
  12270. Playback video with signalstats metadata drawn over the frame.
  12271. @example
  12272. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12273. @end example
  12274. The contents of signalstat_drawtext.txt used in the command are:
  12275. @example
  12276. time %@{pts:hms@}
  12277. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12278. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12279. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12280. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12281. @end example
  12282. @end itemize
  12283. @anchor{signature}
  12284. @section signature
  12285. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12286. input. In this case the matching between the inputs can be calculated additionally.
  12287. The filter always passes through the first input. The signature of each stream can
  12288. be written into a file.
  12289. It accepts the following options:
  12290. @table @option
  12291. @item detectmode
  12292. Enable or disable the matching process.
  12293. Available values are:
  12294. @table @samp
  12295. @item off
  12296. Disable the calculation of a matching (default).
  12297. @item full
  12298. Calculate the matching for the whole video and output whether the whole video
  12299. matches or only parts.
  12300. @item fast
  12301. Calculate only until a matching is found or the video ends. Should be faster in
  12302. some cases.
  12303. @end table
  12304. @item nb_inputs
  12305. Set the number of inputs. The option value must be a non negative integer.
  12306. Default value is 1.
  12307. @item filename
  12308. Set the path to which the output is written. If there is more than one input,
  12309. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12310. integer), that will be replaced with the input number. If no filename is
  12311. specified, no output will be written. This is the default.
  12312. @item format
  12313. Choose the output format.
  12314. Available values are:
  12315. @table @samp
  12316. @item binary
  12317. Use the specified binary representation (default).
  12318. @item xml
  12319. Use the specified xml representation.
  12320. @end table
  12321. @item th_d
  12322. Set threshold to detect one word as similar. The option value must be an integer
  12323. greater than zero. The default value is 9000.
  12324. @item th_dc
  12325. Set threshold to detect all words as similar. The option value must be an integer
  12326. greater than zero. The default value is 60000.
  12327. @item th_xh
  12328. Set threshold to detect frames as similar. The option value must be an integer
  12329. greater than zero. The default value is 116.
  12330. @item th_di
  12331. Set the minimum length of a sequence in frames to recognize it as matching
  12332. sequence. The option value must be a non negative integer value.
  12333. The default value is 0.
  12334. @item th_it
  12335. Set the minimum relation, that matching frames to all frames must have.
  12336. The option value must be a double value between 0 and 1. The default value is 0.5.
  12337. @end table
  12338. @subsection Examples
  12339. @itemize
  12340. @item
  12341. To calculate the signature of an input video and store it in signature.bin:
  12342. @example
  12343. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12344. @end example
  12345. @item
  12346. To detect whether two videos match and store the signatures in XML format in
  12347. signature0.xml and signature1.xml:
  12348. @example
  12349. 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 -
  12350. @end example
  12351. @end itemize
  12352. @anchor{smartblur}
  12353. @section smartblur
  12354. Blur the input video without impacting the outlines.
  12355. It accepts the following options:
  12356. @table @option
  12357. @item luma_radius, lr
  12358. Set the luma radius. The option value must be a float number in
  12359. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12360. used to blur the image (slower if larger). Default value is 1.0.
  12361. @item luma_strength, ls
  12362. Set the luma strength. The option value must be a float number
  12363. in the range [-1.0,1.0] that configures the blurring. A value included
  12364. in [0.0,1.0] will blur the image whereas a value included in
  12365. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12366. @item luma_threshold, lt
  12367. Set the luma threshold used as a coefficient to determine
  12368. whether a pixel should be blurred or not. The option value must be an
  12369. integer in the range [-30,30]. A value of 0 will filter all the image,
  12370. a value included in [0,30] will filter flat areas and a value included
  12371. in [-30,0] will filter edges. Default value is 0.
  12372. @item chroma_radius, cr
  12373. Set the chroma radius. The option value must be a float number in
  12374. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12375. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12376. @item chroma_strength, cs
  12377. Set the chroma strength. The option value must be a float number
  12378. in the range [-1.0,1.0] that configures the blurring. A value included
  12379. in [0.0,1.0] will blur the image whereas a value included in
  12380. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12381. @item chroma_threshold, ct
  12382. Set the chroma threshold used as a coefficient to determine
  12383. whether a pixel should be blurred or not. The option value must be an
  12384. integer in the range [-30,30]. A value of 0 will filter all the image,
  12385. a value included in [0,30] will filter flat areas and a value included
  12386. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12387. @end table
  12388. If a chroma option is not explicitly set, the corresponding luma value
  12389. is set.
  12390. @section ssim
  12391. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12392. This filter takes in input two input videos, the first input is
  12393. considered the "main" source and is passed unchanged to the
  12394. output. The second input is used as a "reference" video for computing
  12395. the SSIM.
  12396. Both video inputs must have the same resolution and pixel format for
  12397. this filter to work correctly. Also it assumes that both inputs
  12398. have the same number of frames, which are compared one by one.
  12399. The filter stores the calculated SSIM of each frame.
  12400. The description of the accepted parameters follows.
  12401. @table @option
  12402. @item stats_file, f
  12403. If specified the filter will use the named file to save the SSIM of
  12404. each individual frame. When filename equals "-" the data is sent to
  12405. standard output.
  12406. @end table
  12407. The file printed if @var{stats_file} is selected, contains a sequence of
  12408. key/value pairs of the form @var{key}:@var{value} for each compared
  12409. couple of frames.
  12410. A description of each shown parameter follows:
  12411. @table @option
  12412. @item n
  12413. sequential number of the input frame, starting from 1
  12414. @item Y, U, V, R, G, B
  12415. SSIM of the compared frames for the component specified by the suffix.
  12416. @item All
  12417. SSIM of the compared frames for the whole frame.
  12418. @item dB
  12419. Same as above but in dB representation.
  12420. @end table
  12421. This filter also supports the @ref{framesync} options.
  12422. For example:
  12423. @example
  12424. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12425. [main][ref] ssim="stats_file=stats.log" [out]
  12426. @end example
  12427. On this example the input file being processed is compared with the
  12428. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12429. is stored in @file{stats.log}.
  12430. Another example with both psnr and ssim at same time:
  12431. @example
  12432. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12433. @end example
  12434. @section stereo3d
  12435. Convert between different stereoscopic image formats.
  12436. The filters accept the following options:
  12437. @table @option
  12438. @item in
  12439. Set stereoscopic image format of input.
  12440. Available values for input image formats are:
  12441. @table @samp
  12442. @item sbsl
  12443. side by side parallel (left eye left, right eye right)
  12444. @item sbsr
  12445. side by side crosseye (right eye left, left eye right)
  12446. @item sbs2l
  12447. side by side parallel with half width resolution
  12448. (left eye left, right eye right)
  12449. @item sbs2r
  12450. side by side crosseye with half width resolution
  12451. (right eye left, left eye right)
  12452. @item abl
  12453. above-below (left eye above, right eye below)
  12454. @item abr
  12455. above-below (right eye above, left eye below)
  12456. @item ab2l
  12457. above-below with half height resolution
  12458. (left eye above, right eye below)
  12459. @item ab2r
  12460. above-below with half height resolution
  12461. (right eye above, left eye below)
  12462. @item al
  12463. alternating frames (left eye first, right eye second)
  12464. @item ar
  12465. alternating frames (right eye first, left eye second)
  12466. @item irl
  12467. interleaved rows (left eye has top row, right eye starts on next row)
  12468. @item irr
  12469. interleaved rows (right eye has top row, left eye starts on next row)
  12470. @item icl
  12471. interleaved columns, left eye first
  12472. @item icr
  12473. interleaved columns, right eye first
  12474. Default value is @samp{sbsl}.
  12475. @end table
  12476. @item out
  12477. Set stereoscopic image format of output.
  12478. @table @samp
  12479. @item sbsl
  12480. side by side parallel (left eye left, right eye right)
  12481. @item sbsr
  12482. side by side crosseye (right eye left, left eye right)
  12483. @item sbs2l
  12484. side by side parallel with half width resolution
  12485. (left eye left, right eye right)
  12486. @item sbs2r
  12487. side by side crosseye with half width resolution
  12488. (right eye left, left eye right)
  12489. @item abl
  12490. above-below (left eye above, right eye below)
  12491. @item abr
  12492. above-below (right eye above, left eye below)
  12493. @item ab2l
  12494. above-below with half height resolution
  12495. (left eye above, right eye below)
  12496. @item ab2r
  12497. above-below with half height resolution
  12498. (right eye above, left eye below)
  12499. @item al
  12500. alternating frames (left eye first, right eye second)
  12501. @item ar
  12502. alternating frames (right eye first, left eye second)
  12503. @item irl
  12504. interleaved rows (left eye has top row, right eye starts on next row)
  12505. @item irr
  12506. interleaved rows (right eye has top row, left eye starts on next row)
  12507. @item arbg
  12508. anaglyph red/blue gray
  12509. (red filter on left eye, blue filter on right eye)
  12510. @item argg
  12511. anaglyph red/green gray
  12512. (red filter on left eye, green filter on right eye)
  12513. @item arcg
  12514. anaglyph red/cyan gray
  12515. (red filter on left eye, cyan filter on right eye)
  12516. @item arch
  12517. anaglyph red/cyan half colored
  12518. (red filter on left eye, cyan filter on right eye)
  12519. @item arcc
  12520. anaglyph red/cyan color
  12521. (red filter on left eye, cyan filter on right eye)
  12522. @item arcd
  12523. anaglyph red/cyan color optimized with the least squares projection of dubois
  12524. (red filter on left eye, cyan filter on right eye)
  12525. @item agmg
  12526. anaglyph green/magenta gray
  12527. (green filter on left eye, magenta filter on right eye)
  12528. @item agmh
  12529. anaglyph green/magenta half colored
  12530. (green filter on left eye, magenta filter on right eye)
  12531. @item agmc
  12532. anaglyph green/magenta colored
  12533. (green filter on left eye, magenta filter on right eye)
  12534. @item agmd
  12535. anaglyph green/magenta color optimized with the least squares projection of dubois
  12536. (green filter on left eye, magenta filter on right eye)
  12537. @item aybg
  12538. anaglyph yellow/blue gray
  12539. (yellow filter on left eye, blue filter on right eye)
  12540. @item aybh
  12541. anaglyph yellow/blue half colored
  12542. (yellow filter on left eye, blue filter on right eye)
  12543. @item aybc
  12544. anaglyph yellow/blue colored
  12545. (yellow filter on left eye, blue filter on right eye)
  12546. @item aybd
  12547. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12548. (yellow filter on left eye, blue filter on right eye)
  12549. @item ml
  12550. mono output (left eye only)
  12551. @item mr
  12552. mono output (right eye only)
  12553. @item chl
  12554. checkerboard, left eye first
  12555. @item chr
  12556. checkerboard, right eye first
  12557. @item icl
  12558. interleaved columns, left eye first
  12559. @item icr
  12560. interleaved columns, right eye first
  12561. @item hdmi
  12562. HDMI frame pack
  12563. @end table
  12564. Default value is @samp{arcd}.
  12565. @end table
  12566. @subsection Examples
  12567. @itemize
  12568. @item
  12569. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12570. @example
  12571. stereo3d=sbsl:aybd
  12572. @end example
  12573. @item
  12574. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12575. @example
  12576. stereo3d=abl:sbsr
  12577. @end example
  12578. @end itemize
  12579. @section streamselect, astreamselect
  12580. Select video or audio streams.
  12581. The filter accepts the following options:
  12582. @table @option
  12583. @item inputs
  12584. Set number of inputs. Default is 2.
  12585. @item map
  12586. Set input indexes to remap to outputs.
  12587. @end table
  12588. @subsection Commands
  12589. The @code{streamselect} and @code{astreamselect} filter supports the following
  12590. commands:
  12591. @table @option
  12592. @item map
  12593. Set input indexes to remap to outputs.
  12594. @end table
  12595. @subsection Examples
  12596. @itemize
  12597. @item
  12598. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12599. @example
  12600. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12601. @end example
  12602. @item
  12603. Same as above, but for audio:
  12604. @example
  12605. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12606. @end example
  12607. @end itemize
  12608. @section sobel
  12609. Apply sobel operator to input video stream.
  12610. The filter accepts the following option:
  12611. @table @option
  12612. @item planes
  12613. Set which planes will be processed, unprocessed planes will be copied.
  12614. By default value 0xf, all planes will be processed.
  12615. @item scale
  12616. Set value which will be multiplied with filtered result.
  12617. @item delta
  12618. Set value which will be added to filtered result.
  12619. @end table
  12620. @anchor{spp}
  12621. @section spp
  12622. Apply a simple postprocessing filter that compresses and decompresses the image
  12623. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12624. and average the results.
  12625. The filter accepts the following options:
  12626. @table @option
  12627. @item quality
  12628. Set quality. This option defines the number of levels for averaging. It accepts
  12629. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12630. effect. A value of @code{6} means the higher quality. For each increment of
  12631. that value the speed drops by a factor of approximately 2. Default value is
  12632. @code{3}.
  12633. @item qp
  12634. Force a constant quantization parameter. If not set, the filter will use the QP
  12635. from the video stream (if available).
  12636. @item mode
  12637. Set thresholding mode. Available modes are:
  12638. @table @samp
  12639. @item hard
  12640. Set hard thresholding (default).
  12641. @item soft
  12642. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12643. @end table
  12644. @item use_bframe_qp
  12645. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12646. option may cause flicker since the B-Frames have often larger QP. Default is
  12647. @code{0} (not enabled).
  12648. @end table
  12649. @section sr
  12650. Scale the input by applying one of the super-resolution methods based on
  12651. convolutional neural networks. Supported models:
  12652. @itemize
  12653. @item
  12654. Super-Resolution Convolutional Neural Network model (SRCNN).
  12655. See @url{https://arxiv.org/abs/1501.00092}.
  12656. @item
  12657. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12658. See @url{https://arxiv.org/abs/1609.05158}.
  12659. @end itemize
  12660. Training scripts as well as scripts for model generation can be found at
  12661. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12662. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12663. The filter accepts the following options:
  12664. @table @option
  12665. @item dnn_backend
  12666. Specify which DNN backend to use for model loading and execution. This option accepts
  12667. the following values:
  12668. @table @samp
  12669. @item native
  12670. Native implementation of DNN loading and execution.
  12671. @item tensorflow
  12672. TensorFlow backend. To enable this backend you
  12673. need to install the TensorFlow for C library (see
  12674. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12675. @code{--enable-libtensorflow}
  12676. @end table
  12677. Default value is @samp{native}.
  12678. @item model
  12679. Set path to model file specifying network architecture and its parameters.
  12680. Note that different backends use different file formats. TensorFlow backend
  12681. can load files for both formats, while native backend can load files for only
  12682. its format.
  12683. @item scale_factor
  12684. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12685. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12686. input upscaled using bicubic upscaling with proper scale factor.
  12687. @end table
  12688. @anchor{subtitles}
  12689. @section subtitles
  12690. Draw subtitles on top of input video using the libass library.
  12691. To enable compilation of this filter you need to configure FFmpeg with
  12692. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12693. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12694. Alpha) subtitles format.
  12695. The filter accepts the following options:
  12696. @table @option
  12697. @item filename, f
  12698. Set the filename of the subtitle file to read. It must be specified.
  12699. @item original_size
  12700. Specify the size of the original video, the video for which the ASS file
  12701. was composed. For the syntax of this option, check the
  12702. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12703. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12704. correctly scale the fonts if the aspect ratio has been changed.
  12705. @item fontsdir
  12706. Set a directory path containing fonts that can be used by the filter.
  12707. These fonts will be used in addition to whatever the font provider uses.
  12708. @item alpha
  12709. Process alpha channel, by default alpha channel is untouched.
  12710. @item charenc
  12711. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12712. useful if not UTF-8.
  12713. @item stream_index, si
  12714. Set subtitles stream index. @code{subtitles} filter only.
  12715. @item force_style
  12716. Override default style or script info parameters of the subtitles. It accepts a
  12717. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12718. @end table
  12719. If the first key is not specified, it is assumed that the first value
  12720. specifies the @option{filename}.
  12721. For example, to render the file @file{sub.srt} on top of the input
  12722. video, use the command:
  12723. @example
  12724. subtitles=sub.srt
  12725. @end example
  12726. which is equivalent to:
  12727. @example
  12728. subtitles=filename=sub.srt
  12729. @end example
  12730. To render the default subtitles stream from file @file{video.mkv}, use:
  12731. @example
  12732. subtitles=video.mkv
  12733. @end example
  12734. To render the second subtitles stream from that file, use:
  12735. @example
  12736. subtitles=video.mkv:si=1
  12737. @end example
  12738. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12739. @code{DejaVu Serif}, use:
  12740. @example
  12741. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12742. @end example
  12743. @section super2xsai
  12744. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12745. Interpolate) pixel art scaling algorithm.
  12746. Useful for enlarging pixel art images without reducing sharpness.
  12747. @section swaprect
  12748. Swap two rectangular objects in video.
  12749. This filter accepts the following options:
  12750. @table @option
  12751. @item w
  12752. Set object width.
  12753. @item h
  12754. Set object height.
  12755. @item x1
  12756. Set 1st rect x coordinate.
  12757. @item y1
  12758. Set 1st rect y coordinate.
  12759. @item x2
  12760. Set 2nd rect x coordinate.
  12761. @item y2
  12762. Set 2nd rect y coordinate.
  12763. All expressions are evaluated once for each frame.
  12764. @end table
  12765. The all options are expressions containing the following constants:
  12766. @table @option
  12767. @item w
  12768. @item h
  12769. The input width and height.
  12770. @item a
  12771. same as @var{w} / @var{h}
  12772. @item sar
  12773. input sample aspect ratio
  12774. @item dar
  12775. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12776. @item n
  12777. The number of the input frame, starting from 0.
  12778. @item t
  12779. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12780. @item pos
  12781. the position in the file of the input frame, NAN if unknown
  12782. @end table
  12783. @section swapuv
  12784. Swap U & V plane.
  12785. @section telecine
  12786. Apply telecine process to the video.
  12787. This filter accepts the following options:
  12788. @table @option
  12789. @item first_field
  12790. @table @samp
  12791. @item top, t
  12792. top field first
  12793. @item bottom, b
  12794. bottom field first
  12795. The default value is @code{top}.
  12796. @end table
  12797. @item pattern
  12798. A string of numbers representing the pulldown pattern you wish to apply.
  12799. The default value is @code{23}.
  12800. @end table
  12801. @example
  12802. Some typical patterns:
  12803. NTSC output (30i):
  12804. 27.5p: 32222
  12805. 24p: 23 (classic)
  12806. 24p: 2332 (preferred)
  12807. 20p: 33
  12808. 18p: 334
  12809. 16p: 3444
  12810. PAL output (25i):
  12811. 27.5p: 12222
  12812. 24p: 222222222223 ("Euro pulldown")
  12813. 16.67p: 33
  12814. 16p: 33333334
  12815. @end example
  12816. @section threshold
  12817. Apply threshold effect to video stream.
  12818. This filter needs four video streams to perform thresholding.
  12819. First stream is stream we are filtering.
  12820. Second stream is holding threshold values, third stream is holding min values,
  12821. and last, fourth stream is holding max values.
  12822. The filter accepts the following option:
  12823. @table @option
  12824. @item planes
  12825. Set which planes will be processed, unprocessed planes will be copied.
  12826. By default value 0xf, all planes will be processed.
  12827. @end table
  12828. For example if first stream pixel's component value is less then threshold value
  12829. of pixel component from 2nd threshold stream, third stream value will picked,
  12830. otherwise fourth stream pixel component value will be picked.
  12831. Using color source filter one can perform various types of thresholding:
  12832. @subsection Examples
  12833. @itemize
  12834. @item
  12835. Binary threshold, using gray color as threshold:
  12836. @example
  12837. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12838. @end example
  12839. @item
  12840. Inverted binary threshold, using gray color as threshold:
  12841. @example
  12842. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12843. @end example
  12844. @item
  12845. Truncate binary threshold, using gray color as threshold:
  12846. @example
  12847. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12848. @end example
  12849. @item
  12850. Threshold to zero, using gray color as threshold:
  12851. @example
  12852. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12853. @end example
  12854. @item
  12855. Inverted threshold to zero, using gray color as threshold:
  12856. @example
  12857. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12858. @end example
  12859. @end itemize
  12860. @section thumbnail
  12861. Select the most representative frame in a given sequence of consecutive frames.
  12862. The filter accepts the following options:
  12863. @table @option
  12864. @item n
  12865. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12866. will pick one of them, and then handle the next batch of @var{n} frames until
  12867. the end. Default is @code{100}.
  12868. @end table
  12869. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12870. value will result in a higher memory usage, so a high value is not recommended.
  12871. @subsection Examples
  12872. @itemize
  12873. @item
  12874. Extract one picture each 50 frames:
  12875. @example
  12876. thumbnail=50
  12877. @end example
  12878. @item
  12879. Complete example of a thumbnail creation with @command{ffmpeg}:
  12880. @example
  12881. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12882. @end example
  12883. @end itemize
  12884. @section tile
  12885. Tile several successive frames together.
  12886. The filter accepts the following options:
  12887. @table @option
  12888. @item layout
  12889. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12890. this option, check the
  12891. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12892. @item nb_frames
  12893. Set the maximum number of frames to render in the given area. It must be less
  12894. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12895. the area will be used.
  12896. @item margin
  12897. Set the outer border margin in pixels.
  12898. @item padding
  12899. Set the inner border thickness (i.e. the number of pixels between frames). For
  12900. more advanced padding options (such as having different values for the edges),
  12901. refer to the pad video filter.
  12902. @item color
  12903. Specify the color of the unused area. For the syntax of this option, check the
  12904. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12905. The default value of @var{color} is "black".
  12906. @item overlap
  12907. Set the number of frames to overlap when tiling several successive frames together.
  12908. The value must be between @code{0} and @var{nb_frames - 1}.
  12909. @item init_padding
  12910. Set the number of frames to initially be empty before displaying first output frame.
  12911. This controls how soon will one get first output frame.
  12912. The value must be between @code{0} and @var{nb_frames - 1}.
  12913. @end table
  12914. @subsection Examples
  12915. @itemize
  12916. @item
  12917. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12918. @example
  12919. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12920. @end example
  12921. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12922. duplicating each output frame to accommodate the originally detected frame
  12923. rate.
  12924. @item
  12925. Display @code{5} pictures in an area of @code{3x2} frames,
  12926. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12927. mixed flat and named options:
  12928. @example
  12929. tile=3x2:nb_frames=5:padding=7:margin=2
  12930. @end example
  12931. @end itemize
  12932. @section tinterlace
  12933. Perform various types of temporal field interlacing.
  12934. Frames are counted starting from 1, so the first input frame is
  12935. considered odd.
  12936. The filter accepts the following options:
  12937. @table @option
  12938. @item mode
  12939. Specify the mode of the interlacing. This option can also be specified
  12940. as a value alone. See below for a list of values for this option.
  12941. Available values are:
  12942. @table @samp
  12943. @item merge, 0
  12944. Move odd frames into the upper field, even into the lower field,
  12945. generating a double height frame at half frame rate.
  12946. @example
  12947. ------> time
  12948. Input:
  12949. Frame 1 Frame 2 Frame 3 Frame 4
  12950. 11111 22222 33333 44444
  12951. 11111 22222 33333 44444
  12952. 11111 22222 33333 44444
  12953. 11111 22222 33333 44444
  12954. Output:
  12955. 11111 33333
  12956. 22222 44444
  12957. 11111 33333
  12958. 22222 44444
  12959. 11111 33333
  12960. 22222 44444
  12961. 11111 33333
  12962. 22222 44444
  12963. @end example
  12964. @item drop_even, 1
  12965. Only output odd frames, even frames are dropped, generating a frame with
  12966. unchanged height at half frame rate.
  12967. @example
  12968. ------> time
  12969. Input:
  12970. Frame 1 Frame 2 Frame 3 Frame 4
  12971. 11111 22222 33333 44444
  12972. 11111 22222 33333 44444
  12973. 11111 22222 33333 44444
  12974. 11111 22222 33333 44444
  12975. Output:
  12976. 11111 33333
  12977. 11111 33333
  12978. 11111 33333
  12979. 11111 33333
  12980. @end example
  12981. @item drop_odd, 2
  12982. Only output even frames, odd frames are dropped, generating a frame with
  12983. unchanged height at half frame rate.
  12984. @example
  12985. ------> time
  12986. Input:
  12987. Frame 1 Frame 2 Frame 3 Frame 4
  12988. 11111 22222 33333 44444
  12989. 11111 22222 33333 44444
  12990. 11111 22222 33333 44444
  12991. 11111 22222 33333 44444
  12992. Output:
  12993. 22222 44444
  12994. 22222 44444
  12995. 22222 44444
  12996. 22222 44444
  12997. @end example
  12998. @item pad, 3
  12999. Expand each frame to full height, but pad alternate lines with black,
  13000. generating a frame with double height at the same input frame rate.
  13001. @example
  13002. ------> time
  13003. Input:
  13004. Frame 1 Frame 2 Frame 3 Frame 4
  13005. 11111 22222 33333 44444
  13006. 11111 22222 33333 44444
  13007. 11111 22222 33333 44444
  13008. 11111 22222 33333 44444
  13009. Output:
  13010. 11111 ..... 33333 .....
  13011. ..... 22222 ..... 44444
  13012. 11111 ..... 33333 .....
  13013. ..... 22222 ..... 44444
  13014. 11111 ..... 33333 .....
  13015. ..... 22222 ..... 44444
  13016. 11111 ..... 33333 .....
  13017. ..... 22222 ..... 44444
  13018. @end example
  13019. @item interleave_top, 4
  13020. Interleave the upper field from odd frames with the lower field from
  13021. even frames, generating a frame with unchanged height at half frame rate.
  13022. @example
  13023. ------> time
  13024. Input:
  13025. Frame 1 Frame 2 Frame 3 Frame 4
  13026. 11111<- 22222 33333<- 44444
  13027. 11111 22222<- 33333 44444<-
  13028. 11111<- 22222 33333<- 44444
  13029. 11111 22222<- 33333 44444<-
  13030. Output:
  13031. 11111 33333
  13032. 22222 44444
  13033. 11111 33333
  13034. 22222 44444
  13035. @end example
  13036. @item interleave_bottom, 5
  13037. Interleave the lower field from odd frames with the upper field from
  13038. even frames, generating a frame with unchanged height at half frame rate.
  13039. @example
  13040. ------> time
  13041. Input:
  13042. Frame 1 Frame 2 Frame 3 Frame 4
  13043. 11111 22222<- 33333 44444<-
  13044. 11111<- 22222 33333<- 44444
  13045. 11111 22222<- 33333 44444<-
  13046. 11111<- 22222 33333<- 44444
  13047. Output:
  13048. 22222 44444
  13049. 11111 33333
  13050. 22222 44444
  13051. 11111 33333
  13052. @end example
  13053. @item interlacex2, 6
  13054. Double frame rate with unchanged height. Frames are inserted each
  13055. containing the second temporal field from the previous input frame and
  13056. the first temporal field from the next input frame. This mode relies on
  13057. the top_field_first flag. Useful for interlaced video displays with no
  13058. field synchronisation.
  13059. @example
  13060. ------> time
  13061. Input:
  13062. Frame 1 Frame 2 Frame 3 Frame 4
  13063. 11111 22222 33333 44444
  13064. 11111 22222 33333 44444
  13065. 11111 22222 33333 44444
  13066. 11111 22222 33333 44444
  13067. Output:
  13068. 11111 22222 22222 33333 33333 44444 44444
  13069. 11111 11111 22222 22222 33333 33333 44444
  13070. 11111 22222 22222 33333 33333 44444 44444
  13071. 11111 11111 22222 22222 33333 33333 44444
  13072. @end example
  13073. @item mergex2, 7
  13074. Move odd frames into the upper field, even into the lower field,
  13075. generating a double height frame at same frame rate.
  13076. @example
  13077. ------> time
  13078. Input:
  13079. Frame 1 Frame 2 Frame 3 Frame 4
  13080. 11111 22222 33333 44444
  13081. 11111 22222 33333 44444
  13082. 11111 22222 33333 44444
  13083. 11111 22222 33333 44444
  13084. Output:
  13085. 11111 33333 33333 55555
  13086. 22222 22222 44444 44444
  13087. 11111 33333 33333 55555
  13088. 22222 22222 44444 44444
  13089. 11111 33333 33333 55555
  13090. 22222 22222 44444 44444
  13091. 11111 33333 33333 55555
  13092. 22222 22222 44444 44444
  13093. @end example
  13094. @end table
  13095. Numeric values are deprecated but are accepted for backward
  13096. compatibility reasons.
  13097. Default mode is @code{merge}.
  13098. @item flags
  13099. Specify flags influencing the filter process.
  13100. Available value for @var{flags} is:
  13101. @table @option
  13102. @item low_pass_filter, vlpf
  13103. Enable linear vertical low-pass filtering in the filter.
  13104. Vertical low-pass filtering is required when creating an interlaced
  13105. destination from a progressive source which contains high-frequency
  13106. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13107. patterning.
  13108. @item complex_filter, cvlpf
  13109. Enable complex vertical low-pass filtering.
  13110. This will slightly less reduce interlace 'twitter' and Moire
  13111. patterning but better retain detail and subjective sharpness impression.
  13112. @end table
  13113. Vertical low-pass filtering can only be enabled for @option{mode}
  13114. @var{interleave_top} and @var{interleave_bottom}.
  13115. @end table
  13116. @section tmix
  13117. Mix successive video frames.
  13118. A description of the accepted options follows.
  13119. @table @option
  13120. @item frames
  13121. The number of successive frames to mix. If unspecified, it defaults to 3.
  13122. @item weights
  13123. Specify weight of each input video frame.
  13124. Each weight is separated by space. If number of weights is smaller than
  13125. number of @var{frames} last specified weight will be used for all remaining
  13126. unset weights.
  13127. @item scale
  13128. Specify scale, if it is set it will be multiplied with sum
  13129. of each weight multiplied with pixel values to give final destination
  13130. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13131. @end table
  13132. @subsection Examples
  13133. @itemize
  13134. @item
  13135. Average 7 successive frames:
  13136. @example
  13137. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13138. @end example
  13139. @item
  13140. Apply simple temporal convolution:
  13141. @example
  13142. tmix=frames=3:weights="-1 3 -1"
  13143. @end example
  13144. @item
  13145. Similar as above but only showing temporal differences:
  13146. @example
  13147. tmix=frames=3:weights="-1 2 -1":scale=1
  13148. @end example
  13149. @end itemize
  13150. @anchor{tonemap}
  13151. @section tonemap
  13152. Tone map colors from different dynamic ranges.
  13153. This filter expects data in single precision floating point, as it needs to
  13154. operate on (and can output) out-of-range values. Another filter, such as
  13155. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13156. The tonemapping algorithms implemented only work on linear light, so input
  13157. data should be linearized beforehand (and possibly correctly tagged).
  13158. @example
  13159. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13160. @end example
  13161. @subsection Options
  13162. The filter accepts the following options.
  13163. @table @option
  13164. @item tonemap
  13165. Set the tone map algorithm to use.
  13166. Possible values are:
  13167. @table @var
  13168. @item none
  13169. Do not apply any tone map, only desaturate overbright pixels.
  13170. @item clip
  13171. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13172. in-range values, while distorting out-of-range values.
  13173. @item linear
  13174. Stretch the entire reference gamut to a linear multiple of the display.
  13175. @item gamma
  13176. Fit a logarithmic transfer between the tone curves.
  13177. @item reinhard
  13178. Preserve overall image brightness with a simple curve, using nonlinear
  13179. contrast, which results in flattening details and degrading color accuracy.
  13180. @item hable
  13181. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13182. of slightly darkening everything. Use it when detail preservation is more
  13183. important than color and brightness accuracy.
  13184. @item mobius
  13185. Smoothly map out-of-range values, while retaining contrast and colors for
  13186. in-range material as much as possible. Use it when color accuracy is more
  13187. important than detail preservation.
  13188. @end table
  13189. Default is none.
  13190. @item param
  13191. Tune the tone mapping algorithm.
  13192. This affects the following algorithms:
  13193. @table @var
  13194. @item none
  13195. Ignored.
  13196. @item linear
  13197. Specifies the scale factor to use while stretching.
  13198. Default to 1.0.
  13199. @item gamma
  13200. Specifies the exponent of the function.
  13201. Default to 1.8.
  13202. @item clip
  13203. Specify an extra linear coefficient to multiply into the signal before clipping.
  13204. Default to 1.0.
  13205. @item reinhard
  13206. Specify the local contrast coefficient at the display peak.
  13207. Default to 0.5, which means that in-gamut values will be about half as bright
  13208. as when clipping.
  13209. @item hable
  13210. Ignored.
  13211. @item mobius
  13212. Specify the transition point from linear to mobius transform. Every value
  13213. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13214. more accurate the result will be, at the cost of losing bright details.
  13215. Default to 0.3, which due to the steep initial slope still preserves in-range
  13216. colors fairly accurately.
  13217. @end table
  13218. @item desat
  13219. Apply desaturation for highlights that exceed this level of brightness. The
  13220. higher the parameter, the more color information will be preserved. This
  13221. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13222. (smoothly) turning into white instead. This makes images feel more natural,
  13223. at the cost of reducing information about out-of-range colors.
  13224. The default of 2.0 is somewhat conservative and will mostly just apply to
  13225. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13226. This option works only if the input frame has a supported color tag.
  13227. @item peak
  13228. Override signal/nominal/reference peak with this value. Useful when the
  13229. embedded peak information in display metadata is not reliable or when tone
  13230. mapping from a lower range to a higher range.
  13231. @end table
  13232. @section tpad
  13233. Temporarily pad video frames.
  13234. The filter accepts the following options:
  13235. @table @option
  13236. @item start
  13237. Specify number of delay frames before input video stream.
  13238. @item stop
  13239. Specify number of padding frames after input video stream.
  13240. Set to -1 to pad indefinitely.
  13241. @item start_mode
  13242. Set kind of frames added to beginning of stream.
  13243. Can be either @var{add} or @var{clone}.
  13244. With @var{add} frames of solid-color are added.
  13245. With @var{clone} frames are clones of first frame.
  13246. @item stop_mode
  13247. Set kind of frames added to end of stream.
  13248. Can be either @var{add} or @var{clone}.
  13249. With @var{add} frames of solid-color are added.
  13250. With @var{clone} frames are clones of last frame.
  13251. @item start_duration, stop_duration
  13252. Specify the duration of the start/stop delay. See
  13253. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13254. for the accepted syntax.
  13255. These options override @var{start} and @var{stop}.
  13256. @item color
  13257. Specify the color of the padded area. For the syntax of this option,
  13258. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13259. manual,ffmpeg-utils}.
  13260. The default value of @var{color} is "black".
  13261. @end table
  13262. @anchor{transpose}
  13263. @section transpose
  13264. Transpose rows with columns in the input video and optionally flip it.
  13265. It accepts the following parameters:
  13266. @table @option
  13267. @item dir
  13268. Specify the transposition direction.
  13269. Can assume the following values:
  13270. @table @samp
  13271. @item 0, 4, cclock_flip
  13272. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13273. @example
  13274. L.R L.l
  13275. . . -> . .
  13276. l.r R.r
  13277. @end example
  13278. @item 1, 5, clock
  13279. Rotate by 90 degrees clockwise, that is:
  13280. @example
  13281. L.R l.L
  13282. . . -> . .
  13283. l.r r.R
  13284. @end example
  13285. @item 2, 6, cclock
  13286. Rotate by 90 degrees counterclockwise, that is:
  13287. @example
  13288. L.R R.r
  13289. . . -> . .
  13290. l.r L.l
  13291. @end example
  13292. @item 3, 7, clock_flip
  13293. Rotate by 90 degrees clockwise and vertically flip, that is:
  13294. @example
  13295. L.R r.R
  13296. . . -> . .
  13297. l.r l.L
  13298. @end example
  13299. @end table
  13300. For values between 4-7, the transposition is only done if the input
  13301. video geometry is portrait and not landscape. These values are
  13302. deprecated, the @code{passthrough} option should be used instead.
  13303. Numerical values are deprecated, and should be dropped in favor of
  13304. symbolic constants.
  13305. @item passthrough
  13306. Do not apply the transposition if the input geometry matches the one
  13307. specified by the specified value. It accepts the following values:
  13308. @table @samp
  13309. @item none
  13310. Always apply transposition.
  13311. @item portrait
  13312. Preserve portrait geometry (when @var{height} >= @var{width}).
  13313. @item landscape
  13314. Preserve landscape geometry (when @var{width} >= @var{height}).
  13315. @end table
  13316. Default value is @code{none}.
  13317. @end table
  13318. For example to rotate by 90 degrees clockwise and preserve portrait
  13319. layout:
  13320. @example
  13321. transpose=dir=1:passthrough=portrait
  13322. @end example
  13323. The command above can also be specified as:
  13324. @example
  13325. transpose=1:portrait
  13326. @end example
  13327. @section transpose_npp
  13328. Transpose rows with columns in the input video and optionally flip it.
  13329. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13330. It accepts the following parameters:
  13331. @table @option
  13332. @item dir
  13333. Specify the transposition direction.
  13334. Can assume the following values:
  13335. @table @samp
  13336. @item cclock_flip
  13337. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13338. @item clock
  13339. Rotate by 90 degrees clockwise.
  13340. @item cclock
  13341. Rotate by 90 degrees counterclockwise.
  13342. @item clock_flip
  13343. Rotate by 90 degrees clockwise and vertically flip.
  13344. @end table
  13345. @item passthrough
  13346. Do not apply the transposition if the input geometry matches the one
  13347. specified by the specified value. It accepts the following values:
  13348. @table @samp
  13349. @item none
  13350. Always apply transposition. (default)
  13351. @item portrait
  13352. Preserve portrait geometry (when @var{height} >= @var{width}).
  13353. @item landscape
  13354. Preserve landscape geometry (when @var{width} >= @var{height}).
  13355. @end table
  13356. @end table
  13357. @section trim
  13358. Trim the input so that the output contains one continuous subpart of the input.
  13359. It accepts the following parameters:
  13360. @table @option
  13361. @item start
  13362. Specify the time of the start of the kept section, i.e. the frame with the
  13363. timestamp @var{start} will be the first frame in the output.
  13364. @item end
  13365. Specify the time of the first frame that will be dropped, i.e. the frame
  13366. immediately preceding the one with the timestamp @var{end} will be the last
  13367. frame in the output.
  13368. @item start_pts
  13369. This is the same as @var{start}, except this option sets the start timestamp
  13370. in timebase units instead of seconds.
  13371. @item end_pts
  13372. This is the same as @var{end}, except this option sets the end timestamp
  13373. in timebase units instead of seconds.
  13374. @item duration
  13375. The maximum duration of the output in seconds.
  13376. @item start_frame
  13377. The number of the first frame that should be passed to the output.
  13378. @item end_frame
  13379. The number of the first frame that should be dropped.
  13380. @end table
  13381. @option{start}, @option{end}, and @option{duration} are expressed as time
  13382. duration specifications; see
  13383. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13384. for the accepted syntax.
  13385. Note that the first two sets of the start/end options and the @option{duration}
  13386. option look at the frame timestamp, while the _frame variants simply count the
  13387. frames that pass through the filter. Also note that this filter does not modify
  13388. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13389. setpts filter after the trim filter.
  13390. If multiple start or end options are set, this filter tries to be greedy and
  13391. keep all the frames that match at least one of the specified constraints. To keep
  13392. only the part that matches all the constraints at once, chain multiple trim
  13393. filters.
  13394. The defaults are such that all the input is kept. So it is possible to set e.g.
  13395. just the end values to keep everything before the specified time.
  13396. Examples:
  13397. @itemize
  13398. @item
  13399. Drop everything except the second minute of input:
  13400. @example
  13401. ffmpeg -i INPUT -vf trim=60:120
  13402. @end example
  13403. @item
  13404. Keep only the first second:
  13405. @example
  13406. ffmpeg -i INPUT -vf trim=duration=1
  13407. @end example
  13408. @end itemize
  13409. @section unpremultiply
  13410. Apply alpha unpremultiply effect to input video stream using first plane
  13411. of second stream as alpha.
  13412. Both streams must have same dimensions and same pixel format.
  13413. The filter accepts the following option:
  13414. @table @option
  13415. @item planes
  13416. Set which planes will be processed, unprocessed planes will be copied.
  13417. By default value 0xf, all planes will be processed.
  13418. If the format has 1 or 2 components, then luma is bit 0.
  13419. If the format has 3 or 4 components:
  13420. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13421. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13422. If present, the alpha channel is always the last bit.
  13423. @item inplace
  13424. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13425. @end table
  13426. @anchor{unsharp}
  13427. @section unsharp
  13428. Sharpen or blur the input video.
  13429. It accepts the following parameters:
  13430. @table @option
  13431. @item luma_msize_x, lx
  13432. Set the luma matrix horizontal size. It must be an odd integer between
  13433. 3 and 23. The default value is 5.
  13434. @item luma_msize_y, ly
  13435. Set the luma matrix vertical size. It must be an odd integer between 3
  13436. and 23. The default value is 5.
  13437. @item luma_amount, la
  13438. Set the luma effect strength. It must be a floating point number, reasonable
  13439. values lay between -1.5 and 1.5.
  13440. Negative values will blur the input video, while positive values will
  13441. sharpen it, a value of zero will disable the effect.
  13442. Default value is 1.0.
  13443. @item chroma_msize_x, cx
  13444. Set the chroma matrix horizontal size. It must be an odd integer
  13445. between 3 and 23. The default value is 5.
  13446. @item chroma_msize_y, cy
  13447. Set the chroma matrix vertical size. It must be an odd integer
  13448. between 3 and 23. The default value is 5.
  13449. @item chroma_amount, ca
  13450. Set the chroma effect strength. It must be a floating point number, reasonable
  13451. values lay between -1.5 and 1.5.
  13452. Negative values will blur the input video, while positive values will
  13453. sharpen it, a value of zero will disable the effect.
  13454. Default value is 0.0.
  13455. @end table
  13456. All parameters are optional and default to the equivalent of the
  13457. string '5:5:1.0:5:5:0.0'.
  13458. @subsection Examples
  13459. @itemize
  13460. @item
  13461. Apply strong luma sharpen effect:
  13462. @example
  13463. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13464. @end example
  13465. @item
  13466. Apply a strong blur of both luma and chroma parameters:
  13467. @example
  13468. unsharp=7:7:-2:7:7:-2
  13469. @end example
  13470. @end itemize
  13471. @section uspp
  13472. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13473. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13474. shifts and average the results.
  13475. The way this differs from the behavior of spp is that uspp actually encodes &
  13476. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13477. DCT similar to MJPEG.
  13478. The filter accepts the following options:
  13479. @table @option
  13480. @item quality
  13481. Set quality. This option defines the number of levels for averaging. It accepts
  13482. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13483. effect. A value of @code{8} means the higher quality. For each increment of
  13484. that value the speed drops by a factor of approximately 2. Default value is
  13485. @code{3}.
  13486. @item qp
  13487. Force a constant quantization parameter. If not set, the filter will use the QP
  13488. from the video stream (if available).
  13489. @end table
  13490. @section vaguedenoiser
  13491. Apply a wavelet based denoiser.
  13492. It transforms each frame from the video input into the wavelet domain,
  13493. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13494. the obtained coefficients. It does an inverse wavelet transform after.
  13495. Due to wavelet properties, it should give a nice smoothed result, and
  13496. reduced noise, without blurring picture features.
  13497. This filter accepts the following options:
  13498. @table @option
  13499. @item threshold
  13500. The filtering strength. The higher, the more filtered the video will be.
  13501. Hard thresholding can use a higher threshold than soft thresholding
  13502. before the video looks overfiltered. Default value is 2.
  13503. @item method
  13504. The filtering method the filter will use.
  13505. It accepts the following values:
  13506. @table @samp
  13507. @item hard
  13508. All values under the threshold will be zeroed.
  13509. @item soft
  13510. All values under the threshold will be zeroed. All values above will be
  13511. reduced by the threshold.
  13512. @item garrote
  13513. Scales or nullifies coefficients - intermediary between (more) soft and
  13514. (less) hard thresholding.
  13515. @end table
  13516. Default is garrote.
  13517. @item nsteps
  13518. Number of times, the wavelet will decompose the picture. Picture can't
  13519. be decomposed beyond a particular point (typically, 8 for a 640x480
  13520. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13521. @item percent
  13522. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13523. @item planes
  13524. A list of the planes to process. By default all planes are processed.
  13525. @end table
  13526. @section vectorscope
  13527. Display 2 color component values in the two dimensional graph (which is called
  13528. a vectorscope).
  13529. This filter accepts the following options:
  13530. @table @option
  13531. @item mode, m
  13532. Set vectorscope mode.
  13533. It accepts the following values:
  13534. @table @samp
  13535. @item gray
  13536. Gray values are displayed on graph, higher brightness means more pixels have
  13537. same component color value on location in graph. This is the default mode.
  13538. @item color
  13539. Gray values are displayed on graph. Surrounding pixels values which are not
  13540. present in video frame are drawn in gradient of 2 color components which are
  13541. set by option @code{x} and @code{y}. The 3rd color component is static.
  13542. @item color2
  13543. Actual color components values present in video frame are displayed on graph.
  13544. @item color3
  13545. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13546. on graph increases value of another color component, which is luminance by
  13547. default values of @code{x} and @code{y}.
  13548. @item color4
  13549. Actual colors present in video frame are displayed on graph. If two different
  13550. colors map to same position on graph then color with higher value of component
  13551. not present in graph is picked.
  13552. @item color5
  13553. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13554. component picked from radial gradient.
  13555. @end table
  13556. @item x
  13557. Set which color component will be represented on X-axis. Default is @code{1}.
  13558. @item y
  13559. Set which color component will be represented on Y-axis. Default is @code{2}.
  13560. @item intensity, i
  13561. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13562. of color component which represents frequency of (X, Y) location in graph.
  13563. @item envelope, e
  13564. @table @samp
  13565. @item none
  13566. No envelope, this is default.
  13567. @item instant
  13568. Instant envelope, even darkest single pixel will be clearly highlighted.
  13569. @item peak
  13570. Hold maximum and minimum values presented in graph over time. This way you
  13571. can still spot out of range values without constantly looking at vectorscope.
  13572. @item peak+instant
  13573. Peak and instant envelope combined together.
  13574. @end table
  13575. @item graticule, g
  13576. Set what kind of graticule to draw.
  13577. @table @samp
  13578. @item none
  13579. @item green
  13580. @item color
  13581. @end table
  13582. @item opacity, o
  13583. Set graticule opacity.
  13584. @item flags, f
  13585. Set graticule flags.
  13586. @table @samp
  13587. @item white
  13588. Draw graticule for white point.
  13589. @item black
  13590. Draw graticule for black point.
  13591. @item name
  13592. Draw color points short names.
  13593. @end table
  13594. @item bgopacity, b
  13595. Set background opacity.
  13596. @item lthreshold, l
  13597. Set low threshold for color component not represented on X or Y axis.
  13598. Values lower than this value will be ignored. Default is 0.
  13599. Note this value is multiplied with actual max possible value one pixel component
  13600. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13601. is 0.1 * 255 = 25.
  13602. @item hthreshold, h
  13603. Set high threshold for color component not represented on X or Y axis.
  13604. Values higher than this value will be ignored. Default is 1.
  13605. Note this value is multiplied with actual max possible value one pixel component
  13606. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13607. is 0.9 * 255 = 230.
  13608. @item colorspace, c
  13609. Set what kind of colorspace to use when drawing graticule.
  13610. @table @samp
  13611. @item auto
  13612. @item 601
  13613. @item 709
  13614. @end table
  13615. Default is auto.
  13616. @end table
  13617. @anchor{vidstabdetect}
  13618. @section vidstabdetect
  13619. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13620. @ref{vidstabtransform} for pass 2.
  13621. This filter generates a file with relative translation and rotation
  13622. transform information about subsequent frames, which is then used by
  13623. the @ref{vidstabtransform} filter.
  13624. To enable compilation of this filter you need to configure FFmpeg with
  13625. @code{--enable-libvidstab}.
  13626. This filter accepts the following options:
  13627. @table @option
  13628. @item result
  13629. Set the path to the file used to write the transforms information.
  13630. Default value is @file{transforms.trf}.
  13631. @item shakiness
  13632. Set how shaky the video is and how quick the camera is. It accepts an
  13633. integer in the range 1-10, a value of 1 means little shakiness, a
  13634. value of 10 means strong shakiness. Default value is 5.
  13635. @item accuracy
  13636. Set the accuracy of the detection process. It must be a value in the
  13637. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13638. accuracy. Default value is 15.
  13639. @item stepsize
  13640. Set stepsize of the search process. The region around minimum is
  13641. scanned with 1 pixel resolution. Default value is 6.
  13642. @item mincontrast
  13643. Set minimum contrast. Below this value a local measurement field is
  13644. discarded. Must be a floating point value in the range 0-1. Default
  13645. value is 0.3.
  13646. @item tripod
  13647. Set reference frame number for tripod mode.
  13648. If enabled, the motion of the frames is compared to a reference frame
  13649. in the filtered stream, identified by the specified number. The idea
  13650. is to compensate all movements in a more-or-less static scene and keep
  13651. the camera view absolutely still.
  13652. If set to 0, it is disabled. The frames are counted starting from 1.
  13653. @item show
  13654. Show fields and transforms in the resulting frames. It accepts an
  13655. integer in the range 0-2. Default value is 0, which disables any
  13656. visualization.
  13657. @end table
  13658. @subsection Examples
  13659. @itemize
  13660. @item
  13661. Use default values:
  13662. @example
  13663. vidstabdetect
  13664. @end example
  13665. @item
  13666. Analyze strongly shaky movie and put the results in file
  13667. @file{mytransforms.trf}:
  13668. @example
  13669. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13670. @end example
  13671. @item
  13672. Visualize the result of internal transformations in the resulting
  13673. video:
  13674. @example
  13675. vidstabdetect=show=1
  13676. @end example
  13677. @item
  13678. Analyze a video with medium shakiness using @command{ffmpeg}:
  13679. @example
  13680. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13681. @end example
  13682. @end itemize
  13683. @anchor{vidstabtransform}
  13684. @section vidstabtransform
  13685. Video stabilization/deshaking: pass 2 of 2,
  13686. see @ref{vidstabdetect} for pass 1.
  13687. Read a file with transform information for each frame and
  13688. apply/compensate them. Together with the @ref{vidstabdetect}
  13689. filter this can be used to deshake videos. See also
  13690. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13691. the @ref{unsharp} filter, see below.
  13692. To enable compilation of this filter you need to configure FFmpeg with
  13693. @code{--enable-libvidstab}.
  13694. @subsection Options
  13695. @table @option
  13696. @item input
  13697. Set path to the file used to read the transforms. Default value is
  13698. @file{transforms.trf}.
  13699. @item smoothing
  13700. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13701. camera movements. Default value is 10.
  13702. For example a number of 10 means that 21 frames are used (10 in the
  13703. past and 10 in the future) to smoothen the motion in the video. A
  13704. larger value leads to a smoother video, but limits the acceleration of
  13705. the camera (pan/tilt movements). 0 is a special case where a static
  13706. camera is simulated.
  13707. @item optalgo
  13708. Set the camera path optimization algorithm.
  13709. Accepted values are:
  13710. @table @samp
  13711. @item gauss
  13712. gaussian kernel low-pass filter on camera motion (default)
  13713. @item avg
  13714. averaging on transformations
  13715. @end table
  13716. @item maxshift
  13717. Set maximal number of pixels to translate frames. Default value is -1,
  13718. meaning no limit.
  13719. @item maxangle
  13720. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13721. value is -1, meaning no limit.
  13722. @item crop
  13723. Specify how to deal with borders that may be visible due to movement
  13724. compensation.
  13725. Available values are:
  13726. @table @samp
  13727. @item keep
  13728. keep image information from previous frame (default)
  13729. @item black
  13730. fill the border black
  13731. @end table
  13732. @item invert
  13733. Invert transforms if set to 1. Default value is 0.
  13734. @item relative
  13735. Consider transforms as relative to previous frame if set to 1,
  13736. absolute if set to 0. Default value is 0.
  13737. @item zoom
  13738. Set percentage to zoom. A positive value will result in a zoom-in
  13739. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13740. zoom).
  13741. @item optzoom
  13742. Set optimal zooming to avoid borders.
  13743. Accepted values are:
  13744. @table @samp
  13745. @item 0
  13746. disabled
  13747. @item 1
  13748. optimal static zoom value is determined (only very strong movements
  13749. will lead to visible borders) (default)
  13750. @item 2
  13751. optimal adaptive zoom value is determined (no borders will be
  13752. visible), see @option{zoomspeed}
  13753. @end table
  13754. Note that the value given at zoom is added to the one calculated here.
  13755. @item zoomspeed
  13756. Set percent to zoom maximally each frame (enabled when
  13757. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13758. 0.25.
  13759. @item interpol
  13760. Specify type of interpolation.
  13761. Available values are:
  13762. @table @samp
  13763. @item no
  13764. no interpolation
  13765. @item linear
  13766. linear only horizontal
  13767. @item bilinear
  13768. linear in both directions (default)
  13769. @item bicubic
  13770. cubic in both directions (slow)
  13771. @end table
  13772. @item tripod
  13773. Enable virtual tripod mode if set to 1, which is equivalent to
  13774. @code{relative=0:smoothing=0}. Default value is 0.
  13775. Use also @code{tripod} option of @ref{vidstabdetect}.
  13776. @item debug
  13777. Increase log verbosity if set to 1. Also the detected global motions
  13778. are written to the temporary file @file{global_motions.trf}. Default
  13779. value is 0.
  13780. @end table
  13781. @subsection Examples
  13782. @itemize
  13783. @item
  13784. Use @command{ffmpeg} for a typical stabilization with default values:
  13785. @example
  13786. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13787. @end example
  13788. Note the use of the @ref{unsharp} filter which is always recommended.
  13789. @item
  13790. Zoom in a bit more and load transform data from a given file:
  13791. @example
  13792. vidstabtransform=zoom=5:input="mytransforms.trf"
  13793. @end example
  13794. @item
  13795. Smoothen the video even more:
  13796. @example
  13797. vidstabtransform=smoothing=30
  13798. @end example
  13799. @end itemize
  13800. @section vflip
  13801. Flip the input video vertically.
  13802. For example, to vertically flip a video with @command{ffmpeg}:
  13803. @example
  13804. ffmpeg -i in.avi -vf "vflip" out.avi
  13805. @end example
  13806. @section vfrdet
  13807. Detect variable frame rate video.
  13808. This filter tries to detect if the input is variable or constant frame rate.
  13809. At end it will output number of frames detected as having variable delta pts,
  13810. and ones with constant delta pts.
  13811. If there was frames with variable delta, than it will also show min and max delta
  13812. encountered.
  13813. @section vibrance
  13814. Boost or alter saturation.
  13815. The filter accepts the following options:
  13816. @table @option
  13817. @item intensity
  13818. Set strength of boost if positive value or strength of alter if negative value.
  13819. Default is 0. Allowed range is from -2 to 2.
  13820. @item rbal
  13821. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13822. @item gbal
  13823. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13824. @item bbal
  13825. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13826. @item rlum
  13827. Set the red luma coefficient.
  13828. @item glum
  13829. Set the green luma coefficient.
  13830. @item blum
  13831. Set the blue luma coefficient.
  13832. @item alternate
  13833. If @code{intensity} is negative and this is set to 1, colors will change,
  13834. otherwise colors will be less saturated, more towards gray.
  13835. @end table
  13836. @anchor{vignette}
  13837. @section vignette
  13838. Make or reverse a natural vignetting effect.
  13839. The filter accepts the following options:
  13840. @table @option
  13841. @item angle, a
  13842. Set lens angle expression as a number of radians.
  13843. The value is clipped in the @code{[0,PI/2]} range.
  13844. Default value: @code{"PI/5"}
  13845. @item x0
  13846. @item y0
  13847. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13848. by default.
  13849. @item mode
  13850. Set forward/backward mode.
  13851. Available modes are:
  13852. @table @samp
  13853. @item forward
  13854. The larger the distance from the central point, the darker the image becomes.
  13855. @item backward
  13856. The larger the distance from the central point, the brighter the image becomes.
  13857. This can be used to reverse a vignette effect, though there is no automatic
  13858. detection to extract the lens @option{angle} and other settings (yet). It can
  13859. also be used to create a burning effect.
  13860. @end table
  13861. Default value is @samp{forward}.
  13862. @item eval
  13863. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13864. It accepts the following values:
  13865. @table @samp
  13866. @item init
  13867. Evaluate expressions only once during the filter initialization.
  13868. @item frame
  13869. Evaluate expressions for each incoming frame. This is way slower than the
  13870. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13871. allows advanced dynamic expressions.
  13872. @end table
  13873. Default value is @samp{init}.
  13874. @item dither
  13875. Set dithering to reduce the circular banding effects. Default is @code{1}
  13876. (enabled).
  13877. @item aspect
  13878. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13879. Setting this value to the SAR of the input will make a rectangular vignetting
  13880. following the dimensions of the video.
  13881. Default is @code{1/1}.
  13882. @end table
  13883. @subsection Expressions
  13884. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13885. following parameters.
  13886. @table @option
  13887. @item w
  13888. @item h
  13889. input width and height
  13890. @item n
  13891. the number of input frame, starting from 0
  13892. @item pts
  13893. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13894. @var{TB} units, NAN if undefined
  13895. @item r
  13896. frame rate of the input video, NAN if the input frame rate is unknown
  13897. @item t
  13898. the PTS (Presentation TimeStamp) of the filtered video frame,
  13899. expressed in seconds, NAN if undefined
  13900. @item tb
  13901. time base of the input video
  13902. @end table
  13903. @subsection Examples
  13904. @itemize
  13905. @item
  13906. Apply simple strong vignetting effect:
  13907. @example
  13908. vignette=PI/4
  13909. @end example
  13910. @item
  13911. Make a flickering vignetting:
  13912. @example
  13913. vignette='PI/4+random(1)*PI/50':eval=frame
  13914. @end example
  13915. @end itemize
  13916. @section vmafmotion
  13917. Obtain the average vmaf motion score of a video.
  13918. It is one of the component filters of VMAF.
  13919. The obtained average motion score is printed through the logging system.
  13920. In the below example the input file @file{ref.mpg} is being processed and score
  13921. is computed.
  13922. @example
  13923. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13924. @end example
  13925. @section vstack
  13926. Stack input videos vertically.
  13927. All streams must be of same pixel format and of same width.
  13928. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13929. to create same output.
  13930. The filter accept the following option:
  13931. @table @option
  13932. @item inputs
  13933. Set number of input streams. Default is 2.
  13934. @item shortest
  13935. If set to 1, force the output to terminate when the shortest input
  13936. terminates. Default value is 0.
  13937. @end table
  13938. @section w3fdif
  13939. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13940. Deinterlacing Filter").
  13941. Based on the process described by Martin Weston for BBC R&D, and
  13942. implemented based on the de-interlace algorithm written by Jim
  13943. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13944. uses filter coefficients calculated by BBC R&D.
  13945. This filter use field-dominance information in frame to decide which
  13946. of each pair of fields to place first in the output.
  13947. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  13948. There are two sets of filter coefficients, so called "simple":
  13949. and "complex". Which set of filter coefficients is used can
  13950. be set by passing an optional parameter:
  13951. @table @option
  13952. @item filter
  13953. Set the interlacing filter coefficients. Accepts one of the following values:
  13954. @table @samp
  13955. @item simple
  13956. Simple filter coefficient set.
  13957. @item complex
  13958. More-complex filter coefficient set.
  13959. @end table
  13960. Default value is @samp{complex}.
  13961. @item deint
  13962. Specify which frames to deinterlace. Accept one of the following values:
  13963. @table @samp
  13964. @item all
  13965. Deinterlace all frames,
  13966. @item interlaced
  13967. Only deinterlace frames marked as interlaced.
  13968. @end table
  13969. Default value is @samp{all}.
  13970. @end table
  13971. @section waveform
  13972. Video waveform monitor.
  13973. The waveform monitor plots color component intensity. By default luminance
  13974. only. Each column of the waveform corresponds to a column of pixels in the
  13975. source video.
  13976. It accepts the following options:
  13977. @table @option
  13978. @item mode, m
  13979. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13980. In row mode, the graph on the left side represents color component value 0 and
  13981. the right side represents value = 255. In column mode, the top side represents
  13982. color component value = 0 and bottom side represents value = 255.
  13983. @item intensity, i
  13984. Set intensity. Smaller values are useful to find out how many values of the same
  13985. luminance are distributed across input rows/columns.
  13986. Default value is @code{0.04}. Allowed range is [0, 1].
  13987. @item mirror, r
  13988. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13989. In mirrored mode, higher values will be represented on the left
  13990. side for @code{row} mode and at the top for @code{column} mode. Default is
  13991. @code{1} (mirrored).
  13992. @item display, d
  13993. Set display mode.
  13994. It accepts the following values:
  13995. @table @samp
  13996. @item overlay
  13997. Presents information identical to that in the @code{parade}, except
  13998. that the graphs representing color components are superimposed directly
  13999. over one another.
  14000. This display mode makes it easier to spot relative differences or similarities
  14001. in overlapping areas of the color components that are supposed to be identical,
  14002. such as neutral whites, grays, or blacks.
  14003. @item stack
  14004. Display separate graph for the color components side by side in
  14005. @code{row} mode or one below the other in @code{column} mode.
  14006. @item parade
  14007. Display separate graph for the color components side by side in
  14008. @code{column} mode or one below the other in @code{row} mode.
  14009. Using this display mode makes it easy to spot color casts in the highlights
  14010. and shadows of an image, by comparing the contours of the top and the bottom
  14011. graphs of each waveform. Since whites, grays, and blacks are characterized
  14012. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14013. should display three waveforms of roughly equal width/height. If not, the
  14014. correction is easy to perform by making level adjustments the three waveforms.
  14015. @end table
  14016. Default is @code{stack}.
  14017. @item components, c
  14018. Set which color components to display. Default is 1, which means only luminance
  14019. or red color component if input is in RGB colorspace. If is set for example to
  14020. 7 it will display all 3 (if) available color components.
  14021. @item envelope, e
  14022. @table @samp
  14023. @item none
  14024. No envelope, this is default.
  14025. @item instant
  14026. Instant envelope, minimum and maximum values presented in graph will be easily
  14027. visible even with small @code{step} value.
  14028. @item peak
  14029. Hold minimum and maximum values presented in graph across time. This way you
  14030. can still spot out of range values without constantly looking at waveforms.
  14031. @item peak+instant
  14032. Peak and instant envelope combined together.
  14033. @end table
  14034. @item filter, f
  14035. @table @samp
  14036. @item lowpass
  14037. No filtering, this is default.
  14038. @item flat
  14039. Luma and chroma combined together.
  14040. @item aflat
  14041. Similar as above, but shows difference between blue and red chroma.
  14042. @item xflat
  14043. Similar as above, but use different colors.
  14044. @item chroma
  14045. Displays only chroma.
  14046. @item color
  14047. Displays actual color value on waveform.
  14048. @item acolor
  14049. Similar as above, but with luma showing frequency of chroma values.
  14050. @end table
  14051. @item graticule, g
  14052. Set which graticule to display.
  14053. @table @samp
  14054. @item none
  14055. Do not display graticule.
  14056. @item green
  14057. Display green graticule showing legal broadcast ranges.
  14058. @item orange
  14059. Display orange graticule showing legal broadcast ranges.
  14060. @end table
  14061. @item opacity, o
  14062. Set graticule opacity.
  14063. @item flags, fl
  14064. Set graticule flags.
  14065. @table @samp
  14066. @item numbers
  14067. Draw numbers above lines. By default enabled.
  14068. @item dots
  14069. Draw dots instead of lines.
  14070. @end table
  14071. @item scale, s
  14072. Set scale used for displaying graticule.
  14073. @table @samp
  14074. @item digital
  14075. @item millivolts
  14076. @item ire
  14077. @end table
  14078. Default is digital.
  14079. @item bgopacity, b
  14080. Set background opacity.
  14081. @end table
  14082. @section weave, doubleweave
  14083. The @code{weave} takes a field-based video input and join
  14084. each two sequential fields into single frame, producing a new double
  14085. height clip with half the frame rate and half the frame count.
  14086. The @code{doubleweave} works same as @code{weave} but without
  14087. halving frame rate and frame count.
  14088. It accepts the following option:
  14089. @table @option
  14090. @item first_field
  14091. Set first field. Available values are:
  14092. @table @samp
  14093. @item top, t
  14094. Set the frame as top-field-first.
  14095. @item bottom, b
  14096. Set the frame as bottom-field-first.
  14097. @end table
  14098. @end table
  14099. @subsection Examples
  14100. @itemize
  14101. @item
  14102. Interlace video using @ref{select} and @ref{separatefields} filter:
  14103. @example
  14104. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14105. @end example
  14106. @end itemize
  14107. @section xbr
  14108. Apply the xBR high-quality magnification filter which is designed for pixel
  14109. art. It follows a set of edge-detection rules, see
  14110. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14111. It accepts the following option:
  14112. @table @option
  14113. @item n
  14114. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14115. @code{3xBR} and @code{4} for @code{4xBR}.
  14116. Default is @code{3}.
  14117. @end table
  14118. @section xmedian
  14119. Pick median pixels from several input videos.
  14120. The filter accept the following options:
  14121. @table @option
  14122. @item inputs
  14123. Set number of inputs.
  14124. Default is 3. Allowed range is from 3 to 255.
  14125. If number of inputs is even number, than result will be mean value between two median values.
  14126. @item planes
  14127. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14128. @end table
  14129. @section xstack
  14130. Stack video inputs into custom layout.
  14131. All streams must be of same pixel format.
  14132. The filter accept the following option:
  14133. @table @option
  14134. @item inputs
  14135. Set number of input streams. Default is 2.
  14136. @item layout
  14137. Specify layout of inputs.
  14138. This option requires the desired layout configuration to be explicitly set by the user.
  14139. This sets position of each video input in output. Each input
  14140. is separated by '|'.
  14141. The first number represents the column, and the second number represents the row.
  14142. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14143. where X is video input from which to take width or height.
  14144. Multiple values can be used when separated by '+'. In such
  14145. case values are summed together.
  14146. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14147. a layout must be set by the user.
  14148. @item shortest
  14149. If set to 1, force the output to terminate when the shortest input
  14150. terminates. Default value is 0.
  14151. @end table
  14152. @subsection Examples
  14153. @itemize
  14154. @item
  14155. Display 4 inputs into 2x2 grid,
  14156. note that if inputs are of different sizes unused gaps might appear,
  14157. as not all of output video is used.
  14158. @example
  14159. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14160. @end example
  14161. @item
  14162. Display 4 inputs into 1x4 grid,
  14163. note that if inputs are of different sizes unused gaps might appear,
  14164. as not all of output video is used.
  14165. @example
  14166. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14167. @end example
  14168. @item
  14169. Display 9 inputs into 3x3 grid,
  14170. note that if inputs are of different sizes unused gaps might appear,
  14171. as not all of output video is used.
  14172. @example
  14173. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14174. @end example
  14175. @end itemize
  14176. @anchor{yadif}
  14177. @section yadif
  14178. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14179. filter").
  14180. It accepts the following parameters:
  14181. @table @option
  14182. @item mode
  14183. The interlacing mode to adopt. It accepts one of the following values:
  14184. @table @option
  14185. @item 0, send_frame
  14186. Output one frame for each frame.
  14187. @item 1, send_field
  14188. Output one frame for each field.
  14189. @item 2, send_frame_nospatial
  14190. Like @code{send_frame}, but it skips the spatial interlacing check.
  14191. @item 3, send_field_nospatial
  14192. Like @code{send_field}, but it skips the spatial interlacing check.
  14193. @end table
  14194. The default value is @code{send_frame}.
  14195. @item parity
  14196. The picture field parity assumed for the input interlaced video. It accepts one
  14197. of the following values:
  14198. @table @option
  14199. @item 0, tff
  14200. Assume the top field is first.
  14201. @item 1, bff
  14202. Assume the bottom field is first.
  14203. @item -1, auto
  14204. Enable automatic detection of field parity.
  14205. @end table
  14206. The default value is @code{auto}.
  14207. If the interlacing is unknown or the decoder does not export this information,
  14208. top field first will be assumed.
  14209. @item deint
  14210. Specify which frames to deinterlace. Accept one of the following
  14211. values:
  14212. @table @option
  14213. @item 0, all
  14214. Deinterlace all frames.
  14215. @item 1, interlaced
  14216. Only deinterlace frames marked as interlaced.
  14217. @end table
  14218. The default value is @code{all}.
  14219. @end table
  14220. @section yadif_cuda
  14221. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14222. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14223. and/or nvenc.
  14224. It accepts the following parameters:
  14225. @table @option
  14226. @item mode
  14227. The interlacing mode to adopt. It accepts one of the following values:
  14228. @table @option
  14229. @item 0, send_frame
  14230. Output one frame for each frame.
  14231. @item 1, send_field
  14232. Output one frame for each field.
  14233. @item 2, send_frame_nospatial
  14234. Like @code{send_frame}, but it skips the spatial interlacing check.
  14235. @item 3, send_field_nospatial
  14236. Like @code{send_field}, but it skips the spatial interlacing check.
  14237. @end table
  14238. The default value is @code{send_frame}.
  14239. @item parity
  14240. The picture field parity assumed for the input interlaced video. It accepts one
  14241. of the following values:
  14242. @table @option
  14243. @item 0, tff
  14244. Assume the top field is first.
  14245. @item 1, bff
  14246. Assume the bottom field is first.
  14247. @item -1, auto
  14248. Enable automatic detection of field parity.
  14249. @end table
  14250. The default value is @code{auto}.
  14251. If the interlacing is unknown or the decoder does not export this information,
  14252. top field first will be assumed.
  14253. @item deint
  14254. Specify which frames to deinterlace. Accept one of the following
  14255. values:
  14256. @table @option
  14257. @item 0, all
  14258. Deinterlace all frames.
  14259. @item 1, interlaced
  14260. Only deinterlace frames marked as interlaced.
  14261. @end table
  14262. The default value is @code{all}.
  14263. @end table
  14264. @section zoompan
  14265. Apply Zoom & Pan effect.
  14266. This filter accepts the following options:
  14267. @table @option
  14268. @item zoom, z
  14269. Set the zoom expression. Range is 1-10. Default is 1.
  14270. @item x
  14271. @item y
  14272. Set the x and y expression. Default is 0.
  14273. @item d
  14274. Set the duration expression in number of frames.
  14275. This sets for how many number of frames effect will last for
  14276. single input image.
  14277. @item s
  14278. Set the output image size, default is 'hd720'.
  14279. @item fps
  14280. Set the output frame rate, default is '25'.
  14281. @end table
  14282. Each expression can contain the following constants:
  14283. @table @option
  14284. @item in_w, iw
  14285. Input width.
  14286. @item in_h, ih
  14287. Input height.
  14288. @item out_w, ow
  14289. Output width.
  14290. @item out_h, oh
  14291. Output height.
  14292. @item in
  14293. Input frame count.
  14294. @item on
  14295. Output frame count.
  14296. @item x
  14297. @item y
  14298. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14299. for current input frame.
  14300. @item px
  14301. @item py
  14302. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14303. not yet such frame (first input frame).
  14304. @item zoom
  14305. Last calculated zoom from 'z' expression for current input frame.
  14306. @item pzoom
  14307. Last calculated zoom of last output frame of previous input frame.
  14308. @item duration
  14309. Number of output frames for current input frame. Calculated from 'd' expression
  14310. for each input frame.
  14311. @item pduration
  14312. number of output frames created for previous input frame
  14313. @item a
  14314. Rational number: input width / input height
  14315. @item sar
  14316. sample aspect ratio
  14317. @item dar
  14318. display aspect ratio
  14319. @end table
  14320. @subsection Examples
  14321. @itemize
  14322. @item
  14323. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14324. @example
  14325. 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
  14326. @end example
  14327. @item
  14328. Zoom-in up to 1.5 and pan always at center of picture:
  14329. @example
  14330. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14331. @end example
  14332. @item
  14333. Same as above but without pausing:
  14334. @example
  14335. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14336. @end example
  14337. @end itemize
  14338. @anchor{zscale}
  14339. @section zscale
  14340. Scale (resize) the input video, using the z.lib library:
  14341. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14342. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14343. The zscale filter forces the output display aspect ratio to be the same
  14344. as the input, by changing the output sample aspect ratio.
  14345. If the input image format is different from the format requested by
  14346. the next filter, the zscale filter will convert the input to the
  14347. requested format.
  14348. @subsection Options
  14349. The filter accepts the following options.
  14350. @table @option
  14351. @item width, w
  14352. @item height, h
  14353. Set the output video dimension expression. Default value is the input
  14354. dimension.
  14355. If the @var{width} or @var{w} value is 0, the input width is used for
  14356. the output. If the @var{height} or @var{h} value is 0, the input height
  14357. is used for the output.
  14358. If one and only one of the values is -n with n >= 1, the zscale filter
  14359. will use a value that maintains the aspect ratio of the input image,
  14360. calculated from the other specified dimension. After that it will,
  14361. however, make sure that the calculated dimension is divisible by n and
  14362. adjust the value if necessary.
  14363. If both values are -n with n >= 1, the behavior will be identical to
  14364. both values being set to 0 as previously detailed.
  14365. See below for the list of accepted constants for use in the dimension
  14366. expression.
  14367. @item size, s
  14368. Set the video size. For the syntax of this option, check the
  14369. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14370. @item dither, d
  14371. Set the dither type.
  14372. Possible values are:
  14373. @table @var
  14374. @item none
  14375. @item ordered
  14376. @item random
  14377. @item error_diffusion
  14378. @end table
  14379. Default is none.
  14380. @item filter, f
  14381. Set the resize filter type.
  14382. Possible values are:
  14383. @table @var
  14384. @item point
  14385. @item bilinear
  14386. @item bicubic
  14387. @item spline16
  14388. @item spline36
  14389. @item lanczos
  14390. @end table
  14391. Default is bilinear.
  14392. @item range, r
  14393. Set the color range.
  14394. Possible values are:
  14395. @table @var
  14396. @item input
  14397. @item limited
  14398. @item full
  14399. @end table
  14400. Default is same as input.
  14401. @item primaries, p
  14402. Set the color primaries.
  14403. Possible values are:
  14404. @table @var
  14405. @item input
  14406. @item 709
  14407. @item unspecified
  14408. @item 170m
  14409. @item 240m
  14410. @item 2020
  14411. @end table
  14412. Default is same as input.
  14413. @item transfer, t
  14414. Set the transfer characteristics.
  14415. Possible values are:
  14416. @table @var
  14417. @item input
  14418. @item 709
  14419. @item unspecified
  14420. @item 601
  14421. @item linear
  14422. @item 2020_10
  14423. @item 2020_12
  14424. @item smpte2084
  14425. @item iec61966-2-1
  14426. @item arib-std-b67
  14427. @end table
  14428. Default is same as input.
  14429. @item matrix, m
  14430. Set the colorspace matrix.
  14431. Possible value are:
  14432. @table @var
  14433. @item input
  14434. @item 709
  14435. @item unspecified
  14436. @item 470bg
  14437. @item 170m
  14438. @item 2020_ncl
  14439. @item 2020_cl
  14440. @end table
  14441. Default is same as input.
  14442. @item rangein, rin
  14443. Set the input color range.
  14444. Possible values are:
  14445. @table @var
  14446. @item input
  14447. @item limited
  14448. @item full
  14449. @end table
  14450. Default is same as input.
  14451. @item primariesin, pin
  14452. Set the input color primaries.
  14453. Possible values are:
  14454. @table @var
  14455. @item input
  14456. @item 709
  14457. @item unspecified
  14458. @item 170m
  14459. @item 240m
  14460. @item 2020
  14461. @end table
  14462. Default is same as input.
  14463. @item transferin, tin
  14464. Set the input transfer characteristics.
  14465. Possible values are:
  14466. @table @var
  14467. @item input
  14468. @item 709
  14469. @item unspecified
  14470. @item 601
  14471. @item linear
  14472. @item 2020_10
  14473. @item 2020_12
  14474. @end table
  14475. Default is same as input.
  14476. @item matrixin, min
  14477. Set the input colorspace matrix.
  14478. Possible value are:
  14479. @table @var
  14480. @item input
  14481. @item 709
  14482. @item unspecified
  14483. @item 470bg
  14484. @item 170m
  14485. @item 2020_ncl
  14486. @item 2020_cl
  14487. @end table
  14488. @item chromal, c
  14489. Set the output chroma location.
  14490. Possible values are:
  14491. @table @var
  14492. @item input
  14493. @item left
  14494. @item center
  14495. @item topleft
  14496. @item top
  14497. @item bottomleft
  14498. @item bottom
  14499. @end table
  14500. @item chromalin, cin
  14501. Set the input chroma location.
  14502. Possible values are:
  14503. @table @var
  14504. @item input
  14505. @item left
  14506. @item center
  14507. @item topleft
  14508. @item top
  14509. @item bottomleft
  14510. @item bottom
  14511. @end table
  14512. @item npl
  14513. Set the nominal peak luminance.
  14514. @end table
  14515. The values of the @option{w} and @option{h} options are expressions
  14516. containing the following constants:
  14517. @table @var
  14518. @item in_w
  14519. @item in_h
  14520. The input width and height
  14521. @item iw
  14522. @item ih
  14523. These are the same as @var{in_w} and @var{in_h}.
  14524. @item out_w
  14525. @item out_h
  14526. The output (scaled) width and height
  14527. @item ow
  14528. @item oh
  14529. These are the same as @var{out_w} and @var{out_h}
  14530. @item a
  14531. The same as @var{iw} / @var{ih}
  14532. @item sar
  14533. input sample aspect ratio
  14534. @item dar
  14535. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14536. @item hsub
  14537. @item vsub
  14538. horizontal and vertical input chroma subsample values. For example for the
  14539. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14540. @item ohsub
  14541. @item ovsub
  14542. horizontal and vertical output chroma subsample values. For example for the
  14543. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14544. @end table
  14545. @table @option
  14546. @end table
  14547. @c man end VIDEO FILTERS
  14548. @chapter OpenCL Video Filters
  14549. @c man begin OPENCL VIDEO FILTERS
  14550. Below is a description of the currently available OpenCL video filters.
  14551. To enable compilation of these filters you need to configure FFmpeg with
  14552. @code{--enable-opencl}.
  14553. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14554. @table @option
  14555. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14556. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14557. given device parameters.
  14558. @item -filter_hw_device @var{name}
  14559. Pass the hardware device called @var{name} to all filters in any filter graph.
  14560. @end table
  14561. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14562. @itemize
  14563. @item
  14564. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14565. @example
  14566. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14567. @end example
  14568. @end itemize
  14569. 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.
  14570. @section avgblur_opencl
  14571. Apply average blur filter.
  14572. The filter accepts the following options:
  14573. @table @option
  14574. @item sizeX
  14575. Set horizontal radius size.
  14576. Range is @code{[1, 1024]} and default value is @code{1}.
  14577. @item planes
  14578. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14579. @item sizeY
  14580. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14581. @end table
  14582. @subsection Example
  14583. @itemize
  14584. @item
  14585. 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.
  14586. @example
  14587. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14588. @end example
  14589. @end itemize
  14590. @section boxblur_opencl
  14591. Apply a boxblur algorithm to the input video.
  14592. It accepts the following parameters:
  14593. @table @option
  14594. @item luma_radius, lr
  14595. @item luma_power, lp
  14596. @item chroma_radius, cr
  14597. @item chroma_power, cp
  14598. @item alpha_radius, ar
  14599. @item alpha_power, ap
  14600. @end table
  14601. A description of the accepted options follows.
  14602. @table @option
  14603. @item luma_radius, lr
  14604. @item chroma_radius, cr
  14605. @item alpha_radius, ar
  14606. Set an expression for the box radius in pixels used for blurring the
  14607. corresponding input plane.
  14608. The radius value must be a non-negative number, and must not be
  14609. greater than the value of the expression @code{min(w,h)/2} for the
  14610. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14611. planes.
  14612. Default value for @option{luma_radius} is "2". If not specified,
  14613. @option{chroma_radius} and @option{alpha_radius} default to the
  14614. corresponding value set for @option{luma_radius}.
  14615. The expressions can contain the following constants:
  14616. @table @option
  14617. @item w
  14618. @item h
  14619. The input width and height in pixels.
  14620. @item cw
  14621. @item ch
  14622. The input chroma image width and height in pixels.
  14623. @item hsub
  14624. @item vsub
  14625. The horizontal and vertical chroma subsample values. For example, for the
  14626. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14627. @end table
  14628. @item luma_power, lp
  14629. @item chroma_power, cp
  14630. @item alpha_power, ap
  14631. Specify how many times the boxblur filter is applied to the
  14632. corresponding plane.
  14633. Default value for @option{luma_power} is 2. If not specified,
  14634. @option{chroma_power} and @option{alpha_power} default to the
  14635. corresponding value set for @option{luma_power}.
  14636. A value of 0 will disable the effect.
  14637. @end table
  14638. @subsection Examples
  14639. 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.
  14640. @itemize
  14641. @item
  14642. Apply a boxblur filter with the luma, chroma, and alpha radius
  14643. 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.
  14644. @example
  14645. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14646. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14647. @end example
  14648. @item
  14649. 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.
  14650. For the luma plane, a 2x2 box radius will be run once.
  14651. For the chroma plane, a 4x4 box radius will be run 5 times.
  14652. For the alpha plane, a 3x3 box radius will be run 7 times.
  14653. @example
  14654. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14655. @end example
  14656. @end itemize
  14657. @section convolution_opencl
  14658. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14659. The filter accepts the following options:
  14660. @table @option
  14661. @item 0m
  14662. @item 1m
  14663. @item 2m
  14664. @item 3m
  14665. Set matrix for each plane.
  14666. Matrix is sequence of 9, 25 or 49 signed numbers.
  14667. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14668. @item 0rdiv
  14669. @item 1rdiv
  14670. @item 2rdiv
  14671. @item 3rdiv
  14672. Set multiplier for calculated value for each plane.
  14673. If unset or 0, it will be sum of all matrix elements.
  14674. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14675. @item 0bias
  14676. @item 1bias
  14677. @item 2bias
  14678. @item 3bias
  14679. Set bias for each plane. This value is added to the result of the multiplication.
  14680. Useful for making the overall image brighter or darker.
  14681. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14682. @end table
  14683. @subsection Examples
  14684. @itemize
  14685. @item
  14686. Apply sharpen:
  14687. @example
  14688. -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
  14689. @end example
  14690. @item
  14691. Apply blur:
  14692. @example
  14693. -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
  14694. @end example
  14695. @item
  14696. Apply edge enhance:
  14697. @example
  14698. -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
  14699. @end example
  14700. @item
  14701. Apply edge detect:
  14702. @example
  14703. -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
  14704. @end example
  14705. @item
  14706. Apply laplacian edge detector which includes diagonals:
  14707. @example
  14708. -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
  14709. @end example
  14710. @item
  14711. Apply emboss:
  14712. @example
  14713. -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
  14714. @end example
  14715. @end itemize
  14716. @section dilation_opencl
  14717. Apply dilation effect to the video.
  14718. This filter replaces the pixel by the local(3x3) maximum.
  14719. It accepts the following options:
  14720. @table @option
  14721. @item threshold0
  14722. @item threshold1
  14723. @item threshold2
  14724. @item threshold3
  14725. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14726. If @code{0}, plane will remain unchanged.
  14727. @item coordinates
  14728. Flag which specifies the pixel to refer to.
  14729. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14730. Flags to local 3x3 coordinates region centered on @code{x}:
  14731. 1 2 3
  14732. 4 x 5
  14733. 6 7 8
  14734. @end table
  14735. @subsection Example
  14736. @itemize
  14737. @item
  14738. 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.
  14739. @example
  14740. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14741. @end example
  14742. @end itemize
  14743. @section erosion_opencl
  14744. Apply erosion effect to the video.
  14745. This filter replaces the pixel by the local(3x3) minimum.
  14746. It accepts the following options:
  14747. @table @option
  14748. @item threshold0
  14749. @item threshold1
  14750. @item threshold2
  14751. @item threshold3
  14752. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14753. If @code{0}, plane will remain unchanged.
  14754. @item coordinates
  14755. Flag which specifies the pixel to refer to.
  14756. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14757. Flags to local 3x3 coordinates region centered on @code{x}:
  14758. 1 2 3
  14759. 4 x 5
  14760. 6 7 8
  14761. @end table
  14762. @subsection Example
  14763. @itemize
  14764. @item
  14765. 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.
  14766. @example
  14767. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14768. @end example
  14769. @end itemize
  14770. @section colorkey_opencl
  14771. RGB colorspace color keying.
  14772. The filter accepts the following options:
  14773. @table @option
  14774. @item color
  14775. The color which will be replaced with transparency.
  14776. @item similarity
  14777. Similarity percentage with the key color.
  14778. 0.01 matches only the exact key color, while 1.0 matches everything.
  14779. @item blend
  14780. Blend percentage.
  14781. 0.0 makes pixels either fully transparent, or not transparent at all.
  14782. Higher values result in semi-transparent pixels, with a higher transparency
  14783. the more similar the pixels color is to the key color.
  14784. @end table
  14785. @subsection Examples
  14786. @itemize
  14787. @item
  14788. Make every semi-green pixel in the input transparent with some slight blending:
  14789. @example
  14790. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14791. @end example
  14792. @end itemize
  14793. @section nlmeans_opencl
  14794. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14795. @section overlay_opencl
  14796. Overlay one video on top of another.
  14797. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14798. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14799. The filter accepts the following options:
  14800. @table @option
  14801. @item x
  14802. Set the x coordinate of the overlaid video on the main video.
  14803. Default value is @code{0}.
  14804. @item y
  14805. Set the x coordinate of the overlaid video on the main video.
  14806. Default value is @code{0}.
  14807. @end table
  14808. @subsection Examples
  14809. @itemize
  14810. @item
  14811. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14812. @example
  14813. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14814. @end example
  14815. @item
  14816. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14817. @example
  14818. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14819. @end example
  14820. @end itemize
  14821. @section prewitt_opencl
  14822. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14823. The filter accepts the following option:
  14824. @table @option
  14825. @item planes
  14826. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14827. @item scale
  14828. Set value which will be multiplied with filtered result.
  14829. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14830. @item delta
  14831. Set value which will be added to filtered result.
  14832. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14833. @end table
  14834. @subsection Example
  14835. @itemize
  14836. @item
  14837. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14838. @example
  14839. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14840. @end example
  14841. @end itemize
  14842. @section roberts_opencl
  14843. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14844. The filter accepts the following option:
  14845. @table @option
  14846. @item planes
  14847. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14848. @item scale
  14849. Set value which will be multiplied with filtered result.
  14850. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14851. @item delta
  14852. Set value which will be added to filtered result.
  14853. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14854. @end table
  14855. @subsection Example
  14856. @itemize
  14857. @item
  14858. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14859. @example
  14860. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14861. @end example
  14862. @end itemize
  14863. @section sobel_opencl
  14864. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14865. The filter accepts the following option:
  14866. @table @option
  14867. @item planes
  14868. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14869. @item scale
  14870. Set value which will be multiplied with filtered result.
  14871. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14872. @item delta
  14873. Set value which will be added to filtered result.
  14874. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14875. @end table
  14876. @subsection Example
  14877. @itemize
  14878. @item
  14879. Apply sobel operator with scale set to 2 and delta set to 10
  14880. @example
  14881. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14882. @end example
  14883. @end itemize
  14884. @section tonemap_opencl
  14885. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14886. It accepts the following parameters:
  14887. @table @option
  14888. @item tonemap
  14889. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14890. @item param
  14891. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14892. @item desat
  14893. Apply desaturation for highlights that exceed this level of brightness. The
  14894. higher the parameter, the more color information will be preserved. This
  14895. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14896. (smoothly) turning into white instead. This makes images feel more natural,
  14897. at the cost of reducing information about out-of-range colors.
  14898. The default value is 0.5, and the algorithm here is a little different from
  14899. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14900. @item threshold
  14901. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14902. is used to detect whether the scene has changed or not. If the distance between
  14903. the current frame average brightness and the current running average exceeds
  14904. a threshold value, we would re-calculate scene average and peak brightness.
  14905. The default value is 0.2.
  14906. @item format
  14907. Specify the output pixel format.
  14908. Currently supported formats are:
  14909. @table @var
  14910. @item p010
  14911. @item nv12
  14912. @end table
  14913. @item range, r
  14914. Set the output color range.
  14915. Possible values are:
  14916. @table @var
  14917. @item tv/mpeg
  14918. @item pc/jpeg
  14919. @end table
  14920. Default is same as input.
  14921. @item primaries, p
  14922. Set the output color primaries.
  14923. Possible values are:
  14924. @table @var
  14925. @item bt709
  14926. @item bt2020
  14927. @end table
  14928. Default is same as input.
  14929. @item transfer, t
  14930. Set the output transfer characteristics.
  14931. Possible values are:
  14932. @table @var
  14933. @item bt709
  14934. @item bt2020
  14935. @end table
  14936. Default is bt709.
  14937. @item matrix, m
  14938. Set the output colorspace matrix.
  14939. Possible value are:
  14940. @table @var
  14941. @item bt709
  14942. @item bt2020
  14943. @end table
  14944. Default is same as input.
  14945. @end table
  14946. @subsection Example
  14947. @itemize
  14948. @item
  14949. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14950. @example
  14951. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14952. @end example
  14953. @end itemize
  14954. @section unsharp_opencl
  14955. Sharpen or blur the input video.
  14956. It accepts the following parameters:
  14957. @table @option
  14958. @item luma_msize_x, lx
  14959. Set the luma matrix horizontal size.
  14960. Range is @code{[1, 23]} and default value is @code{5}.
  14961. @item luma_msize_y, ly
  14962. Set the luma matrix vertical size.
  14963. Range is @code{[1, 23]} and default value is @code{5}.
  14964. @item luma_amount, la
  14965. Set the luma effect strength.
  14966. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14967. Negative values will blur the input video, while positive values will
  14968. sharpen it, a value of zero will disable the effect.
  14969. @item chroma_msize_x, cx
  14970. Set the chroma matrix horizontal size.
  14971. Range is @code{[1, 23]} and default value is @code{5}.
  14972. @item chroma_msize_y, cy
  14973. Set the chroma matrix vertical size.
  14974. Range is @code{[1, 23]} and default value is @code{5}.
  14975. @item chroma_amount, ca
  14976. Set the chroma effect strength.
  14977. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14978. Negative values will blur the input video, while positive values will
  14979. sharpen it, a value of zero will disable the effect.
  14980. @end table
  14981. All parameters are optional and default to the equivalent of the
  14982. string '5:5:1.0:5:5:0.0'.
  14983. @subsection Examples
  14984. @itemize
  14985. @item
  14986. Apply strong luma sharpen effect:
  14987. @example
  14988. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14989. @end example
  14990. @item
  14991. Apply a strong blur of both luma and chroma parameters:
  14992. @example
  14993. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14994. @end example
  14995. @end itemize
  14996. @c man end OPENCL VIDEO FILTERS
  14997. @chapter Video Sources
  14998. @c man begin VIDEO SOURCES
  14999. Below is a description of the currently available video sources.
  15000. @section buffer
  15001. Buffer video frames, and make them available to the filter chain.
  15002. This source is mainly intended for a programmatic use, in particular
  15003. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15004. It accepts the following parameters:
  15005. @table @option
  15006. @item video_size
  15007. Specify the size (width and height) of the buffered video frames. For the
  15008. syntax of this option, check the
  15009. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15010. @item width
  15011. The input video width.
  15012. @item height
  15013. The input video height.
  15014. @item pix_fmt
  15015. A string representing the pixel format of the buffered video frames.
  15016. It may be a number corresponding to a pixel format, or a pixel format
  15017. name.
  15018. @item time_base
  15019. Specify the timebase assumed by the timestamps of the buffered frames.
  15020. @item frame_rate
  15021. Specify the frame rate expected for the video stream.
  15022. @item pixel_aspect, sar
  15023. The sample (pixel) aspect ratio of the input video.
  15024. @item sws_param
  15025. Specify the optional parameters to be used for the scale filter which
  15026. is automatically inserted when an input change is detected in the
  15027. input size or format.
  15028. @item hw_frames_ctx
  15029. When using a hardware pixel format, this should be a reference to an
  15030. AVHWFramesContext describing input frames.
  15031. @end table
  15032. For example:
  15033. @example
  15034. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15035. @end example
  15036. will instruct the source to accept video frames with size 320x240 and
  15037. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15038. square pixels (1:1 sample aspect ratio).
  15039. Since the pixel format with name "yuv410p" corresponds to the number 6
  15040. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15041. this example corresponds to:
  15042. @example
  15043. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15044. @end example
  15045. Alternatively, the options can be specified as a flat string, but this
  15046. syntax is deprecated:
  15047. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15048. @section cellauto
  15049. Create a pattern generated by an elementary cellular automaton.
  15050. The initial state of the cellular automaton can be defined through the
  15051. @option{filename} and @option{pattern} options. If such options are
  15052. not specified an initial state is created randomly.
  15053. At each new frame a new row in the video is filled with the result of
  15054. the cellular automaton next generation. The behavior when the whole
  15055. frame is filled is defined by the @option{scroll} option.
  15056. This source accepts the following options:
  15057. @table @option
  15058. @item filename, f
  15059. Read the initial cellular automaton state, i.e. the starting row, from
  15060. the specified file.
  15061. In the file, each non-whitespace character is considered an alive
  15062. cell, a newline will terminate the row, and further characters in the
  15063. file will be ignored.
  15064. @item pattern, p
  15065. Read the initial cellular automaton state, i.e. the starting row, from
  15066. the specified string.
  15067. Each non-whitespace character in the string is considered an alive
  15068. cell, a newline will terminate the row, and further characters in the
  15069. string will be ignored.
  15070. @item rate, r
  15071. Set the video rate, that is the number of frames generated per second.
  15072. Default is 25.
  15073. @item random_fill_ratio, ratio
  15074. Set the random fill ratio for the initial cellular automaton row. It
  15075. is a floating point number value ranging from 0 to 1, defaults to
  15076. 1/PHI.
  15077. This option is ignored when a file or a pattern is specified.
  15078. @item random_seed, seed
  15079. Set the seed for filling randomly the initial row, must be an integer
  15080. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15081. set to -1, the filter will try to use a good random seed on a best
  15082. effort basis.
  15083. @item rule
  15084. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15085. Default value is 110.
  15086. @item size, s
  15087. Set the size of the output video. For the syntax of this option, check the
  15088. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15089. If @option{filename} or @option{pattern} is specified, the size is set
  15090. by default to the width of the specified initial state row, and the
  15091. height is set to @var{width} * PHI.
  15092. If @option{size} is set, it must contain the width of the specified
  15093. pattern string, and the specified pattern will be centered in the
  15094. larger row.
  15095. If a filename or a pattern string is not specified, the size value
  15096. defaults to "320x518" (used for a randomly generated initial state).
  15097. @item scroll
  15098. If set to 1, scroll the output upward when all the rows in the output
  15099. have been already filled. If set to 0, the new generated row will be
  15100. written over the top row just after the bottom row is filled.
  15101. Defaults to 1.
  15102. @item start_full, full
  15103. If set to 1, completely fill the output with generated rows before
  15104. outputting the first frame.
  15105. This is the default behavior, for disabling set the value to 0.
  15106. @item stitch
  15107. If set to 1, stitch the left and right row edges together.
  15108. This is the default behavior, for disabling set the value to 0.
  15109. @end table
  15110. @subsection Examples
  15111. @itemize
  15112. @item
  15113. Read the initial state from @file{pattern}, and specify an output of
  15114. size 200x400.
  15115. @example
  15116. cellauto=f=pattern:s=200x400
  15117. @end example
  15118. @item
  15119. Generate a random initial row with a width of 200 cells, with a fill
  15120. ratio of 2/3:
  15121. @example
  15122. cellauto=ratio=2/3:s=200x200
  15123. @end example
  15124. @item
  15125. Create a pattern generated by rule 18 starting by a single alive cell
  15126. centered on an initial row with width 100:
  15127. @example
  15128. cellauto=p=@@:s=100x400:full=0:rule=18
  15129. @end example
  15130. @item
  15131. Specify a more elaborated initial pattern:
  15132. @example
  15133. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15134. @end example
  15135. @end itemize
  15136. @anchor{coreimagesrc}
  15137. @section coreimagesrc
  15138. Video source generated on GPU using Apple's CoreImage API on OSX.
  15139. This video source is a specialized version of the @ref{coreimage} video filter.
  15140. Use a core image generator at the beginning of the applied filterchain to
  15141. generate the content.
  15142. The coreimagesrc video source accepts the following options:
  15143. @table @option
  15144. @item list_generators
  15145. List all available generators along with all their respective options as well as
  15146. possible minimum and maximum values along with the default values.
  15147. @example
  15148. list_generators=true
  15149. @end example
  15150. @item size, s
  15151. Specify the size of the sourced video. For the syntax of this option, check the
  15152. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15153. The default value is @code{320x240}.
  15154. @item rate, r
  15155. Specify the frame rate of the sourced video, as the number of frames
  15156. generated per second. It has to be a string in the format
  15157. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15158. number or a valid video frame rate abbreviation. The default value is
  15159. "25".
  15160. @item sar
  15161. Set the sample aspect ratio of the sourced video.
  15162. @item duration, d
  15163. Set the duration of the sourced video. See
  15164. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15165. for the accepted syntax.
  15166. If not specified, or the expressed duration is negative, the video is
  15167. supposed to be generated forever.
  15168. @end table
  15169. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15170. A complete filterchain can be used for further processing of the
  15171. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15172. and examples for details.
  15173. @subsection Examples
  15174. @itemize
  15175. @item
  15176. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15177. given as complete and escaped command-line for Apple's standard bash shell:
  15178. @example
  15179. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15180. @end example
  15181. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15182. need for a nullsrc video source.
  15183. @end itemize
  15184. @section mandelbrot
  15185. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15186. point specified with @var{start_x} and @var{start_y}.
  15187. This source accepts the following options:
  15188. @table @option
  15189. @item end_pts
  15190. Set the terminal pts value. Default value is 400.
  15191. @item end_scale
  15192. Set the terminal scale value.
  15193. Must be a floating point value. Default value is 0.3.
  15194. @item inner
  15195. Set the inner coloring mode, that is the algorithm used to draw the
  15196. Mandelbrot fractal internal region.
  15197. It shall assume one of the following values:
  15198. @table @option
  15199. @item black
  15200. Set black mode.
  15201. @item convergence
  15202. Show time until convergence.
  15203. @item mincol
  15204. Set color based on point closest to the origin of the iterations.
  15205. @item period
  15206. Set period mode.
  15207. @end table
  15208. Default value is @var{mincol}.
  15209. @item bailout
  15210. Set the bailout value. Default value is 10.0.
  15211. @item maxiter
  15212. Set the maximum of iterations performed by the rendering
  15213. algorithm. Default value is 7189.
  15214. @item outer
  15215. Set outer coloring mode.
  15216. It shall assume one of following values:
  15217. @table @option
  15218. @item iteration_count
  15219. Set iteration count mode.
  15220. @item normalized_iteration_count
  15221. set normalized iteration count mode.
  15222. @end table
  15223. Default value is @var{normalized_iteration_count}.
  15224. @item rate, r
  15225. Set frame rate, expressed as number of frames per second. Default
  15226. value is "25".
  15227. @item size, s
  15228. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15229. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15230. @item start_scale
  15231. Set the initial scale value. Default value is 3.0.
  15232. @item start_x
  15233. Set the initial x position. Must be a floating point value between
  15234. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15235. @item start_y
  15236. Set the initial y position. Must be a floating point value between
  15237. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15238. @end table
  15239. @section mptestsrc
  15240. Generate various test patterns, as generated by the MPlayer test filter.
  15241. The size of the generated video is fixed, and is 256x256.
  15242. This source is useful in particular for testing encoding features.
  15243. This source accepts the following options:
  15244. @table @option
  15245. @item rate, r
  15246. Specify the frame rate of the sourced video, as the number of frames
  15247. generated per second. It has to be a string in the format
  15248. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15249. number or a valid video frame rate abbreviation. The default value is
  15250. "25".
  15251. @item duration, d
  15252. Set the duration of the sourced video. See
  15253. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15254. for the accepted syntax.
  15255. If not specified, or the expressed duration is negative, the video is
  15256. supposed to be generated forever.
  15257. @item test, t
  15258. Set the number or the name of the test to perform. Supported tests are:
  15259. @table @option
  15260. @item dc_luma
  15261. @item dc_chroma
  15262. @item freq_luma
  15263. @item freq_chroma
  15264. @item amp_luma
  15265. @item amp_chroma
  15266. @item cbp
  15267. @item mv
  15268. @item ring1
  15269. @item ring2
  15270. @item all
  15271. @end table
  15272. Default value is "all", which will cycle through the list of all tests.
  15273. @end table
  15274. Some examples:
  15275. @example
  15276. mptestsrc=t=dc_luma
  15277. @end example
  15278. will generate a "dc_luma" test pattern.
  15279. @section frei0r_src
  15280. Provide a frei0r source.
  15281. To enable compilation of this filter you need to install the frei0r
  15282. header and configure FFmpeg with @code{--enable-frei0r}.
  15283. This source accepts the following parameters:
  15284. @table @option
  15285. @item size
  15286. The size of the video to generate. For the syntax of this option, check the
  15287. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15288. @item framerate
  15289. The framerate of the generated video. It may be a string of the form
  15290. @var{num}/@var{den} or a frame rate abbreviation.
  15291. @item filter_name
  15292. The name to the frei0r source to load. For more information regarding frei0r and
  15293. how to set the parameters, read the @ref{frei0r} section in the video filters
  15294. documentation.
  15295. @item filter_params
  15296. A '|'-separated list of parameters to pass to the frei0r source.
  15297. @end table
  15298. For example, to generate a frei0r partik0l source with size 200x200
  15299. and frame rate 10 which is overlaid on the overlay filter main input:
  15300. @example
  15301. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15302. @end example
  15303. @section life
  15304. Generate a life pattern.
  15305. This source is based on a generalization of John Conway's life game.
  15306. The sourced input represents a life grid, each pixel represents a cell
  15307. which can be in one of two possible states, alive or dead. Every cell
  15308. interacts with its eight neighbours, which are the cells that are
  15309. horizontally, vertically, or diagonally adjacent.
  15310. At each interaction the grid evolves according to the adopted rule,
  15311. which specifies the number of neighbor alive cells which will make a
  15312. cell stay alive or born. The @option{rule} option allows one to specify
  15313. the rule to adopt.
  15314. This source accepts the following options:
  15315. @table @option
  15316. @item filename, f
  15317. Set the file from which to read the initial grid state. In the file,
  15318. each non-whitespace character is considered an alive cell, and newline
  15319. is used to delimit the end of each row.
  15320. If this option is not specified, the initial grid is generated
  15321. randomly.
  15322. @item rate, r
  15323. Set the video rate, that is the number of frames generated per second.
  15324. Default is 25.
  15325. @item random_fill_ratio, ratio
  15326. Set the random fill ratio for the initial random grid. It is a
  15327. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15328. It is ignored when a file is specified.
  15329. @item random_seed, seed
  15330. Set the seed for filling the initial random grid, must be an integer
  15331. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15332. set to -1, the filter will try to use a good random seed on a best
  15333. effort basis.
  15334. @item rule
  15335. Set the life rule.
  15336. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15337. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15338. @var{NS} specifies the number of alive neighbor cells which make a
  15339. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15340. which make a dead cell to become alive (i.e. to "born").
  15341. "s" and "b" can be used in place of "S" and "B", respectively.
  15342. Alternatively a rule can be specified by an 18-bits integer. The 9
  15343. high order bits are used to encode the next cell state if it is alive
  15344. for each number of neighbor alive cells, the low order bits specify
  15345. the rule for "borning" new cells. Higher order bits encode for an
  15346. higher number of neighbor cells.
  15347. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15348. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15349. Default value is "S23/B3", which is the original Conway's game of life
  15350. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15351. cells, and will born a new cell if there are three alive cells around
  15352. a dead cell.
  15353. @item size, s
  15354. Set the size of the output video. For the syntax of this option, check the
  15355. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15356. If @option{filename} is specified, the size is set by default to the
  15357. same size of the input file. If @option{size} is set, it must contain
  15358. the size specified in the input file, and the initial grid defined in
  15359. that file is centered in the larger resulting area.
  15360. If a filename is not specified, the size value defaults to "320x240"
  15361. (used for a randomly generated initial grid).
  15362. @item stitch
  15363. If set to 1, stitch the left and right grid edges together, and the
  15364. top and bottom edges also. Defaults to 1.
  15365. @item mold
  15366. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15367. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15368. value from 0 to 255.
  15369. @item life_color
  15370. Set the color of living (or new born) cells.
  15371. @item death_color
  15372. Set the color of dead cells. If @option{mold} is set, this is the first color
  15373. used to represent a dead cell.
  15374. @item mold_color
  15375. Set mold color, for definitely dead and moldy cells.
  15376. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15377. ffmpeg-utils manual,ffmpeg-utils}.
  15378. @end table
  15379. @subsection Examples
  15380. @itemize
  15381. @item
  15382. Read a grid from @file{pattern}, and center it on a grid of size
  15383. 300x300 pixels:
  15384. @example
  15385. life=f=pattern:s=300x300
  15386. @end example
  15387. @item
  15388. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15389. @example
  15390. life=ratio=2/3:s=200x200
  15391. @end example
  15392. @item
  15393. Specify a custom rule for evolving a randomly generated grid:
  15394. @example
  15395. life=rule=S14/B34
  15396. @end example
  15397. @item
  15398. Full example with slow death effect (mold) using @command{ffplay}:
  15399. @example
  15400. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15401. @end example
  15402. @end itemize
  15403. @anchor{allrgb}
  15404. @anchor{allyuv}
  15405. @anchor{color}
  15406. @anchor{haldclutsrc}
  15407. @anchor{nullsrc}
  15408. @anchor{pal75bars}
  15409. @anchor{pal100bars}
  15410. @anchor{rgbtestsrc}
  15411. @anchor{smptebars}
  15412. @anchor{smptehdbars}
  15413. @anchor{testsrc}
  15414. @anchor{testsrc2}
  15415. @anchor{yuvtestsrc}
  15416. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15417. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15418. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15419. The @code{color} source provides an uniformly colored input.
  15420. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15421. @ref{haldclut} filter.
  15422. The @code{nullsrc} source returns unprocessed video frames. It is
  15423. mainly useful to be employed in analysis / debugging tools, or as the
  15424. source for filters which ignore the input data.
  15425. The @code{pal75bars} source generates a color bars pattern, based on
  15426. EBU PAL recommendations with 75% color levels.
  15427. The @code{pal100bars} source generates a color bars pattern, based on
  15428. EBU PAL recommendations with 100% color levels.
  15429. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15430. detecting RGB vs BGR issues. You should see a red, green and blue
  15431. stripe from top to bottom.
  15432. The @code{smptebars} source generates a color bars pattern, based on
  15433. the SMPTE Engineering Guideline EG 1-1990.
  15434. The @code{smptehdbars} source generates a color bars pattern, based on
  15435. the SMPTE RP 219-2002.
  15436. The @code{testsrc} source generates a test video pattern, showing a
  15437. color pattern, a scrolling gradient and a timestamp. This is mainly
  15438. intended for testing purposes.
  15439. The @code{testsrc2} source is similar to testsrc, but supports more
  15440. pixel formats instead of just @code{rgb24}. This allows using it as an
  15441. input for other tests without requiring a format conversion.
  15442. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15443. see a y, cb and cr stripe from top to bottom.
  15444. The sources accept the following parameters:
  15445. @table @option
  15446. @item level
  15447. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15448. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15449. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15450. coded on a @code{1/(N*N)} scale.
  15451. @item color, c
  15452. Specify the color of the source, only available in the @code{color}
  15453. source. For the syntax of this option, check the
  15454. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15455. @item size, s
  15456. Specify the size of the sourced video. For the syntax of this option, check the
  15457. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15458. The default value is @code{320x240}.
  15459. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15460. @code{haldclutsrc} filters.
  15461. @item rate, r
  15462. Specify the frame rate of the sourced video, as the number of frames
  15463. generated per second. It has to be a string in the format
  15464. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15465. number or a valid video frame rate abbreviation. The default value is
  15466. "25".
  15467. @item duration, d
  15468. Set the duration of the sourced video. See
  15469. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15470. for the accepted syntax.
  15471. If not specified, or the expressed duration is negative, the video is
  15472. supposed to be generated forever.
  15473. @item sar
  15474. Set the sample aspect ratio of the sourced video.
  15475. @item alpha
  15476. Specify the alpha (opacity) of the background, only available in the
  15477. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15478. 255 (fully opaque, the default).
  15479. @item decimals, n
  15480. Set the number of decimals to show in the timestamp, only available in the
  15481. @code{testsrc} source.
  15482. The displayed timestamp value will correspond to the original
  15483. timestamp value multiplied by the power of 10 of the specified
  15484. value. Default value is 0.
  15485. @end table
  15486. @subsection Examples
  15487. @itemize
  15488. @item
  15489. Generate a video with a duration of 5.3 seconds, with size
  15490. 176x144 and a frame rate of 10 frames per second:
  15491. @example
  15492. testsrc=duration=5.3:size=qcif:rate=10
  15493. @end example
  15494. @item
  15495. The following graph description will generate a red source
  15496. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15497. frames per second:
  15498. @example
  15499. color=c=red@@0.2:s=qcif:r=10
  15500. @end example
  15501. @item
  15502. If the input content is to be ignored, @code{nullsrc} can be used. The
  15503. following command generates noise in the luminance plane by employing
  15504. the @code{geq} filter:
  15505. @example
  15506. nullsrc=s=256x256, geq=random(1)*255:128:128
  15507. @end example
  15508. @end itemize
  15509. @subsection Commands
  15510. The @code{color} source supports the following commands:
  15511. @table @option
  15512. @item c, color
  15513. Set the color of the created image. Accepts the same syntax of the
  15514. corresponding @option{color} option.
  15515. @end table
  15516. @section openclsrc
  15517. Generate video using an OpenCL program.
  15518. @table @option
  15519. @item source
  15520. OpenCL program source file.
  15521. @item kernel
  15522. Kernel name in program.
  15523. @item size, s
  15524. Size of frames to generate. This must be set.
  15525. @item format
  15526. Pixel format to use for the generated frames. This must be set.
  15527. @item rate, r
  15528. Number of frames generated every second. Default value is '25'.
  15529. @end table
  15530. For details of how the program loading works, see the @ref{program_opencl}
  15531. filter.
  15532. Example programs:
  15533. @itemize
  15534. @item
  15535. Generate a colour ramp by setting pixel values from the position of the pixel
  15536. in the output image. (Note that this will work with all pixel formats, but
  15537. the generated output will not be the same.)
  15538. @verbatim
  15539. __kernel void ramp(__write_only image2d_t dst,
  15540. unsigned int index)
  15541. {
  15542. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15543. float4 val;
  15544. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15545. write_imagef(dst, loc, val);
  15546. }
  15547. @end verbatim
  15548. @item
  15549. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15550. @verbatim
  15551. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15552. unsigned int index)
  15553. {
  15554. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15555. float4 value = 0.0f;
  15556. int x = loc.x + index;
  15557. int y = loc.y + index;
  15558. while (x > 0 || y > 0) {
  15559. if (x % 3 == 1 && y % 3 == 1) {
  15560. value = 1.0f;
  15561. break;
  15562. }
  15563. x /= 3;
  15564. y /= 3;
  15565. }
  15566. write_imagef(dst, loc, value);
  15567. }
  15568. @end verbatim
  15569. @end itemize
  15570. @c man end VIDEO SOURCES
  15571. @chapter Video Sinks
  15572. @c man begin VIDEO SINKS
  15573. Below is a description of the currently available video sinks.
  15574. @section buffersink
  15575. Buffer video frames, and make them available to the end of the filter
  15576. graph.
  15577. This sink is mainly intended for programmatic use, in particular
  15578. through the interface defined in @file{libavfilter/buffersink.h}
  15579. or the options system.
  15580. It accepts a pointer to an AVBufferSinkContext structure, which
  15581. defines the incoming buffers' formats, to be passed as the opaque
  15582. parameter to @code{avfilter_init_filter} for initialization.
  15583. @section nullsink
  15584. Null video sink: do absolutely nothing with the input video. It is
  15585. mainly useful as a template and for use in analysis / debugging
  15586. tools.
  15587. @c man end VIDEO SINKS
  15588. @chapter Multimedia Filters
  15589. @c man begin MULTIMEDIA FILTERS
  15590. Below is a description of the currently available multimedia filters.
  15591. @section abitscope
  15592. Convert input audio to a video output, displaying the audio bit scope.
  15593. The filter accepts the following options:
  15594. @table @option
  15595. @item rate, r
  15596. Set frame rate, expressed as number of frames per second. Default
  15597. value is "25".
  15598. @item size, s
  15599. Specify the video size for the output. For the syntax of this option, check the
  15600. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15601. Default value is @code{1024x256}.
  15602. @item colors
  15603. Specify list of colors separated by space or by '|' which will be used to
  15604. draw channels. Unrecognized or missing colors will be replaced
  15605. by white color.
  15606. @end table
  15607. @section ahistogram
  15608. Convert input audio to a video output, displaying the volume histogram.
  15609. The filter accepts the following options:
  15610. @table @option
  15611. @item dmode
  15612. Specify how histogram is calculated.
  15613. It accepts the following values:
  15614. @table @samp
  15615. @item single
  15616. Use single histogram for all channels.
  15617. @item separate
  15618. Use separate histogram for each channel.
  15619. @end table
  15620. Default is @code{single}.
  15621. @item rate, r
  15622. Set frame rate, expressed as number of frames per second. Default
  15623. value is "25".
  15624. @item size, s
  15625. Specify the video size for the output. For the syntax of this option, check the
  15626. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15627. Default value is @code{hd720}.
  15628. @item scale
  15629. Set display scale.
  15630. It accepts the following values:
  15631. @table @samp
  15632. @item log
  15633. logarithmic
  15634. @item sqrt
  15635. square root
  15636. @item cbrt
  15637. cubic root
  15638. @item lin
  15639. linear
  15640. @item rlog
  15641. reverse logarithmic
  15642. @end table
  15643. Default is @code{log}.
  15644. @item ascale
  15645. Set amplitude scale.
  15646. It accepts the following values:
  15647. @table @samp
  15648. @item log
  15649. logarithmic
  15650. @item lin
  15651. linear
  15652. @end table
  15653. Default is @code{log}.
  15654. @item acount
  15655. Set how much frames to accumulate in histogram.
  15656. Default is 1. Setting this to -1 accumulates all frames.
  15657. @item rheight
  15658. Set histogram ratio of window height.
  15659. @item slide
  15660. Set sonogram sliding.
  15661. It accepts the following values:
  15662. @table @samp
  15663. @item replace
  15664. replace old rows with new ones.
  15665. @item scroll
  15666. scroll from top to bottom.
  15667. @end table
  15668. Default is @code{replace}.
  15669. @end table
  15670. @section aphasemeter
  15671. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15672. representing mean phase of current audio frame. A video output can also be produced and is
  15673. enabled by default. The audio is passed through as first output.
  15674. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15675. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15676. and @code{1} means channels are in phase.
  15677. The filter accepts the following options, all related to its video output:
  15678. @table @option
  15679. @item rate, r
  15680. Set the output frame rate. Default value is @code{25}.
  15681. @item size, s
  15682. Set the video size for the output. For the syntax of this option, check the
  15683. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15684. Default value is @code{800x400}.
  15685. @item rc
  15686. @item gc
  15687. @item bc
  15688. Specify the red, green, blue contrast. Default values are @code{2},
  15689. @code{7} and @code{1}.
  15690. Allowed range is @code{[0, 255]}.
  15691. @item mpc
  15692. Set color which will be used for drawing median phase. If color is
  15693. @code{none} which is default, no median phase value will be drawn.
  15694. @item video
  15695. Enable video output. Default is enabled.
  15696. @end table
  15697. @section avectorscope
  15698. Convert input audio to a video output, representing the audio vector
  15699. scope.
  15700. The filter is used to measure the difference between channels of stereo
  15701. audio stream. A monoaural signal, consisting of identical left and right
  15702. signal, results in straight vertical line. Any stereo separation is visible
  15703. as a deviation from this line, creating a Lissajous figure.
  15704. If the straight (or deviation from it) but horizontal line appears this
  15705. indicates that the left and right channels are out of phase.
  15706. The filter accepts the following options:
  15707. @table @option
  15708. @item mode, m
  15709. Set the vectorscope mode.
  15710. Available values are:
  15711. @table @samp
  15712. @item lissajous
  15713. Lissajous rotated by 45 degrees.
  15714. @item lissajous_xy
  15715. Same as above but not rotated.
  15716. @item polar
  15717. Shape resembling half of circle.
  15718. @end table
  15719. Default value is @samp{lissajous}.
  15720. @item size, s
  15721. Set the video size for the output. For the syntax of this option, check the
  15722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15723. Default value is @code{400x400}.
  15724. @item rate, r
  15725. Set the output frame rate. Default value is @code{25}.
  15726. @item rc
  15727. @item gc
  15728. @item bc
  15729. @item ac
  15730. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15731. @code{160}, @code{80} and @code{255}.
  15732. Allowed range is @code{[0, 255]}.
  15733. @item rf
  15734. @item gf
  15735. @item bf
  15736. @item af
  15737. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15738. @code{10}, @code{5} and @code{5}.
  15739. Allowed range is @code{[0, 255]}.
  15740. @item zoom
  15741. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15742. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15743. @item draw
  15744. Set the vectorscope drawing mode.
  15745. Available values are:
  15746. @table @samp
  15747. @item dot
  15748. Draw dot for each sample.
  15749. @item line
  15750. Draw line between previous and current sample.
  15751. @end table
  15752. Default value is @samp{dot}.
  15753. @item scale
  15754. Specify amplitude scale of audio samples.
  15755. Available values are:
  15756. @table @samp
  15757. @item lin
  15758. Linear.
  15759. @item sqrt
  15760. Square root.
  15761. @item cbrt
  15762. Cubic root.
  15763. @item log
  15764. Logarithmic.
  15765. @end table
  15766. @item swap
  15767. Swap left channel axis with right channel axis.
  15768. @item mirror
  15769. Mirror axis.
  15770. @table @samp
  15771. @item none
  15772. No mirror.
  15773. @item x
  15774. Mirror only x axis.
  15775. @item y
  15776. Mirror only y axis.
  15777. @item xy
  15778. Mirror both axis.
  15779. @end table
  15780. @end table
  15781. @subsection Examples
  15782. @itemize
  15783. @item
  15784. Complete example using @command{ffplay}:
  15785. @example
  15786. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15787. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15788. @end example
  15789. @end itemize
  15790. @section bench, abench
  15791. Benchmark part of a filtergraph.
  15792. The filter accepts the following options:
  15793. @table @option
  15794. @item action
  15795. Start or stop a timer.
  15796. Available values are:
  15797. @table @samp
  15798. @item start
  15799. Get the current time, set it as frame metadata (using the key
  15800. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15801. @item stop
  15802. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15803. the input frame metadata to get the time difference. Time difference, average,
  15804. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15805. @code{min}) are then printed. The timestamps are expressed in seconds.
  15806. @end table
  15807. @end table
  15808. @subsection Examples
  15809. @itemize
  15810. @item
  15811. Benchmark @ref{selectivecolor} filter:
  15812. @example
  15813. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15814. @end example
  15815. @end itemize
  15816. @section concat
  15817. Concatenate audio and video streams, joining them together one after the
  15818. other.
  15819. The filter works on segments of synchronized video and audio streams. All
  15820. segments must have the same number of streams of each type, and that will
  15821. also be the number of streams at output.
  15822. The filter accepts the following options:
  15823. @table @option
  15824. @item n
  15825. Set the number of segments. Default is 2.
  15826. @item v
  15827. Set the number of output video streams, that is also the number of video
  15828. streams in each segment. Default is 1.
  15829. @item a
  15830. Set the number of output audio streams, that is also the number of audio
  15831. streams in each segment. Default is 0.
  15832. @item unsafe
  15833. Activate unsafe mode: do not fail if segments have a different format.
  15834. @end table
  15835. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15836. @var{a} audio outputs.
  15837. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15838. segment, in the same order as the outputs, then the inputs for the second
  15839. segment, etc.
  15840. Related streams do not always have exactly the same duration, for various
  15841. reasons including codec frame size or sloppy authoring. For that reason,
  15842. related synchronized streams (e.g. a video and its audio track) should be
  15843. concatenated at once. The concat filter will use the duration of the longest
  15844. stream in each segment (except the last one), and if necessary pad shorter
  15845. audio streams with silence.
  15846. For this filter to work correctly, all segments must start at timestamp 0.
  15847. All corresponding streams must have the same parameters in all segments; the
  15848. filtering system will automatically select a common pixel format for video
  15849. streams, and a common sample format, sample rate and channel layout for
  15850. audio streams, but other settings, such as resolution, must be converted
  15851. explicitly by the user.
  15852. Different frame rates are acceptable but will result in variable frame rate
  15853. at output; be sure to configure the output file to handle it.
  15854. @subsection Examples
  15855. @itemize
  15856. @item
  15857. Concatenate an opening, an episode and an ending, all in bilingual version
  15858. (video in stream 0, audio in streams 1 and 2):
  15859. @example
  15860. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15861. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15862. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15863. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15864. @end example
  15865. @item
  15866. Concatenate two parts, handling audio and video separately, using the
  15867. (a)movie sources, and adjusting the resolution:
  15868. @example
  15869. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15870. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15871. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15872. @end example
  15873. Note that a desync will happen at the stitch if the audio and video streams
  15874. do not have exactly the same duration in the first file.
  15875. @end itemize
  15876. @subsection Commands
  15877. This filter supports the following commands:
  15878. @table @option
  15879. @item next
  15880. Close the current segment and step to the next one
  15881. @end table
  15882. @section drawgraph, adrawgraph
  15883. Draw a graph using input video or audio metadata.
  15884. It accepts the following parameters:
  15885. @table @option
  15886. @item m1
  15887. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15888. @item fg1
  15889. Set 1st foreground color expression.
  15890. @item m2
  15891. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15892. @item fg2
  15893. Set 2nd foreground color expression.
  15894. @item m3
  15895. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15896. @item fg3
  15897. Set 3rd foreground color expression.
  15898. @item m4
  15899. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15900. @item fg4
  15901. Set 4th foreground color expression.
  15902. @item min
  15903. Set minimal value of metadata value.
  15904. @item max
  15905. Set maximal value of metadata value.
  15906. @item bg
  15907. Set graph background color. Default is white.
  15908. @item mode
  15909. Set graph mode.
  15910. Available values for mode is:
  15911. @table @samp
  15912. @item bar
  15913. @item dot
  15914. @item line
  15915. @end table
  15916. Default is @code{line}.
  15917. @item slide
  15918. Set slide mode.
  15919. Available values for slide is:
  15920. @table @samp
  15921. @item frame
  15922. Draw new frame when right border is reached.
  15923. @item replace
  15924. Replace old columns with new ones.
  15925. @item scroll
  15926. Scroll from right to left.
  15927. @item rscroll
  15928. Scroll from left to right.
  15929. @item picture
  15930. Draw single picture.
  15931. @end table
  15932. Default is @code{frame}.
  15933. @item size
  15934. Set size of graph video. For the syntax of this option, check the
  15935. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15936. The default value is @code{900x256}.
  15937. The foreground color expressions can use the following variables:
  15938. @table @option
  15939. @item MIN
  15940. Minimal value of metadata value.
  15941. @item MAX
  15942. Maximal value of metadata value.
  15943. @item VAL
  15944. Current metadata key value.
  15945. @end table
  15946. The color is defined as 0xAABBGGRR.
  15947. @end table
  15948. Example using metadata from @ref{signalstats} filter:
  15949. @example
  15950. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15951. @end example
  15952. Example using metadata from @ref{ebur128} filter:
  15953. @example
  15954. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15955. @end example
  15956. @anchor{ebur128}
  15957. @section ebur128
  15958. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15959. level. By default, it logs a message at a frequency of 10Hz with the
  15960. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15961. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15962. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15963. sample format is double-precision floating point. The input stream will be converted to
  15964. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15965. after this filter to obtain the original parameters.
  15966. The filter also has a video output (see the @var{video} option) with a real
  15967. time graph to observe the loudness evolution. The graphic contains the logged
  15968. message mentioned above, so it is not printed anymore when this option is set,
  15969. unless the verbose logging is set. The main graphing area contains the
  15970. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15971. the momentary loudness (400 milliseconds), but can optionally be configured
  15972. to instead display short-term loudness (see @var{gauge}).
  15973. The green area marks a +/- 1LU target range around the target loudness
  15974. (-23LUFS by default, unless modified through @var{target}).
  15975. More information about the Loudness Recommendation EBU R128 on
  15976. @url{http://tech.ebu.ch/loudness}.
  15977. The filter accepts the following options:
  15978. @table @option
  15979. @item video
  15980. Activate the video output. The audio stream is passed unchanged whether this
  15981. option is set or no. The video stream will be the first output stream if
  15982. activated. Default is @code{0}.
  15983. @item size
  15984. Set the video size. This option is for video only. For the syntax of this
  15985. option, check the
  15986. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15987. Default and minimum resolution is @code{640x480}.
  15988. @item meter
  15989. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15990. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15991. other integer value between this range is allowed.
  15992. @item metadata
  15993. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15994. into 100ms output frames, each of them containing various loudness information
  15995. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15996. Default is @code{0}.
  15997. @item framelog
  15998. Force the frame logging level.
  15999. Available values are:
  16000. @table @samp
  16001. @item info
  16002. information logging level
  16003. @item verbose
  16004. verbose logging level
  16005. @end table
  16006. By default, the logging level is set to @var{info}. If the @option{video} or
  16007. the @option{metadata} options are set, it switches to @var{verbose}.
  16008. @item peak
  16009. Set peak mode(s).
  16010. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16011. values are:
  16012. @table @samp
  16013. @item none
  16014. Disable any peak mode (default).
  16015. @item sample
  16016. Enable sample-peak mode.
  16017. Simple peak mode looking for the higher sample value. It logs a message
  16018. for sample-peak (identified by @code{SPK}).
  16019. @item true
  16020. Enable true-peak mode.
  16021. If enabled, the peak lookup is done on an over-sampled version of the input
  16022. stream for better peak accuracy. It logs a message for true-peak.
  16023. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16024. This mode requires a build with @code{libswresample}.
  16025. @end table
  16026. @item dualmono
  16027. Treat mono input files as "dual mono". If a mono file is intended for playback
  16028. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16029. If set to @code{true}, this option will compensate for this effect.
  16030. Multi-channel input files are not affected by this option.
  16031. @item panlaw
  16032. Set a specific pan law to be used for the measurement of dual mono files.
  16033. This parameter is optional, and has a default value of -3.01dB.
  16034. @item target
  16035. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16036. This parameter is optional and has a default value of -23LUFS as specified
  16037. by EBU R128. However, material published online may prefer a level of -16LUFS
  16038. (e.g. for use with podcasts or video platforms).
  16039. @item gauge
  16040. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16041. @code{shortterm}. By default the momentary value will be used, but in certain
  16042. scenarios it may be more useful to observe the short term value instead (e.g.
  16043. live mixing).
  16044. @item scale
  16045. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16046. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16047. video output, not the summary or continuous log output.
  16048. @end table
  16049. @subsection Examples
  16050. @itemize
  16051. @item
  16052. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16053. @example
  16054. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16055. @end example
  16056. @item
  16057. Run an analysis with @command{ffmpeg}:
  16058. @example
  16059. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16060. @end example
  16061. @end itemize
  16062. @section interleave, ainterleave
  16063. Temporally interleave frames from several inputs.
  16064. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16065. These filters read frames from several inputs and send the oldest
  16066. queued frame to the output.
  16067. Input streams must have well defined, monotonically increasing frame
  16068. timestamp values.
  16069. In order to submit one frame to output, these filters need to enqueue
  16070. at least one frame for each input, so they cannot work in case one
  16071. input is not yet terminated and will not receive incoming frames.
  16072. For example consider the case when one input is a @code{select} filter
  16073. which always drops input frames. The @code{interleave} filter will keep
  16074. reading from that input, but it will never be able to send new frames
  16075. to output until the input sends an end-of-stream signal.
  16076. Also, depending on inputs synchronization, the filters will drop
  16077. frames in case one input receives more frames than the other ones, and
  16078. the queue is already filled.
  16079. These filters accept the following options:
  16080. @table @option
  16081. @item nb_inputs, n
  16082. Set the number of different inputs, it is 2 by default.
  16083. @end table
  16084. @subsection Examples
  16085. @itemize
  16086. @item
  16087. Interleave frames belonging to different streams using @command{ffmpeg}:
  16088. @example
  16089. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16090. @end example
  16091. @item
  16092. Add flickering blur effect:
  16093. @example
  16094. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16095. @end example
  16096. @end itemize
  16097. @section metadata, ametadata
  16098. Manipulate frame metadata.
  16099. This filter accepts the following options:
  16100. @table @option
  16101. @item mode
  16102. Set mode of operation of the filter.
  16103. Can be one of the following:
  16104. @table @samp
  16105. @item select
  16106. If both @code{value} and @code{key} is set, select frames
  16107. which have such metadata. If only @code{key} is set, select
  16108. every frame that has such key in metadata.
  16109. @item add
  16110. Add new metadata @code{key} and @code{value}. If key is already available
  16111. do nothing.
  16112. @item modify
  16113. Modify value of already present key.
  16114. @item delete
  16115. If @code{value} is set, delete only keys that have such value.
  16116. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16117. the frame.
  16118. @item print
  16119. Print key and its value if metadata was found. If @code{key} is not set print all
  16120. metadata values available in frame.
  16121. @end table
  16122. @item key
  16123. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16124. @item value
  16125. Set metadata value which will be used. This option is mandatory for
  16126. @code{modify} and @code{add} mode.
  16127. @item function
  16128. Which function to use when comparing metadata value and @code{value}.
  16129. Can be one of following:
  16130. @table @samp
  16131. @item same_str
  16132. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16133. @item starts_with
  16134. Values are interpreted as strings, returns true if metadata value starts with
  16135. the @code{value} option string.
  16136. @item less
  16137. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16138. @item equal
  16139. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16140. @item greater
  16141. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16142. @item expr
  16143. Values are interpreted as floats, returns true if expression from option @code{expr}
  16144. evaluates to true.
  16145. @end table
  16146. @item expr
  16147. Set expression which is used when @code{function} is set to @code{expr}.
  16148. The expression is evaluated through the eval API and can contain the following
  16149. constants:
  16150. @table @option
  16151. @item VALUE1
  16152. Float representation of @code{value} from metadata key.
  16153. @item VALUE2
  16154. Float representation of @code{value} as supplied by user in @code{value} option.
  16155. @end table
  16156. @item file
  16157. If specified in @code{print} mode, output is written to the named file. Instead of
  16158. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16159. for standard output. If @code{file} option is not set, output is written to the log
  16160. with AV_LOG_INFO loglevel.
  16161. @end table
  16162. @subsection Examples
  16163. @itemize
  16164. @item
  16165. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16166. between 0 and 1.
  16167. @example
  16168. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16169. @end example
  16170. @item
  16171. Print silencedetect output to file @file{metadata.txt}.
  16172. @example
  16173. silencedetect,ametadata=mode=print:file=metadata.txt
  16174. @end example
  16175. @item
  16176. Direct all metadata to a pipe with file descriptor 4.
  16177. @example
  16178. metadata=mode=print:file='pipe\:4'
  16179. @end example
  16180. @end itemize
  16181. @section perms, aperms
  16182. Set read/write permissions for the output frames.
  16183. These filters are mainly aimed at developers to test direct path in the
  16184. following filter in the filtergraph.
  16185. The filters accept the following options:
  16186. @table @option
  16187. @item mode
  16188. Select the permissions mode.
  16189. It accepts the following values:
  16190. @table @samp
  16191. @item none
  16192. Do nothing. This is the default.
  16193. @item ro
  16194. Set all the output frames read-only.
  16195. @item rw
  16196. Set all the output frames directly writable.
  16197. @item toggle
  16198. Make the frame read-only if writable, and writable if read-only.
  16199. @item random
  16200. Set each output frame read-only or writable randomly.
  16201. @end table
  16202. @item seed
  16203. Set the seed for the @var{random} mode, must be an integer included between
  16204. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16205. @code{-1}, the filter will try to use a good random seed on a best effort
  16206. basis.
  16207. @end table
  16208. Note: in case of auto-inserted filter between the permission filter and the
  16209. following one, the permission might not be received as expected in that
  16210. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16211. perms/aperms filter can avoid this problem.
  16212. @section realtime, arealtime
  16213. Slow down filtering to match real time approximately.
  16214. These filters will pause the filtering for a variable amount of time to
  16215. match the output rate with the input timestamps.
  16216. They are similar to the @option{re} option to @code{ffmpeg}.
  16217. They accept the following options:
  16218. @table @option
  16219. @item limit
  16220. Time limit for the pauses. Any pause longer than that will be considered
  16221. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16222. @item speed
  16223. Speed factor for processing. The value must be a float larger than zero.
  16224. Values larger than 1.0 will result in faster than realtime processing,
  16225. smaller will slow processing down. The @var{limit} is automatically adapted
  16226. accordingly. Default is 1.0.
  16227. A processing speed faster than what is possible without these filters cannot
  16228. be achieved.
  16229. @end table
  16230. @anchor{select}
  16231. @section select, aselect
  16232. Select frames to pass in output.
  16233. This filter accepts the following options:
  16234. @table @option
  16235. @item expr, e
  16236. Set expression, which is evaluated for each input frame.
  16237. If the expression is evaluated to zero, the frame is discarded.
  16238. If the evaluation result is negative or NaN, the frame is sent to the
  16239. first output; otherwise it is sent to the output with index
  16240. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16241. For example a value of @code{1.2} corresponds to the output with index
  16242. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16243. @item outputs, n
  16244. Set the number of outputs. The output to which to send the selected
  16245. frame is based on the result of the evaluation. Default value is 1.
  16246. @end table
  16247. The expression can contain the following constants:
  16248. @table @option
  16249. @item n
  16250. The (sequential) number of the filtered frame, starting from 0.
  16251. @item selected_n
  16252. The (sequential) number of the selected frame, starting from 0.
  16253. @item prev_selected_n
  16254. The sequential number of the last selected frame. It's NAN if undefined.
  16255. @item TB
  16256. The timebase of the input timestamps.
  16257. @item pts
  16258. The PTS (Presentation TimeStamp) of the filtered video frame,
  16259. expressed in @var{TB} units. It's NAN if undefined.
  16260. @item t
  16261. The PTS of the filtered video frame,
  16262. expressed in seconds. It's NAN if undefined.
  16263. @item prev_pts
  16264. The PTS of the previously filtered video frame. It's NAN if undefined.
  16265. @item prev_selected_pts
  16266. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16267. @item prev_selected_t
  16268. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16269. @item start_pts
  16270. The PTS of the first video frame in the video. It's NAN if undefined.
  16271. @item start_t
  16272. The time of the first video frame in the video. It's NAN if undefined.
  16273. @item pict_type @emph{(video only)}
  16274. The type of the filtered frame. It can assume one of the following
  16275. values:
  16276. @table @option
  16277. @item I
  16278. @item P
  16279. @item B
  16280. @item S
  16281. @item SI
  16282. @item SP
  16283. @item BI
  16284. @end table
  16285. @item interlace_type @emph{(video only)}
  16286. The frame interlace type. It can assume one of the following values:
  16287. @table @option
  16288. @item PROGRESSIVE
  16289. The frame is progressive (not interlaced).
  16290. @item TOPFIRST
  16291. The frame is top-field-first.
  16292. @item BOTTOMFIRST
  16293. The frame is bottom-field-first.
  16294. @end table
  16295. @item consumed_sample_n @emph{(audio only)}
  16296. the number of selected samples before the current frame
  16297. @item samples_n @emph{(audio only)}
  16298. the number of samples in the current frame
  16299. @item sample_rate @emph{(audio only)}
  16300. the input sample rate
  16301. @item key
  16302. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16303. @item pos
  16304. the position in the file of the filtered frame, -1 if the information
  16305. is not available (e.g. for synthetic video)
  16306. @item scene @emph{(video only)}
  16307. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16308. probability for the current frame to introduce a new scene, while a higher
  16309. value means the current frame is more likely to be one (see the example below)
  16310. @item concatdec_select
  16311. The concat demuxer can select only part of a concat input file by setting an
  16312. inpoint and an outpoint, but the output packets may not be entirely contained
  16313. in the selected interval. By using this variable, it is possible to skip frames
  16314. generated by the concat demuxer which are not exactly contained in the selected
  16315. interval.
  16316. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16317. and the @var{lavf.concat.duration} packet metadata values which are also
  16318. present in the decoded frames.
  16319. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16320. start_time and either the duration metadata is missing or the frame pts is less
  16321. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16322. missing.
  16323. That basically means that an input frame is selected if its pts is within the
  16324. interval set by the concat demuxer.
  16325. @end table
  16326. The default value of the select expression is "1".
  16327. @subsection Examples
  16328. @itemize
  16329. @item
  16330. Select all frames in input:
  16331. @example
  16332. select
  16333. @end example
  16334. The example above is the same as:
  16335. @example
  16336. select=1
  16337. @end example
  16338. @item
  16339. Skip all frames:
  16340. @example
  16341. select=0
  16342. @end example
  16343. @item
  16344. Select only I-frames:
  16345. @example
  16346. select='eq(pict_type\,I)'
  16347. @end example
  16348. @item
  16349. Select one frame every 100:
  16350. @example
  16351. select='not(mod(n\,100))'
  16352. @end example
  16353. @item
  16354. Select only frames contained in the 10-20 time interval:
  16355. @example
  16356. select=between(t\,10\,20)
  16357. @end example
  16358. @item
  16359. Select only I-frames contained in the 10-20 time interval:
  16360. @example
  16361. select=between(t\,10\,20)*eq(pict_type\,I)
  16362. @end example
  16363. @item
  16364. Select frames with a minimum distance of 10 seconds:
  16365. @example
  16366. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16367. @end example
  16368. @item
  16369. Use aselect to select only audio frames with samples number > 100:
  16370. @example
  16371. aselect='gt(samples_n\,100)'
  16372. @end example
  16373. @item
  16374. Create a mosaic of the first scenes:
  16375. @example
  16376. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16377. @end example
  16378. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16379. choice.
  16380. @item
  16381. Send even and odd frames to separate outputs, and compose them:
  16382. @example
  16383. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16384. @end example
  16385. @item
  16386. Select useful frames from an ffconcat file which is using inpoints and
  16387. outpoints but where the source files are not intra frame only.
  16388. @example
  16389. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16390. @end example
  16391. @end itemize
  16392. @section sendcmd, asendcmd
  16393. Send commands to filters in the filtergraph.
  16394. These filters read commands to be sent to other filters in the
  16395. filtergraph.
  16396. @code{sendcmd} must be inserted between two video filters,
  16397. @code{asendcmd} must be inserted between two audio filters, but apart
  16398. from that they act the same way.
  16399. The specification of commands can be provided in the filter arguments
  16400. with the @var{commands} option, or in a file specified by the
  16401. @var{filename} option.
  16402. These filters accept the following options:
  16403. @table @option
  16404. @item commands, c
  16405. Set the commands to be read and sent to the other filters.
  16406. @item filename, f
  16407. Set the filename of the commands to be read and sent to the other
  16408. filters.
  16409. @end table
  16410. @subsection Commands syntax
  16411. A commands description consists of a sequence of interval
  16412. specifications, comprising a list of commands to be executed when a
  16413. particular event related to that interval occurs. The occurring event
  16414. is typically the current frame time entering or leaving a given time
  16415. interval.
  16416. An interval is specified by the following syntax:
  16417. @example
  16418. @var{START}[-@var{END}] @var{COMMANDS};
  16419. @end example
  16420. The time interval is specified by the @var{START} and @var{END} times.
  16421. @var{END} is optional and defaults to the maximum time.
  16422. The current frame time is considered within the specified interval if
  16423. it is included in the interval [@var{START}, @var{END}), that is when
  16424. the time is greater or equal to @var{START} and is lesser than
  16425. @var{END}.
  16426. @var{COMMANDS} consists of a sequence of one or more command
  16427. specifications, separated by ",", relating to that interval. The
  16428. syntax of a command specification is given by:
  16429. @example
  16430. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16431. @end example
  16432. @var{FLAGS} is optional and specifies the type of events relating to
  16433. the time interval which enable sending the specified command, and must
  16434. be a non-null sequence of identifier flags separated by "+" or "|" and
  16435. enclosed between "[" and "]".
  16436. The following flags are recognized:
  16437. @table @option
  16438. @item enter
  16439. The command is sent when the current frame timestamp enters the
  16440. specified interval. In other words, the command is sent when the
  16441. previous frame timestamp was not in the given interval, and the
  16442. current is.
  16443. @item leave
  16444. The command is sent when the current frame timestamp leaves the
  16445. specified interval. In other words, the command is sent when the
  16446. previous frame timestamp was in the given interval, and the
  16447. current is not.
  16448. @end table
  16449. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16450. assumed.
  16451. @var{TARGET} specifies the target of the command, usually the name of
  16452. the filter class or a specific filter instance name.
  16453. @var{COMMAND} specifies the name of the command for the target filter.
  16454. @var{ARG} is optional and specifies the optional list of argument for
  16455. the given @var{COMMAND}.
  16456. Between one interval specification and another, whitespaces, or
  16457. sequences of characters starting with @code{#} until the end of line,
  16458. are ignored and can be used to annotate comments.
  16459. A simplified BNF description of the commands specification syntax
  16460. follows:
  16461. @example
  16462. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16463. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16464. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16465. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16466. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16467. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16468. @end example
  16469. @subsection Examples
  16470. @itemize
  16471. @item
  16472. Specify audio tempo change at second 4:
  16473. @example
  16474. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16475. @end example
  16476. @item
  16477. Target a specific filter instance:
  16478. @example
  16479. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16480. @end example
  16481. @item
  16482. Specify a list of drawtext and hue commands in a file.
  16483. @example
  16484. # show text in the interval 5-10
  16485. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16486. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16487. # desaturate the image in the interval 15-20
  16488. 15.0-20.0 [enter] hue s 0,
  16489. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16490. [leave] hue s 1,
  16491. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16492. # apply an exponential saturation fade-out effect, starting from time 25
  16493. 25 [enter] hue s exp(25-t)
  16494. @end example
  16495. A filtergraph allowing to read and process the above command list
  16496. stored in a file @file{test.cmd}, can be specified with:
  16497. @example
  16498. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16499. @end example
  16500. @end itemize
  16501. @anchor{setpts}
  16502. @section setpts, asetpts
  16503. Change the PTS (presentation timestamp) of the input frames.
  16504. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16505. This filter accepts the following options:
  16506. @table @option
  16507. @item expr
  16508. The expression which is evaluated for each frame to construct its timestamp.
  16509. @end table
  16510. The expression is evaluated through the eval API and can contain the following
  16511. constants:
  16512. @table @option
  16513. @item FRAME_RATE, FR
  16514. frame rate, only defined for constant frame-rate video
  16515. @item PTS
  16516. The presentation timestamp in input
  16517. @item N
  16518. The count of the input frame for video or the number of consumed samples,
  16519. not including the current frame for audio, starting from 0.
  16520. @item NB_CONSUMED_SAMPLES
  16521. The number of consumed samples, not including the current frame (only
  16522. audio)
  16523. @item NB_SAMPLES, S
  16524. The number of samples in the current frame (only audio)
  16525. @item SAMPLE_RATE, SR
  16526. The audio sample rate.
  16527. @item STARTPTS
  16528. The PTS of the first frame.
  16529. @item STARTT
  16530. the time in seconds of the first frame
  16531. @item INTERLACED
  16532. State whether the current frame is interlaced.
  16533. @item T
  16534. the time in seconds of the current frame
  16535. @item POS
  16536. original position in the file of the frame, or undefined if undefined
  16537. for the current frame
  16538. @item PREV_INPTS
  16539. The previous input PTS.
  16540. @item PREV_INT
  16541. previous input time in seconds
  16542. @item PREV_OUTPTS
  16543. The previous output PTS.
  16544. @item PREV_OUTT
  16545. previous output time in seconds
  16546. @item RTCTIME
  16547. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16548. instead.
  16549. @item RTCSTART
  16550. The wallclock (RTC) time at the start of the movie in microseconds.
  16551. @item TB
  16552. The timebase of the input timestamps.
  16553. @end table
  16554. @subsection Examples
  16555. @itemize
  16556. @item
  16557. Start counting PTS from zero
  16558. @example
  16559. setpts=PTS-STARTPTS
  16560. @end example
  16561. @item
  16562. Apply fast motion effect:
  16563. @example
  16564. setpts=0.5*PTS
  16565. @end example
  16566. @item
  16567. Apply slow motion effect:
  16568. @example
  16569. setpts=2.0*PTS
  16570. @end example
  16571. @item
  16572. Set fixed rate of 25 frames per second:
  16573. @example
  16574. setpts=N/(25*TB)
  16575. @end example
  16576. @item
  16577. Set fixed rate 25 fps with some jitter:
  16578. @example
  16579. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16580. @end example
  16581. @item
  16582. Apply an offset of 10 seconds to the input PTS:
  16583. @example
  16584. setpts=PTS+10/TB
  16585. @end example
  16586. @item
  16587. Generate timestamps from a "live source" and rebase onto the current timebase:
  16588. @example
  16589. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16590. @end example
  16591. @item
  16592. Generate timestamps by counting samples:
  16593. @example
  16594. asetpts=N/SR/TB
  16595. @end example
  16596. @end itemize
  16597. @section setrange
  16598. Force color range for the output video frame.
  16599. The @code{setrange} filter marks the color range property for the
  16600. output frames. It does not change the input frame, but only sets the
  16601. corresponding property, which affects how the frame is treated by
  16602. following filters.
  16603. The filter accepts the following options:
  16604. @table @option
  16605. @item range
  16606. Available values are:
  16607. @table @samp
  16608. @item auto
  16609. Keep the same color range property.
  16610. @item unspecified, unknown
  16611. Set the color range as unspecified.
  16612. @item limited, tv, mpeg
  16613. Set the color range as limited.
  16614. @item full, pc, jpeg
  16615. Set the color range as full.
  16616. @end table
  16617. @end table
  16618. @section settb, asettb
  16619. Set the timebase to use for the output frames timestamps.
  16620. It is mainly useful for testing timebase configuration.
  16621. It accepts the following parameters:
  16622. @table @option
  16623. @item expr, tb
  16624. The expression which is evaluated into the output timebase.
  16625. @end table
  16626. The value for @option{tb} is an arithmetic expression representing a
  16627. rational. The expression can contain the constants "AVTB" (the default
  16628. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16629. audio only). Default value is "intb".
  16630. @subsection Examples
  16631. @itemize
  16632. @item
  16633. Set the timebase to 1/25:
  16634. @example
  16635. settb=expr=1/25
  16636. @end example
  16637. @item
  16638. Set the timebase to 1/10:
  16639. @example
  16640. settb=expr=0.1
  16641. @end example
  16642. @item
  16643. Set the timebase to 1001/1000:
  16644. @example
  16645. settb=1+0.001
  16646. @end example
  16647. @item
  16648. Set the timebase to 2*intb:
  16649. @example
  16650. settb=2*intb
  16651. @end example
  16652. @item
  16653. Set the default timebase value:
  16654. @example
  16655. settb=AVTB
  16656. @end example
  16657. @end itemize
  16658. @section showcqt
  16659. Convert input audio to a video output representing frequency spectrum
  16660. logarithmically using Brown-Puckette constant Q transform algorithm with
  16661. direct frequency domain coefficient calculation (but the transform itself
  16662. is not really constant Q, instead the Q factor is actually variable/clamped),
  16663. with musical tone scale, from E0 to D#10.
  16664. The filter accepts the following options:
  16665. @table @option
  16666. @item size, s
  16667. Specify the video size for the output. It must be even. For the syntax of this option,
  16668. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16669. Default value is @code{1920x1080}.
  16670. @item fps, rate, r
  16671. Set the output frame rate. Default value is @code{25}.
  16672. @item bar_h
  16673. Set the bargraph height. It must be even. Default value is @code{-1} which
  16674. computes the bargraph height automatically.
  16675. @item axis_h
  16676. Set the axis height. It must be even. Default value is @code{-1} which computes
  16677. the axis height automatically.
  16678. @item sono_h
  16679. Set the sonogram height. It must be even. Default value is @code{-1} which
  16680. computes the sonogram height automatically.
  16681. @item fullhd
  16682. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16683. instead. Default value is @code{1}.
  16684. @item sono_v, volume
  16685. Specify the sonogram volume expression. It can contain variables:
  16686. @table @option
  16687. @item bar_v
  16688. the @var{bar_v} evaluated expression
  16689. @item frequency, freq, f
  16690. the frequency where it is evaluated
  16691. @item timeclamp, tc
  16692. the value of @var{timeclamp} option
  16693. @end table
  16694. and functions:
  16695. @table @option
  16696. @item a_weighting(f)
  16697. A-weighting of equal loudness
  16698. @item b_weighting(f)
  16699. B-weighting of equal loudness
  16700. @item c_weighting(f)
  16701. C-weighting of equal loudness.
  16702. @end table
  16703. Default value is @code{16}.
  16704. @item bar_v, volume2
  16705. Specify the bargraph volume expression. It can contain variables:
  16706. @table @option
  16707. @item sono_v
  16708. the @var{sono_v} evaluated expression
  16709. @item frequency, freq, f
  16710. the frequency where it is evaluated
  16711. @item timeclamp, tc
  16712. the value of @var{timeclamp} option
  16713. @end table
  16714. and functions:
  16715. @table @option
  16716. @item a_weighting(f)
  16717. A-weighting of equal loudness
  16718. @item b_weighting(f)
  16719. B-weighting of equal loudness
  16720. @item c_weighting(f)
  16721. C-weighting of equal loudness.
  16722. @end table
  16723. Default value is @code{sono_v}.
  16724. @item sono_g, gamma
  16725. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16726. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16727. Acceptable range is @code{[1, 7]}.
  16728. @item bar_g, gamma2
  16729. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16730. @code{[1, 7]}.
  16731. @item bar_t
  16732. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16733. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16734. @item timeclamp, tc
  16735. Specify the transform timeclamp. At low frequency, there is trade-off between
  16736. accuracy in time domain and frequency domain. If timeclamp is lower,
  16737. event in time domain is represented more accurately (such as fast bass drum),
  16738. otherwise event in frequency domain is represented more accurately
  16739. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16740. @item attack
  16741. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16742. limits future samples by applying asymmetric windowing in time domain, useful
  16743. when low latency is required. Accepted range is @code{[0, 1]}.
  16744. @item basefreq
  16745. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16746. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16747. @item endfreq
  16748. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16749. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16750. @item coeffclamp
  16751. This option is deprecated and ignored.
  16752. @item tlength
  16753. Specify the transform length in time domain. Use this option to control accuracy
  16754. trade-off between time domain and frequency domain at every frequency sample.
  16755. It can contain variables:
  16756. @table @option
  16757. @item frequency, freq, f
  16758. the frequency where it is evaluated
  16759. @item timeclamp, tc
  16760. the value of @var{timeclamp} option.
  16761. @end table
  16762. Default value is @code{384*tc/(384+tc*f)}.
  16763. @item count
  16764. Specify the transform count for every video frame. Default value is @code{6}.
  16765. Acceptable range is @code{[1, 30]}.
  16766. @item fcount
  16767. Specify the transform count for every single pixel. Default value is @code{0},
  16768. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16769. @item fontfile
  16770. Specify font file for use with freetype to draw the axis. If not specified,
  16771. use embedded font. Note that drawing with font file or embedded font is not
  16772. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16773. option instead.
  16774. @item font
  16775. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16776. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16777. @item fontcolor
  16778. Specify font color expression. This is arithmetic expression that should return
  16779. integer value 0xRRGGBB. It can contain variables:
  16780. @table @option
  16781. @item frequency, freq, f
  16782. the frequency where it is evaluated
  16783. @item timeclamp, tc
  16784. the value of @var{timeclamp} option
  16785. @end table
  16786. and functions:
  16787. @table @option
  16788. @item midi(f)
  16789. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16790. @item r(x), g(x), b(x)
  16791. red, green, and blue value of intensity x.
  16792. @end table
  16793. Default value is @code{st(0, (midi(f)-59.5)/12);
  16794. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16795. r(1-ld(1)) + b(ld(1))}.
  16796. @item axisfile
  16797. Specify image file to draw the axis. This option override @var{fontfile} and
  16798. @var{fontcolor} option.
  16799. @item axis, text
  16800. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16801. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16802. Default value is @code{1}.
  16803. @item csp
  16804. Set colorspace. The accepted values are:
  16805. @table @samp
  16806. @item unspecified
  16807. Unspecified (default)
  16808. @item bt709
  16809. BT.709
  16810. @item fcc
  16811. FCC
  16812. @item bt470bg
  16813. BT.470BG or BT.601-6 625
  16814. @item smpte170m
  16815. SMPTE-170M or BT.601-6 525
  16816. @item smpte240m
  16817. SMPTE-240M
  16818. @item bt2020ncl
  16819. BT.2020 with non-constant luminance
  16820. @end table
  16821. @item cscheme
  16822. Set spectrogram color scheme. This is list of floating point values with format
  16823. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16824. The default is @code{1|0.5|0|0|0.5|1}.
  16825. @end table
  16826. @subsection Examples
  16827. @itemize
  16828. @item
  16829. Playing audio while showing the spectrum:
  16830. @example
  16831. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16832. @end example
  16833. @item
  16834. Same as above, but with frame rate 30 fps:
  16835. @example
  16836. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16837. @end example
  16838. @item
  16839. Playing at 1280x720:
  16840. @example
  16841. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16842. @end example
  16843. @item
  16844. Disable sonogram display:
  16845. @example
  16846. sono_h=0
  16847. @end example
  16848. @item
  16849. A1 and its harmonics: A1, A2, (near)E3, A3:
  16850. @example
  16851. 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),
  16852. asplit[a][out1]; [a] showcqt [out0]'
  16853. @end example
  16854. @item
  16855. Same as above, but with more accuracy in frequency domain:
  16856. @example
  16857. 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),
  16858. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16859. @end example
  16860. @item
  16861. Custom volume:
  16862. @example
  16863. bar_v=10:sono_v=bar_v*a_weighting(f)
  16864. @end example
  16865. @item
  16866. Custom gamma, now spectrum is linear to the amplitude.
  16867. @example
  16868. bar_g=2:sono_g=2
  16869. @end example
  16870. @item
  16871. Custom tlength equation:
  16872. @example
  16873. 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)))'
  16874. @end example
  16875. @item
  16876. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16877. @example
  16878. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16879. @end example
  16880. @item
  16881. Custom font using fontconfig:
  16882. @example
  16883. font='Courier New,Monospace,mono|bold'
  16884. @end example
  16885. @item
  16886. Custom frequency range with custom axis using image file:
  16887. @example
  16888. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16889. @end example
  16890. @end itemize
  16891. @section showfreqs
  16892. Convert input audio to video output representing the audio power spectrum.
  16893. Audio amplitude is on Y-axis while frequency is on X-axis.
  16894. The filter accepts the following options:
  16895. @table @option
  16896. @item size, s
  16897. Specify size of video. For the syntax of this option, check the
  16898. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16899. Default is @code{1024x512}.
  16900. @item mode
  16901. Set display mode.
  16902. This set how each frequency bin will be represented.
  16903. It accepts the following values:
  16904. @table @samp
  16905. @item line
  16906. @item bar
  16907. @item dot
  16908. @end table
  16909. Default is @code{bar}.
  16910. @item ascale
  16911. Set amplitude scale.
  16912. It accepts the following values:
  16913. @table @samp
  16914. @item lin
  16915. Linear scale.
  16916. @item sqrt
  16917. Square root scale.
  16918. @item cbrt
  16919. Cubic root scale.
  16920. @item log
  16921. Logarithmic scale.
  16922. @end table
  16923. Default is @code{log}.
  16924. @item fscale
  16925. Set frequency scale.
  16926. It accepts the following values:
  16927. @table @samp
  16928. @item lin
  16929. Linear scale.
  16930. @item log
  16931. Logarithmic scale.
  16932. @item rlog
  16933. Reverse logarithmic scale.
  16934. @end table
  16935. Default is @code{lin}.
  16936. @item win_size
  16937. Set window size.
  16938. It accepts the following values:
  16939. @table @samp
  16940. @item w16
  16941. @item w32
  16942. @item w64
  16943. @item w128
  16944. @item w256
  16945. @item w512
  16946. @item w1024
  16947. @item w2048
  16948. @item w4096
  16949. @item w8192
  16950. @item w16384
  16951. @item w32768
  16952. @item w65536
  16953. @end table
  16954. Default is @code{w2048}
  16955. @item win_func
  16956. Set windowing function.
  16957. It accepts the following values:
  16958. @table @samp
  16959. @item rect
  16960. @item bartlett
  16961. @item hanning
  16962. @item hamming
  16963. @item blackman
  16964. @item welch
  16965. @item flattop
  16966. @item bharris
  16967. @item bnuttall
  16968. @item bhann
  16969. @item sine
  16970. @item nuttall
  16971. @item lanczos
  16972. @item gauss
  16973. @item tukey
  16974. @item dolph
  16975. @item cauchy
  16976. @item parzen
  16977. @item poisson
  16978. @item bohman
  16979. @end table
  16980. Default is @code{hanning}.
  16981. @item overlap
  16982. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16983. which means optimal overlap for selected window function will be picked.
  16984. @item averaging
  16985. Set time averaging. Setting this to 0 will display current maximal peaks.
  16986. Default is @code{1}, which means time averaging is disabled.
  16987. @item colors
  16988. Specify list of colors separated by space or by '|' which will be used to
  16989. draw channel frequencies. Unrecognized or missing colors will be replaced
  16990. by white color.
  16991. @item cmode
  16992. Set channel display mode.
  16993. It accepts the following values:
  16994. @table @samp
  16995. @item combined
  16996. @item separate
  16997. @end table
  16998. Default is @code{combined}.
  16999. @item minamp
  17000. Set minimum amplitude used in @code{log} amplitude scaler.
  17001. @end table
  17002. @section showspatial
  17003. Convert stereo input audio to a video output, representing the spatial relationship
  17004. between two channels.
  17005. The filter accepts the following options:
  17006. @table @option
  17007. @item size, s
  17008. Specify the video size for the output. For the syntax of this option, check the
  17009. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17010. Default value is @code{512x512}.
  17011. @item win_size
  17012. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17013. @item win_func
  17014. Set window function.
  17015. It accepts the following values:
  17016. @table @samp
  17017. @item rect
  17018. @item bartlett
  17019. @item hann
  17020. @item hanning
  17021. @item hamming
  17022. @item blackman
  17023. @item welch
  17024. @item flattop
  17025. @item bharris
  17026. @item bnuttall
  17027. @item bhann
  17028. @item sine
  17029. @item nuttall
  17030. @item lanczos
  17031. @item gauss
  17032. @item tukey
  17033. @item dolph
  17034. @item cauchy
  17035. @item parzen
  17036. @item poisson
  17037. @item bohman
  17038. @end table
  17039. Default value is @code{hann}.
  17040. @item overlap
  17041. Set ratio of overlap window. Default value is @code{0.5}.
  17042. When value is @code{1} overlap is set to recommended size for specific
  17043. window function currently used.
  17044. @end table
  17045. @anchor{showspectrum}
  17046. @section showspectrum
  17047. Convert input audio to a video output, representing the audio frequency
  17048. spectrum.
  17049. The filter accepts the following options:
  17050. @table @option
  17051. @item size, s
  17052. Specify the video size for the output. For the syntax of this option, check the
  17053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17054. Default value is @code{640x512}.
  17055. @item slide
  17056. Specify how the spectrum should slide along the window.
  17057. It accepts the following values:
  17058. @table @samp
  17059. @item replace
  17060. the samples start again on the left when they reach the right
  17061. @item scroll
  17062. the samples scroll from right to left
  17063. @item fullframe
  17064. frames are only produced when the samples reach the right
  17065. @item rscroll
  17066. the samples scroll from left to right
  17067. @end table
  17068. Default value is @code{replace}.
  17069. @item mode
  17070. Specify display mode.
  17071. It accepts the following values:
  17072. @table @samp
  17073. @item combined
  17074. all channels are displayed in the same row
  17075. @item separate
  17076. all channels are displayed in separate rows
  17077. @end table
  17078. Default value is @samp{combined}.
  17079. @item color
  17080. Specify display color mode.
  17081. It accepts the following values:
  17082. @table @samp
  17083. @item channel
  17084. each channel is displayed in a separate color
  17085. @item intensity
  17086. each channel is displayed using the same color scheme
  17087. @item rainbow
  17088. each channel is displayed using the rainbow color scheme
  17089. @item moreland
  17090. each channel is displayed using the moreland color scheme
  17091. @item nebulae
  17092. each channel is displayed using the nebulae color scheme
  17093. @item fire
  17094. each channel is displayed using the fire color scheme
  17095. @item fiery
  17096. each channel is displayed using the fiery color scheme
  17097. @item fruit
  17098. each channel is displayed using the fruit color scheme
  17099. @item cool
  17100. each channel is displayed using the cool color scheme
  17101. @item magma
  17102. each channel is displayed using the magma color scheme
  17103. @item green
  17104. each channel is displayed using the green color scheme
  17105. @item viridis
  17106. each channel is displayed using the viridis color scheme
  17107. @item plasma
  17108. each channel is displayed using the plasma color scheme
  17109. @item cividis
  17110. each channel is displayed using the cividis color scheme
  17111. @item terrain
  17112. each channel is displayed using the terrain color scheme
  17113. @end table
  17114. Default value is @samp{channel}.
  17115. @item scale
  17116. Specify scale used for calculating intensity color values.
  17117. It accepts the following values:
  17118. @table @samp
  17119. @item lin
  17120. linear
  17121. @item sqrt
  17122. square root, default
  17123. @item cbrt
  17124. cubic root
  17125. @item log
  17126. logarithmic
  17127. @item 4thrt
  17128. 4th root
  17129. @item 5thrt
  17130. 5th root
  17131. @end table
  17132. Default value is @samp{sqrt}.
  17133. @item fscale
  17134. Specify frequency scale.
  17135. It accepts the following values:
  17136. @table @samp
  17137. @item lin
  17138. linear
  17139. @item log
  17140. logarithmic
  17141. @end table
  17142. Default value is @samp{lin}.
  17143. @item saturation
  17144. Set saturation modifier for displayed colors. Negative values provide
  17145. alternative color scheme. @code{0} is no saturation at all.
  17146. Saturation must be in [-10.0, 10.0] range.
  17147. Default value is @code{1}.
  17148. @item win_func
  17149. Set window function.
  17150. It accepts the following values:
  17151. @table @samp
  17152. @item rect
  17153. @item bartlett
  17154. @item hann
  17155. @item hanning
  17156. @item hamming
  17157. @item blackman
  17158. @item welch
  17159. @item flattop
  17160. @item bharris
  17161. @item bnuttall
  17162. @item bhann
  17163. @item sine
  17164. @item nuttall
  17165. @item lanczos
  17166. @item gauss
  17167. @item tukey
  17168. @item dolph
  17169. @item cauchy
  17170. @item parzen
  17171. @item poisson
  17172. @item bohman
  17173. @end table
  17174. Default value is @code{hann}.
  17175. @item orientation
  17176. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17177. @code{horizontal}. Default is @code{vertical}.
  17178. @item overlap
  17179. Set ratio of overlap window. Default value is @code{0}.
  17180. When value is @code{1} overlap is set to recommended size for specific
  17181. window function currently used.
  17182. @item gain
  17183. Set scale gain for calculating intensity color values.
  17184. Default value is @code{1}.
  17185. @item data
  17186. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17187. @item rotation
  17188. Set color rotation, must be in [-1.0, 1.0] range.
  17189. Default value is @code{0}.
  17190. @item start
  17191. Set start frequency from which to display spectrogram. Default is @code{0}.
  17192. @item stop
  17193. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17194. @item fps
  17195. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17196. @item legend
  17197. Draw time and frequency axes and legends. Default is disabled.
  17198. @end table
  17199. The usage is very similar to the showwaves filter; see the examples in that
  17200. section.
  17201. @subsection Examples
  17202. @itemize
  17203. @item
  17204. Large window with logarithmic color scaling:
  17205. @example
  17206. showspectrum=s=1280x480:scale=log
  17207. @end example
  17208. @item
  17209. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17210. @example
  17211. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17212. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17213. @end example
  17214. @end itemize
  17215. @section showspectrumpic
  17216. Convert input audio to a single video frame, representing the audio frequency
  17217. spectrum.
  17218. The filter accepts the following options:
  17219. @table @option
  17220. @item size, s
  17221. Specify the video size for the output. For the syntax of this option, check the
  17222. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17223. Default value is @code{4096x2048}.
  17224. @item mode
  17225. Specify display mode.
  17226. It accepts the following values:
  17227. @table @samp
  17228. @item combined
  17229. all channels are displayed in the same row
  17230. @item separate
  17231. all channels are displayed in separate rows
  17232. @end table
  17233. Default value is @samp{combined}.
  17234. @item color
  17235. Specify display color mode.
  17236. It accepts the following values:
  17237. @table @samp
  17238. @item channel
  17239. each channel is displayed in a separate color
  17240. @item intensity
  17241. each channel is displayed using the same color scheme
  17242. @item rainbow
  17243. each channel is displayed using the rainbow color scheme
  17244. @item moreland
  17245. each channel is displayed using the moreland color scheme
  17246. @item nebulae
  17247. each channel is displayed using the nebulae color scheme
  17248. @item fire
  17249. each channel is displayed using the fire color scheme
  17250. @item fiery
  17251. each channel is displayed using the fiery color scheme
  17252. @item fruit
  17253. each channel is displayed using the fruit color scheme
  17254. @item cool
  17255. each channel is displayed using the cool color scheme
  17256. @item magma
  17257. each channel is displayed using the magma color scheme
  17258. @item green
  17259. each channel is displayed using the green color scheme
  17260. @item viridis
  17261. each channel is displayed using the viridis color scheme
  17262. @item plasma
  17263. each channel is displayed using the plasma color scheme
  17264. @item cividis
  17265. each channel is displayed using the cividis color scheme
  17266. @item terrain
  17267. each channel is displayed using the terrain color scheme
  17268. @end table
  17269. Default value is @samp{intensity}.
  17270. @item scale
  17271. Specify scale used for calculating intensity color values.
  17272. It accepts the following values:
  17273. @table @samp
  17274. @item lin
  17275. linear
  17276. @item sqrt
  17277. square root, default
  17278. @item cbrt
  17279. cubic root
  17280. @item log
  17281. logarithmic
  17282. @item 4thrt
  17283. 4th root
  17284. @item 5thrt
  17285. 5th root
  17286. @end table
  17287. Default value is @samp{log}.
  17288. @item fscale
  17289. Specify frequency scale.
  17290. It accepts the following values:
  17291. @table @samp
  17292. @item lin
  17293. linear
  17294. @item log
  17295. logarithmic
  17296. @end table
  17297. Default value is @samp{lin}.
  17298. @item saturation
  17299. Set saturation modifier for displayed colors. Negative values provide
  17300. alternative color scheme. @code{0} is no saturation at all.
  17301. Saturation must be in [-10.0, 10.0] range.
  17302. Default value is @code{1}.
  17303. @item win_func
  17304. Set window function.
  17305. It accepts the following values:
  17306. @table @samp
  17307. @item rect
  17308. @item bartlett
  17309. @item hann
  17310. @item hanning
  17311. @item hamming
  17312. @item blackman
  17313. @item welch
  17314. @item flattop
  17315. @item bharris
  17316. @item bnuttall
  17317. @item bhann
  17318. @item sine
  17319. @item nuttall
  17320. @item lanczos
  17321. @item gauss
  17322. @item tukey
  17323. @item dolph
  17324. @item cauchy
  17325. @item parzen
  17326. @item poisson
  17327. @item bohman
  17328. @end table
  17329. Default value is @code{hann}.
  17330. @item orientation
  17331. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17332. @code{horizontal}. Default is @code{vertical}.
  17333. @item gain
  17334. Set scale gain for calculating intensity color values.
  17335. Default value is @code{1}.
  17336. @item legend
  17337. Draw time and frequency axes and legends. Default is enabled.
  17338. @item rotation
  17339. Set color rotation, must be in [-1.0, 1.0] range.
  17340. Default value is @code{0}.
  17341. @item start
  17342. Set start frequency from which to display spectrogram. Default is @code{0}.
  17343. @item stop
  17344. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17345. @end table
  17346. @subsection Examples
  17347. @itemize
  17348. @item
  17349. Extract an audio spectrogram of a whole audio track
  17350. in a 1024x1024 picture using @command{ffmpeg}:
  17351. @example
  17352. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17353. @end example
  17354. @end itemize
  17355. @section showvolume
  17356. Convert input audio volume to a video output.
  17357. The filter accepts the following options:
  17358. @table @option
  17359. @item rate, r
  17360. Set video rate.
  17361. @item b
  17362. Set border width, allowed range is [0, 5]. Default is 1.
  17363. @item w
  17364. Set channel width, allowed range is [80, 8192]. Default is 400.
  17365. @item h
  17366. Set channel height, allowed range is [1, 900]. Default is 20.
  17367. @item f
  17368. Set fade, allowed range is [0, 1]. Default is 0.95.
  17369. @item c
  17370. Set volume color expression.
  17371. The expression can use the following variables:
  17372. @table @option
  17373. @item VOLUME
  17374. Current max volume of channel in dB.
  17375. @item PEAK
  17376. Current peak.
  17377. @item CHANNEL
  17378. Current channel number, starting from 0.
  17379. @end table
  17380. @item t
  17381. If set, displays channel names. Default is enabled.
  17382. @item v
  17383. If set, displays volume values. Default is enabled.
  17384. @item o
  17385. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17386. default is @code{h}.
  17387. @item s
  17388. Set step size, allowed range is [0, 5]. Default is 0, which means
  17389. step is disabled.
  17390. @item p
  17391. Set background opacity, allowed range is [0, 1]. Default is 0.
  17392. @item m
  17393. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17394. default is @code{p}.
  17395. @item ds
  17396. Set display scale, can be linear: @code{lin} or log: @code{log},
  17397. default is @code{lin}.
  17398. @item dm
  17399. In second.
  17400. If set to > 0., display a line for the max level
  17401. in the previous seconds.
  17402. default is disabled: @code{0.}
  17403. @item dmc
  17404. The color of the max line. Use when @code{dm} option is set to > 0.
  17405. default is: @code{orange}
  17406. @end table
  17407. @section showwaves
  17408. Convert input audio to a video output, representing the samples waves.
  17409. The filter accepts the following options:
  17410. @table @option
  17411. @item size, s
  17412. Specify the video size for the output. For the syntax of this option, check the
  17413. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17414. Default value is @code{600x240}.
  17415. @item mode
  17416. Set display mode.
  17417. Available values are:
  17418. @table @samp
  17419. @item point
  17420. Draw a point for each sample.
  17421. @item line
  17422. Draw a vertical line for each sample.
  17423. @item p2p
  17424. Draw a point for each sample and a line between them.
  17425. @item cline
  17426. Draw a centered vertical line for each sample.
  17427. @end table
  17428. Default value is @code{point}.
  17429. @item n
  17430. Set the number of samples which are printed on the same column. A
  17431. larger value will decrease the frame rate. Must be a positive
  17432. integer. This option can be set only if the value for @var{rate}
  17433. is not explicitly specified.
  17434. @item rate, r
  17435. Set the (approximate) output frame rate. This is done by setting the
  17436. option @var{n}. Default value is "25".
  17437. @item split_channels
  17438. Set if channels should be drawn separately or overlap. Default value is 0.
  17439. @item colors
  17440. Set colors separated by '|' which are going to be used for drawing of each channel.
  17441. @item scale
  17442. Set amplitude scale.
  17443. Available values are:
  17444. @table @samp
  17445. @item lin
  17446. Linear.
  17447. @item log
  17448. Logarithmic.
  17449. @item sqrt
  17450. Square root.
  17451. @item cbrt
  17452. Cubic root.
  17453. @end table
  17454. Default is linear.
  17455. @item draw
  17456. Set the draw mode. This is mostly useful to set for high @var{n}.
  17457. Available values are:
  17458. @table @samp
  17459. @item scale
  17460. Scale pixel values for each drawn sample.
  17461. @item full
  17462. Draw every sample directly.
  17463. @end table
  17464. Default value is @code{scale}.
  17465. @end table
  17466. @subsection Examples
  17467. @itemize
  17468. @item
  17469. Output the input file audio and the corresponding video representation
  17470. at the same time:
  17471. @example
  17472. amovie=a.mp3,asplit[out0],showwaves[out1]
  17473. @end example
  17474. @item
  17475. Create a synthetic signal and show it with showwaves, forcing a
  17476. frame rate of 30 frames per second:
  17477. @example
  17478. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17479. @end example
  17480. @end itemize
  17481. @section showwavespic
  17482. Convert input audio to a single video frame, representing the samples waves.
  17483. The filter accepts the following options:
  17484. @table @option
  17485. @item size, s
  17486. Specify the video size for the output. For the syntax of this option, check the
  17487. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17488. Default value is @code{600x240}.
  17489. @item split_channels
  17490. Set if channels should be drawn separately or overlap. Default value is 0.
  17491. @item colors
  17492. Set colors separated by '|' which are going to be used for drawing of each channel.
  17493. @item scale
  17494. Set amplitude scale.
  17495. Available values are:
  17496. @table @samp
  17497. @item lin
  17498. Linear.
  17499. @item log
  17500. Logarithmic.
  17501. @item sqrt
  17502. Square root.
  17503. @item cbrt
  17504. Cubic root.
  17505. @end table
  17506. Default is linear.
  17507. @item draw
  17508. Set the draw mode.
  17509. Available values are:
  17510. @table @samp
  17511. @item scale
  17512. Scale pixel values for each drawn sample.
  17513. @item full
  17514. Draw every sample directly.
  17515. @end table
  17516. Default value is @code{scale}.
  17517. @end table
  17518. @subsection Examples
  17519. @itemize
  17520. @item
  17521. Extract a channel split representation of the wave form of a whole audio track
  17522. in a 1024x800 picture using @command{ffmpeg}:
  17523. @example
  17524. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17525. @end example
  17526. @end itemize
  17527. @section sidedata, asidedata
  17528. Delete frame side data, or select frames based on it.
  17529. This filter accepts the following options:
  17530. @table @option
  17531. @item mode
  17532. Set mode of operation of the filter.
  17533. Can be one of the following:
  17534. @table @samp
  17535. @item select
  17536. Select every frame with side data of @code{type}.
  17537. @item delete
  17538. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17539. data in the frame.
  17540. @end table
  17541. @item type
  17542. Set side data type used with all modes. Must be set for @code{select} mode. For
  17543. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17544. in @file{libavutil/frame.h}. For example, to choose
  17545. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17546. @end table
  17547. @section spectrumsynth
  17548. Sythesize audio from 2 input video spectrums, first input stream represents
  17549. magnitude across time and second represents phase across time.
  17550. The filter will transform from frequency domain as displayed in videos back
  17551. to time domain as presented in audio output.
  17552. This filter is primarily created for reversing processed @ref{showspectrum}
  17553. filter outputs, but can synthesize sound from other spectrograms too.
  17554. But in such case results are going to be poor if the phase data is not
  17555. available, because in such cases phase data need to be recreated, usually
  17556. it's just recreated from random noise.
  17557. For best results use gray only output (@code{channel} color mode in
  17558. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17559. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17560. @code{data} option. Inputs videos should generally use @code{fullframe}
  17561. slide mode as that saves resources needed for decoding video.
  17562. The filter accepts the following options:
  17563. @table @option
  17564. @item sample_rate
  17565. Specify sample rate of output audio, the sample rate of audio from which
  17566. spectrum was generated may differ.
  17567. @item channels
  17568. Set number of channels represented in input video spectrums.
  17569. @item scale
  17570. Set scale which was used when generating magnitude input spectrum.
  17571. Can be @code{lin} or @code{log}. Default is @code{log}.
  17572. @item slide
  17573. Set slide which was used when generating inputs spectrums.
  17574. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17575. Default is @code{fullframe}.
  17576. @item win_func
  17577. Set window function used for resynthesis.
  17578. @item overlap
  17579. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17580. which means optimal overlap for selected window function will be picked.
  17581. @item orientation
  17582. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17583. Default is @code{vertical}.
  17584. @end table
  17585. @subsection Examples
  17586. @itemize
  17587. @item
  17588. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17589. then resynthesize videos back to audio with spectrumsynth:
  17590. @example
  17591. 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
  17592. 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
  17593. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17594. @end example
  17595. @end itemize
  17596. @section split, asplit
  17597. Split input into several identical outputs.
  17598. @code{asplit} works with audio input, @code{split} with video.
  17599. The filter accepts a single parameter which specifies the number of outputs. If
  17600. unspecified, it defaults to 2.
  17601. @subsection Examples
  17602. @itemize
  17603. @item
  17604. Create two separate outputs from the same input:
  17605. @example
  17606. [in] split [out0][out1]
  17607. @end example
  17608. @item
  17609. To create 3 or more outputs, you need to specify the number of
  17610. outputs, like in:
  17611. @example
  17612. [in] asplit=3 [out0][out1][out2]
  17613. @end example
  17614. @item
  17615. Create two separate outputs from the same input, one cropped and
  17616. one padded:
  17617. @example
  17618. [in] split [splitout1][splitout2];
  17619. [splitout1] crop=100:100:0:0 [cropout];
  17620. [splitout2] pad=200:200:100:100 [padout];
  17621. @end example
  17622. @item
  17623. Create 5 copies of the input audio with @command{ffmpeg}:
  17624. @example
  17625. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17626. @end example
  17627. @end itemize
  17628. @section zmq, azmq
  17629. Receive commands sent through a libzmq client, and forward them to
  17630. filters in the filtergraph.
  17631. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17632. must be inserted between two video filters, @code{azmq} between two
  17633. audio filters. Both are capable to send messages to any filter type.
  17634. To enable these filters you need to install the libzmq library and
  17635. headers and configure FFmpeg with @code{--enable-libzmq}.
  17636. For more information about libzmq see:
  17637. @url{http://www.zeromq.org/}
  17638. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17639. receives messages sent through a network interface defined by the
  17640. @option{bind_address} (or the abbreviation "@option{b}") option.
  17641. Default value of this option is @file{tcp://localhost:5555}. You may
  17642. want to alter this value to your needs, but do not forget to escape any
  17643. ':' signs (see @ref{filtergraph escaping}).
  17644. The received message must be in the form:
  17645. @example
  17646. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17647. @end example
  17648. @var{TARGET} specifies the target of the command, usually the name of
  17649. the filter class or a specific filter instance name. The default
  17650. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17651. but you can override this by using the @samp{filter_name@@id} syntax
  17652. (see @ref{Filtergraph syntax}).
  17653. @var{COMMAND} specifies the name of the command for the target filter.
  17654. @var{ARG} is optional and specifies the optional argument list for the
  17655. given @var{COMMAND}.
  17656. Upon reception, the message is processed and the corresponding command
  17657. is injected into the filtergraph. Depending on the result, the filter
  17658. will send a reply to the client, adopting the format:
  17659. @example
  17660. @var{ERROR_CODE} @var{ERROR_REASON}
  17661. @var{MESSAGE}
  17662. @end example
  17663. @var{MESSAGE} is optional.
  17664. @subsection Examples
  17665. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17666. be used to send commands processed by these filters.
  17667. Consider the following filtergraph generated by @command{ffplay}.
  17668. In this example the last overlay filter has an instance name. All other
  17669. filters will have default instance names.
  17670. @example
  17671. ffplay -dumpgraph 1 -f lavfi "
  17672. color=s=100x100:c=red [l];
  17673. color=s=100x100:c=blue [r];
  17674. nullsrc=s=200x100, zmq [bg];
  17675. [bg][l] overlay [bg+l];
  17676. [bg+l][r] overlay@@my=x=100 "
  17677. @end example
  17678. To change the color of the left side of the video, the following
  17679. command can be used:
  17680. @example
  17681. echo Parsed_color_0 c yellow | tools/zmqsend
  17682. @end example
  17683. To change the right side:
  17684. @example
  17685. echo Parsed_color_1 c pink | tools/zmqsend
  17686. @end example
  17687. To change the position of the right side:
  17688. @example
  17689. echo overlay@@my x 150 | tools/zmqsend
  17690. @end example
  17691. @c man end MULTIMEDIA FILTERS
  17692. @chapter Multimedia Sources
  17693. @c man begin MULTIMEDIA SOURCES
  17694. Below is a description of the currently available multimedia sources.
  17695. @section amovie
  17696. This is the same as @ref{movie} source, except it selects an audio
  17697. stream by default.
  17698. @anchor{movie}
  17699. @section movie
  17700. Read audio and/or video stream(s) from a movie container.
  17701. It accepts the following parameters:
  17702. @table @option
  17703. @item filename
  17704. The name of the resource to read (not necessarily a file; it can also be a
  17705. device or a stream accessed through some protocol).
  17706. @item format_name, f
  17707. Specifies the format assumed for the movie to read, and can be either
  17708. the name of a container or an input device. If not specified, the
  17709. format is guessed from @var{movie_name} or by probing.
  17710. @item seek_point, sp
  17711. Specifies the seek point in seconds. The frames will be output
  17712. starting from this seek point. The parameter is evaluated with
  17713. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17714. postfix. The default value is "0".
  17715. @item streams, s
  17716. Specifies the streams to read. Several streams can be specified,
  17717. separated by "+". The source will then have as many outputs, in the
  17718. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17719. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17720. respectively the default (best suited) video and audio stream. Default
  17721. is "dv", or "da" if the filter is called as "amovie".
  17722. @item stream_index, si
  17723. Specifies the index of the video stream to read. If the value is -1,
  17724. the most suitable video stream will be automatically selected. The default
  17725. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17726. audio instead of video.
  17727. @item loop
  17728. Specifies how many times to read the stream in sequence.
  17729. If the value is 0, the stream will be looped infinitely.
  17730. Default value is "1".
  17731. Note that when the movie is looped the source timestamps are not
  17732. changed, so it will generate non monotonically increasing timestamps.
  17733. @item discontinuity
  17734. Specifies the time difference between frames above which the point is
  17735. considered a timestamp discontinuity which is removed by adjusting the later
  17736. timestamps.
  17737. @end table
  17738. It allows overlaying a second video on top of the main input of
  17739. a filtergraph, as shown in this graph:
  17740. @example
  17741. input -----------> deltapts0 --> overlay --> output
  17742. ^
  17743. |
  17744. movie --> scale--> deltapts1 -------+
  17745. @end example
  17746. @subsection Examples
  17747. @itemize
  17748. @item
  17749. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17750. on top of the input labelled "in":
  17751. @example
  17752. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17753. [in] setpts=PTS-STARTPTS [main];
  17754. [main][over] overlay=16:16 [out]
  17755. @end example
  17756. @item
  17757. Read from a video4linux2 device, and overlay it on top of the input
  17758. labelled "in":
  17759. @example
  17760. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17761. [in] setpts=PTS-STARTPTS [main];
  17762. [main][over] overlay=16:16 [out]
  17763. @end example
  17764. @item
  17765. Read the first video stream and the audio stream with id 0x81 from
  17766. dvd.vob; the video is connected to the pad named "video" and the audio is
  17767. connected to the pad named "audio":
  17768. @example
  17769. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17770. @end example
  17771. @end itemize
  17772. @subsection Commands
  17773. Both movie and amovie support the following commands:
  17774. @table @option
  17775. @item seek
  17776. Perform seek using "av_seek_frame".
  17777. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17778. @itemize
  17779. @item
  17780. @var{stream_index}: If stream_index is -1, a default
  17781. stream is selected, and @var{timestamp} is automatically converted
  17782. from AV_TIME_BASE units to the stream specific time_base.
  17783. @item
  17784. @var{timestamp}: Timestamp in AVStream.time_base units
  17785. or, if no stream is specified, in AV_TIME_BASE units.
  17786. @item
  17787. @var{flags}: Flags which select direction and seeking mode.
  17788. @end itemize
  17789. @item get_duration
  17790. Get movie duration in AV_TIME_BASE units.
  17791. @end table
  17792. @c man end MULTIMEDIA SOURCES