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.

20016 lines
530KB

  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. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @item k
  885. kHz
  886. @end table
  887. @item width, w
  888. Specify the band-width of a filter in width_type units.
  889. @item channels, c
  890. Specify which channels to filter, by default all available are filtered.
  891. @end table
  892. @subsection Commands
  893. This filter supports the following commands:
  894. @table @option
  895. @item frequency, f
  896. Change allpass frequency.
  897. Syntax for the command is : "@var{frequency}"
  898. @item width_type, t
  899. Change allpass width_type.
  900. Syntax for the command is : "@var{width_type}"
  901. @item width, w
  902. Change allpass width.
  903. Syntax for the command is : "@var{width}"
  904. @end table
  905. @section aloop
  906. Loop audio samples.
  907. The filter accepts the following options:
  908. @table @option
  909. @item loop
  910. Set the number of loops. Setting this value to -1 will result in infinite loops.
  911. Default is 0.
  912. @item size
  913. Set maximal number of samples. Default is 0.
  914. @item start
  915. Set first sample of loop. Default is 0.
  916. @end table
  917. @anchor{amerge}
  918. @section amerge
  919. Merge two or more audio streams into a single multi-channel stream.
  920. The filter accepts the following options:
  921. @table @option
  922. @item inputs
  923. Set the number of inputs. Default is 2.
  924. @end table
  925. If the channel layouts of the inputs are disjoint, and therefore compatible,
  926. the channel layout of the output will be set accordingly and the channels
  927. will be reordered as necessary. If the channel layouts of the inputs are not
  928. disjoint, the output will have all the channels of the first input then all
  929. the channels of the second input, in that order, and the channel layout of
  930. the output will be the default value corresponding to the total number of
  931. channels.
  932. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  933. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  934. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  935. first input, b1 is the first channel of the second input).
  936. On the other hand, if both input are in stereo, the output channels will be
  937. in the default order: a1, a2, b1, b2, and the channel layout will be
  938. arbitrarily set to 4.0, which may or may not be the expected value.
  939. All inputs must have the same sample rate, and format.
  940. If inputs do not have the same duration, the output will stop with the
  941. shortest.
  942. @subsection Examples
  943. @itemize
  944. @item
  945. Merge two mono files into a stereo stream:
  946. @example
  947. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  948. @end example
  949. @item
  950. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  951. @example
  952. 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
  953. @end example
  954. @end itemize
  955. @section amix
  956. Mixes multiple audio inputs into a single output.
  957. Note that this filter only supports float samples (the @var{amerge}
  958. and @var{pan} audio filters support many formats). If the @var{amix}
  959. input has integer samples then @ref{aresample} will be automatically
  960. inserted to perform the conversion to float samples.
  961. For example
  962. @example
  963. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  964. @end example
  965. will mix 3 input audio streams to a single output with the same duration as the
  966. first input and a dropout transition time of 3 seconds.
  967. It accepts the following parameters:
  968. @table @option
  969. @item inputs
  970. The number of inputs. If unspecified, it defaults to 2.
  971. @item duration
  972. How to determine the end-of-stream.
  973. @table @option
  974. @item longest
  975. The duration of the longest input. (default)
  976. @item shortest
  977. The duration of the shortest input.
  978. @item first
  979. The duration of the first input.
  980. @end table
  981. @item dropout_transition
  982. The transition time, in seconds, for volume renormalization when an input
  983. stream ends. The default value is 2 seconds.
  984. @end table
  985. @section anequalizer
  986. High-order parametric multiband equalizer for each channel.
  987. It accepts the following parameters:
  988. @table @option
  989. @item params
  990. This option string is in format:
  991. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  992. Each equalizer band is separated by '|'.
  993. @table @option
  994. @item chn
  995. Set channel number to which equalization will be applied.
  996. If input doesn't have that channel the entry is ignored.
  997. @item f
  998. Set central frequency for band.
  999. If input doesn't have that frequency the entry is ignored.
  1000. @item w
  1001. Set band width in hertz.
  1002. @item g
  1003. Set band gain in dB.
  1004. @item t
  1005. Set filter type for band, optional, can be:
  1006. @table @samp
  1007. @item 0
  1008. Butterworth, this is default.
  1009. @item 1
  1010. Chebyshev type 1.
  1011. @item 2
  1012. Chebyshev type 2.
  1013. @end table
  1014. @end table
  1015. @item curves
  1016. With this option activated frequency response of anequalizer is displayed
  1017. in video stream.
  1018. @item size
  1019. Set video stream size. Only useful if curves option is activated.
  1020. @item mgain
  1021. Set max gain that will be displayed. Only useful if curves option is activated.
  1022. Setting this to a reasonable value makes it possible to display gain which is derived from
  1023. neighbour bands which are too close to each other and thus produce higher gain
  1024. when both are activated.
  1025. @item fscale
  1026. Set frequency scale used to draw frequency response in video output.
  1027. Can be linear or logarithmic. Default is logarithmic.
  1028. @item colors
  1029. Set color for each channel curve which is going to be displayed in video stream.
  1030. This is list of color names separated by space or by '|'.
  1031. Unrecognised or missing colors will be replaced by white color.
  1032. @end table
  1033. @subsection Examples
  1034. @itemize
  1035. @item
  1036. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1037. for first 2 channels using Chebyshev type 1 filter:
  1038. @example
  1039. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1040. @end example
  1041. @end itemize
  1042. @subsection Commands
  1043. This filter supports the following commands:
  1044. @table @option
  1045. @item change
  1046. Alter existing filter parameters.
  1047. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1048. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1049. error is returned.
  1050. @var{freq} set new frequency parameter.
  1051. @var{width} set new width parameter in herz.
  1052. @var{gain} set new gain parameter in dB.
  1053. Full filter invocation with asendcmd may look like this:
  1054. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1055. @end table
  1056. @section anull
  1057. Pass the audio source unchanged to the output.
  1058. @section apad
  1059. Pad the end of an audio stream with silence.
  1060. This can be used together with @command{ffmpeg} @option{-shortest} to
  1061. extend audio streams to the same length as the video stream.
  1062. A description of the accepted options follows.
  1063. @table @option
  1064. @item packet_size
  1065. Set silence packet size. Default value is 4096.
  1066. @item pad_len
  1067. Set the number of samples of silence to add to the end. After the
  1068. value is reached, the stream is terminated. This option is mutually
  1069. exclusive with @option{whole_len}.
  1070. @item whole_len
  1071. Set the minimum total number of samples in the output audio stream. If
  1072. the value is longer than the input audio length, silence is added to
  1073. the end, until the value is reached. This option is mutually exclusive
  1074. with @option{pad_len}.
  1075. @end table
  1076. If neither the @option{pad_len} nor the @option{whole_len} option is
  1077. set, the filter will add silence to the end of the input stream
  1078. indefinitely.
  1079. @subsection Examples
  1080. @itemize
  1081. @item
  1082. Add 1024 samples of silence to the end of the input:
  1083. @example
  1084. apad=pad_len=1024
  1085. @end example
  1086. @item
  1087. Make sure the audio output will contain at least 10000 samples, pad
  1088. the input with silence if required:
  1089. @example
  1090. apad=whole_len=10000
  1091. @end example
  1092. @item
  1093. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1094. video stream will always result the shortest and will be converted
  1095. until the end in the output file when using the @option{shortest}
  1096. option:
  1097. @example
  1098. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1099. @end example
  1100. @end itemize
  1101. @section aphaser
  1102. Add a phasing effect to the input audio.
  1103. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1104. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1105. A description of the accepted parameters follows.
  1106. @table @option
  1107. @item in_gain
  1108. Set input gain. Default is 0.4.
  1109. @item out_gain
  1110. Set output gain. Default is 0.74
  1111. @item delay
  1112. Set delay in milliseconds. Default is 3.0.
  1113. @item decay
  1114. Set decay. Default is 0.4.
  1115. @item speed
  1116. Set modulation speed in Hz. Default is 0.5.
  1117. @item type
  1118. Set modulation type. Default is triangular.
  1119. It accepts the following values:
  1120. @table @samp
  1121. @item triangular, t
  1122. @item sinusoidal, s
  1123. @end table
  1124. @end table
  1125. @section apulsator
  1126. Audio pulsator is something between an autopanner and a tremolo.
  1127. But it can produce funny stereo effects as well. Pulsator changes the volume
  1128. of the left and right channel based on a LFO (low frequency oscillator) with
  1129. different waveforms and shifted phases.
  1130. This filter have the ability to define an offset between left and right
  1131. channel. An offset of 0 means that both LFO shapes match each other.
  1132. The left and right channel are altered equally - a conventional tremolo.
  1133. An offset of 50% means that the shape of the right channel is exactly shifted
  1134. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1135. an autopanner. At 1 both curves match again. Every setting in between moves the
  1136. phase shift gapless between all stages and produces some "bypassing" sounds with
  1137. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1138. the 0.5) the faster the signal passes from the left to the right speaker.
  1139. The filter accepts the following options:
  1140. @table @option
  1141. @item level_in
  1142. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1143. @item level_out
  1144. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1145. @item mode
  1146. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1147. sawup or sawdown. Default is sine.
  1148. @item amount
  1149. Set modulation. Define how much of original signal is affected by the LFO.
  1150. @item offset_l
  1151. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1152. @item offset_r
  1153. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1154. @item width
  1155. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1156. @item timing
  1157. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1158. @item bpm
  1159. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1160. is set to bpm.
  1161. @item ms
  1162. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1163. is set to ms.
  1164. @item hz
  1165. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1166. if timing is set to hz.
  1167. @end table
  1168. @anchor{aresample}
  1169. @section aresample
  1170. Resample the input audio to the specified parameters, using the
  1171. libswresample library. If none are specified then the filter will
  1172. automatically convert between its input and output.
  1173. This filter is also able to stretch/squeeze the audio data to make it match
  1174. the timestamps or to inject silence / cut out audio to make it match the
  1175. timestamps, do a combination of both or do neither.
  1176. The filter accepts the syntax
  1177. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1178. expresses a sample rate and @var{resampler_options} is a list of
  1179. @var{key}=@var{value} pairs, separated by ":". See the
  1180. @ref{Resampler Options,,the "Resampler Options" section in the
  1181. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1182. for the complete list of supported options.
  1183. @subsection Examples
  1184. @itemize
  1185. @item
  1186. Resample the input audio to 44100Hz:
  1187. @example
  1188. aresample=44100
  1189. @end example
  1190. @item
  1191. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1192. samples per second compensation:
  1193. @example
  1194. aresample=async=1000
  1195. @end example
  1196. @end itemize
  1197. @section areverse
  1198. Reverse an audio clip.
  1199. Warning: This filter requires memory to buffer the entire clip, so trimming
  1200. is suggested.
  1201. @subsection Examples
  1202. @itemize
  1203. @item
  1204. Take the first 5 seconds of a clip, and reverse it.
  1205. @example
  1206. atrim=end=5,areverse
  1207. @end example
  1208. @end itemize
  1209. @section asetnsamples
  1210. Set the number of samples per each output audio frame.
  1211. The last output packet may contain a different number of samples, as
  1212. the filter will flush all the remaining samples when the input audio
  1213. signals its end.
  1214. The filter accepts the following options:
  1215. @table @option
  1216. @item nb_out_samples, n
  1217. Set the number of frames per each output audio frame. The number is
  1218. intended as the number of samples @emph{per each channel}.
  1219. Default value is 1024.
  1220. @item pad, p
  1221. If set to 1, the filter will pad the last audio frame with zeroes, so
  1222. that the last frame will contain the same number of samples as the
  1223. previous ones. Default value is 1.
  1224. @end table
  1225. For example, to set the number of per-frame samples to 1234 and
  1226. disable padding for the last frame, use:
  1227. @example
  1228. asetnsamples=n=1234:p=0
  1229. @end example
  1230. @section asetrate
  1231. Set the sample rate without altering the PCM data.
  1232. This will result in a change of speed and pitch.
  1233. The filter accepts the following options:
  1234. @table @option
  1235. @item sample_rate, r
  1236. Set the output sample rate. Default is 44100 Hz.
  1237. @end table
  1238. @section ashowinfo
  1239. Show a line containing various information for each input audio frame.
  1240. The input audio is not modified.
  1241. The shown line contains a sequence of key/value pairs of the form
  1242. @var{key}:@var{value}.
  1243. The following values are shown in the output:
  1244. @table @option
  1245. @item n
  1246. The (sequential) number of the input frame, starting from 0.
  1247. @item pts
  1248. The presentation timestamp of the input frame, in time base units; the time base
  1249. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1250. @item pts_time
  1251. The presentation timestamp of the input frame in seconds.
  1252. @item pos
  1253. position of the frame in the input stream, -1 if this information in
  1254. unavailable and/or meaningless (for example in case of synthetic audio)
  1255. @item fmt
  1256. The sample format.
  1257. @item chlayout
  1258. The channel layout.
  1259. @item rate
  1260. The sample rate for the audio frame.
  1261. @item nb_samples
  1262. The number of samples (per channel) in the frame.
  1263. @item checksum
  1264. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1265. audio, the data is treated as if all the planes were concatenated.
  1266. @item plane_checksums
  1267. A list of Adler-32 checksums for each data plane.
  1268. @end table
  1269. @anchor{astats}
  1270. @section astats
  1271. Display time domain statistical information about the audio channels.
  1272. Statistics are calculated and displayed for each audio channel and,
  1273. where applicable, an overall figure is also given.
  1274. It accepts the following option:
  1275. @table @option
  1276. @item length
  1277. Short window length in seconds, used for peak and trough RMS measurement.
  1278. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1279. @item metadata
  1280. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1281. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1282. disabled.
  1283. Available keys for each channel are:
  1284. DC_offset
  1285. Min_level
  1286. Max_level
  1287. Min_difference
  1288. Max_difference
  1289. Mean_difference
  1290. RMS_difference
  1291. Peak_level
  1292. RMS_peak
  1293. RMS_trough
  1294. Crest_factor
  1295. Flat_factor
  1296. Peak_count
  1297. Bit_depth
  1298. Dynamic_range
  1299. and for Overall:
  1300. DC_offset
  1301. Min_level
  1302. Max_level
  1303. Min_difference
  1304. Max_difference
  1305. Mean_difference
  1306. RMS_difference
  1307. Peak_level
  1308. RMS_level
  1309. RMS_peak
  1310. RMS_trough
  1311. Flat_factor
  1312. Peak_count
  1313. Bit_depth
  1314. Number_of_samples
  1315. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1316. this @code{lavfi.astats.Overall.Peak_count}.
  1317. For description what each key means read below.
  1318. @item reset
  1319. Set number of frame after which stats are going to be recalculated.
  1320. Default is disabled.
  1321. @end table
  1322. A description of each shown parameter follows:
  1323. @table @option
  1324. @item DC offset
  1325. Mean amplitude displacement from zero.
  1326. @item Min level
  1327. Minimal sample level.
  1328. @item Max level
  1329. Maximal sample level.
  1330. @item Min difference
  1331. Minimal difference between two consecutive samples.
  1332. @item Max difference
  1333. Maximal difference between two consecutive samples.
  1334. @item Mean difference
  1335. Mean difference between two consecutive samples.
  1336. The average of each difference between two consecutive samples.
  1337. @item RMS difference
  1338. Root Mean Square difference between two consecutive samples.
  1339. @item Peak level dB
  1340. @item RMS level dB
  1341. Standard peak and RMS level measured in dBFS.
  1342. @item RMS peak dB
  1343. @item RMS trough dB
  1344. Peak and trough values for RMS level measured over a short window.
  1345. @item Crest factor
  1346. Standard ratio of peak to RMS level (note: not in dB).
  1347. @item Flat factor
  1348. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1349. (i.e. either @var{Min level} or @var{Max level}).
  1350. @item Peak count
  1351. Number of occasions (not the number of samples) that the signal attained either
  1352. @var{Min level} or @var{Max level}.
  1353. @item Bit depth
  1354. Overall bit depth of audio. Number of bits used for each sample.
  1355. @item Dynamic range
  1356. Measured dynamic range of audio in dB.
  1357. @end table
  1358. @section atempo
  1359. Adjust audio tempo.
  1360. The filter accepts exactly one parameter, the audio tempo. If not
  1361. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1362. be in the [0.5, 2.0] range.
  1363. @subsection Examples
  1364. @itemize
  1365. @item
  1366. Slow down audio to 80% tempo:
  1367. @example
  1368. atempo=0.8
  1369. @end example
  1370. @item
  1371. To speed up audio to 125% tempo:
  1372. @example
  1373. atempo=1.25
  1374. @end example
  1375. @end itemize
  1376. @section atrim
  1377. Trim the input so that the output contains one continuous subpart of the input.
  1378. It accepts the following parameters:
  1379. @table @option
  1380. @item start
  1381. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1382. sample with the timestamp @var{start} will be the first sample in the output.
  1383. @item end
  1384. Specify time of the first audio sample that will be dropped, i.e. the
  1385. audio sample immediately preceding the one with the timestamp @var{end} will be
  1386. the last sample in the output.
  1387. @item start_pts
  1388. Same as @var{start}, except this option sets the start timestamp in samples
  1389. instead of seconds.
  1390. @item end_pts
  1391. Same as @var{end}, except this option sets the end timestamp in samples instead
  1392. of seconds.
  1393. @item duration
  1394. The maximum duration of the output in seconds.
  1395. @item start_sample
  1396. The number of the first sample that should be output.
  1397. @item end_sample
  1398. The number of the first sample that should be dropped.
  1399. @end table
  1400. @option{start}, @option{end}, and @option{duration} are expressed as time
  1401. duration specifications; see
  1402. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1403. Note that the first two sets of the start/end options and the @option{duration}
  1404. option look at the frame timestamp, while the _sample options simply count the
  1405. samples that pass through the filter. So start/end_pts and start/end_sample will
  1406. give different results when the timestamps are wrong, inexact or do not start at
  1407. zero. Also note that this filter does not modify the timestamps. If you wish
  1408. to have the output timestamps start at zero, insert the asetpts filter after the
  1409. atrim filter.
  1410. If multiple start or end options are set, this filter tries to be greedy and
  1411. keep all samples that match at least one of the specified constraints. To keep
  1412. only the part that matches all the constraints at once, chain multiple atrim
  1413. filters.
  1414. The defaults are such that all the input is kept. So it is possible to set e.g.
  1415. just the end values to keep everything before the specified time.
  1416. Examples:
  1417. @itemize
  1418. @item
  1419. Drop everything except the second minute of input:
  1420. @example
  1421. ffmpeg -i INPUT -af atrim=60:120
  1422. @end example
  1423. @item
  1424. Keep only the first 1000 samples:
  1425. @example
  1426. ffmpeg -i INPUT -af atrim=end_sample=1000
  1427. @end example
  1428. @end itemize
  1429. @section bandpass
  1430. Apply a two-pole Butterworth band-pass filter with central
  1431. frequency @var{frequency}, and (3dB-point) band-width width.
  1432. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1433. instead of the default: constant 0dB peak gain.
  1434. The filter roll off at 6dB per octave (20dB per decade).
  1435. The filter accepts the following options:
  1436. @table @option
  1437. @item frequency, f
  1438. Set the filter's central frequency. Default is @code{3000}.
  1439. @item csg
  1440. Constant skirt gain if set to 1. Defaults to 0.
  1441. @item width_type, t
  1442. Set method to specify band-width of filter.
  1443. @table @option
  1444. @item h
  1445. Hz
  1446. @item q
  1447. Q-Factor
  1448. @item o
  1449. octave
  1450. @item s
  1451. slope
  1452. @item k
  1453. kHz
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @subsection Commands
  1461. This filter supports the following commands:
  1462. @table @option
  1463. @item frequency, f
  1464. Change bandpass frequency.
  1465. Syntax for the command is : "@var{frequency}"
  1466. @item width_type, t
  1467. Change bandpass width_type.
  1468. Syntax for the command is : "@var{width_type}"
  1469. @item width, w
  1470. Change bandpass width.
  1471. Syntax for the command is : "@var{width}"
  1472. @end table
  1473. @section bandreject
  1474. Apply a two-pole Butterworth band-reject filter with central
  1475. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1476. The filter roll off at 6dB per octave (20dB per decade).
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item frequency, f
  1480. Set the filter's central frequency. Default is @code{3000}.
  1481. @item width_type, t
  1482. Set method to specify band-width of filter.
  1483. @table @option
  1484. @item h
  1485. Hz
  1486. @item q
  1487. Q-Factor
  1488. @item o
  1489. octave
  1490. @item s
  1491. slope
  1492. @item k
  1493. kHz
  1494. @end table
  1495. @item width, w
  1496. Specify the band-width of a filter in width_type units.
  1497. @item channels, c
  1498. Specify which channels to filter, by default all available are filtered.
  1499. @end table
  1500. @subsection Commands
  1501. This filter supports the following commands:
  1502. @table @option
  1503. @item frequency, f
  1504. Change bandreject frequency.
  1505. Syntax for the command is : "@var{frequency}"
  1506. @item width_type, t
  1507. Change bandreject width_type.
  1508. Syntax for the command is : "@var{width_type}"
  1509. @item width, w
  1510. Change bandreject width.
  1511. Syntax for the command is : "@var{width}"
  1512. @end table
  1513. @section bass
  1514. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1515. shelving filter with a response similar to that of a standard
  1516. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1517. The filter accepts the following options:
  1518. @table @option
  1519. @item gain, g
  1520. Give the gain at 0 Hz. Its useful range is about -20
  1521. (for a large cut) to +20 (for a large boost).
  1522. Beware of clipping when using a positive gain.
  1523. @item frequency, f
  1524. Set the filter's central frequency and so can be used
  1525. to extend or reduce the frequency range to be boosted or cut.
  1526. The default value is @code{100} Hz.
  1527. @item width_type, t
  1528. Set method to specify band-width of filter.
  1529. @table @option
  1530. @item h
  1531. Hz
  1532. @item q
  1533. Q-Factor
  1534. @item o
  1535. octave
  1536. @item s
  1537. slope
  1538. @item k
  1539. kHz
  1540. @end table
  1541. @item width, w
  1542. Determine how steep is the filter's shelf transition.
  1543. @item channels, c
  1544. Specify which channels to filter, by default all available are filtered.
  1545. @end table
  1546. @subsection Commands
  1547. This filter supports the following commands:
  1548. @table @option
  1549. @item frequency, f
  1550. Change bass frequency.
  1551. Syntax for the command is : "@var{frequency}"
  1552. @item width_type, t
  1553. Change bass width_type.
  1554. Syntax for the command is : "@var{width_type}"
  1555. @item width, w
  1556. Change bass width.
  1557. Syntax for the command is : "@var{width}"
  1558. @item gain, g
  1559. Change bass gain.
  1560. Syntax for the command is : "@var{gain}"
  1561. @end table
  1562. @section biquad
  1563. Apply a biquad IIR filter with the given coefficients.
  1564. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1565. are the numerator and denominator coefficients respectively.
  1566. and @var{channels}, @var{c} specify which channels to filter, by default all
  1567. available are filtered.
  1568. @subsection Commands
  1569. This filter supports the following commands:
  1570. @table @option
  1571. @item a0
  1572. @item a1
  1573. @item a2
  1574. @item b0
  1575. @item b1
  1576. @item b2
  1577. Change biquad parameter.
  1578. Syntax for the command is : "@var{value}"
  1579. @end table
  1580. @section bs2b
  1581. Bauer stereo to binaural transformation, which improves headphone listening of
  1582. stereo audio records.
  1583. To enable compilation of this filter you need to configure FFmpeg with
  1584. @code{--enable-libbs2b}.
  1585. It accepts the following parameters:
  1586. @table @option
  1587. @item profile
  1588. Pre-defined crossfeed level.
  1589. @table @option
  1590. @item default
  1591. Default level (fcut=700, feed=50).
  1592. @item cmoy
  1593. Chu Moy circuit (fcut=700, feed=60).
  1594. @item jmeier
  1595. Jan Meier circuit (fcut=650, feed=95).
  1596. @end table
  1597. @item fcut
  1598. Cut frequency (in Hz).
  1599. @item feed
  1600. Feed level (in Hz).
  1601. @end table
  1602. @section channelmap
  1603. Remap input channels to new locations.
  1604. It accepts the following parameters:
  1605. @table @option
  1606. @item map
  1607. Map channels from input to output. The argument is a '|'-separated list of
  1608. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1609. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1610. channel (e.g. FL for front left) or its index in the input channel layout.
  1611. @var{out_channel} is the name of the output channel or its index in the output
  1612. channel layout. If @var{out_channel} is not given then it is implicitly an
  1613. index, starting with zero and increasing by one for each mapping.
  1614. @item channel_layout
  1615. The channel layout of the output stream.
  1616. @end table
  1617. If no mapping is present, the filter will implicitly map input channels to
  1618. output channels, preserving indices.
  1619. For example, assuming a 5.1+downmix input MOV file,
  1620. @example
  1621. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1622. @end example
  1623. will create an output WAV file tagged as stereo from the downmix channels of
  1624. the input.
  1625. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1626. @example
  1627. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1628. @end example
  1629. @section channelsplit
  1630. Split each channel from an input audio stream into a separate output stream.
  1631. It accepts the following parameters:
  1632. @table @option
  1633. @item channel_layout
  1634. The channel layout of the input stream. The default is "stereo".
  1635. @end table
  1636. For example, assuming a stereo input MP3 file,
  1637. @example
  1638. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1639. @end example
  1640. will create an output Matroska file with two audio streams, one containing only
  1641. the left channel and the other the right channel.
  1642. Split a 5.1 WAV file into per-channel files:
  1643. @example
  1644. ffmpeg -i in.wav -filter_complex
  1645. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1646. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1647. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1648. side_right.wav
  1649. @end example
  1650. @section chorus
  1651. Add a chorus effect to the audio.
  1652. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1653. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1654. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1655. The modulation depth defines the range the modulated delay is played before or after
  1656. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1657. sound tuned around the original one, like in a chorus where some vocals are slightly
  1658. off key.
  1659. It accepts the following parameters:
  1660. @table @option
  1661. @item in_gain
  1662. Set input gain. Default is 0.4.
  1663. @item out_gain
  1664. Set output gain. Default is 0.4.
  1665. @item delays
  1666. Set delays. A typical delay is around 40ms to 60ms.
  1667. @item decays
  1668. Set decays.
  1669. @item speeds
  1670. Set speeds.
  1671. @item depths
  1672. Set depths.
  1673. @end table
  1674. @subsection Examples
  1675. @itemize
  1676. @item
  1677. A single delay:
  1678. @example
  1679. chorus=0.7:0.9:55:0.4:0.25:2
  1680. @end example
  1681. @item
  1682. Two delays:
  1683. @example
  1684. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1685. @end example
  1686. @item
  1687. Fuller sounding chorus with three delays:
  1688. @example
  1689. 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
  1690. @end example
  1691. @end itemize
  1692. @section compand
  1693. Compress or expand the audio's dynamic range.
  1694. It accepts the following parameters:
  1695. @table @option
  1696. @item attacks
  1697. @item decays
  1698. A list of times in seconds for each channel over which the instantaneous level
  1699. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1700. increase of volume and @var{decays} refers to decrease of volume. For most
  1701. situations, the attack time (response to the audio getting louder) should be
  1702. shorter than the decay time, because the human ear is more sensitive to sudden
  1703. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1704. a typical value for decay is 0.8 seconds.
  1705. If specified number of attacks & decays is lower than number of channels, the last
  1706. set attack/decay will be used for all remaining channels.
  1707. @item points
  1708. A list of points for the transfer function, specified in dB relative to the
  1709. maximum possible signal amplitude. Each key points list must be defined using
  1710. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1711. @code{x0/y0 x1/y1 x2/y2 ....}
  1712. The input values must be in strictly increasing order but the transfer function
  1713. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1714. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1715. function are @code{-70/-70|-60/-20|1/0}.
  1716. @item soft-knee
  1717. Set the curve radius in dB for all joints. It defaults to 0.01.
  1718. @item gain
  1719. Set the additional gain in dB to be applied at all points on the transfer
  1720. function. This allows for easy adjustment of the overall gain.
  1721. It defaults to 0.
  1722. @item volume
  1723. Set an initial volume, in dB, to be assumed for each channel when filtering
  1724. starts. This permits the user to supply a nominal level initially, so that, for
  1725. example, a very large gain is not applied to initial signal levels before the
  1726. companding has begun to operate. A typical value for audio which is initially
  1727. quiet is -90 dB. It defaults to 0.
  1728. @item delay
  1729. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1730. delayed before being fed to the volume adjuster. Specifying a delay
  1731. approximately equal to the attack/decay times allows the filter to effectively
  1732. operate in predictive rather than reactive mode. It defaults to 0.
  1733. @end table
  1734. @subsection Examples
  1735. @itemize
  1736. @item
  1737. Make music with both quiet and loud passages suitable for listening to in a
  1738. noisy environment:
  1739. @example
  1740. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1741. @end example
  1742. Another example for audio with whisper and explosion parts:
  1743. @example
  1744. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1745. @end example
  1746. @item
  1747. A noise gate for when the noise is at a lower level than the signal:
  1748. @example
  1749. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1750. @end example
  1751. @item
  1752. Here is another noise gate, this time for when the noise is at a higher level
  1753. than the signal (making it, in some ways, similar to squelch):
  1754. @example
  1755. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1756. @end example
  1757. @item
  1758. 2:1 compression starting at -6dB:
  1759. @example
  1760. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1761. @end example
  1762. @item
  1763. 2:1 compression starting at -9dB:
  1764. @example
  1765. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1766. @end example
  1767. @item
  1768. 2:1 compression starting at -12dB:
  1769. @example
  1770. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1771. @end example
  1772. @item
  1773. 2:1 compression starting at -18dB:
  1774. @example
  1775. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1776. @end example
  1777. @item
  1778. 3:1 compression starting at -15dB:
  1779. @example
  1780. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1781. @end example
  1782. @item
  1783. Compressor/Gate:
  1784. @example
  1785. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1786. @end example
  1787. @item
  1788. Expander:
  1789. @example
  1790. 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
  1791. @end example
  1792. @item
  1793. Hard limiter at -6dB:
  1794. @example
  1795. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1796. @end example
  1797. @item
  1798. Hard limiter at -12dB:
  1799. @example
  1800. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1801. @end example
  1802. @item
  1803. Hard noise gate at -35 dB:
  1804. @example
  1805. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1806. @end example
  1807. @item
  1808. Soft limiter:
  1809. @example
  1810. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1811. @end example
  1812. @end itemize
  1813. @section compensationdelay
  1814. Compensation Delay Line is a metric based delay to compensate differing
  1815. positions of microphones or speakers.
  1816. For example, you have recorded guitar with two microphones placed in
  1817. different location. Because the front of sound wave has fixed speed in
  1818. normal conditions, the phasing of microphones can vary and depends on
  1819. their location and interposition. The best sound mix can be achieved when
  1820. these microphones are in phase (synchronized). Note that distance of
  1821. ~30 cm between microphones makes one microphone to capture signal in
  1822. antiphase to another microphone. That makes the final mix sounding moody.
  1823. This filter helps to solve phasing problems by adding different delays
  1824. to each microphone track and make them synchronized.
  1825. The best result can be reached when you take one track as base and
  1826. synchronize other tracks one by one with it.
  1827. Remember that synchronization/delay tolerance depends on sample rate, too.
  1828. Higher sample rates will give more tolerance.
  1829. It accepts the following parameters:
  1830. @table @option
  1831. @item mm
  1832. Set millimeters distance. This is compensation distance for fine tuning.
  1833. Default is 0.
  1834. @item cm
  1835. Set cm distance. This is compensation distance for tightening distance setup.
  1836. Default is 0.
  1837. @item m
  1838. Set meters distance. This is compensation distance for hard distance setup.
  1839. Default is 0.
  1840. @item dry
  1841. Set dry amount. Amount of unprocessed (dry) signal.
  1842. Default is 0.
  1843. @item wet
  1844. Set wet amount. Amount of processed (wet) signal.
  1845. Default is 1.
  1846. @item temp
  1847. Set temperature degree in Celsius. This is the temperature of the environment.
  1848. Default is 20.
  1849. @end table
  1850. @section crossfeed
  1851. Apply headphone crossfeed filter.
  1852. Crossfeed is the process of blending the left and right channels of stereo
  1853. audio recording.
  1854. It is mainly used to reduce extreme stereo separation of low frequencies.
  1855. The intent is to produce more speaker like sound to the listener.
  1856. The filter accepts the following options:
  1857. @table @option
  1858. @item strength
  1859. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1860. This sets gain of low shelf filter for side part of stereo image.
  1861. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1862. @item range
  1863. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1864. This sets cut off frequency of low shelf filter. Default is cut off near
  1865. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1866. @item level_in
  1867. Set input gain. Default is 0.9.
  1868. @item level_out
  1869. Set output gain. Default is 1.
  1870. @end table
  1871. @section crystalizer
  1872. Simple algorithm to expand audio dynamic range.
  1873. The filter accepts the following options:
  1874. @table @option
  1875. @item i
  1876. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1877. (unchanged sound) to 10.0 (maximum effect).
  1878. @item c
  1879. Enable clipping. By default is enabled.
  1880. @end table
  1881. @section dcshift
  1882. Apply a DC shift to the audio.
  1883. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1884. in the recording chain) from the audio. The effect of a DC offset is reduced
  1885. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1886. a signal has a DC offset.
  1887. @table @option
  1888. @item shift
  1889. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1890. the audio.
  1891. @item limitergain
  1892. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1893. used to prevent clipping.
  1894. @end table
  1895. @section dynaudnorm
  1896. Dynamic Audio Normalizer.
  1897. This filter applies a certain amount of gain to the input audio in order
  1898. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1899. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1900. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1901. This allows for applying extra gain to the "quiet" sections of the audio
  1902. while avoiding distortions or clipping the "loud" sections. In other words:
  1903. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1904. sections, in the sense that the volume of each section is brought to the
  1905. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1906. this goal *without* applying "dynamic range compressing". It will retain 100%
  1907. of the dynamic range *within* each section of the audio file.
  1908. @table @option
  1909. @item f
  1910. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1911. Default is 500 milliseconds.
  1912. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1913. referred to as frames. This is required, because a peak magnitude has no
  1914. meaning for just a single sample value. Instead, we need to determine the
  1915. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1916. normalizer would simply use the peak magnitude of the complete file, the
  1917. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1918. frame. The length of a frame is specified in milliseconds. By default, the
  1919. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1920. been found to give good results with most files.
  1921. Note that the exact frame length, in number of samples, will be determined
  1922. automatically, based on the sampling rate of the individual input audio file.
  1923. @item g
  1924. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1925. number. Default is 31.
  1926. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1927. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1928. is specified in frames, centered around the current frame. For the sake of
  1929. simplicity, this must be an odd number. Consequently, the default value of 31
  1930. takes into account the current frame, as well as the 15 preceding frames and
  1931. the 15 subsequent frames. Using a larger window results in a stronger
  1932. smoothing effect and thus in less gain variation, i.e. slower gain
  1933. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1934. effect and thus in more gain variation, i.e. faster gain adaptation.
  1935. In other words, the more you increase this value, the more the Dynamic Audio
  1936. Normalizer will behave like a "traditional" normalization filter. On the
  1937. contrary, the more you decrease this value, the more the Dynamic Audio
  1938. Normalizer will behave like a dynamic range compressor.
  1939. @item p
  1940. Set the target peak value. This specifies the highest permissible magnitude
  1941. level for the normalized audio input. This filter will try to approach the
  1942. target peak magnitude as closely as possible, but at the same time it also
  1943. makes sure that the normalized signal will never exceed the peak magnitude.
  1944. A frame's maximum local gain factor is imposed directly by the target peak
  1945. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1946. It is not recommended to go above this value.
  1947. @item m
  1948. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1949. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1950. factor for each input frame, i.e. the maximum gain factor that does not
  1951. result in clipping or distortion. The maximum gain factor is determined by
  1952. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1953. additionally bounds the frame's maximum gain factor by a predetermined
  1954. (global) maximum gain factor. This is done in order to avoid excessive gain
  1955. factors in "silent" or almost silent frames. By default, the maximum gain
  1956. factor is 10.0, For most inputs the default value should be sufficient and
  1957. it usually is not recommended to increase this value. Though, for input
  1958. with an extremely low overall volume level, it may be necessary to allow even
  1959. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1960. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1961. Instead, a "sigmoid" threshold function will be applied. This way, the
  1962. gain factors will smoothly approach the threshold value, but never exceed that
  1963. value.
  1964. @item r
  1965. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1966. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1967. This means that the maximum local gain factor for each frame is defined
  1968. (only) by the frame's highest magnitude sample. This way, the samples can
  1969. be amplified as much as possible without exceeding the maximum signal
  1970. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1971. Normalizer can also take into account the frame's root mean square,
  1972. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1973. determine the power of a time-varying signal. It is therefore considered
  1974. that the RMS is a better approximation of the "perceived loudness" than
  1975. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1976. frames to a constant RMS value, a uniform "perceived loudness" can be
  1977. established. If a target RMS value has been specified, a frame's local gain
  1978. factor is defined as the factor that would result in exactly that RMS value.
  1979. Note, however, that the maximum local gain factor is still restricted by the
  1980. frame's highest magnitude sample, in order to prevent clipping.
  1981. @item n
  1982. Enable channels coupling. By default is enabled.
  1983. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1984. amount. This means the same gain factor will be applied to all channels, i.e.
  1985. the maximum possible gain factor is determined by the "loudest" channel.
  1986. However, in some recordings, it may happen that the volume of the different
  1987. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1988. In this case, this option can be used to disable the channel coupling. This way,
  1989. the gain factor will be determined independently for each channel, depending
  1990. only on the individual channel's highest magnitude sample. This allows for
  1991. harmonizing the volume of the different channels.
  1992. @item c
  1993. Enable DC bias correction. By default is disabled.
  1994. An audio signal (in the time domain) is a sequence of sample values.
  1995. In the Dynamic Audio Normalizer these sample values are represented in the
  1996. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1997. audio signal, or "waveform", should be centered around the zero point.
  1998. That means if we calculate the mean value of all samples in a file, or in a
  1999. single frame, then the result should be 0.0 or at least very close to that
  2000. value. If, however, there is a significant deviation of the mean value from
  2001. 0.0, in either positive or negative direction, this is referred to as a
  2002. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2003. Audio Normalizer provides optional DC bias correction.
  2004. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2005. the mean value, or "DC correction" offset, of each input frame and subtract
  2006. that value from all of the frame's sample values which ensures those samples
  2007. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2008. boundaries, the DC correction offset values will be interpolated smoothly
  2009. between neighbouring frames.
  2010. @item b
  2011. Enable alternative boundary mode. By default is disabled.
  2012. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2013. around each frame. This includes the preceding frames as well as the
  2014. subsequent frames. However, for the "boundary" frames, located at the very
  2015. beginning and at the very end of the audio file, not all neighbouring
  2016. frames are available. In particular, for the first few frames in the audio
  2017. file, the preceding frames are not known. And, similarly, for the last few
  2018. frames in the audio file, the subsequent frames are not known. Thus, the
  2019. question arises which gain factors should be assumed for the missing frames
  2020. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2021. to deal with this situation. The default boundary mode assumes a gain factor
  2022. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2023. "fade out" at the beginning and at the end of the input, respectively.
  2024. @item s
  2025. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2026. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2027. compression. This means that signal peaks will not be pruned and thus the
  2028. full dynamic range will be retained within each local neighbourhood. However,
  2029. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2030. normalization algorithm with a more "traditional" compression.
  2031. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2032. (thresholding) function. If (and only if) the compression feature is enabled,
  2033. all input frames will be processed by a soft knee thresholding function prior
  2034. to the actual normalization process. Put simply, the thresholding function is
  2035. going to prune all samples whose magnitude exceeds a certain threshold value.
  2036. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2037. value. Instead, the threshold value will be adjusted for each individual
  2038. frame.
  2039. In general, smaller parameters result in stronger compression, and vice versa.
  2040. Values below 3.0 are not recommended, because audible distortion may appear.
  2041. @end table
  2042. @section earwax
  2043. Make audio easier to listen to on headphones.
  2044. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2045. so that when listened to on headphones the stereo image is moved from
  2046. inside your head (standard for headphones) to outside and in front of
  2047. the listener (standard for speakers).
  2048. Ported from SoX.
  2049. @section equalizer
  2050. Apply a two-pole peaking equalisation (EQ) filter. With this
  2051. filter, the signal-level at and around a selected frequency can
  2052. be increased or decreased, whilst (unlike bandpass and bandreject
  2053. filters) that at all other frequencies is unchanged.
  2054. In order to produce complex equalisation curves, this filter can
  2055. be given several times, each with a different central frequency.
  2056. The filter accepts the following options:
  2057. @table @option
  2058. @item frequency, f
  2059. Set the filter's central frequency in Hz.
  2060. @item width_type, t
  2061. Set method to specify band-width of filter.
  2062. @table @option
  2063. @item h
  2064. Hz
  2065. @item q
  2066. Q-Factor
  2067. @item o
  2068. octave
  2069. @item s
  2070. slope
  2071. @item k
  2072. kHz
  2073. @end table
  2074. @item width, w
  2075. Specify the band-width of a filter in width_type units.
  2076. @item gain, g
  2077. Set the required gain or attenuation in dB.
  2078. Beware of clipping when using a positive gain.
  2079. @item channels, c
  2080. Specify which channels to filter, by default all available are filtered.
  2081. @end table
  2082. @subsection Examples
  2083. @itemize
  2084. @item
  2085. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2086. @example
  2087. equalizer=f=1000:t=h:width=200:g=-10
  2088. @end example
  2089. @item
  2090. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2091. @example
  2092. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2093. @end example
  2094. @end itemize
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change equalizer frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change equalizer width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change equalizer width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change equalizer gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @end table
  2111. @section extrastereo
  2112. Linearly increases the difference between left and right channels which
  2113. adds some sort of "live" effect to playback.
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item m
  2117. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2118. (average of both channels), with 1.0 sound will be unchanged, with
  2119. -1.0 left and right channels will be swapped.
  2120. @item c
  2121. Enable clipping. By default is enabled.
  2122. @end table
  2123. @section firequalizer
  2124. Apply FIR Equalization using arbitrary frequency response.
  2125. The filter accepts the following option:
  2126. @table @option
  2127. @item gain
  2128. Set gain curve equation (in dB). The expression can contain variables:
  2129. @table @option
  2130. @item f
  2131. the evaluated frequency
  2132. @item sr
  2133. sample rate
  2134. @item ch
  2135. channel number, set to 0 when multichannels evaluation is disabled
  2136. @item chid
  2137. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2138. multichannels evaluation is disabled
  2139. @item chs
  2140. number of channels
  2141. @item chlayout
  2142. channel_layout, see libavutil/channel_layout.h
  2143. @end table
  2144. and functions:
  2145. @table @option
  2146. @item gain_interpolate(f)
  2147. interpolate gain on frequency f based on gain_entry
  2148. @item cubic_interpolate(f)
  2149. same as gain_interpolate, but smoother
  2150. @end table
  2151. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2152. @item gain_entry
  2153. Set gain entry for gain_interpolate function. The expression can
  2154. contain functions:
  2155. @table @option
  2156. @item entry(f, g)
  2157. store gain entry at frequency f with value g
  2158. @end table
  2159. This option is also available as command.
  2160. @item delay
  2161. Set filter delay in seconds. Higher value means more accurate.
  2162. Default is @code{0.01}.
  2163. @item accuracy
  2164. Set filter accuracy in Hz. Lower value means more accurate.
  2165. Default is @code{5}.
  2166. @item wfunc
  2167. Set window function. Acceptable values are:
  2168. @table @option
  2169. @item rectangular
  2170. rectangular window, useful when gain curve is already smooth
  2171. @item hann
  2172. hann window (default)
  2173. @item hamming
  2174. hamming window
  2175. @item blackman
  2176. blackman window
  2177. @item nuttall3
  2178. 3-terms continuous 1st derivative nuttall window
  2179. @item mnuttall3
  2180. minimum 3-terms discontinuous nuttall window
  2181. @item nuttall
  2182. 4-terms continuous 1st derivative nuttall window
  2183. @item bnuttall
  2184. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2185. @item bharris
  2186. blackman-harris window
  2187. @item tukey
  2188. tukey window
  2189. @end table
  2190. @item fixed
  2191. If enabled, use fixed number of audio samples. This improves speed when
  2192. filtering with large delay. Default is disabled.
  2193. @item multi
  2194. Enable multichannels evaluation on gain. Default is disabled.
  2195. @item zero_phase
  2196. Enable zero phase mode by subtracting timestamp to compensate delay.
  2197. Default is disabled.
  2198. @item scale
  2199. Set scale used by gain. Acceptable values are:
  2200. @table @option
  2201. @item linlin
  2202. linear frequency, linear gain
  2203. @item linlog
  2204. linear frequency, logarithmic (in dB) gain (default)
  2205. @item loglin
  2206. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2207. @item loglog
  2208. logarithmic frequency, logarithmic gain
  2209. @end table
  2210. @item dumpfile
  2211. Set file for dumping, suitable for gnuplot.
  2212. @item dumpscale
  2213. Set scale for dumpfile. Acceptable values are same with scale option.
  2214. Default is linlog.
  2215. @item fft2
  2216. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2217. Default is disabled.
  2218. @item min_phase
  2219. Enable minimum phase impulse response. Default is disabled.
  2220. @end table
  2221. @subsection Examples
  2222. @itemize
  2223. @item
  2224. lowpass at 1000 Hz:
  2225. @example
  2226. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2227. @end example
  2228. @item
  2229. lowpass at 1000 Hz with gain_entry:
  2230. @example
  2231. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2232. @end example
  2233. @item
  2234. custom equalization:
  2235. @example
  2236. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2237. @end example
  2238. @item
  2239. higher delay with zero phase to compensate delay:
  2240. @example
  2241. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2242. @end example
  2243. @item
  2244. lowpass on left channel, highpass on right channel:
  2245. @example
  2246. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2247. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2248. @end example
  2249. @end itemize
  2250. @section flanger
  2251. Apply a flanging effect to the audio.
  2252. The filter accepts the following options:
  2253. @table @option
  2254. @item delay
  2255. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2256. @item depth
  2257. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2258. @item regen
  2259. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2260. Default value is 0.
  2261. @item width
  2262. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2263. Default value is 71.
  2264. @item speed
  2265. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2266. @item shape
  2267. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2268. Default value is @var{sinusoidal}.
  2269. @item phase
  2270. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2271. Default value is 25.
  2272. @item interp
  2273. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2274. Default is @var{linear}.
  2275. @end table
  2276. @section haas
  2277. Apply Haas effect to audio.
  2278. Note that this makes most sense to apply on mono signals.
  2279. With this filter applied to mono signals it give some directionality and
  2280. stretches its stereo image.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item level_in
  2284. Set input level. By default is @var{1}, or 0dB
  2285. @item level_out
  2286. Set output level. By default is @var{1}, or 0dB.
  2287. @item side_gain
  2288. Set gain applied to side part of signal. By default is @var{1}.
  2289. @item middle_source
  2290. Set kind of middle source. Can be one of the following:
  2291. @table @samp
  2292. @item left
  2293. Pick left channel.
  2294. @item right
  2295. Pick right channel.
  2296. @item mid
  2297. Pick middle part signal of stereo image.
  2298. @item side
  2299. Pick side part signal of stereo image.
  2300. @end table
  2301. @item middle_phase
  2302. Change middle phase. By default is disabled.
  2303. @item left_delay
  2304. Set left channel delay. By default is @var{2.05} milliseconds.
  2305. @item left_balance
  2306. Set left channel balance. By default is @var{-1}.
  2307. @item left_gain
  2308. Set left channel gain. By default is @var{1}.
  2309. @item left_phase
  2310. Change left phase. By default is disabled.
  2311. @item right_delay
  2312. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2313. @item right_balance
  2314. Set right channel balance. By default is @var{1}.
  2315. @item right_gain
  2316. Set right channel gain. By default is @var{1}.
  2317. @item right_phase
  2318. Change right phase. By default is enabled.
  2319. @end table
  2320. @section hdcd
  2321. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2322. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2323. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2324. of HDCD, and detects the Transient Filter flag.
  2325. @example
  2326. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2327. @end example
  2328. When using the filter with wav, note the default encoding for wav is 16-bit,
  2329. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2330. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2331. @example
  2332. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2333. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2334. @end example
  2335. The filter accepts the following options:
  2336. @table @option
  2337. @item disable_autoconvert
  2338. Disable any automatic format conversion or resampling in the filter graph.
  2339. @item process_stereo
  2340. Process the stereo channels together. If target_gain does not match between
  2341. channels, consider it invalid and use the last valid target_gain.
  2342. @item cdt_ms
  2343. Set the code detect timer period in ms.
  2344. @item force_pe
  2345. Always extend peaks above -3dBFS even if PE isn't signaled.
  2346. @item analyze_mode
  2347. Replace audio with a solid tone and adjust the amplitude to signal some
  2348. specific aspect of the decoding process. The output file can be loaded in
  2349. an audio editor alongside the original to aid analysis.
  2350. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2351. Modes are:
  2352. @table @samp
  2353. @item 0, off
  2354. Disabled
  2355. @item 1, lle
  2356. Gain adjustment level at each sample
  2357. @item 2, pe
  2358. Samples where peak extend occurs
  2359. @item 3, cdt
  2360. Samples where the code detect timer is active
  2361. @item 4, tgm
  2362. Samples where the target gain does not match between channels
  2363. @end table
  2364. @end table
  2365. @section headphone
  2366. Apply head-related transfer functions (HRTFs) to create virtual
  2367. loudspeakers around the user for binaural listening via headphones.
  2368. The HRIRs are provided via additional streams, for each channel
  2369. one stereo input stream is needed.
  2370. The filter accepts the following options:
  2371. @table @option
  2372. @item map
  2373. Set mapping of input streams for convolution.
  2374. The argument is a '|'-separated list of channel names in order as they
  2375. are given as additional stream inputs for filter.
  2376. This also specify number of input streams. Number of input streams
  2377. must be not less than number of channels in first stream plus one.
  2378. @item gain
  2379. Set gain applied to audio. Value is in dB. Default is 0.
  2380. @item type
  2381. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2382. processing audio in time domain which is slow.
  2383. @var{freq} is processing audio in frequency domain which is fast.
  2384. Default is @var{freq}.
  2385. @item lfe
  2386. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2387. @end table
  2388. @subsection Examples
  2389. @itemize
  2390. @item
  2391. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2392. each amovie filter use stereo file with IR coefficients as input.
  2393. The files give coefficients for each position of virtual loudspeaker:
  2394. @example
  2395. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2396. output.wav
  2397. @end example
  2398. @end itemize
  2399. @section highpass
  2400. Apply a high-pass filter with 3dB point frequency.
  2401. The filter can be either single-pole, or double-pole (the default).
  2402. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2403. The filter accepts the following options:
  2404. @table @option
  2405. @item frequency, f
  2406. Set frequency in Hz. Default is 3000.
  2407. @item poles, p
  2408. Set number of poles. Default is 2.
  2409. @item width_type, t
  2410. Set method to specify band-width of filter.
  2411. @table @option
  2412. @item h
  2413. Hz
  2414. @item q
  2415. Q-Factor
  2416. @item o
  2417. octave
  2418. @item s
  2419. slope
  2420. @item k
  2421. kHz
  2422. @end table
  2423. @item width, w
  2424. Specify the band-width of a filter in width_type units.
  2425. Applies only to double-pole filter.
  2426. The default is 0.707q and gives a Butterworth response.
  2427. @item channels, c
  2428. Specify which channels to filter, by default all available are filtered.
  2429. @end table
  2430. @subsection Commands
  2431. This filter supports the following commands:
  2432. @table @option
  2433. @item frequency, f
  2434. Change highpass frequency.
  2435. Syntax for the command is : "@var{frequency}"
  2436. @item width_type, t
  2437. Change highpass width_type.
  2438. Syntax for the command is : "@var{width_type}"
  2439. @item width, w
  2440. Change highpass width.
  2441. Syntax for the command is : "@var{width}"
  2442. @end table
  2443. @section join
  2444. Join multiple input streams into one multi-channel stream.
  2445. It accepts the following parameters:
  2446. @table @option
  2447. @item inputs
  2448. The number of input streams. It defaults to 2.
  2449. @item channel_layout
  2450. The desired output channel layout. It defaults to stereo.
  2451. @item map
  2452. Map channels from inputs to output. The argument is a '|'-separated list of
  2453. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2454. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2455. can be either the name of the input channel (e.g. FL for front left) or its
  2456. index in the specified input stream. @var{out_channel} is the name of the output
  2457. channel.
  2458. @end table
  2459. The filter will attempt to guess the mappings when they are not specified
  2460. explicitly. It does so by first trying to find an unused matching input channel
  2461. and if that fails it picks the first unused input channel.
  2462. Join 3 inputs (with properly set channel layouts):
  2463. @example
  2464. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2465. @end example
  2466. Build a 5.1 output from 6 single-channel streams:
  2467. @example
  2468. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2469. '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'
  2470. out
  2471. @end example
  2472. @section ladspa
  2473. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2474. To enable compilation of this filter you need to configure FFmpeg with
  2475. @code{--enable-ladspa}.
  2476. @table @option
  2477. @item file, f
  2478. Specifies the name of LADSPA plugin library to load. If the environment
  2479. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2480. each one of the directories specified by the colon separated list in
  2481. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2482. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2483. @file{/usr/lib/ladspa/}.
  2484. @item plugin, p
  2485. Specifies the plugin within the library. Some libraries contain only
  2486. one plugin, but others contain many of them. If this is not set filter
  2487. will list all available plugins within the specified library.
  2488. @item controls, c
  2489. Set the '|' separated list of controls which are zero or more floating point
  2490. values that determine the behavior of the loaded plugin (for example delay,
  2491. threshold or gain).
  2492. Controls need to be defined using the following syntax:
  2493. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2494. @var{valuei} is the value set on the @var{i}-th control.
  2495. Alternatively they can be also defined using the following syntax:
  2496. @var{value0}|@var{value1}|@var{value2}|..., where
  2497. @var{valuei} is the value set on the @var{i}-th control.
  2498. If @option{controls} is set to @code{help}, all available controls and
  2499. their valid ranges are printed.
  2500. @item sample_rate, s
  2501. Specify the sample rate, default to 44100. Only used if plugin have
  2502. zero inputs.
  2503. @item nb_samples, n
  2504. Set the number of samples per channel per each output frame, default
  2505. is 1024. Only used if plugin have zero inputs.
  2506. @item duration, d
  2507. Set the minimum duration of the sourced audio. See
  2508. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2509. for the accepted syntax.
  2510. Note that the resulting duration may be greater than the specified duration,
  2511. as the generated audio is always cut at the end of a complete frame.
  2512. If not specified, or the expressed duration is negative, the audio is
  2513. supposed to be generated forever.
  2514. Only used if plugin have zero inputs.
  2515. @end table
  2516. @subsection Examples
  2517. @itemize
  2518. @item
  2519. List all available plugins within amp (LADSPA example plugin) library:
  2520. @example
  2521. ladspa=file=amp
  2522. @end example
  2523. @item
  2524. List all available controls and their valid ranges for @code{vcf_notch}
  2525. plugin from @code{VCF} library:
  2526. @example
  2527. ladspa=f=vcf:p=vcf_notch:c=help
  2528. @end example
  2529. @item
  2530. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2531. plugin library:
  2532. @example
  2533. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2534. @end example
  2535. @item
  2536. Add reverberation to the audio using TAP-plugins
  2537. (Tom's Audio Processing plugins):
  2538. @example
  2539. ladspa=file=tap_reverb:tap_reverb
  2540. @end example
  2541. @item
  2542. Generate white noise, with 0.2 amplitude:
  2543. @example
  2544. ladspa=file=cmt:noise_source_white:c=c0=.2
  2545. @end example
  2546. @item
  2547. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2548. @code{C* Audio Plugin Suite} (CAPS) library:
  2549. @example
  2550. ladspa=file=caps:Click:c=c1=20'
  2551. @end example
  2552. @item
  2553. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2554. @example
  2555. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2556. @end example
  2557. @item
  2558. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2559. @code{SWH Plugins} collection:
  2560. @example
  2561. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2562. @end example
  2563. @item
  2564. Attenuate low frequencies using Multiband EQ from Steve Harris
  2565. @code{SWH Plugins} collection:
  2566. @example
  2567. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2568. @end example
  2569. @item
  2570. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2571. (CAPS) library:
  2572. @example
  2573. ladspa=caps:Narrower
  2574. @end example
  2575. @item
  2576. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2577. @example
  2578. ladspa=caps:White:.2
  2579. @end example
  2580. @item
  2581. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2582. @example
  2583. ladspa=caps:Fractal:c=c1=1
  2584. @end example
  2585. @item
  2586. Dynamic volume normalization using @code{VLevel} plugin:
  2587. @example
  2588. ladspa=vlevel-ladspa:vlevel_mono
  2589. @end example
  2590. @end itemize
  2591. @subsection Commands
  2592. This filter supports the following commands:
  2593. @table @option
  2594. @item cN
  2595. Modify the @var{N}-th control value.
  2596. If the specified value is not valid, it is ignored and prior one is kept.
  2597. @end table
  2598. @section loudnorm
  2599. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2600. Support for both single pass (livestreams, files) and double pass (files) modes.
  2601. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2602. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2603. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2604. The filter accepts the following options:
  2605. @table @option
  2606. @item I, i
  2607. Set integrated loudness target.
  2608. Range is -70.0 - -5.0. Default value is -24.0.
  2609. @item LRA, lra
  2610. Set loudness range target.
  2611. Range is 1.0 - 20.0. Default value is 7.0.
  2612. @item TP, tp
  2613. Set maximum true peak.
  2614. Range is -9.0 - +0.0. Default value is -2.0.
  2615. @item measured_I, measured_i
  2616. Measured IL of input file.
  2617. Range is -99.0 - +0.0.
  2618. @item measured_LRA, measured_lra
  2619. Measured LRA of input file.
  2620. Range is 0.0 - 99.0.
  2621. @item measured_TP, measured_tp
  2622. Measured true peak of input file.
  2623. Range is -99.0 - +99.0.
  2624. @item measured_thresh
  2625. Measured threshold of input file.
  2626. Range is -99.0 - +0.0.
  2627. @item offset
  2628. Set offset gain. Gain is applied before the true-peak limiter.
  2629. Range is -99.0 - +99.0. Default is +0.0.
  2630. @item linear
  2631. Normalize linearly if possible.
  2632. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2633. to be specified in order to use this mode.
  2634. Options are true or false. Default is true.
  2635. @item dual_mono
  2636. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2637. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2638. If set to @code{true}, this option will compensate for this effect.
  2639. Multi-channel input files are not affected by this option.
  2640. Options are true or false. Default is false.
  2641. @item print_format
  2642. Set print format for stats. Options are summary, json, or none.
  2643. Default value is none.
  2644. @end table
  2645. @section lowpass
  2646. Apply a low-pass filter with 3dB point frequency.
  2647. The filter can be either single-pole or double-pole (the default).
  2648. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item frequency, f
  2652. Set frequency in Hz. Default is 500.
  2653. @item poles, p
  2654. Set number of poles. Default is 2.
  2655. @item width_type, t
  2656. Set method to specify band-width of filter.
  2657. @table @option
  2658. @item h
  2659. Hz
  2660. @item q
  2661. Q-Factor
  2662. @item o
  2663. octave
  2664. @item s
  2665. slope
  2666. @item k
  2667. kHz
  2668. @end table
  2669. @item width, w
  2670. Specify the band-width of a filter in width_type units.
  2671. Applies only to double-pole filter.
  2672. The default is 0.707q and gives a Butterworth response.
  2673. @item channels, c
  2674. Specify which channels to filter, by default all available are filtered.
  2675. @end table
  2676. @subsection Examples
  2677. @itemize
  2678. @item
  2679. Lowpass only LFE channel, it LFE is not present it does nothing:
  2680. @example
  2681. lowpass=c=LFE
  2682. @end example
  2683. @end itemize
  2684. @subsection Commands
  2685. This filter supports the following commands:
  2686. @table @option
  2687. @item frequency, f
  2688. Change lowpass frequency.
  2689. Syntax for the command is : "@var{frequency}"
  2690. @item width_type, t
  2691. Change lowpass width_type.
  2692. Syntax for the command is : "@var{width_type}"
  2693. @item width, w
  2694. Change lowpass width.
  2695. Syntax for the command is : "@var{width}"
  2696. @end table
  2697. @section lv2
  2698. Load a LV2 (LADSPA Version 2) plugin.
  2699. To enable compilation of this filter you need to configure FFmpeg with
  2700. @code{--enable-lv2}.
  2701. @table @option
  2702. @item plugin, p
  2703. Specifies the plugin URI. You may need to escape ':'.
  2704. @item controls, c
  2705. Set the '|' separated list of controls which are zero or more floating point
  2706. values that determine the behavior of the loaded plugin (for example delay,
  2707. threshold or gain).
  2708. If @option{controls} is set to @code{help}, all available controls and
  2709. their valid ranges are printed.
  2710. @item sample_rate, s
  2711. Specify the sample rate, default to 44100. Only used if plugin have
  2712. zero inputs.
  2713. @item nb_samples, n
  2714. Set the number of samples per channel per each output frame, default
  2715. is 1024. Only used if plugin have zero inputs.
  2716. @item duration, d
  2717. Set the minimum duration of the sourced audio. See
  2718. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2719. for the accepted syntax.
  2720. Note that the resulting duration may be greater than the specified duration,
  2721. as the generated audio is always cut at the end of a complete frame.
  2722. If not specified, or the expressed duration is negative, the audio is
  2723. supposed to be generated forever.
  2724. Only used if plugin have zero inputs.
  2725. @end table
  2726. @subsection Examples
  2727. @itemize
  2728. @item
  2729. Apply bass enhancer plugin from Calf:
  2730. @example
  2731. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2732. @end example
  2733. @item
  2734. Apply bass vinyl plugin from Calf:
  2735. @example
  2736. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2737. @end example
  2738. @item
  2739. Apply bit crusher plugin from ArtyFX:
  2740. @example
  2741. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2742. @end example
  2743. @end itemize
  2744. @section mcompand
  2745. Multiband Compress or expand the audio's dynamic range.
  2746. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2747. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2748. response when absent compander action.
  2749. It accepts the following parameters:
  2750. @table @option
  2751. @item args
  2752. This option syntax is:
  2753. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2754. For explanation of each item refer to compand filter documentation.
  2755. @end table
  2756. @anchor{pan}
  2757. @section pan
  2758. Mix channels with specific gain levels. The filter accepts the output
  2759. channel layout followed by a set of channels definitions.
  2760. This filter is also designed to efficiently remap the channels of an audio
  2761. stream.
  2762. The filter accepts parameters of the form:
  2763. "@var{l}|@var{outdef}|@var{outdef}|..."
  2764. @table @option
  2765. @item l
  2766. output channel layout or number of channels
  2767. @item outdef
  2768. output channel specification, of the form:
  2769. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2770. @item out_name
  2771. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2772. number (c0, c1, etc.)
  2773. @item gain
  2774. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2775. @item in_name
  2776. input channel to use, see out_name for details; it is not possible to mix
  2777. named and numbered input channels
  2778. @end table
  2779. If the `=' in a channel specification is replaced by `<', then the gains for
  2780. that specification will be renormalized so that the total is 1, thus
  2781. avoiding clipping noise.
  2782. @subsection Mixing examples
  2783. For example, if you want to down-mix from stereo to mono, but with a bigger
  2784. factor for the left channel:
  2785. @example
  2786. pan=1c|c0=0.9*c0+0.1*c1
  2787. @end example
  2788. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2789. 7-channels surround:
  2790. @example
  2791. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2792. @end example
  2793. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2794. that should be preferred (see "-ac" option) unless you have very specific
  2795. needs.
  2796. @subsection Remapping examples
  2797. The channel remapping will be effective if, and only if:
  2798. @itemize
  2799. @item gain coefficients are zeroes or ones,
  2800. @item only one input per channel output,
  2801. @end itemize
  2802. If all these conditions are satisfied, the filter will notify the user ("Pure
  2803. channel mapping detected"), and use an optimized and lossless method to do the
  2804. remapping.
  2805. For example, if you have a 5.1 source and want a stereo audio stream by
  2806. dropping the extra channels:
  2807. @example
  2808. pan="stereo| c0=FL | c1=FR"
  2809. @end example
  2810. Given the same source, you can also switch front left and front right channels
  2811. and keep the input channel layout:
  2812. @example
  2813. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2814. @end example
  2815. If the input is a stereo audio stream, you can mute the front left channel (and
  2816. still keep the stereo channel layout) with:
  2817. @example
  2818. pan="stereo|c1=c1"
  2819. @end example
  2820. Still with a stereo audio stream input, you can copy the right channel in both
  2821. front left and right:
  2822. @example
  2823. pan="stereo| c0=FR | c1=FR"
  2824. @end example
  2825. @section replaygain
  2826. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2827. outputs it unchanged.
  2828. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2829. @section resample
  2830. Convert the audio sample format, sample rate and channel layout. It is
  2831. not meant to be used directly.
  2832. @section rubberband
  2833. Apply time-stretching and pitch-shifting with librubberband.
  2834. The filter accepts the following options:
  2835. @table @option
  2836. @item tempo
  2837. Set tempo scale factor.
  2838. @item pitch
  2839. Set pitch scale factor.
  2840. @item transients
  2841. Set transients detector.
  2842. Possible values are:
  2843. @table @var
  2844. @item crisp
  2845. @item mixed
  2846. @item smooth
  2847. @end table
  2848. @item detector
  2849. Set detector.
  2850. Possible values are:
  2851. @table @var
  2852. @item compound
  2853. @item percussive
  2854. @item soft
  2855. @end table
  2856. @item phase
  2857. Set phase.
  2858. Possible values are:
  2859. @table @var
  2860. @item laminar
  2861. @item independent
  2862. @end table
  2863. @item window
  2864. Set processing window size.
  2865. Possible values are:
  2866. @table @var
  2867. @item standard
  2868. @item short
  2869. @item long
  2870. @end table
  2871. @item smoothing
  2872. Set smoothing.
  2873. Possible values are:
  2874. @table @var
  2875. @item off
  2876. @item on
  2877. @end table
  2878. @item formant
  2879. Enable formant preservation when shift pitching.
  2880. Possible values are:
  2881. @table @var
  2882. @item shifted
  2883. @item preserved
  2884. @end table
  2885. @item pitchq
  2886. Set pitch quality.
  2887. Possible values are:
  2888. @table @var
  2889. @item quality
  2890. @item speed
  2891. @item consistency
  2892. @end table
  2893. @item channels
  2894. Set channels.
  2895. Possible values are:
  2896. @table @var
  2897. @item apart
  2898. @item together
  2899. @end table
  2900. @end table
  2901. @section sidechaincompress
  2902. This filter acts like normal compressor but has the ability to compress
  2903. detected signal using second input signal.
  2904. It needs two input streams and returns one output stream.
  2905. First input stream will be processed depending on second stream signal.
  2906. The filtered signal then can be filtered with other filters in later stages of
  2907. processing. See @ref{pan} and @ref{amerge} filter.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item level_in
  2911. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2912. @item threshold
  2913. If a signal of second stream raises above this level it will affect the gain
  2914. reduction of first stream.
  2915. By default is 0.125. Range is between 0.00097563 and 1.
  2916. @item ratio
  2917. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2918. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2919. Default is 2. Range is between 1 and 20.
  2920. @item attack
  2921. Amount of milliseconds the signal has to rise above the threshold before gain
  2922. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2923. @item release
  2924. Amount of milliseconds the signal has to fall below the threshold before
  2925. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2926. @item makeup
  2927. Set the amount by how much signal will be amplified after processing.
  2928. Default is 1. Range is from 1 to 64.
  2929. @item knee
  2930. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2931. Default is 2.82843. Range is between 1 and 8.
  2932. @item link
  2933. Choose if the @code{average} level between all channels of side-chain stream
  2934. or the louder(@code{maximum}) channel of side-chain stream affects the
  2935. reduction. Default is @code{average}.
  2936. @item detection
  2937. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2938. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2939. @item level_sc
  2940. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2941. @item mix
  2942. How much to use compressed signal in output. Default is 1.
  2943. Range is between 0 and 1.
  2944. @end table
  2945. @subsection Examples
  2946. @itemize
  2947. @item
  2948. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2949. depending on the signal of 2nd input and later compressed signal to be
  2950. merged with 2nd input:
  2951. @example
  2952. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2953. @end example
  2954. @end itemize
  2955. @section sidechaingate
  2956. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2957. filter the detected signal before sending it to the gain reduction stage.
  2958. Normally a gate uses the full range signal to detect a level above the
  2959. threshold.
  2960. For example: If you cut all lower frequencies from your sidechain signal
  2961. the gate will decrease the volume of your track only if not enough highs
  2962. appear. With this technique you are able to reduce the resonation of a
  2963. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2964. guitar.
  2965. It needs two input streams and returns one output stream.
  2966. First input stream will be processed depending on second stream signal.
  2967. The filter accepts the following options:
  2968. @table @option
  2969. @item level_in
  2970. Set input level before filtering.
  2971. Default is 1. Allowed range is from 0.015625 to 64.
  2972. @item range
  2973. Set the level of gain reduction when the signal is below the threshold.
  2974. Default is 0.06125. Allowed range is from 0 to 1.
  2975. @item threshold
  2976. If a signal rises above this level the gain reduction is released.
  2977. Default is 0.125. Allowed range is from 0 to 1.
  2978. @item ratio
  2979. Set a ratio about which the signal is reduced.
  2980. Default is 2. Allowed range is from 1 to 9000.
  2981. @item attack
  2982. Amount of milliseconds the signal has to rise above the threshold before gain
  2983. reduction stops.
  2984. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2985. @item release
  2986. Amount of milliseconds the signal has to fall below the threshold before the
  2987. reduction is increased again. Default is 250 milliseconds.
  2988. Allowed range is from 0.01 to 9000.
  2989. @item makeup
  2990. Set amount of amplification of signal after processing.
  2991. Default is 1. Allowed range is from 1 to 64.
  2992. @item knee
  2993. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2994. Default is 2.828427125. Allowed range is from 1 to 8.
  2995. @item detection
  2996. Choose if exact signal should be taken for detection or an RMS like one.
  2997. Default is rms. Can be peak or rms.
  2998. @item link
  2999. Choose if the average level between all channels or the louder channel affects
  3000. the reduction.
  3001. Default is average. Can be average or maximum.
  3002. @item level_sc
  3003. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3004. @end table
  3005. @section silencedetect
  3006. Detect silence in an audio stream.
  3007. This filter logs a message when it detects that the input audio volume is less
  3008. or equal to a noise tolerance value for a duration greater or equal to the
  3009. minimum detected noise duration.
  3010. The printed times and duration are expressed in seconds.
  3011. The filter accepts the following options:
  3012. @table @option
  3013. @item duration, d
  3014. Set silence duration until notification (default is 2 seconds).
  3015. @item noise, n
  3016. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3017. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3018. @end table
  3019. @subsection Examples
  3020. @itemize
  3021. @item
  3022. Detect 5 seconds of silence with -50dB noise tolerance:
  3023. @example
  3024. silencedetect=n=-50dB:d=5
  3025. @end example
  3026. @item
  3027. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3028. tolerance in @file{silence.mp3}:
  3029. @example
  3030. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3031. @end example
  3032. @end itemize
  3033. @section silenceremove
  3034. Remove silence from the beginning, middle or end of the audio.
  3035. The filter accepts the following options:
  3036. @table @option
  3037. @item start_periods
  3038. This value is used to indicate if audio should be trimmed at beginning of
  3039. the audio. A value of zero indicates no silence should be trimmed from the
  3040. beginning. When specifying a non-zero value, it trims audio up until it
  3041. finds non-silence. Normally, when trimming silence from beginning of audio
  3042. the @var{start_periods} will be @code{1} but it can be increased to higher
  3043. values to trim all audio up to specific count of non-silence periods.
  3044. Default value is @code{0}.
  3045. @item start_duration
  3046. Specify the amount of time that non-silence must be detected before it stops
  3047. trimming audio. By increasing the duration, bursts of noises can be treated
  3048. as silence and trimmed off. Default value is @code{0}.
  3049. @item start_threshold
  3050. This indicates what sample value should be treated as silence. For digital
  3051. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3052. you may wish to increase the value to account for background noise.
  3053. Can be specified in dB (in case "dB" is appended to the specified value)
  3054. or amplitude ratio. Default value is @code{0}.
  3055. @item stop_periods
  3056. Set the count for trimming silence from the end of audio.
  3057. To remove silence from the middle of a file, specify a @var{stop_periods}
  3058. that is negative. This value is then treated as a positive value and is
  3059. used to indicate the effect should restart processing as specified by
  3060. @var{start_periods}, making it suitable for removing periods of silence
  3061. in the middle of the audio.
  3062. Default value is @code{0}.
  3063. @item stop_duration
  3064. Specify a duration of silence that must exist before audio is not copied any
  3065. more. By specifying a higher duration, silence that is wanted can be left in
  3066. the audio.
  3067. Default value is @code{0}.
  3068. @item stop_threshold
  3069. This is the same as @option{start_threshold} but for trimming silence from
  3070. the end of audio.
  3071. Can be specified in dB (in case "dB" is appended to the specified value)
  3072. or amplitude ratio. Default value is @code{0}.
  3073. @item leave_silence
  3074. This indicates that @var{stop_duration} length of audio should be left intact
  3075. at the beginning of each period of silence.
  3076. For example, if you want to remove long pauses between words but do not want
  3077. to remove the pauses completely. Default value is @code{0}.
  3078. @item detection
  3079. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3080. and works better with digital silence which is exactly 0.
  3081. Default value is @code{rms}.
  3082. @item window
  3083. Set ratio used to calculate size of window for detecting silence.
  3084. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3085. @end table
  3086. @subsection Examples
  3087. @itemize
  3088. @item
  3089. The following example shows how this filter can be used to start a recording
  3090. that does not contain the delay at the start which usually occurs between
  3091. pressing the record button and the start of the performance:
  3092. @example
  3093. silenceremove=1:5:0.02
  3094. @end example
  3095. @item
  3096. Trim all silence encountered from beginning to end where there is more than 1
  3097. second of silence in audio:
  3098. @example
  3099. silenceremove=0:0:0:-1:1:-90dB
  3100. @end example
  3101. @end itemize
  3102. @section sofalizer
  3103. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3104. loudspeakers around the user for binaural listening via headphones (audio
  3105. formats up to 9 channels supported).
  3106. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3107. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3108. Austrian Academy of Sciences.
  3109. To enable compilation of this filter you need to configure FFmpeg with
  3110. @code{--enable-libmysofa}.
  3111. The filter accepts the following options:
  3112. @table @option
  3113. @item sofa
  3114. Set the SOFA file used for rendering.
  3115. @item gain
  3116. Set gain applied to audio. Value is in dB. Default is 0.
  3117. @item rotation
  3118. Set rotation of virtual loudspeakers in deg. Default is 0.
  3119. @item elevation
  3120. Set elevation of virtual speakers in deg. Default is 0.
  3121. @item radius
  3122. Set distance in meters between loudspeakers and the listener with near-field
  3123. HRTFs. Default is 1.
  3124. @item type
  3125. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3126. processing audio in time domain which is slow.
  3127. @var{freq} is processing audio in frequency domain which is fast.
  3128. Default is @var{freq}.
  3129. @item speakers
  3130. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3131. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3132. Each virtual loudspeaker is described with short channel name following with
  3133. azimuth and elevation in degrees.
  3134. Each virtual loudspeaker description is separated by '|'.
  3135. For example to override front left and front right channel positions use:
  3136. 'speakers=FL 45 15|FR 345 15'.
  3137. Descriptions with unrecognised channel names are ignored.
  3138. @item lfegain
  3139. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3140. @end table
  3141. @subsection Examples
  3142. @itemize
  3143. @item
  3144. Using ClubFritz6 sofa file:
  3145. @example
  3146. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3147. @end example
  3148. @item
  3149. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3150. @example
  3151. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3152. @end example
  3153. @item
  3154. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3155. and also with custom gain:
  3156. @example
  3157. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3158. @end example
  3159. @end itemize
  3160. @section stereotools
  3161. This filter has some handy utilities to manage stereo signals, for converting
  3162. M/S stereo recordings to L/R signal while having control over the parameters
  3163. or spreading the stereo image of master track.
  3164. The filter accepts the following options:
  3165. @table @option
  3166. @item level_in
  3167. Set input level before filtering for both channels. Defaults is 1.
  3168. Allowed range is from 0.015625 to 64.
  3169. @item level_out
  3170. Set output level after filtering for both channels. Defaults is 1.
  3171. Allowed range is from 0.015625 to 64.
  3172. @item balance_in
  3173. Set input balance between both channels. Default is 0.
  3174. Allowed range is from -1 to 1.
  3175. @item balance_out
  3176. Set output balance between both channels. Default is 0.
  3177. Allowed range is from -1 to 1.
  3178. @item softclip
  3179. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3180. clipping. Disabled by default.
  3181. @item mutel
  3182. Mute the left channel. Disabled by default.
  3183. @item muter
  3184. Mute the right channel. Disabled by default.
  3185. @item phasel
  3186. Change the phase of the left channel. Disabled by default.
  3187. @item phaser
  3188. Change the phase of the right channel. Disabled by default.
  3189. @item mode
  3190. Set stereo mode. Available values are:
  3191. @table @samp
  3192. @item lr>lr
  3193. Left/Right to Left/Right, this is default.
  3194. @item lr>ms
  3195. Left/Right to Mid/Side.
  3196. @item ms>lr
  3197. Mid/Side to Left/Right.
  3198. @item lr>ll
  3199. Left/Right to Left/Left.
  3200. @item lr>rr
  3201. Left/Right to Right/Right.
  3202. @item lr>l+r
  3203. Left/Right to Left + Right.
  3204. @item lr>rl
  3205. Left/Right to Right/Left.
  3206. @item ms>ll
  3207. Mid/Side to Left/Left.
  3208. @item ms>rr
  3209. Mid/Side to Right/Right.
  3210. @end table
  3211. @item slev
  3212. Set level of side signal. Default is 1.
  3213. Allowed range is from 0.015625 to 64.
  3214. @item sbal
  3215. Set balance of side signal. Default is 0.
  3216. Allowed range is from -1 to 1.
  3217. @item mlev
  3218. Set level of the middle signal. Default is 1.
  3219. Allowed range is from 0.015625 to 64.
  3220. @item mpan
  3221. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3222. @item base
  3223. Set stereo base between mono and inversed channels. Default is 0.
  3224. Allowed range is from -1 to 1.
  3225. @item delay
  3226. Set delay in milliseconds how much to delay left from right channel and
  3227. vice versa. Default is 0. Allowed range is from -20 to 20.
  3228. @item sclevel
  3229. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3230. @item phase
  3231. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3232. @item bmode_in, bmode_out
  3233. Set balance mode for balance_in/balance_out option.
  3234. Can be one of the following:
  3235. @table @samp
  3236. @item balance
  3237. Classic balance mode. Attenuate one channel at time.
  3238. Gain is raised up to 1.
  3239. @item amplitude
  3240. Similar as classic mode above but gain is raised up to 2.
  3241. @item power
  3242. Equal power distribution, from -6dB to +6dB range.
  3243. @end table
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Apply karaoke like effect:
  3249. @example
  3250. stereotools=mlev=0.015625
  3251. @end example
  3252. @item
  3253. Convert M/S signal to L/R:
  3254. @example
  3255. "stereotools=mode=ms>lr"
  3256. @end example
  3257. @end itemize
  3258. @section stereowiden
  3259. This filter enhance the stereo effect by suppressing signal common to both
  3260. channels and by delaying the signal of left into right and vice versa,
  3261. thereby widening the stereo effect.
  3262. The filter accepts the following options:
  3263. @table @option
  3264. @item delay
  3265. Time in milliseconds of the delay of left signal into right and vice versa.
  3266. Default is 20 milliseconds.
  3267. @item feedback
  3268. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3269. effect of left signal in right output and vice versa which gives widening
  3270. effect. Default is 0.3.
  3271. @item crossfeed
  3272. Cross feed of left into right with inverted phase. This helps in suppressing
  3273. the mono. If the value is 1 it will cancel all the signal common to both
  3274. channels. Default is 0.3.
  3275. @item drymix
  3276. Set level of input signal of original channel. Default is 0.8.
  3277. @end table
  3278. @section superequalizer
  3279. Apply 18 band equalizer.
  3280. The filter accepts the following options:
  3281. @table @option
  3282. @item 1b
  3283. Set 65Hz band gain.
  3284. @item 2b
  3285. Set 92Hz band gain.
  3286. @item 3b
  3287. Set 131Hz band gain.
  3288. @item 4b
  3289. Set 185Hz band gain.
  3290. @item 5b
  3291. Set 262Hz band gain.
  3292. @item 6b
  3293. Set 370Hz band gain.
  3294. @item 7b
  3295. Set 523Hz band gain.
  3296. @item 8b
  3297. Set 740Hz band gain.
  3298. @item 9b
  3299. Set 1047Hz band gain.
  3300. @item 10b
  3301. Set 1480Hz band gain.
  3302. @item 11b
  3303. Set 2093Hz band gain.
  3304. @item 12b
  3305. Set 2960Hz band gain.
  3306. @item 13b
  3307. Set 4186Hz band gain.
  3308. @item 14b
  3309. Set 5920Hz band gain.
  3310. @item 15b
  3311. Set 8372Hz band gain.
  3312. @item 16b
  3313. Set 11840Hz band gain.
  3314. @item 17b
  3315. Set 16744Hz band gain.
  3316. @item 18b
  3317. Set 20000Hz band gain.
  3318. @end table
  3319. @section surround
  3320. Apply audio surround upmix filter.
  3321. This filter allows to produce multichannel output from audio stream.
  3322. The filter accepts the following options:
  3323. @table @option
  3324. @item chl_out
  3325. Set output channel layout. By default, this is @var{5.1}.
  3326. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3327. for the required syntax.
  3328. @item chl_in
  3329. Set input channel layout. By default, this is @var{stereo}.
  3330. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3331. for the required syntax.
  3332. @item level_in
  3333. Set input volume level. By default, this is @var{1}.
  3334. @item level_out
  3335. Set output volume level. By default, this is @var{1}.
  3336. @item lfe
  3337. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3338. @item lfe_low
  3339. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3340. @item lfe_high
  3341. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3342. @item fc_in
  3343. Set front center input volume. By default, this is @var{1}.
  3344. @item fc_out
  3345. Set front center output volume. By default, this is @var{1}.
  3346. @item lfe_in
  3347. Set LFE input volume. By default, this is @var{1}.
  3348. @item lfe_out
  3349. Set LFE output volume. By default, this is @var{1}.
  3350. @end table
  3351. @section treble
  3352. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3353. shelving filter with a response similar to that of a standard
  3354. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3355. The filter accepts the following options:
  3356. @table @option
  3357. @item gain, g
  3358. Give the gain at whichever is the lower of ~22 kHz and the
  3359. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3360. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3361. @item frequency, f
  3362. Set the filter's central frequency and so can be used
  3363. to extend or reduce the frequency range to be boosted or cut.
  3364. The default value is @code{3000} Hz.
  3365. @item width_type, t
  3366. Set method to specify band-width of filter.
  3367. @table @option
  3368. @item h
  3369. Hz
  3370. @item q
  3371. Q-Factor
  3372. @item o
  3373. octave
  3374. @item s
  3375. slope
  3376. @item k
  3377. kHz
  3378. @end table
  3379. @item width, w
  3380. Determine how steep is the filter's shelf transition.
  3381. @item channels, c
  3382. Specify which channels to filter, by default all available are filtered.
  3383. @end table
  3384. @subsection Commands
  3385. This filter supports the following commands:
  3386. @table @option
  3387. @item frequency, f
  3388. Change treble frequency.
  3389. Syntax for the command is : "@var{frequency}"
  3390. @item width_type, t
  3391. Change treble width_type.
  3392. Syntax for the command is : "@var{width_type}"
  3393. @item width, w
  3394. Change treble width.
  3395. Syntax for the command is : "@var{width}"
  3396. @item gain, g
  3397. Change treble gain.
  3398. Syntax for the command is : "@var{gain}"
  3399. @end table
  3400. @section tremolo
  3401. Sinusoidal amplitude modulation.
  3402. The filter accepts the following options:
  3403. @table @option
  3404. @item f
  3405. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3406. (20 Hz or lower) will result in a tremolo effect.
  3407. This filter may also be used as a ring modulator by specifying
  3408. a modulation frequency higher than 20 Hz.
  3409. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3410. @item d
  3411. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3412. Default value is 0.5.
  3413. @end table
  3414. @section vibrato
  3415. Sinusoidal phase modulation.
  3416. The filter accepts the following options:
  3417. @table @option
  3418. @item f
  3419. Modulation frequency in Hertz.
  3420. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3421. @item d
  3422. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3423. Default value is 0.5.
  3424. @end table
  3425. @section volume
  3426. Adjust the input audio volume.
  3427. It accepts the following parameters:
  3428. @table @option
  3429. @item volume
  3430. Set audio volume expression.
  3431. Output values are clipped to the maximum value.
  3432. The output audio volume is given by the relation:
  3433. @example
  3434. @var{output_volume} = @var{volume} * @var{input_volume}
  3435. @end example
  3436. The default value for @var{volume} is "1.0".
  3437. @item precision
  3438. This parameter represents the mathematical precision.
  3439. It determines which input sample formats will be allowed, which affects the
  3440. precision of the volume scaling.
  3441. @table @option
  3442. @item fixed
  3443. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3444. @item float
  3445. 32-bit floating-point; this limits input sample format to FLT. (default)
  3446. @item double
  3447. 64-bit floating-point; this limits input sample format to DBL.
  3448. @end table
  3449. @item replaygain
  3450. Choose the behaviour on encountering ReplayGain side data in input frames.
  3451. @table @option
  3452. @item drop
  3453. Remove ReplayGain side data, ignoring its contents (the default).
  3454. @item ignore
  3455. Ignore ReplayGain side data, but leave it in the frame.
  3456. @item track
  3457. Prefer the track gain, if present.
  3458. @item album
  3459. Prefer the album gain, if present.
  3460. @end table
  3461. @item replaygain_preamp
  3462. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3463. Default value for @var{replaygain_preamp} is 0.0.
  3464. @item eval
  3465. Set when the volume expression is evaluated.
  3466. It accepts the following values:
  3467. @table @samp
  3468. @item once
  3469. only evaluate expression once during the filter initialization, or
  3470. when the @samp{volume} command is sent
  3471. @item frame
  3472. evaluate expression for each incoming frame
  3473. @end table
  3474. Default value is @samp{once}.
  3475. @end table
  3476. The volume expression can contain the following parameters.
  3477. @table @option
  3478. @item n
  3479. frame number (starting at zero)
  3480. @item nb_channels
  3481. number of channels
  3482. @item nb_consumed_samples
  3483. number of samples consumed by the filter
  3484. @item nb_samples
  3485. number of samples in the current frame
  3486. @item pos
  3487. original frame position in the file
  3488. @item pts
  3489. frame PTS
  3490. @item sample_rate
  3491. sample rate
  3492. @item startpts
  3493. PTS at start of stream
  3494. @item startt
  3495. time at start of stream
  3496. @item t
  3497. frame time
  3498. @item tb
  3499. timestamp timebase
  3500. @item volume
  3501. last set volume value
  3502. @end table
  3503. Note that when @option{eval} is set to @samp{once} only the
  3504. @var{sample_rate} and @var{tb} variables are available, all other
  3505. variables will evaluate to NAN.
  3506. @subsection Commands
  3507. This filter supports the following commands:
  3508. @table @option
  3509. @item volume
  3510. Modify the volume expression.
  3511. The command accepts the same syntax of the corresponding option.
  3512. If the specified expression is not valid, it is kept at its current
  3513. value.
  3514. @item replaygain_noclip
  3515. Prevent clipping by limiting the gain applied.
  3516. Default value for @var{replaygain_noclip} is 1.
  3517. @end table
  3518. @subsection Examples
  3519. @itemize
  3520. @item
  3521. Halve the input audio volume:
  3522. @example
  3523. volume=volume=0.5
  3524. volume=volume=1/2
  3525. volume=volume=-6.0206dB
  3526. @end example
  3527. In all the above example the named key for @option{volume} can be
  3528. omitted, for example like in:
  3529. @example
  3530. volume=0.5
  3531. @end example
  3532. @item
  3533. Increase input audio power by 6 decibels using fixed-point precision:
  3534. @example
  3535. volume=volume=6dB:precision=fixed
  3536. @end example
  3537. @item
  3538. Fade volume after time 10 with an annihilation period of 5 seconds:
  3539. @example
  3540. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3541. @end example
  3542. @end itemize
  3543. @section volumedetect
  3544. Detect the volume of the input video.
  3545. The filter has no parameters. The input is not modified. Statistics about
  3546. the volume will be printed in the log when the input stream end is reached.
  3547. In particular it will show the mean volume (root mean square), maximum
  3548. volume (on a per-sample basis), and the beginning of a histogram of the
  3549. registered volume values (from the maximum value to a cumulated 1/1000 of
  3550. the samples).
  3551. All volumes are in decibels relative to the maximum PCM value.
  3552. @subsection Examples
  3553. Here is an excerpt of the output:
  3554. @example
  3555. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3556. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3557. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3558. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3559. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3560. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3561. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3562. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3563. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3564. @end example
  3565. It means that:
  3566. @itemize
  3567. @item
  3568. The mean square energy is approximately -27 dB, or 10^-2.7.
  3569. @item
  3570. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3571. @item
  3572. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3573. @end itemize
  3574. In other words, raising the volume by +4 dB does not cause any clipping,
  3575. raising it by +5 dB causes clipping for 6 samples, etc.
  3576. @c man end AUDIO FILTERS
  3577. @chapter Audio Sources
  3578. @c man begin AUDIO SOURCES
  3579. Below is a description of the currently available audio sources.
  3580. @section abuffer
  3581. Buffer audio frames, and make them available to the filter chain.
  3582. This source is mainly intended for a programmatic use, in particular
  3583. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3584. It accepts the following parameters:
  3585. @table @option
  3586. @item time_base
  3587. The timebase which will be used for timestamps of submitted frames. It must be
  3588. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3589. @item sample_rate
  3590. The sample rate of the incoming audio buffers.
  3591. @item sample_fmt
  3592. The sample format of the incoming audio buffers.
  3593. Either a sample format name or its corresponding integer representation from
  3594. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3595. @item channel_layout
  3596. The channel layout of the incoming audio buffers.
  3597. Either a channel layout name from channel_layout_map in
  3598. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3599. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3600. @item channels
  3601. The number of channels of the incoming audio buffers.
  3602. If both @var{channels} and @var{channel_layout} are specified, then they
  3603. must be consistent.
  3604. @end table
  3605. @subsection Examples
  3606. @example
  3607. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3608. @end example
  3609. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3610. Since the sample format with name "s16p" corresponds to the number
  3611. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3612. equivalent to:
  3613. @example
  3614. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3615. @end example
  3616. @section aevalsrc
  3617. Generate an audio signal specified by an expression.
  3618. This source accepts in input one or more expressions (one for each
  3619. channel), which are evaluated and used to generate a corresponding
  3620. audio signal.
  3621. This source accepts the following options:
  3622. @table @option
  3623. @item exprs
  3624. Set the '|'-separated expressions list for each separate channel. In case the
  3625. @option{channel_layout} option is not specified, the selected channel layout
  3626. depends on the number of provided expressions. Otherwise the last
  3627. specified expression is applied to the remaining output channels.
  3628. @item channel_layout, c
  3629. Set the channel layout. The number of channels in the specified layout
  3630. must be equal to the number of specified expressions.
  3631. @item duration, d
  3632. Set the minimum duration of the sourced audio. See
  3633. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3634. for the accepted syntax.
  3635. Note that the resulting duration may be greater than the specified
  3636. duration, as the generated audio is always cut at the end of a
  3637. complete frame.
  3638. If not specified, or the expressed duration is negative, the audio is
  3639. supposed to be generated forever.
  3640. @item nb_samples, n
  3641. Set the number of samples per channel per each output frame,
  3642. default to 1024.
  3643. @item sample_rate, s
  3644. Specify the sample rate, default to 44100.
  3645. @end table
  3646. Each expression in @var{exprs} can contain the following constants:
  3647. @table @option
  3648. @item n
  3649. number of the evaluated sample, starting from 0
  3650. @item t
  3651. time of the evaluated sample expressed in seconds, starting from 0
  3652. @item s
  3653. sample rate
  3654. @end table
  3655. @subsection Examples
  3656. @itemize
  3657. @item
  3658. Generate silence:
  3659. @example
  3660. aevalsrc=0
  3661. @end example
  3662. @item
  3663. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3664. 8000 Hz:
  3665. @example
  3666. aevalsrc="sin(440*2*PI*t):s=8000"
  3667. @end example
  3668. @item
  3669. Generate a two channels signal, specify the channel layout (Front
  3670. Center + Back Center) explicitly:
  3671. @example
  3672. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3673. @end example
  3674. @item
  3675. Generate white noise:
  3676. @example
  3677. aevalsrc="-2+random(0)"
  3678. @end example
  3679. @item
  3680. Generate an amplitude modulated signal:
  3681. @example
  3682. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3683. @end example
  3684. @item
  3685. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3686. @example
  3687. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3688. @end example
  3689. @end itemize
  3690. @section anullsrc
  3691. The null audio source, return unprocessed audio frames. It is mainly useful
  3692. as a template and to be employed in analysis / debugging tools, or as
  3693. the source for filters which ignore the input data (for example the sox
  3694. synth filter).
  3695. This source accepts the following options:
  3696. @table @option
  3697. @item channel_layout, cl
  3698. Specifies the channel layout, and can be either an integer or a string
  3699. representing a channel layout. The default value of @var{channel_layout}
  3700. is "stereo".
  3701. Check the channel_layout_map definition in
  3702. @file{libavutil/channel_layout.c} for the mapping between strings and
  3703. channel layout values.
  3704. @item sample_rate, r
  3705. Specifies the sample rate, and defaults to 44100.
  3706. @item nb_samples, n
  3707. Set the number of samples per requested frames.
  3708. @end table
  3709. @subsection Examples
  3710. @itemize
  3711. @item
  3712. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3713. @example
  3714. anullsrc=r=48000:cl=4
  3715. @end example
  3716. @item
  3717. Do the same operation with a more obvious syntax:
  3718. @example
  3719. anullsrc=r=48000:cl=mono
  3720. @end example
  3721. @end itemize
  3722. All the parameters need to be explicitly defined.
  3723. @section flite
  3724. Synthesize a voice utterance using the libflite library.
  3725. To enable compilation of this filter you need to configure FFmpeg with
  3726. @code{--enable-libflite}.
  3727. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3728. The filter accepts the following options:
  3729. @table @option
  3730. @item list_voices
  3731. If set to 1, list the names of the available voices and exit
  3732. immediately. Default value is 0.
  3733. @item nb_samples, n
  3734. Set the maximum number of samples per frame. Default value is 512.
  3735. @item textfile
  3736. Set the filename containing the text to speak.
  3737. @item text
  3738. Set the text to speak.
  3739. @item voice, v
  3740. Set the voice to use for the speech synthesis. Default value is
  3741. @code{kal}. See also the @var{list_voices} option.
  3742. @end table
  3743. @subsection Examples
  3744. @itemize
  3745. @item
  3746. Read from file @file{speech.txt}, and synthesize the text using the
  3747. standard flite voice:
  3748. @example
  3749. flite=textfile=speech.txt
  3750. @end example
  3751. @item
  3752. Read the specified text selecting the @code{slt} voice:
  3753. @example
  3754. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3755. @end example
  3756. @item
  3757. Input text to ffmpeg:
  3758. @example
  3759. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3760. @end example
  3761. @item
  3762. Make @file{ffplay} speak the specified text, using @code{flite} and
  3763. the @code{lavfi} device:
  3764. @example
  3765. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3766. @end example
  3767. @end itemize
  3768. For more information about libflite, check:
  3769. @url{http://www.festvox.org/flite/}
  3770. @section anoisesrc
  3771. Generate a noise audio signal.
  3772. The filter accepts the following options:
  3773. @table @option
  3774. @item sample_rate, r
  3775. Specify the sample rate. Default value is 48000 Hz.
  3776. @item amplitude, a
  3777. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3778. is 1.0.
  3779. @item duration, d
  3780. Specify the duration of the generated audio stream. Not specifying this option
  3781. results in noise with an infinite length.
  3782. @item color, colour, c
  3783. Specify the color of noise. Available noise colors are white, pink, brown,
  3784. blue and violet. Default color is white.
  3785. @item seed, s
  3786. Specify a value used to seed the PRNG.
  3787. @item nb_samples, n
  3788. Set the number of samples per each output frame, default is 1024.
  3789. @end table
  3790. @subsection Examples
  3791. @itemize
  3792. @item
  3793. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3794. @example
  3795. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3796. @end example
  3797. @end itemize
  3798. @section sine
  3799. Generate an audio signal made of a sine wave with amplitude 1/8.
  3800. The audio signal is bit-exact.
  3801. The filter accepts the following options:
  3802. @table @option
  3803. @item frequency, f
  3804. Set the carrier frequency. Default is 440 Hz.
  3805. @item beep_factor, b
  3806. Enable a periodic beep every second with frequency @var{beep_factor} times
  3807. the carrier frequency. Default is 0, meaning the beep is disabled.
  3808. @item sample_rate, r
  3809. Specify the sample rate, default is 44100.
  3810. @item duration, d
  3811. Specify the duration of the generated audio stream.
  3812. @item samples_per_frame
  3813. Set the number of samples per output frame.
  3814. The expression can contain the following constants:
  3815. @table @option
  3816. @item n
  3817. The (sequential) number of the output audio frame, starting from 0.
  3818. @item pts
  3819. The PTS (Presentation TimeStamp) of the output audio frame,
  3820. expressed in @var{TB} units.
  3821. @item t
  3822. The PTS of the output audio frame, expressed in seconds.
  3823. @item TB
  3824. The timebase of the output audio frames.
  3825. @end table
  3826. Default is @code{1024}.
  3827. @end table
  3828. @subsection Examples
  3829. @itemize
  3830. @item
  3831. Generate a simple 440 Hz sine wave:
  3832. @example
  3833. sine
  3834. @end example
  3835. @item
  3836. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3837. @example
  3838. sine=220:4:d=5
  3839. sine=f=220:b=4:d=5
  3840. sine=frequency=220:beep_factor=4:duration=5
  3841. @end example
  3842. @item
  3843. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3844. pattern:
  3845. @example
  3846. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3847. @end example
  3848. @end itemize
  3849. @c man end AUDIO SOURCES
  3850. @chapter Audio Sinks
  3851. @c man begin AUDIO SINKS
  3852. Below is a description of the currently available audio sinks.
  3853. @section abuffersink
  3854. Buffer audio frames, and make them available to the end of filter chain.
  3855. This sink is mainly intended for programmatic use, in particular
  3856. through the interface defined in @file{libavfilter/buffersink.h}
  3857. or the options system.
  3858. It accepts a pointer to an AVABufferSinkContext structure, which
  3859. defines the incoming buffers' formats, to be passed as the opaque
  3860. parameter to @code{avfilter_init_filter} for initialization.
  3861. @section anullsink
  3862. Null audio sink; do absolutely nothing with the input audio. It is
  3863. mainly useful as a template and for use in analysis / debugging
  3864. tools.
  3865. @c man end AUDIO SINKS
  3866. @chapter Video Filters
  3867. @c man begin VIDEO FILTERS
  3868. When you configure your FFmpeg build, you can disable any of the
  3869. existing filters using @code{--disable-filters}.
  3870. The configure output will show the video filters included in your
  3871. build.
  3872. Below is a description of the currently available video filters.
  3873. @section alphaextract
  3874. Extract the alpha component from the input as a grayscale video. This
  3875. is especially useful with the @var{alphamerge} filter.
  3876. @section alphamerge
  3877. Add or replace the alpha component of the primary input with the
  3878. grayscale value of a second input. This is intended for use with
  3879. @var{alphaextract} to allow the transmission or storage of frame
  3880. sequences that have alpha in a format that doesn't support an alpha
  3881. channel.
  3882. For example, to reconstruct full frames from a normal YUV-encoded video
  3883. and a separate video created with @var{alphaextract}, you might use:
  3884. @example
  3885. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3886. @end example
  3887. Since this filter is designed for reconstruction, it operates on frame
  3888. sequences without considering timestamps, and terminates when either
  3889. input reaches end of stream. This will cause problems if your encoding
  3890. pipeline drops frames. If you're trying to apply an image as an
  3891. overlay to a video stream, consider the @var{overlay} filter instead.
  3892. @section ass
  3893. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3894. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3895. Substation Alpha) subtitles files.
  3896. This filter accepts the following option in addition to the common options from
  3897. the @ref{subtitles} filter:
  3898. @table @option
  3899. @item shaping
  3900. Set the shaping engine
  3901. Available values are:
  3902. @table @samp
  3903. @item auto
  3904. The default libass shaping engine, which is the best available.
  3905. @item simple
  3906. Fast, font-agnostic shaper that can do only substitutions
  3907. @item complex
  3908. Slower shaper using OpenType for substitutions and positioning
  3909. @end table
  3910. The default is @code{auto}.
  3911. @end table
  3912. @section atadenoise
  3913. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item 0a
  3917. Set threshold A for 1st plane. Default is 0.02.
  3918. Valid range is 0 to 0.3.
  3919. @item 0b
  3920. Set threshold B for 1st plane. Default is 0.04.
  3921. Valid range is 0 to 5.
  3922. @item 1a
  3923. Set threshold A for 2nd plane. Default is 0.02.
  3924. Valid range is 0 to 0.3.
  3925. @item 1b
  3926. Set threshold B for 2nd plane. Default is 0.04.
  3927. Valid range is 0 to 5.
  3928. @item 2a
  3929. Set threshold A for 3rd plane. Default is 0.02.
  3930. Valid range is 0 to 0.3.
  3931. @item 2b
  3932. Set threshold B for 3rd plane. Default is 0.04.
  3933. Valid range is 0 to 5.
  3934. Threshold A is designed to react on abrupt changes in the input signal and
  3935. threshold B is designed to react on continuous changes in the input signal.
  3936. @item s
  3937. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3938. number in range [5, 129].
  3939. @item p
  3940. Set what planes of frame filter will use for averaging. Default is all.
  3941. @end table
  3942. @section avgblur
  3943. Apply average blur filter.
  3944. The filter accepts the following options:
  3945. @table @option
  3946. @item sizeX
  3947. Set horizontal kernel size.
  3948. @item planes
  3949. Set which planes to filter. By default all planes are filtered.
  3950. @item sizeY
  3951. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3952. Default is @code{0}.
  3953. @end table
  3954. @section bbox
  3955. Compute the bounding box for the non-black pixels in the input frame
  3956. luminance plane.
  3957. This filter computes the bounding box containing all the pixels with a
  3958. luminance value greater than the minimum allowed value.
  3959. The parameters describing the bounding box are printed on the filter
  3960. log.
  3961. The filter accepts the following option:
  3962. @table @option
  3963. @item min_val
  3964. Set the minimal luminance value. Default is @code{16}.
  3965. @end table
  3966. @section bitplanenoise
  3967. Show and measure bit plane noise.
  3968. The filter accepts the following options:
  3969. @table @option
  3970. @item bitplane
  3971. Set which plane to analyze. Default is @code{1}.
  3972. @item filter
  3973. Filter out noisy pixels from @code{bitplane} set above.
  3974. Default is disabled.
  3975. @end table
  3976. @section blackdetect
  3977. Detect video intervals that are (almost) completely black. Can be
  3978. useful to detect chapter transitions, commercials, or invalid
  3979. recordings. Output lines contains the time for the start, end and
  3980. duration of the detected black interval expressed in seconds.
  3981. In order to display the output lines, you need to set the loglevel at
  3982. least to the AV_LOG_INFO value.
  3983. The filter accepts the following options:
  3984. @table @option
  3985. @item black_min_duration, d
  3986. Set the minimum detected black duration expressed in seconds. It must
  3987. be a non-negative floating point number.
  3988. Default value is 2.0.
  3989. @item picture_black_ratio_th, pic_th
  3990. Set the threshold for considering a picture "black".
  3991. Express the minimum value for the ratio:
  3992. @example
  3993. @var{nb_black_pixels} / @var{nb_pixels}
  3994. @end example
  3995. for which a picture is considered black.
  3996. Default value is 0.98.
  3997. @item pixel_black_th, pix_th
  3998. Set the threshold for considering a pixel "black".
  3999. The threshold expresses the maximum pixel luminance value for which a
  4000. pixel is considered "black". The provided value is scaled according to
  4001. the following equation:
  4002. @example
  4003. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4004. @end example
  4005. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4006. the input video format, the range is [0-255] for YUV full-range
  4007. formats and [16-235] for YUV non full-range formats.
  4008. Default value is 0.10.
  4009. @end table
  4010. The following example sets the maximum pixel threshold to the minimum
  4011. value, and detects only black intervals of 2 or more seconds:
  4012. @example
  4013. blackdetect=d=2:pix_th=0.00
  4014. @end example
  4015. @section blackframe
  4016. Detect frames that are (almost) completely black. Can be useful to
  4017. detect chapter transitions or commercials. Output lines consist of
  4018. the frame number of the detected frame, the percentage of blackness,
  4019. the position in the file if known or -1 and the timestamp in seconds.
  4020. In order to display the output lines, you need to set the loglevel at
  4021. least to the AV_LOG_INFO value.
  4022. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4023. The value represents the percentage of pixels in the picture that
  4024. are below the threshold value.
  4025. It accepts the following parameters:
  4026. @table @option
  4027. @item amount
  4028. The percentage of the pixels that have to be below the threshold; it defaults to
  4029. @code{98}.
  4030. @item threshold, thresh
  4031. The threshold below which a pixel value is considered black; it defaults to
  4032. @code{32}.
  4033. @end table
  4034. @section blend, tblend
  4035. Blend two video frames into each other.
  4036. The @code{blend} filter takes two input streams and outputs one
  4037. stream, the first input is the "top" layer and second input is
  4038. "bottom" layer. By default, the output terminates when the longest input terminates.
  4039. The @code{tblend} (time blend) filter takes two consecutive frames
  4040. from one single stream, and outputs the result obtained by blending
  4041. the new frame on top of the old frame.
  4042. A description of the accepted options follows.
  4043. @table @option
  4044. @item c0_mode
  4045. @item c1_mode
  4046. @item c2_mode
  4047. @item c3_mode
  4048. @item all_mode
  4049. Set blend mode for specific pixel component or all pixel components in case
  4050. of @var{all_mode}. Default value is @code{normal}.
  4051. Available values for component modes are:
  4052. @table @samp
  4053. @item addition
  4054. @item grainmerge
  4055. @item and
  4056. @item average
  4057. @item burn
  4058. @item darken
  4059. @item difference
  4060. @item grainextract
  4061. @item divide
  4062. @item dodge
  4063. @item freeze
  4064. @item exclusion
  4065. @item extremity
  4066. @item glow
  4067. @item hardlight
  4068. @item hardmix
  4069. @item heat
  4070. @item lighten
  4071. @item linearlight
  4072. @item multiply
  4073. @item multiply128
  4074. @item negation
  4075. @item normal
  4076. @item or
  4077. @item overlay
  4078. @item phoenix
  4079. @item pinlight
  4080. @item reflect
  4081. @item screen
  4082. @item softlight
  4083. @item subtract
  4084. @item vividlight
  4085. @item xor
  4086. @end table
  4087. @item c0_opacity
  4088. @item c1_opacity
  4089. @item c2_opacity
  4090. @item c3_opacity
  4091. @item all_opacity
  4092. Set blend opacity for specific pixel component or all pixel components in case
  4093. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4094. @item c0_expr
  4095. @item c1_expr
  4096. @item c2_expr
  4097. @item c3_expr
  4098. @item all_expr
  4099. Set blend expression for specific pixel component or all pixel components in case
  4100. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4101. The expressions can use the following variables:
  4102. @table @option
  4103. @item N
  4104. The sequential number of the filtered frame, starting from @code{0}.
  4105. @item X
  4106. @item Y
  4107. the coordinates of the current sample
  4108. @item W
  4109. @item H
  4110. the width and height of currently filtered plane
  4111. @item SW
  4112. @item SH
  4113. Width and height scale depending on the currently filtered plane. It is the
  4114. ratio between the corresponding luma plane number of pixels and the current
  4115. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4116. @code{0.5,0.5} for chroma planes.
  4117. @item T
  4118. Time of the current frame, expressed in seconds.
  4119. @item TOP, A
  4120. Value of pixel component at current location for first video frame (top layer).
  4121. @item BOTTOM, B
  4122. Value of pixel component at current location for second video frame (bottom layer).
  4123. @end table
  4124. @end table
  4125. The @code{blend} filter also supports the @ref{framesync} options.
  4126. @subsection Examples
  4127. @itemize
  4128. @item
  4129. Apply transition from bottom layer to top layer in first 10 seconds:
  4130. @example
  4131. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4132. @end example
  4133. @item
  4134. Apply linear horizontal transition from top layer to bottom layer:
  4135. @example
  4136. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4137. @end example
  4138. @item
  4139. Apply 1x1 checkerboard effect:
  4140. @example
  4141. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4142. @end example
  4143. @item
  4144. Apply uncover left effect:
  4145. @example
  4146. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4147. @end example
  4148. @item
  4149. Apply uncover down effect:
  4150. @example
  4151. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4152. @end example
  4153. @item
  4154. Apply uncover up-left effect:
  4155. @example
  4156. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4157. @end example
  4158. @item
  4159. Split diagonally video and shows top and bottom layer on each side:
  4160. @example
  4161. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4162. @end example
  4163. @item
  4164. Display differences between the current and the previous frame:
  4165. @example
  4166. tblend=all_mode=grainextract
  4167. @end example
  4168. @end itemize
  4169. @section boxblur
  4170. Apply a boxblur algorithm to the input video.
  4171. It accepts the following parameters:
  4172. @table @option
  4173. @item luma_radius, lr
  4174. @item luma_power, lp
  4175. @item chroma_radius, cr
  4176. @item chroma_power, cp
  4177. @item alpha_radius, ar
  4178. @item alpha_power, ap
  4179. @end table
  4180. A description of the accepted options follows.
  4181. @table @option
  4182. @item luma_radius, lr
  4183. @item chroma_radius, cr
  4184. @item alpha_radius, ar
  4185. Set an expression for the box radius in pixels used for blurring the
  4186. corresponding input plane.
  4187. The radius value must be a non-negative number, and must not be
  4188. greater than the value of the expression @code{min(w,h)/2} for the
  4189. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4190. planes.
  4191. Default value for @option{luma_radius} is "2". If not specified,
  4192. @option{chroma_radius} and @option{alpha_radius} default to the
  4193. corresponding value set for @option{luma_radius}.
  4194. The expressions can contain the following constants:
  4195. @table @option
  4196. @item w
  4197. @item h
  4198. The input width and height in pixels.
  4199. @item cw
  4200. @item ch
  4201. The input chroma image width and height in pixels.
  4202. @item hsub
  4203. @item vsub
  4204. The horizontal and vertical chroma subsample values. For example, for the
  4205. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4206. @end table
  4207. @item luma_power, lp
  4208. @item chroma_power, cp
  4209. @item alpha_power, ap
  4210. Specify how many times the boxblur filter is applied to the
  4211. corresponding plane.
  4212. Default value for @option{luma_power} is 2. If not specified,
  4213. @option{chroma_power} and @option{alpha_power} default to the
  4214. corresponding value set for @option{luma_power}.
  4215. A value of 0 will disable the effect.
  4216. @end table
  4217. @subsection Examples
  4218. @itemize
  4219. @item
  4220. Apply a boxblur filter with the luma, chroma, and alpha radii
  4221. set to 2:
  4222. @example
  4223. boxblur=luma_radius=2:luma_power=1
  4224. boxblur=2:1
  4225. @end example
  4226. @item
  4227. Set the luma radius to 2, and alpha and chroma radius to 0:
  4228. @example
  4229. boxblur=2:1:cr=0:ar=0
  4230. @end example
  4231. @item
  4232. Set the luma and chroma radii to a fraction of the video dimension:
  4233. @example
  4234. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4235. @end example
  4236. @end itemize
  4237. @section bwdif
  4238. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4239. Deinterlacing Filter").
  4240. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4241. interpolation algorithms.
  4242. It accepts the following parameters:
  4243. @table @option
  4244. @item mode
  4245. The interlacing mode to adopt. It accepts one of the following values:
  4246. @table @option
  4247. @item 0, send_frame
  4248. Output one frame for each frame.
  4249. @item 1, send_field
  4250. Output one frame for each field.
  4251. @end table
  4252. The default value is @code{send_field}.
  4253. @item parity
  4254. The picture field parity assumed for the input interlaced video. It accepts one
  4255. of the following values:
  4256. @table @option
  4257. @item 0, tff
  4258. Assume the top field is first.
  4259. @item 1, bff
  4260. Assume the bottom field is first.
  4261. @item -1, auto
  4262. Enable automatic detection of field parity.
  4263. @end table
  4264. The default value is @code{auto}.
  4265. If the interlacing is unknown or the decoder does not export this information,
  4266. top field first will be assumed.
  4267. @item deint
  4268. Specify which frames to deinterlace. Accept one of the following
  4269. values:
  4270. @table @option
  4271. @item 0, all
  4272. Deinterlace all frames.
  4273. @item 1, interlaced
  4274. Only deinterlace frames marked as interlaced.
  4275. @end table
  4276. The default value is @code{all}.
  4277. @end table
  4278. @section chromakey
  4279. YUV colorspace color/chroma keying.
  4280. The filter accepts the following options:
  4281. @table @option
  4282. @item color
  4283. The color which will be replaced with transparency.
  4284. @item similarity
  4285. Similarity percentage with the key color.
  4286. 0.01 matches only the exact key color, while 1.0 matches everything.
  4287. @item blend
  4288. Blend percentage.
  4289. 0.0 makes pixels either fully transparent, or not transparent at all.
  4290. Higher values result in semi-transparent pixels, with a higher transparency
  4291. the more similar the pixels color is to the key color.
  4292. @item yuv
  4293. Signals that the color passed is already in YUV instead of RGB.
  4294. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4295. This can be used to pass exact YUV values as hexadecimal numbers.
  4296. @end table
  4297. @subsection Examples
  4298. @itemize
  4299. @item
  4300. Make every green pixel in the input image transparent:
  4301. @example
  4302. ffmpeg -i input.png -vf chromakey=green out.png
  4303. @end example
  4304. @item
  4305. Overlay a greenscreen-video on top of a static black background.
  4306. @example
  4307. 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
  4308. @end example
  4309. @end itemize
  4310. @section ciescope
  4311. Display CIE color diagram with pixels overlaid onto it.
  4312. The filter accepts the following options:
  4313. @table @option
  4314. @item system
  4315. Set color system.
  4316. @table @samp
  4317. @item ntsc, 470m
  4318. @item ebu, 470bg
  4319. @item smpte
  4320. @item 240m
  4321. @item apple
  4322. @item widergb
  4323. @item cie1931
  4324. @item rec709, hdtv
  4325. @item uhdtv, rec2020
  4326. @end table
  4327. @item cie
  4328. Set CIE system.
  4329. @table @samp
  4330. @item xyy
  4331. @item ucs
  4332. @item luv
  4333. @end table
  4334. @item gamuts
  4335. Set what gamuts to draw.
  4336. See @code{system} option for available values.
  4337. @item size, s
  4338. Set ciescope size, by default set to 512.
  4339. @item intensity, i
  4340. Set intensity used to map input pixel values to CIE diagram.
  4341. @item contrast
  4342. Set contrast used to draw tongue colors that are out of active color system gamut.
  4343. @item corrgamma
  4344. Correct gamma displayed on scope, by default enabled.
  4345. @item showwhite
  4346. Show white point on CIE diagram, by default disabled.
  4347. @item gamma
  4348. Set input gamma. Used only with XYZ input color space.
  4349. @end table
  4350. @section codecview
  4351. Visualize information exported by some codecs.
  4352. Some codecs can export information through frames using side-data or other
  4353. means. For example, some MPEG based codecs export motion vectors through the
  4354. @var{export_mvs} flag in the codec @option{flags2} option.
  4355. The filter accepts the following option:
  4356. @table @option
  4357. @item mv
  4358. Set motion vectors to visualize.
  4359. Available flags for @var{mv} are:
  4360. @table @samp
  4361. @item pf
  4362. forward predicted MVs of P-frames
  4363. @item bf
  4364. forward predicted MVs of B-frames
  4365. @item bb
  4366. backward predicted MVs of B-frames
  4367. @end table
  4368. @item qp
  4369. Display quantization parameters using the chroma planes.
  4370. @item mv_type, mvt
  4371. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4372. Available flags for @var{mv_type} are:
  4373. @table @samp
  4374. @item fp
  4375. forward predicted MVs
  4376. @item bp
  4377. backward predicted MVs
  4378. @end table
  4379. @item frame_type, ft
  4380. Set frame type to visualize motion vectors of.
  4381. Available flags for @var{frame_type} are:
  4382. @table @samp
  4383. @item if
  4384. intra-coded frames (I-frames)
  4385. @item pf
  4386. predicted frames (P-frames)
  4387. @item bf
  4388. bi-directionally predicted frames (B-frames)
  4389. @end table
  4390. @end table
  4391. @subsection Examples
  4392. @itemize
  4393. @item
  4394. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4395. @example
  4396. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4397. @end example
  4398. @item
  4399. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4400. @example
  4401. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4402. @end example
  4403. @end itemize
  4404. @section colorbalance
  4405. Modify intensity of primary colors (red, green and blue) of input frames.
  4406. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4407. regions for the red-cyan, green-magenta or blue-yellow balance.
  4408. A positive adjustment value shifts the balance towards the primary color, a negative
  4409. value towards the complementary color.
  4410. The filter accepts the following options:
  4411. @table @option
  4412. @item rs
  4413. @item gs
  4414. @item bs
  4415. Adjust red, green and blue shadows (darkest pixels).
  4416. @item rm
  4417. @item gm
  4418. @item bm
  4419. Adjust red, green and blue midtones (medium pixels).
  4420. @item rh
  4421. @item gh
  4422. @item bh
  4423. Adjust red, green and blue highlights (brightest pixels).
  4424. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4425. @end table
  4426. @subsection Examples
  4427. @itemize
  4428. @item
  4429. Add red color cast to shadows:
  4430. @example
  4431. colorbalance=rs=.3
  4432. @end example
  4433. @end itemize
  4434. @section colorkey
  4435. RGB colorspace color keying.
  4436. The filter accepts the following options:
  4437. @table @option
  4438. @item color
  4439. The color which will be replaced with transparency.
  4440. @item similarity
  4441. Similarity percentage with the key color.
  4442. 0.01 matches only the exact key color, while 1.0 matches everything.
  4443. @item blend
  4444. Blend percentage.
  4445. 0.0 makes pixels either fully transparent, or not transparent at all.
  4446. Higher values result in semi-transparent pixels, with a higher transparency
  4447. the more similar the pixels color is to the key color.
  4448. @end table
  4449. @subsection Examples
  4450. @itemize
  4451. @item
  4452. Make every green pixel in the input image transparent:
  4453. @example
  4454. ffmpeg -i input.png -vf colorkey=green out.png
  4455. @end example
  4456. @item
  4457. Overlay a greenscreen-video on top of a static background image.
  4458. @example
  4459. 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
  4460. @end example
  4461. @end itemize
  4462. @section colorlevels
  4463. Adjust video input frames using levels.
  4464. The filter accepts the following options:
  4465. @table @option
  4466. @item rimin
  4467. @item gimin
  4468. @item bimin
  4469. @item aimin
  4470. Adjust red, green, blue and alpha input black point.
  4471. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4472. @item rimax
  4473. @item gimax
  4474. @item bimax
  4475. @item aimax
  4476. Adjust red, green, blue and alpha input white point.
  4477. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4478. Input levels are used to lighten highlights (bright tones), darken shadows
  4479. (dark tones), change the balance of bright and dark tones.
  4480. @item romin
  4481. @item gomin
  4482. @item bomin
  4483. @item aomin
  4484. Adjust red, green, blue and alpha output black point.
  4485. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4486. @item romax
  4487. @item gomax
  4488. @item bomax
  4489. @item aomax
  4490. Adjust red, green, blue and alpha output white point.
  4491. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4492. Output levels allows manual selection of a constrained output level range.
  4493. @end table
  4494. @subsection Examples
  4495. @itemize
  4496. @item
  4497. Make video output darker:
  4498. @example
  4499. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4500. @end example
  4501. @item
  4502. Increase contrast:
  4503. @example
  4504. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4505. @end example
  4506. @item
  4507. Make video output lighter:
  4508. @example
  4509. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4510. @end example
  4511. @item
  4512. Increase brightness:
  4513. @example
  4514. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4515. @end example
  4516. @end itemize
  4517. @section colorchannelmixer
  4518. Adjust video input frames by re-mixing color channels.
  4519. This filter modifies a color channel by adding the values associated to
  4520. the other channels of the same pixels. For example if the value to
  4521. modify is red, the output value will be:
  4522. @example
  4523. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4524. @end example
  4525. The filter accepts the following options:
  4526. @table @option
  4527. @item rr
  4528. @item rg
  4529. @item rb
  4530. @item ra
  4531. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4532. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4533. @item gr
  4534. @item gg
  4535. @item gb
  4536. @item ga
  4537. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4538. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4539. @item br
  4540. @item bg
  4541. @item bb
  4542. @item ba
  4543. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4544. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4545. @item ar
  4546. @item ag
  4547. @item ab
  4548. @item aa
  4549. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4550. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4551. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4552. @end table
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Convert source to grayscale:
  4557. @example
  4558. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4559. @end example
  4560. @item
  4561. Simulate sepia tones:
  4562. @example
  4563. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4564. @end example
  4565. @end itemize
  4566. @section colormatrix
  4567. Convert color matrix.
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item src
  4571. @item dst
  4572. Specify the source and destination color matrix. Both values must be
  4573. specified.
  4574. The accepted values are:
  4575. @table @samp
  4576. @item bt709
  4577. BT.709
  4578. @item fcc
  4579. FCC
  4580. @item bt601
  4581. BT.601
  4582. @item bt470
  4583. BT.470
  4584. @item bt470bg
  4585. BT.470BG
  4586. @item smpte170m
  4587. SMPTE-170M
  4588. @item smpte240m
  4589. SMPTE-240M
  4590. @item bt2020
  4591. BT.2020
  4592. @end table
  4593. @end table
  4594. For example to convert from BT.601 to SMPTE-240M, use the command:
  4595. @example
  4596. colormatrix=bt601:smpte240m
  4597. @end example
  4598. @section colorspace
  4599. Convert colorspace, transfer characteristics or color primaries.
  4600. Input video needs to have an even size.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @anchor{all}
  4604. @item all
  4605. Specify all color properties at once.
  4606. The accepted values are:
  4607. @table @samp
  4608. @item bt470m
  4609. BT.470M
  4610. @item bt470bg
  4611. BT.470BG
  4612. @item bt601-6-525
  4613. BT.601-6 525
  4614. @item bt601-6-625
  4615. BT.601-6 625
  4616. @item bt709
  4617. BT.709
  4618. @item smpte170m
  4619. SMPTE-170M
  4620. @item smpte240m
  4621. SMPTE-240M
  4622. @item bt2020
  4623. BT.2020
  4624. @end table
  4625. @anchor{space}
  4626. @item space
  4627. Specify output colorspace.
  4628. The accepted values are:
  4629. @table @samp
  4630. @item bt709
  4631. BT.709
  4632. @item fcc
  4633. FCC
  4634. @item bt470bg
  4635. BT.470BG or BT.601-6 625
  4636. @item smpte170m
  4637. SMPTE-170M or BT.601-6 525
  4638. @item smpte240m
  4639. SMPTE-240M
  4640. @item ycgco
  4641. YCgCo
  4642. @item bt2020ncl
  4643. BT.2020 with non-constant luminance
  4644. @end table
  4645. @anchor{trc}
  4646. @item trc
  4647. Specify output transfer characteristics.
  4648. The accepted values are:
  4649. @table @samp
  4650. @item bt709
  4651. BT.709
  4652. @item bt470m
  4653. BT.470M
  4654. @item bt470bg
  4655. BT.470BG
  4656. @item gamma22
  4657. Constant gamma of 2.2
  4658. @item gamma28
  4659. Constant gamma of 2.8
  4660. @item smpte170m
  4661. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4662. @item smpte240m
  4663. SMPTE-240M
  4664. @item srgb
  4665. SRGB
  4666. @item iec61966-2-1
  4667. iec61966-2-1
  4668. @item iec61966-2-4
  4669. iec61966-2-4
  4670. @item xvycc
  4671. xvycc
  4672. @item bt2020-10
  4673. BT.2020 for 10-bits content
  4674. @item bt2020-12
  4675. BT.2020 for 12-bits content
  4676. @end table
  4677. @anchor{primaries}
  4678. @item primaries
  4679. Specify output color primaries.
  4680. The accepted values are:
  4681. @table @samp
  4682. @item bt709
  4683. BT.709
  4684. @item bt470m
  4685. BT.470M
  4686. @item bt470bg
  4687. BT.470BG or BT.601-6 625
  4688. @item smpte170m
  4689. SMPTE-170M or BT.601-6 525
  4690. @item smpte240m
  4691. SMPTE-240M
  4692. @item film
  4693. film
  4694. @item smpte431
  4695. SMPTE-431
  4696. @item smpte432
  4697. SMPTE-432
  4698. @item bt2020
  4699. BT.2020
  4700. @item jedec-p22
  4701. JEDEC P22 phosphors
  4702. @end table
  4703. @anchor{range}
  4704. @item range
  4705. Specify output color range.
  4706. The accepted values are:
  4707. @table @samp
  4708. @item tv
  4709. TV (restricted) range
  4710. @item mpeg
  4711. MPEG (restricted) range
  4712. @item pc
  4713. PC (full) range
  4714. @item jpeg
  4715. JPEG (full) range
  4716. @end table
  4717. @item format
  4718. Specify output color format.
  4719. The accepted values are:
  4720. @table @samp
  4721. @item yuv420p
  4722. YUV 4:2:0 planar 8-bits
  4723. @item yuv420p10
  4724. YUV 4:2:0 planar 10-bits
  4725. @item yuv420p12
  4726. YUV 4:2:0 planar 12-bits
  4727. @item yuv422p
  4728. YUV 4:2:2 planar 8-bits
  4729. @item yuv422p10
  4730. YUV 4:2:2 planar 10-bits
  4731. @item yuv422p12
  4732. YUV 4:2:2 planar 12-bits
  4733. @item yuv444p
  4734. YUV 4:4:4 planar 8-bits
  4735. @item yuv444p10
  4736. YUV 4:4:4 planar 10-bits
  4737. @item yuv444p12
  4738. YUV 4:4:4 planar 12-bits
  4739. @end table
  4740. @item fast
  4741. Do a fast conversion, which skips gamma/primary correction. This will take
  4742. significantly less CPU, but will be mathematically incorrect. To get output
  4743. compatible with that produced by the colormatrix filter, use fast=1.
  4744. @item dither
  4745. Specify dithering mode.
  4746. The accepted values are:
  4747. @table @samp
  4748. @item none
  4749. No dithering
  4750. @item fsb
  4751. Floyd-Steinberg dithering
  4752. @end table
  4753. @item wpadapt
  4754. Whitepoint adaptation mode.
  4755. The accepted values are:
  4756. @table @samp
  4757. @item bradford
  4758. Bradford whitepoint adaptation
  4759. @item vonkries
  4760. von Kries whitepoint adaptation
  4761. @item identity
  4762. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4763. @end table
  4764. @item iall
  4765. Override all input properties at once. Same accepted values as @ref{all}.
  4766. @item ispace
  4767. Override input colorspace. Same accepted values as @ref{space}.
  4768. @item iprimaries
  4769. Override input color primaries. Same accepted values as @ref{primaries}.
  4770. @item itrc
  4771. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4772. @item irange
  4773. Override input color range. Same accepted values as @ref{range}.
  4774. @end table
  4775. The filter converts the transfer characteristics, color space and color
  4776. primaries to the specified user values. The output value, if not specified,
  4777. is set to a default value based on the "all" property. If that property is
  4778. also not specified, the filter will log an error. The output color range and
  4779. format default to the same value as the input color range and format. The
  4780. input transfer characteristics, color space, color primaries and color range
  4781. should be set on the input data. If any of these are missing, the filter will
  4782. log an error and no conversion will take place.
  4783. For example to convert the input to SMPTE-240M, use the command:
  4784. @example
  4785. colorspace=smpte240m
  4786. @end example
  4787. @section convolution
  4788. Apply convolution 3x3, 5x5 or 7x7 filter.
  4789. The filter accepts the following options:
  4790. @table @option
  4791. @item 0m
  4792. @item 1m
  4793. @item 2m
  4794. @item 3m
  4795. Set matrix for each plane.
  4796. Matrix is sequence of 9, 25 or 49 signed integers.
  4797. @item 0rdiv
  4798. @item 1rdiv
  4799. @item 2rdiv
  4800. @item 3rdiv
  4801. Set multiplier for calculated value for each plane.
  4802. @item 0bias
  4803. @item 1bias
  4804. @item 2bias
  4805. @item 3bias
  4806. Set bias for each plane. This value is added to the result of the multiplication.
  4807. Useful for making the overall image brighter or darker. Default is 0.0.
  4808. @end table
  4809. @subsection Examples
  4810. @itemize
  4811. @item
  4812. Apply sharpen:
  4813. @example
  4814. 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"
  4815. @end example
  4816. @item
  4817. Apply blur:
  4818. @example
  4819. 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"
  4820. @end example
  4821. @item
  4822. Apply edge enhance:
  4823. @example
  4824. 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"
  4825. @end example
  4826. @item
  4827. Apply edge detect:
  4828. @example
  4829. 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"
  4830. @end example
  4831. @item
  4832. Apply laplacian edge detector which includes diagonals:
  4833. @example
  4834. 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"
  4835. @end example
  4836. @item
  4837. Apply emboss:
  4838. @example
  4839. 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"
  4840. @end example
  4841. @end itemize
  4842. @section convolve
  4843. Apply 2D convolution of video stream in frequency domain using second stream
  4844. as impulse.
  4845. The filter accepts the following options:
  4846. @table @option
  4847. @item planes
  4848. Set which planes to process.
  4849. @item impulse
  4850. Set which impulse video frames will be processed, can be @var{first}
  4851. or @var{all}. Default is @var{all}.
  4852. @end table
  4853. The @code{convolve} filter also supports the @ref{framesync} options.
  4854. @section copy
  4855. Copy the input video source unchanged to the output. This is mainly useful for
  4856. testing purposes.
  4857. @anchor{coreimage}
  4858. @section coreimage
  4859. Video filtering on GPU using Apple's CoreImage API on OSX.
  4860. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4861. processed by video hardware. However, software-based OpenGL implementations
  4862. exist which means there is no guarantee for hardware processing. It depends on
  4863. the respective OSX.
  4864. There are many filters and image generators provided by Apple that come with a
  4865. large variety of options. The filter has to be referenced by its name along
  4866. with its options.
  4867. The coreimage filter accepts the following options:
  4868. @table @option
  4869. @item list_filters
  4870. List all available filters and generators along with all their respective
  4871. options as well as possible minimum and maximum values along with the default
  4872. values.
  4873. @example
  4874. list_filters=true
  4875. @end example
  4876. @item filter
  4877. Specify all filters by their respective name and options.
  4878. Use @var{list_filters} to determine all valid filter names and options.
  4879. Numerical options are specified by a float value and are automatically clamped
  4880. to their respective value range. Vector and color options have to be specified
  4881. by a list of space separated float values. Character escaping has to be done.
  4882. A special option name @code{default} is available to use default options for a
  4883. filter.
  4884. It is required to specify either @code{default} or at least one of the filter options.
  4885. All omitted options are used with their default values.
  4886. The syntax of the filter string is as follows:
  4887. @example
  4888. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4889. @end example
  4890. @item output_rect
  4891. Specify a rectangle where the output of the filter chain is copied into the
  4892. input image. It is given by a list of space separated float values:
  4893. @example
  4894. output_rect=x\ y\ width\ height
  4895. @end example
  4896. If not given, the output rectangle equals the dimensions of the input image.
  4897. The output rectangle is automatically cropped at the borders of the input
  4898. image. Negative values are valid for each component.
  4899. @example
  4900. output_rect=25\ 25\ 100\ 100
  4901. @end example
  4902. @end table
  4903. Several filters can be chained for successive processing without GPU-HOST
  4904. transfers allowing for fast processing of complex filter chains.
  4905. Currently, only filters with zero (generators) or exactly one (filters) input
  4906. image and one output image are supported. Also, transition filters are not yet
  4907. usable as intended.
  4908. Some filters generate output images with additional padding depending on the
  4909. respective filter kernel. The padding is automatically removed to ensure the
  4910. filter output has the same size as the input image.
  4911. For image generators, the size of the output image is determined by the
  4912. previous output image of the filter chain or the input image of the whole
  4913. filterchain, respectively. The generators do not use the pixel information of
  4914. this image to generate their output. However, the generated output is
  4915. blended onto this image, resulting in partial or complete coverage of the
  4916. output image.
  4917. The @ref{coreimagesrc} video source can be used for generating input images
  4918. which are directly fed into the filter chain. By using it, providing input
  4919. images by another video source or an input video is not required.
  4920. @subsection Examples
  4921. @itemize
  4922. @item
  4923. List all filters available:
  4924. @example
  4925. coreimage=list_filters=true
  4926. @end example
  4927. @item
  4928. Use the CIBoxBlur filter with default options to blur an image:
  4929. @example
  4930. coreimage=filter=CIBoxBlur@@default
  4931. @end example
  4932. @item
  4933. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4934. its center at 100x100 and a radius of 50 pixels:
  4935. @example
  4936. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4937. @end example
  4938. @item
  4939. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4940. given as complete and escaped command-line for Apple's standard bash shell:
  4941. @example
  4942. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4943. @end example
  4944. @end itemize
  4945. @section crop
  4946. Crop the input video to given dimensions.
  4947. It accepts the following parameters:
  4948. @table @option
  4949. @item w, out_w
  4950. The width of the output video. It defaults to @code{iw}.
  4951. This expression is evaluated only once during the filter
  4952. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4953. @item h, out_h
  4954. The height of the output video. It defaults to @code{ih}.
  4955. This expression is evaluated only once during the filter
  4956. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4957. @item x
  4958. The horizontal position, in the input video, of the left edge of the output
  4959. video. It defaults to @code{(in_w-out_w)/2}.
  4960. This expression is evaluated per-frame.
  4961. @item y
  4962. The vertical position, in the input video, of the top edge of the output video.
  4963. It defaults to @code{(in_h-out_h)/2}.
  4964. This expression is evaluated per-frame.
  4965. @item keep_aspect
  4966. If set to 1 will force the output display aspect ratio
  4967. to be the same of the input, by changing the output sample aspect
  4968. ratio. It defaults to 0.
  4969. @item exact
  4970. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4971. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4972. It defaults to 0.
  4973. @end table
  4974. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4975. expressions containing the following constants:
  4976. @table @option
  4977. @item x
  4978. @item y
  4979. The computed values for @var{x} and @var{y}. They are evaluated for
  4980. each new frame.
  4981. @item in_w
  4982. @item in_h
  4983. The input width and height.
  4984. @item iw
  4985. @item ih
  4986. These are the same as @var{in_w} and @var{in_h}.
  4987. @item out_w
  4988. @item out_h
  4989. The output (cropped) width and height.
  4990. @item ow
  4991. @item oh
  4992. These are the same as @var{out_w} and @var{out_h}.
  4993. @item a
  4994. same as @var{iw} / @var{ih}
  4995. @item sar
  4996. input sample aspect ratio
  4997. @item dar
  4998. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4999. @item hsub
  5000. @item vsub
  5001. horizontal and vertical chroma subsample values. For example for the
  5002. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5003. @item n
  5004. The number of the input frame, starting from 0.
  5005. @item pos
  5006. the position in the file of the input frame, NAN if unknown
  5007. @item t
  5008. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5009. @end table
  5010. The expression for @var{out_w} may depend on the value of @var{out_h},
  5011. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5012. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5013. evaluated after @var{out_w} and @var{out_h}.
  5014. The @var{x} and @var{y} parameters specify the expressions for the
  5015. position of the top-left corner of the output (non-cropped) area. They
  5016. are evaluated for each frame. If the evaluated value is not valid, it
  5017. is approximated to the nearest valid value.
  5018. The expression for @var{x} may depend on @var{y}, and the expression
  5019. for @var{y} may depend on @var{x}.
  5020. @subsection Examples
  5021. @itemize
  5022. @item
  5023. Crop area with size 100x100 at position (12,34).
  5024. @example
  5025. crop=100:100:12:34
  5026. @end example
  5027. Using named options, the example above becomes:
  5028. @example
  5029. crop=w=100:h=100:x=12:y=34
  5030. @end example
  5031. @item
  5032. Crop the central input area with size 100x100:
  5033. @example
  5034. crop=100:100
  5035. @end example
  5036. @item
  5037. Crop the central input area with size 2/3 of the input video:
  5038. @example
  5039. crop=2/3*in_w:2/3*in_h
  5040. @end example
  5041. @item
  5042. Crop the input video central square:
  5043. @example
  5044. crop=out_w=in_h
  5045. crop=in_h
  5046. @end example
  5047. @item
  5048. Delimit the rectangle with the top-left corner placed at position
  5049. 100:100 and the right-bottom corner corresponding to the right-bottom
  5050. corner of the input image.
  5051. @example
  5052. crop=in_w-100:in_h-100:100:100
  5053. @end example
  5054. @item
  5055. Crop 10 pixels from the left and right borders, and 20 pixels from
  5056. the top and bottom borders
  5057. @example
  5058. crop=in_w-2*10:in_h-2*20
  5059. @end example
  5060. @item
  5061. Keep only the bottom right quarter of the input image:
  5062. @example
  5063. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5064. @end example
  5065. @item
  5066. Crop height for getting Greek harmony:
  5067. @example
  5068. crop=in_w:1/PHI*in_w
  5069. @end example
  5070. @item
  5071. Apply trembling effect:
  5072. @example
  5073. 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)
  5074. @end example
  5075. @item
  5076. Apply erratic camera effect depending on timestamp:
  5077. @example
  5078. 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)"
  5079. @end example
  5080. @item
  5081. Set x depending on the value of y:
  5082. @example
  5083. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5084. @end example
  5085. @end itemize
  5086. @subsection Commands
  5087. This filter supports the following commands:
  5088. @table @option
  5089. @item w, out_w
  5090. @item h, out_h
  5091. @item x
  5092. @item y
  5093. Set width/height of the output video and the horizontal/vertical position
  5094. in the input video.
  5095. The command accepts the same syntax of the corresponding option.
  5096. If the specified expression is not valid, it is kept at its current
  5097. value.
  5098. @end table
  5099. @section cropdetect
  5100. Auto-detect the crop size.
  5101. It calculates the necessary cropping parameters and prints the
  5102. recommended parameters via the logging system. The detected dimensions
  5103. correspond to the non-black area of the input video.
  5104. It accepts the following parameters:
  5105. @table @option
  5106. @item limit
  5107. Set higher black value threshold, which can be optionally specified
  5108. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5109. value greater to the set value is considered non-black. It defaults to 24.
  5110. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5111. on the bitdepth of the pixel format.
  5112. @item round
  5113. The value which the width/height should be divisible by. It defaults to
  5114. 16. The offset is automatically adjusted to center the video. Use 2 to
  5115. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5116. encoding to most video codecs.
  5117. @item reset_count, reset
  5118. Set the counter that determines after how many frames cropdetect will
  5119. reset the previously detected largest video area and start over to
  5120. detect the current optimal crop area. Default value is 0.
  5121. This can be useful when channel logos distort the video area. 0
  5122. indicates 'never reset', and returns the largest area encountered during
  5123. playback.
  5124. @end table
  5125. @anchor{curves}
  5126. @section curves
  5127. Apply color adjustments using curves.
  5128. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5129. component (red, green and blue) has its values defined by @var{N} key points
  5130. tied from each other using a smooth curve. The x-axis represents the pixel
  5131. values from the input frame, and the y-axis the new pixel values to be set for
  5132. the output frame.
  5133. By default, a component curve is defined by the two points @var{(0;0)} and
  5134. @var{(1;1)}. This creates a straight line where each original pixel value is
  5135. "adjusted" to its own value, which means no change to the image.
  5136. The filter allows you to redefine these two points and add some more. A new
  5137. curve (using a natural cubic spline interpolation) will be define to pass
  5138. smoothly through all these new coordinates. The new defined points needs to be
  5139. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5140. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5141. the vector spaces, the values will be clipped accordingly.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item preset
  5145. Select one of the available color presets. This option can be used in addition
  5146. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5147. options takes priority on the preset values.
  5148. Available presets are:
  5149. @table @samp
  5150. @item none
  5151. @item color_negative
  5152. @item cross_process
  5153. @item darker
  5154. @item increase_contrast
  5155. @item lighter
  5156. @item linear_contrast
  5157. @item medium_contrast
  5158. @item negative
  5159. @item strong_contrast
  5160. @item vintage
  5161. @end table
  5162. Default is @code{none}.
  5163. @item master, m
  5164. Set the master key points. These points will define a second pass mapping. It
  5165. is sometimes called a "luminance" or "value" mapping. It can be used with
  5166. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5167. post-processing LUT.
  5168. @item red, r
  5169. Set the key points for the red component.
  5170. @item green, g
  5171. Set the key points for the green component.
  5172. @item blue, b
  5173. Set the key points for the blue component.
  5174. @item all
  5175. Set the key points for all components (not including master).
  5176. Can be used in addition to the other key points component
  5177. options. In this case, the unset component(s) will fallback on this
  5178. @option{all} setting.
  5179. @item psfile
  5180. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5181. @item plot
  5182. Save Gnuplot script of the curves in specified file.
  5183. @end table
  5184. To avoid some filtergraph syntax conflicts, each key points list need to be
  5185. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5186. @subsection Examples
  5187. @itemize
  5188. @item
  5189. Increase slightly the middle level of blue:
  5190. @example
  5191. curves=blue='0/0 0.5/0.58 1/1'
  5192. @end example
  5193. @item
  5194. Vintage effect:
  5195. @example
  5196. 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'
  5197. @end example
  5198. Here we obtain the following coordinates for each components:
  5199. @table @var
  5200. @item red
  5201. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5202. @item green
  5203. @code{(0;0) (0.50;0.48) (1;1)}
  5204. @item blue
  5205. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5206. @end table
  5207. @item
  5208. The previous example can also be achieved with the associated built-in preset:
  5209. @example
  5210. curves=preset=vintage
  5211. @end example
  5212. @item
  5213. Or simply:
  5214. @example
  5215. curves=vintage
  5216. @end example
  5217. @item
  5218. Use a Photoshop preset and redefine the points of the green component:
  5219. @example
  5220. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5221. @end example
  5222. @item
  5223. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5224. and @command{gnuplot}:
  5225. @example
  5226. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5227. gnuplot -p /tmp/curves.plt
  5228. @end example
  5229. @end itemize
  5230. @section datascope
  5231. Video data analysis filter.
  5232. This filter shows hexadecimal pixel values of part of video.
  5233. The filter accepts the following options:
  5234. @table @option
  5235. @item size, s
  5236. Set output video size.
  5237. @item x
  5238. Set x offset from where to pick pixels.
  5239. @item y
  5240. Set y offset from where to pick pixels.
  5241. @item mode
  5242. Set scope mode, can be one of the following:
  5243. @table @samp
  5244. @item mono
  5245. Draw hexadecimal pixel values with white color on black background.
  5246. @item color
  5247. Draw hexadecimal pixel values with input video pixel color on black
  5248. background.
  5249. @item color2
  5250. Draw hexadecimal pixel values on color background picked from input video,
  5251. the text color is picked in such way so its always visible.
  5252. @end table
  5253. @item axis
  5254. Draw rows and columns numbers on left and top of video.
  5255. @item opacity
  5256. Set background opacity.
  5257. @end table
  5258. @section dctdnoiz
  5259. Denoise frames using 2D DCT (frequency domain filtering).
  5260. This filter is not designed for real time.
  5261. The filter accepts the following options:
  5262. @table @option
  5263. @item sigma, s
  5264. Set the noise sigma constant.
  5265. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5266. coefficient (absolute value) below this threshold with be dropped.
  5267. If you need a more advanced filtering, see @option{expr}.
  5268. Default is @code{0}.
  5269. @item overlap
  5270. Set number overlapping pixels for each block. Since the filter can be slow, you
  5271. may want to reduce this value, at the cost of a less effective filter and the
  5272. risk of various artefacts.
  5273. If the overlapping value doesn't permit processing the whole input width or
  5274. height, a warning will be displayed and according borders won't be denoised.
  5275. Default value is @var{blocksize}-1, which is the best possible setting.
  5276. @item expr, e
  5277. Set the coefficient factor expression.
  5278. For each coefficient of a DCT block, this expression will be evaluated as a
  5279. multiplier value for the coefficient.
  5280. If this is option is set, the @option{sigma} option will be ignored.
  5281. The absolute value of the coefficient can be accessed through the @var{c}
  5282. variable.
  5283. @item n
  5284. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5285. @var{blocksize}, which is the width and height of the processed blocks.
  5286. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5287. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5288. on the speed processing. Also, a larger block size does not necessarily means a
  5289. better de-noising.
  5290. @end table
  5291. @subsection Examples
  5292. Apply a denoise with a @option{sigma} of @code{4.5}:
  5293. @example
  5294. dctdnoiz=4.5
  5295. @end example
  5296. The same operation can be achieved using the expression system:
  5297. @example
  5298. dctdnoiz=e='gte(c, 4.5*3)'
  5299. @end example
  5300. Violent denoise using a block size of @code{16x16}:
  5301. @example
  5302. dctdnoiz=15:n=4
  5303. @end example
  5304. @section deband
  5305. Remove banding artifacts from input video.
  5306. It works by replacing banded pixels with average value of referenced pixels.
  5307. The filter accepts the following options:
  5308. @table @option
  5309. @item 1thr
  5310. @item 2thr
  5311. @item 3thr
  5312. @item 4thr
  5313. Set banding detection threshold for each plane. Default is 0.02.
  5314. Valid range is 0.00003 to 0.5.
  5315. If difference between current pixel and reference pixel is less than threshold,
  5316. it will be considered as banded.
  5317. @item range, r
  5318. Banding detection range in pixels. Default is 16. If positive, random number
  5319. in range 0 to set value will be used. If negative, exact absolute value
  5320. will be used.
  5321. The range defines square of four pixels around current pixel.
  5322. @item direction, d
  5323. Set direction in radians from which four pixel will be compared. If positive,
  5324. random direction from 0 to set direction will be picked. If negative, exact of
  5325. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5326. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5327. column.
  5328. @item blur, b
  5329. If enabled, current pixel is compared with average value of all four
  5330. surrounding pixels. The default is enabled. If disabled current pixel is
  5331. compared with all four surrounding pixels. The pixel is considered banded
  5332. if only all four differences with surrounding pixels are less than threshold.
  5333. @item coupling, c
  5334. If enabled, current pixel is changed if and only if all pixel components are banded,
  5335. e.g. banding detection threshold is triggered for all color components.
  5336. The default is disabled.
  5337. @end table
  5338. @anchor{decimate}
  5339. @section decimate
  5340. Drop duplicated frames at regular intervals.
  5341. The filter accepts the following options:
  5342. @table @option
  5343. @item cycle
  5344. Set the number of frames from which one will be dropped. Setting this to
  5345. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5346. Default is @code{5}.
  5347. @item dupthresh
  5348. Set the threshold for duplicate detection. If the difference metric for a frame
  5349. is less than or equal to this value, then it is declared as duplicate. Default
  5350. is @code{1.1}
  5351. @item scthresh
  5352. Set scene change threshold. Default is @code{15}.
  5353. @item blockx
  5354. @item blocky
  5355. Set the size of the x and y-axis blocks used during metric calculations.
  5356. Larger blocks give better noise suppression, but also give worse detection of
  5357. small movements. Must be a power of two. Default is @code{32}.
  5358. @item ppsrc
  5359. Mark main input as a pre-processed input and activate clean source input
  5360. stream. This allows the input to be pre-processed with various filters to help
  5361. the metrics calculation while keeping the frame selection lossless. When set to
  5362. @code{1}, the first stream is for the pre-processed input, and the second
  5363. stream is the clean source from where the kept frames are chosen. Default is
  5364. @code{0}.
  5365. @item chroma
  5366. Set whether or not chroma is considered in the metric calculations. Default is
  5367. @code{1}.
  5368. @end table
  5369. @section deflate
  5370. Apply deflate effect to the video.
  5371. This filter replaces the pixel by the local(3x3) average by taking into account
  5372. only values lower than the pixel.
  5373. It accepts the following options:
  5374. @table @option
  5375. @item threshold0
  5376. @item threshold1
  5377. @item threshold2
  5378. @item threshold3
  5379. Limit the maximum change for each plane, default is 65535.
  5380. If 0, plane will remain unchanged.
  5381. @end table
  5382. @section deflicker
  5383. Remove temporal frame luminance variations.
  5384. It accepts the following options:
  5385. @table @option
  5386. @item size, s
  5387. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5388. @item mode, m
  5389. Set averaging mode to smooth temporal luminance variations.
  5390. Available values are:
  5391. @table @samp
  5392. @item am
  5393. Arithmetic mean
  5394. @item gm
  5395. Geometric mean
  5396. @item hm
  5397. Harmonic mean
  5398. @item qm
  5399. Quadratic mean
  5400. @item cm
  5401. Cubic mean
  5402. @item pm
  5403. Power mean
  5404. @item median
  5405. Median
  5406. @end table
  5407. @item bypass
  5408. Do not actually modify frame. Useful when one only wants metadata.
  5409. @end table
  5410. @section dejudder
  5411. Remove judder produced by partially interlaced telecined content.
  5412. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5413. source was partially telecined content then the output of @code{pullup,dejudder}
  5414. will have a variable frame rate. May change the recorded frame rate of the
  5415. container. Aside from that change, this filter will not affect constant frame
  5416. rate video.
  5417. The option available in this filter is:
  5418. @table @option
  5419. @item cycle
  5420. Specify the length of the window over which the judder repeats.
  5421. Accepts any integer greater than 1. Useful values are:
  5422. @table @samp
  5423. @item 4
  5424. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5425. @item 5
  5426. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5427. @item 20
  5428. If a mixture of the two.
  5429. @end table
  5430. The default is @samp{4}.
  5431. @end table
  5432. @section delogo
  5433. Suppress a TV station logo by a simple interpolation of the surrounding
  5434. pixels. Just set a rectangle covering the logo and watch it disappear
  5435. (and sometimes something even uglier appear - your mileage may vary).
  5436. It accepts the following parameters:
  5437. @table @option
  5438. @item x
  5439. @item y
  5440. Specify the top left corner coordinates of the logo. They must be
  5441. specified.
  5442. @item w
  5443. @item h
  5444. Specify the width and height of the logo to clear. They must be
  5445. specified.
  5446. @item band, t
  5447. Specify the thickness of the fuzzy edge of the rectangle (added to
  5448. @var{w} and @var{h}). The default value is 1. This option is
  5449. deprecated, setting higher values should no longer be necessary and
  5450. is not recommended.
  5451. @item show
  5452. When set to 1, a green rectangle is drawn on the screen to simplify
  5453. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5454. The default value is 0.
  5455. The rectangle is drawn on the outermost pixels which will be (partly)
  5456. replaced with interpolated values. The values of the next pixels
  5457. immediately outside this rectangle in each direction will be used to
  5458. compute the interpolated pixel values inside the rectangle.
  5459. @end table
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Set a rectangle covering the area with top left corner coordinates 0,0
  5464. and size 100x77, and a band of size 10:
  5465. @example
  5466. delogo=x=0:y=0:w=100:h=77:band=10
  5467. @end example
  5468. @end itemize
  5469. @section deshake
  5470. Attempt to fix small changes in horizontal and/or vertical shift. This
  5471. filter helps remove camera shake from hand-holding a camera, bumping a
  5472. tripod, moving on a vehicle, etc.
  5473. The filter accepts the following options:
  5474. @table @option
  5475. @item x
  5476. @item y
  5477. @item w
  5478. @item h
  5479. Specify a rectangular area where to limit the search for motion
  5480. vectors.
  5481. If desired the search for motion vectors can be limited to a
  5482. rectangular area of the frame defined by its top left corner, width
  5483. and height. These parameters have the same meaning as the drawbox
  5484. filter which can be used to visualise the position of the bounding
  5485. box.
  5486. This is useful when simultaneous movement of subjects within the frame
  5487. might be confused for camera motion by the motion vector search.
  5488. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5489. then the full frame is used. This allows later options to be set
  5490. without specifying the bounding box for the motion vector search.
  5491. Default - search the whole frame.
  5492. @item rx
  5493. @item ry
  5494. Specify the maximum extent of movement in x and y directions in the
  5495. range 0-64 pixels. Default 16.
  5496. @item edge
  5497. Specify how to generate pixels to fill blanks at the edge of the
  5498. frame. Available values are:
  5499. @table @samp
  5500. @item blank, 0
  5501. Fill zeroes at blank locations
  5502. @item original, 1
  5503. Original image at blank locations
  5504. @item clamp, 2
  5505. Extruded edge value at blank locations
  5506. @item mirror, 3
  5507. Mirrored edge at blank locations
  5508. @end table
  5509. Default value is @samp{mirror}.
  5510. @item blocksize
  5511. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5512. default 8.
  5513. @item contrast
  5514. Specify the contrast threshold for blocks. Only blocks with more than
  5515. the specified contrast (difference between darkest and lightest
  5516. pixels) will be considered. Range 1-255, default 125.
  5517. @item search
  5518. Specify the search strategy. Available values are:
  5519. @table @samp
  5520. @item exhaustive, 0
  5521. Set exhaustive search
  5522. @item less, 1
  5523. Set less exhaustive search.
  5524. @end table
  5525. Default value is @samp{exhaustive}.
  5526. @item filename
  5527. If set then a detailed log of the motion search is written to the
  5528. specified file.
  5529. @end table
  5530. @section despill
  5531. Remove unwanted contamination of foreground colors, caused by reflected color of
  5532. greenscreen or bluescreen.
  5533. This filter accepts the following options:
  5534. @table @option
  5535. @item type
  5536. Set what type of despill to use.
  5537. @item mix
  5538. Set how spillmap will be generated.
  5539. @item expand
  5540. Set how much to get rid of still remaining spill.
  5541. @item red
  5542. Controls amount of red in spill area.
  5543. @item green
  5544. Controls amount of green in spill area.
  5545. Should be -1 for greenscreen.
  5546. @item blue
  5547. Controls amount of blue in spill area.
  5548. Should be -1 for bluescreen.
  5549. @item brightness
  5550. Controls brightness of spill area, preserving colors.
  5551. @item alpha
  5552. Modify alpha from generated spillmap.
  5553. @end table
  5554. @section detelecine
  5555. Apply an exact inverse of the telecine operation. It requires a predefined
  5556. pattern specified using the pattern option which must be the same as that passed
  5557. to the telecine filter.
  5558. This filter accepts the following options:
  5559. @table @option
  5560. @item first_field
  5561. @table @samp
  5562. @item top, t
  5563. top field first
  5564. @item bottom, b
  5565. bottom field first
  5566. The default value is @code{top}.
  5567. @end table
  5568. @item pattern
  5569. A string of numbers representing the pulldown pattern you wish to apply.
  5570. The default value is @code{23}.
  5571. @item start_frame
  5572. A number representing position of the first frame with respect to the telecine
  5573. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5574. @end table
  5575. @section dilation
  5576. Apply dilation effect to the video.
  5577. This filter replaces the pixel by the local(3x3) maximum.
  5578. It accepts the following options:
  5579. @table @option
  5580. @item threshold0
  5581. @item threshold1
  5582. @item threshold2
  5583. @item threshold3
  5584. Limit the maximum change for each plane, default is 65535.
  5585. If 0, plane will remain unchanged.
  5586. @item coordinates
  5587. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5588. pixels are used.
  5589. Flags to local 3x3 coordinates maps like this:
  5590. 1 2 3
  5591. 4 5
  5592. 6 7 8
  5593. @end table
  5594. @section displace
  5595. Displace pixels as indicated by second and third input stream.
  5596. It takes three input streams and outputs one stream, the first input is the
  5597. source, and second and third input are displacement maps.
  5598. The second input specifies how much to displace pixels along the
  5599. x-axis, while the third input specifies how much to displace pixels
  5600. along the y-axis.
  5601. If one of displacement map streams terminates, last frame from that
  5602. displacement map will be used.
  5603. Note that once generated, displacements maps can be reused over and over again.
  5604. A description of the accepted options follows.
  5605. @table @option
  5606. @item edge
  5607. Set displace behavior for pixels that are out of range.
  5608. Available values are:
  5609. @table @samp
  5610. @item blank
  5611. Missing pixels are replaced by black pixels.
  5612. @item smear
  5613. Adjacent pixels will spread out to replace missing pixels.
  5614. @item wrap
  5615. Out of range pixels are wrapped so they point to pixels of other side.
  5616. @item mirror
  5617. Out of range pixels will be replaced with mirrored pixels.
  5618. @end table
  5619. Default is @samp{smear}.
  5620. @end table
  5621. @subsection Examples
  5622. @itemize
  5623. @item
  5624. Add ripple effect to rgb input of video size hd720:
  5625. @example
  5626. 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
  5627. @end example
  5628. @item
  5629. Add wave effect to rgb input of video size hd720:
  5630. @example
  5631. 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
  5632. @end example
  5633. @end itemize
  5634. @section drawbox
  5635. Draw a colored box on the input image.
  5636. It accepts the following parameters:
  5637. @table @option
  5638. @item x
  5639. @item y
  5640. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5641. @item width, w
  5642. @item height, h
  5643. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5644. the input width and height. It defaults to 0.
  5645. @item color, c
  5646. Specify the color of the box to write. For the general syntax of this option,
  5647. check the "Color" section in the ffmpeg-utils manual. If the special
  5648. value @code{invert} is used, the box edge color is the same as the
  5649. video with inverted luma.
  5650. @item thickness, t
  5651. The expression which sets the thickness of the box edge.
  5652. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5653. See below for the list of accepted constants.
  5654. @item replace
  5655. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5656. will overwrite the video's color and alpha pixels.
  5657. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5658. @end table
  5659. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5660. following constants:
  5661. @table @option
  5662. @item dar
  5663. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5664. @item hsub
  5665. @item vsub
  5666. horizontal and vertical chroma subsample values. For example for the
  5667. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5668. @item in_h, ih
  5669. @item in_w, iw
  5670. The input width and height.
  5671. @item sar
  5672. The input sample aspect ratio.
  5673. @item x
  5674. @item y
  5675. The x and y offset coordinates where the box is drawn.
  5676. @item w
  5677. @item h
  5678. The width and height of the drawn box.
  5679. @item t
  5680. The thickness of the drawn box.
  5681. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5682. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5683. @end table
  5684. @subsection Examples
  5685. @itemize
  5686. @item
  5687. Draw a black box around the edge of the input image:
  5688. @example
  5689. drawbox
  5690. @end example
  5691. @item
  5692. Draw a box with color red and an opacity of 50%:
  5693. @example
  5694. drawbox=10:20:200:60:red@@0.5
  5695. @end example
  5696. The previous example can be specified as:
  5697. @example
  5698. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5699. @end example
  5700. @item
  5701. Fill the box with pink color:
  5702. @example
  5703. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5704. @end example
  5705. @item
  5706. Draw a 2-pixel red 2.40:1 mask:
  5707. @example
  5708. 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
  5709. @end example
  5710. @end itemize
  5711. @section drawgrid
  5712. Draw a grid on the input image.
  5713. It accepts the following parameters:
  5714. @table @option
  5715. @item x
  5716. @item y
  5717. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5718. @item width, w
  5719. @item height, h
  5720. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5721. input width and height, respectively, minus @code{thickness}, so image gets
  5722. framed. Default to 0.
  5723. @item color, c
  5724. Specify the color of the grid. For the general syntax of this option,
  5725. check the "Color" section in the ffmpeg-utils manual. If the special
  5726. value @code{invert} is used, the grid color is the same as the
  5727. video with inverted luma.
  5728. @item thickness, t
  5729. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5730. See below for the list of accepted constants.
  5731. @item replace
  5732. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5733. will overwrite the video's color and alpha pixels.
  5734. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5735. @end table
  5736. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5737. following constants:
  5738. @table @option
  5739. @item dar
  5740. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5741. @item hsub
  5742. @item vsub
  5743. horizontal and vertical chroma subsample values. For example for the
  5744. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5745. @item in_h, ih
  5746. @item in_w, iw
  5747. The input grid cell width and height.
  5748. @item sar
  5749. The input sample aspect ratio.
  5750. @item x
  5751. @item y
  5752. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5753. @item w
  5754. @item h
  5755. The width and height of the drawn cell.
  5756. @item t
  5757. The thickness of the drawn cell.
  5758. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5759. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5760. @end table
  5761. @subsection Examples
  5762. @itemize
  5763. @item
  5764. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5765. @example
  5766. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5767. @end example
  5768. @item
  5769. Draw a white 3x3 grid with an opacity of 50%:
  5770. @example
  5771. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5772. @end example
  5773. @end itemize
  5774. @anchor{drawtext}
  5775. @section drawtext
  5776. Draw a text string or text from a specified file on top of a video, using the
  5777. libfreetype library.
  5778. To enable compilation of this filter, you need to configure FFmpeg with
  5779. @code{--enable-libfreetype}.
  5780. To enable default font fallback and the @var{font} option you need to
  5781. configure FFmpeg with @code{--enable-libfontconfig}.
  5782. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5783. @code{--enable-libfribidi}.
  5784. @subsection Syntax
  5785. It accepts the following parameters:
  5786. @table @option
  5787. @item box
  5788. Used to draw a box around text using the background color.
  5789. The value must be either 1 (enable) or 0 (disable).
  5790. The default value of @var{box} is 0.
  5791. @item boxborderw
  5792. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5793. The default value of @var{boxborderw} is 0.
  5794. @item boxcolor
  5795. The color to be used for drawing box around text. For the syntax of this
  5796. option, check the "Color" section in the ffmpeg-utils manual.
  5797. The default value of @var{boxcolor} is "white".
  5798. @item line_spacing
  5799. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5800. The default value of @var{line_spacing} is 0.
  5801. @item borderw
  5802. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5803. The default value of @var{borderw} is 0.
  5804. @item bordercolor
  5805. Set the color to be used for drawing border around text. For the syntax of this
  5806. option, check the "Color" section in the ffmpeg-utils manual.
  5807. The default value of @var{bordercolor} is "black".
  5808. @item expansion
  5809. Select how the @var{text} is expanded. Can be either @code{none},
  5810. @code{strftime} (deprecated) or
  5811. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5812. below for details.
  5813. @item basetime
  5814. Set a start time for the count. Value is in microseconds. Only applied
  5815. in the deprecated strftime expansion mode. To emulate in normal expansion
  5816. mode use the @code{pts} function, supplying the start time (in seconds)
  5817. as the second argument.
  5818. @item fix_bounds
  5819. If true, check and fix text coords to avoid clipping.
  5820. @item fontcolor
  5821. The color to be used for drawing fonts. For the syntax of this option, check
  5822. the "Color" section in the ffmpeg-utils manual.
  5823. The default value of @var{fontcolor} is "black".
  5824. @item fontcolor_expr
  5825. String which is expanded the same way as @var{text} to obtain dynamic
  5826. @var{fontcolor} value. By default this option has empty value and is not
  5827. processed. When this option is set, it overrides @var{fontcolor} option.
  5828. @item font
  5829. The font family to be used for drawing text. By default Sans.
  5830. @item fontfile
  5831. The font file to be used for drawing text. The path must be included.
  5832. This parameter is mandatory if the fontconfig support is disabled.
  5833. @item alpha
  5834. Draw the text applying alpha blending. The value can
  5835. be a number between 0.0 and 1.0.
  5836. The expression accepts the same variables @var{x, y} as well.
  5837. The default value is 1.
  5838. Please see @var{fontcolor_expr}.
  5839. @item fontsize
  5840. The font size to be used for drawing text.
  5841. The default value of @var{fontsize} is 16.
  5842. @item text_shaping
  5843. If set to 1, attempt to shape the text (for example, reverse the order of
  5844. right-to-left text and join Arabic characters) before drawing it.
  5845. Otherwise, just draw the text exactly as given.
  5846. By default 1 (if supported).
  5847. @item ft_load_flags
  5848. The flags to be used for loading the fonts.
  5849. The flags map the corresponding flags supported by libfreetype, and are
  5850. a combination of the following values:
  5851. @table @var
  5852. @item default
  5853. @item no_scale
  5854. @item no_hinting
  5855. @item render
  5856. @item no_bitmap
  5857. @item vertical_layout
  5858. @item force_autohint
  5859. @item crop_bitmap
  5860. @item pedantic
  5861. @item ignore_global_advance_width
  5862. @item no_recurse
  5863. @item ignore_transform
  5864. @item monochrome
  5865. @item linear_design
  5866. @item no_autohint
  5867. @end table
  5868. Default value is "default".
  5869. For more information consult the documentation for the FT_LOAD_*
  5870. libfreetype flags.
  5871. @item shadowcolor
  5872. The color to be used for drawing a shadow behind the drawn text. For the
  5873. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5874. The default value of @var{shadowcolor} is "black".
  5875. @item shadowx
  5876. @item shadowy
  5877. The x and y offsets for the text shadow position with respect to the
  5878. position of the text. They can be either positive or negative
  5879. values. The default value for both is "0".
  5880. @item start_number
  5881. The starting frame number for the n/frame_num variable. The default value
  5882. is "0".
  5883. @item tabsize
  5884. The size in number of spaces to use for rendering the tab.
  5885. Default value is 4.
  5886. @item timecode
  5887. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5888. format. It can be used with or without text parameter. @var{timecode_rate}
  5889. option must be specified.
  5890. @item timecode_rate, rate, r
  5891. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5892. integer. Minimum value is "1".
  5893. Drop-frame timecode is supported for frame rates 30 & 60.
  5894. @item tc24hmax
  5895. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5896. Default is 0 (disabled).
  5897. @item text
  5898. The text string to be drawn. The text must be a sequence of UTF-8
  5899. encoded characters.
  5900. This parameter is mandatory if no file is specified with the parameter
  5901. @var{textfile}.
  5902. @item textfile
  5903. A text file containing text to be drawn. The text must be a sequence
  5904. of UTF-8 encoded characters.
  5905. This parameter is mandatory if no text string is specified with the
  5906. parameter @var{text}.
  5907. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5908. @item reload
  5909. If set to 1, the @var{textfile} will be reloaded before each frame.
  5910. Be sure to update it atomically, or it may be read partially, or even fail.
  5911. @item x
  5912. @item y
  5913. The expressions which specify the offsets where text will be drawn
  5914. within the video frame. They are relative to the top/left border of the
  5915. output image.
  5916. The default value of @var{x} and @var{y} is "0".
  5917. See below for the list of accepted constants and functions.
  5918. @end table
  5919. The parameters for @var{x} and @var{y} are expressions containing the
  5920. following constants and functions:
  5921. @table @option
  5922. @item dar
  5923. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5924. @item hsub
  5925. @item vsub
  5926. horizontal and vertical chroma subsample values. For example for the
  5927. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5928. @item line_h, lh
  5929. the height of each text line
  5930. @item main_h, h, H
  5931. the input height
  5932. @item main_w, w, W
  5933. the input width
  5934. @item max_glyph_a, ascent
  5935. the maximum distance from the baseline to the highest/upper grid
  5936. coordinate used to place a glyph outline point, for all the rendered
  5937. glyphs.
  5938. It is a positive value, due to the grid's orientation with the Y axis
  5939. upwards.
  5940. @item max_glyph_d, descent
  5941. the maximum distance from the baseline to the lowest grid coordinate
  5942. used to place a glyph outline point, for all the rendered glyphs.
  5943. This is a negative value, due to the grid's orientation, with the Y axis
  5944. upwards.
  5945. @item max_glyph_h
  5946. maximum glyph height, that is the maximum height for all the glyphs
  5947. contained in the rendered text, it is equivalent to @var{ascent} -
  5948. @var{descent}.
  5949. @item max_glyph_w
  5950. maximum glyph width, that is the maximum width for all the glyphs
  5951. contained in the rendered text
  5952. @item n
  5953. the number of input frame, starting from 0
  5954. @item rand(min, max)
  5955. return a random number included between @var{min} and @var{max}
  5956. @item sar
  5957. The input sample aspect ratio.
  5958. @item t
  5959. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5960. @item text_h, th
  5961. the height of the rendered text
  5962. @item text_w, tw
  5963. the width of the rendered text
  5964. @item x
  5965. @item y
  5966. the x and y offset coordinates where the text is drawn.
  5967. These parameters allow the @var{x} and @var{y} expressions to refer
  5968. each other, so you can for example specify @code{y=x/dar}.
  5969. @end table
  5970. @anchor{drawtext_expansion}
  5971. @subsection Text expansion
  5972. If @option{expansion} is set to @code{strftime},
  5973. the filter recognizes strftime() sequences in the provided text and
  5974. expands them accordingly. Check the documentation of strftime(). This
  5975. feature is deprecated.
  5976. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5977. If @option{expansion} is set to @code{normal} (which is the default),
  5978. the following expansion mechanism is used.
  5979. The backslash character @samp{\}, followed by any character, always expands to
  5980. the second character.
  5981. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5982. braces is a function name, possibly followed by arguments separated by ':'.
  5983. If the arguments contain special characters or delimiters (':' or '@}'),
  5984. they should be escaped.
  5985. Note that they probably must also be escaped as the value for the
  5986. @option{text} option in the filter argument string and as the filter
  5987. argument in the filtergraph description, and possibly also for the shell,
  5988. that makes up to four levels of escaping; using a text file avoids these
  5989. problems.
  5990. The following functions are available:
  5991. @table @command
  5992. @item expr, e
  5993. The expression evaluation result.
  5994. It must take one argument specifying the expression to be evaluated,
  5995. which accepts the same constants and functions as the @var{x} and
  5996. @var{y} values. Note that not all constants should be used, for
  5997. example the text size is not known when evaluating the expression, so
  5998. the constants @var{text_w} and @var{text_h} will have an undefined
  5999. value.
  6000. @item expr_int_format, eif
  6001. Evaluate the expression's value and output as formatted integer.
  6002. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6003. The second argument specifies the output format. Allowed values are @samp{x},
  6004. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6005. @code{printf} function.
  6006. The third parameter is optional and sets the number of positions taken by the output.
  6007. It can be used to add padding with zeros from the left.
  6008. @item gmtime
  6009. The time at which the filter is running, expressed in UTC.
  6010. It can accept an argument: a strftime() format string.
  6011. @item localtime
  6012. The time at which the filter is running, expressed in the local time zone.
  6013. It can accept an argument: a strftime() format string.
  6014. @item metadata
  6015. Frame metadata. Takes one or two arguments.
  6016. The first argument is mandatory and specifies the metadata key.
  6017. The second argument is optional and specifies a default value, used when the
  6018. metadata key is not found or empty.
  6019. @item n, frame_num
  6020. The frame number, starting from 0.
  6021. @item pict_type
  6022. A 1 character description of the current picture type.
  6023. @item pts
  6024. The timestamp of the current frame.
  6025. It can take up to three arguments.
  6026. The first argument is the format of the timestamp; it defaults to @code{flt}
  6027. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6028. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6029. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6030. @code{localtime} stands for the timestamp of the frame formatted as
  6031. local time zone time.
  6032. The second argument is an offset added to the timestamp.
  6033. If the format is set to @code{localtime} or @code{gmtime},
  6034. a third argument may be supplied: a strftime() format string.
  6035. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6036. @end table
  6037. @subsection Examples
  6038. @itemize
  6039. @item
  6040. Draw "Test Text" with font FreeSerif, using the default values for the
  6041. optional parameters.
  6042. @example
  6043. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6044. @end example
  6045. @item
  6046. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6047. and y=50 (counting from the top-left corner of the screen), text is
  6048. yellow with a red box around it. Both the text and the box have an
  6049. opacity of 20%.
  6050. @example
  6051. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6052. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6053. @end example
  6054. Note that the double quotes are not necessary if spaces are not used
  6055. within the parameter list.
  6056. @item
  6057. Show the text at the center of the video frame:
  6058. @example
  6059. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6060. @end example
  6061. @item
  6062. Show the text at a random position, switching to a new position every 30 seconds:
  6063. @example
  6064. 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)"
  6065. @end example
  6066. @item
  6067. Show a text line sliding from right to left in the last row of the video
  6068. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6069. with no newlines.
  6070. @example
  6071. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6072. @end example
  6073. @item
  6074. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6075. @example
  6076. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6077. @end example
  6078. @item
  6079. Draw a single green letter "g", at the center of the input video.
  6080. The glyph baseline is placed at half screen height.
  6081. @example
  6082. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6083. @end example
  6084. @item
  6085. Show text for 1 second every 3 seconds:
  6086. @example
  6087. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6088. @end example
  6089. @item
  6090. Use fontconfig to set the font. Note that the colons need to be escaped.
  6091. @example
  6092. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6093. @end example
  6094. @item
  6095. Print the date of a real-time encoding (see strftime(3)):
  6096. @example
  6097. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6098. @end example
  6099. @item
  6100. Show text fading in and out (appearing/disappearing):
  6101. @example
  6102. #!/bin/sh
  6103. DS=1.0 # display start
  6104. DE=10.0 # display end
  6105. FID=1.5 # fade in duration
  6106. FOD=5 # fade out duration
  6107. 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 @}"
  6108. @end example
  6109. @item
  6110. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6111. and the @option{fontsize} value are included in the @option{y} offset.
  6112. @example
  6113. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6114. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6115. @end example
  6116. @end itemize
  6117. For more information about libfreetype, check:
  6118. @url{http://www.freetype.org/}.
  6119. For more information about fontconfig, check:
  6120. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6121. For more information about libfribidi, check:
  6122. @url{http://fribidi.org/}.
  6123. @section edgedetect
  6124. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6125. The filter accepts the following options:
  6126. @table @option
  6127. @item low
  6128. @item high
  6129. Set low and high threshold values used by the Canny thresholding
  6130. algorithm.
  6131. The high threshold selects the "strong" edge pixels, which are then
  6132. connected through 8-connectivity with the "weak" edge pixels selected
  6133. by the low threshold.
  6134. @var{low} and @var{high} threshold values must be chosen in the range
  6135. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6136. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6137. is @code{50/255}.
  6138. @item mode
  6139. Define the drawing mode.
  6140. @table @samp
  6141. @item wires
  6142. Draw white/gray wires on black background.
  6143. @item colormix
  6144. Mix the colors to create a paint/cartoon effect.
  6145. @end table
  6146. Default value is @var{wires}.
  6147. @end table
  6148. @subsection Examples
  6149. @itemize
  6150. @item
  6151. Standard edge detection with custom values for the hysteresis thresholding:
  6152. @example
  6153. edgedetect=low=0.1:high=0.4
  6154. @end example
  6155. @item
  6156. Painting effect without thresholding:
  6157. @example
  6158. edgedetect=mode=colormix:high=0
  6159. @end example
  6160. @end itemize
  6161. @section eq
  6162. Set brightness, contrast, saturation and approximate gamma adjustment.
  6163. The filter accepts the following options:
  6164. @table @option
  6165. @item contrast
  6166. Set the contrast expression. The value must be a float value in range
  6167. @code{-2.0} to @code{2.0}. The default value is "1".
  6168. @item brightness
  6169. Set the brightness expression. The value must be a float value in
  6170. range @code{-1.0} to @code{1.0}. The default value is "0".
  6171. @item saturation
  6172. Set the saturation expression. The value must be a float in
  6173. range @code{0.0} to @code{3.0}. The default value is "1".
  6174. @item gamma
  6175. Set the gamma expression. The value must be a float in range
  6176. @code{0.1} to @code{10.0}. The default value is "1".
  6177. @item gamma_r
  6178. Set the gamma expression for red. The value must be a float in
  6179. range @code{0.1} to @code{10.0}. The default value is "1".
  6180. @item gamma_g
  6181. Set the gamma expression for green. The value must be a float in range
  6182. @code{0.1} to @code{10.0}. The default value is "1".
  6183. @item gamma_b
  6184. Set the gamma expression for blue. The value must be a float in range
  6185. @code{0.1} to @code{10.0}. The default value is "1".
  6186. @item gamma_weight
  6187. Set the gamma weight expression. It can be used to reduce the effect
  6188. of a high gamma value on bright image areas, e.g. keep them from
  6189. getting overamplified and just plain white. The value must be a float
  6190. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6191. gamma correction all the way down while @code{1.0} leaves it at its
  6192. full strength. Default is "1".
  6193. @item eval
  6194. Set when the expressions for brightness, contrast, saturation and
  6195. gamma expressions are evaluated.
  6196. It accepts the following values:
  6197. @table @samp
  6198. @item init
  6199. only evaluate expressions once during the filter initialization or
  6200. when a command is processed
  6201. @item frame
  6202. evaluate expressions for each incoming frame
  6203. @end table
  6204. Default value is @samp{init}.
  6205. @end table
  6206. The expressions accept the following parameters:
  6207. @table @option
  6208. @item n
  6209. frame count of the input frame starting from 0
  6210. @item pos
  6211. byte position of the corresponding packet in the input file, NAN if
  6212. unspecified
  6213. @item r
  6214. frame rate of the input video, NAN if the input frame rate is unknown
  6215. @item t
  6216. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6217. @end table
  6218. @subsection Commands
  6219. The filter supports the following commands:
  6220. @table @option
  6221. @item contrast
  6222. Set the contrast expression.
  6223. @item brightness
  6224. Set the brightness expression.
  6225. @item saturation
  6226. Set the saturation expression.
  6227. @item gamma
  6228. Set the gamma expression.
  6229. @item gamma_r
  6230. Set the gamma_r expression.
  6231. @item gamma_g
  6232. Set gamma_g expression.
  6233. @item gamma_b
  6234. Set gamma_b expression.
  6235. @item gamma_weight
  6236. Set gamma_weight expression.
  6237. The command accepts the same syntax of the corresponding option.
  6238. If the specified expression is not valid, it is kept at its current
  6239. value.
  6240. @end table
  6241. @section erosion
  6242. Apply erosion effect to the video.
  6243. This filter replaces the pixel by the local(3x3) minimum.
  6244. It accepts the following options:
  6245. @table @option
  6246. @item threshold0
  6247. @item threshold1
  6248. @item threshold2
  6249. @item threshold3
  6250. Limit the maximum change for each plane, default is 65535.
  6251. If 0, plane will remain unchanged.
  6252. @item coordinates
  6253. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6254. pixels are used.
  6255. Flags to local 3x3 coordinates maps like this:
  6256. 1 2 3
  6257. 4 5
  6258. 6 7 8
  6259. @end table
  6260. @section extractplanes
  6261. Extract color channel components from input video stream into
  6262. separate grayscale video streams.
  6263. The filter accepts the following option:
  6264. @table @option
  6265. @item planes
  6266. Set plane(s) to extract.
  6267. Available values for planes are:
  6268. @table @samp
  6269. @item y
  6270. @item u
  6271. @item v
  6272. @item a
  6273. @item r
  6274. @item g
  6275. @item b
  6276. @end table
  6277. Choosing planes not available in the input will result in an error.
  6278. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6279. with @code{y}, @code{u}, @code{v} planes at same time.
  6280. @end table
  6281. @subsection Examples
  6282. @itemize
  6283. @item
  6284. Extract luma, u and v color channel component from input video frame
  6285. into 3 grayscale outputs:
  6286. @example
  6287. 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
  6288. @end example
  6289. @end itemize
  6290. @section elbg
  6291. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6292. For each input image, the filter will compute the optimal mapping from
  6293. the input to the output given the codebook length, that is the number
  6294. of distinct output colors.
  6295. This filter accepts the following options.
  6296. @table @option
  6297. @item codebook_length, l
  6298. Set codebook length. The value must be a positive integer, and
  6299. represents the number of distinct output colors. Default value is 256.
  6300. @item nb_steps, n
  6301. Set the maximum number of iterations to apply for computing the optimal
  6302. mapping. The higher the value the better the result and the higher the
  6303. computation time. Default value is 1.
  6304. @item seed, s
  6305. Set a random seed, must be an integer included between 0 and
  6306. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6307. will try to use a good random seed on a best effort basis.
  6308. @item pal8
  6309. Set pal8 output pixel format. This option does not work with codebook
  6310. length greater than 256.
  6311. @end table
  6312. @section fade
  6313. Apply a fade-in/out effect to the input video.
  6314. It accepts the following parameters:
  6315. @table @option
  6316. @item type, t
  6317. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6318. effect.
  6319. Default is @code{in}.
  6320. @item start_frame, s
  6321. Specify the number of the frame to start applying the fade
  6322. effect at. Default is 0.
  6323. @item nb_frames, n
  6324. The number of frames that the fade effect lasts. At the end of the
  6325. fade-in effect, the output video will have the same intensity as the input video.
  6326. At the end of the fade-out transition, the output video will be filled with the
  6327. selected @option{color}.
  6328. Default is 25.
  6329. @item alpha
  6330. If set to 1, fade only alpha channel, if one exists on the input.
  6331. Default value is 0.
  6332. @item start_time, st
  6333. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6334. effect. If both start_frame and start_time are specified, the fade will start at
  6335. whichever comes last. Default is 0.
  6336. @item duration, d
  6337. The number of seconds for which the fade effect has to last. At the end of the
  6338. fade-in effect the output video will have the same intensity as the input video,
  6339. at the end of the fade-out transition the output video will be filled with the
  6340. selected @option{color}.
  6341. If both duration and nb_frames are specified, duration is used. Default is 0
  6342. (nb_frames is used by default).
  6343. @item color, c
  6344. Specify the color of the fade. Default is "black".
  6345. @end table
  6346. @subsection Examples
  6347. @itemize
  6348. @item
  6349. Fade in the first 30 frames of video:
  6350. @example
  6351. fade=in:0:30
  6352. @end example
  6353. The command above is equivalent to:
  6354. @example
  6355. fade=t=in:s=0:n=30
  6356. @end example
  6357. @item
  6358. Fade out the last 45 frames of a 200-frame video:
  6359. @example
  6360. fade=out:155:45
  6361. fade=type=out:start_frame=155:nb_frames=45
  6362. @end example
  6363. @item
  6364. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6365. @example
  6366. fade=in:0:25, fade=out:975:25
  6367. @end example
  6368. @item
  6369. Make the first 5 frames yellow, then fade in from frame 5-24:
  6370. @example
  6371. fade=in:5:20:color=yellow
  6372. @end example
  6373. @item
  6374. Fade in alpha over first 25 frames of video:
  6375. @example
  6376. fade=in:0:25:alpha=1
  6377. @end example
  6378. @item
  6379. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6380. @example
  6381. fade=t=in:st=5.5:d=0.5
  6382. @end example
  6383. @end itemize
  6384. @section fftfilt
  6385. Apply arbitrary expressions to samples in frequency domain
  6386. @table @option
  6387. @item dc_Y
  6388. Adjust the dc value (gain) of the luma plane of the image. The filter
  6389. accepts an integer value in range @code{0} to @code{1000}. The default
  6390. value is set to @code{0}.
  6391. @item dc_U
  6392. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6393. filter accepts an integer value in range @code{0} to @code{1000}. The
  6394. default value is set to @code{0}.
  6395. @item dc_V
  6396. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6397. filter accepts an integer value in range @code{0} to @code{1000}. The
  6398. default value is set to @code{0}.
  6399. @item weight_Y
  6400. Set the frequency domain weight expression for the luma plane.
  6401. @item weight_U
  6402. Set the frequency domain weight expression for the 1st chroma plane.
  6403. @item weight_V
  6404. Set the frequency domain weight expression for the 2nd chroma plane.
  6405. @item eval
  6406. Set when the expressions are evaluated.
  6407. It accepts the following values:
  6408. @table @samp
  6409. @item init
  6410. Only evaluate expressions once during the filter initialization.
  6411. @item frame
  6412. Evaluate expressions for each incoming frame.
  6413. @end table
  6414. Default value is @samp{init}.
  6415. The filter accepts the following variables:
  6416. @item X
  6417. @item Y
  6418. The coordinates of the current sample.
  6419. @item W
  6420. @item H
  6421. The width and height of the image.
  6422. @item N
  6423. The number of input frame, starting from 0.
  6424. @end table
  6425. @subsection Examples
  6426. @itemize
  6427. @item
  6428. High-pass:
  6429. @example
  6430. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6431. @end example
  6432. @item
  6433. Low-pass:
  6434. @example
  6435. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6436. @end example
  6437. @item
  6438. Sharpen:
  6439. @example
  6440. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6441. @end example
  6442. @item
  6443. Blur:
  6444. @example
  6445. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6446. @end example
  6447. @end itemize
  6448. @section field
  6449. Extract a single field from an interlaced image using stride
  6450. arithmetic to avoid wasting CPU time. The output frames are marked as
  6451. non-interlaced.
  6452. The filter accepts the following options:
  6453. @table @option
  6454. @item type
  6455. Specify whether to extract the top (if the value is @code{0} or
  6456. @code{top}) or the bottom field (if the value is @code{1} or
  6457. @code{bottom}).
  6458. @end table
  6459. @section fieldhint
  6460. Create new frames by copying the top and bottom fields from surrounding frames
  6461. supplied as numbers by the hint file.
  6462. @table @option
  6463. @item hint
  6464. Set file containing hints: absolute/relative frame numbers.
  6465. There must be one line for each frame in a clip. Each line must contain two
  6466. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6467. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6468. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6469. for @code{relative} mode. First number tells from which frame to pick up top
  6470. field and second number tells from which frame to pick up bottom field.
  6471. If optionally followed by @code{+} output frame will be marked as interlaced,
  6472. else if followed by @code{-} output frame will be marked as progressive, else
  6473. it will be marked same as input frame.
  6474. If line starts with @code{#} or @code{;} that line is skipped.
  6475. @item mode
  6476. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6477. @end table
  6478. Example of first several lines of @code{hint} file for @code{relative} mode:
  6479. @example
  6480. 0,0 - # first frame
  6481. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6482. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6483. 1,0 -
  6484. 0,0 -
  6485. 0,0 -
  6486. 1,0 -
  6487. 1,0 -
  6488. 1,0 -
  6489. 0,0 -
  6490. 0,0 -
  6491. 1,0 -
  6492. 1,0 -
  6493. 1,0 -
  6494. 0,0 -
  6495. @end example
  6496. @section fieldmatch
  6497. Field matching filter for inverse telecine. It is meant to reconstruct the
  6498. progressive frames from a telecined stream. The filter does not drop duplicated
  6499. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6500. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6501. The separation of the field matching and the decimation is notably motivated by
  6502. the possibility of inserting a de-interlacing filter fallback between the two.
  6503. If the source has mixed telecined and real interlaced content,
  6504. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6505. But these remaining combed frames will be marked as interlaced, and thus can be
  6506. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6507. In addition to the various configuration options, @code{fieldmatch} can take an
  6508. optional second stream, activated through the @option{ppsrc} option. If
  6509. enabled, the frames reconstruction will be based on the fields and frames from
  6510. this second stream. This allows the first input to be pre-processed in order to
  6511. help the various algorithms of the filter, while keeping the output lossless
  6512. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6513. or brightness/contrast adjustments can help.
  6514. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6515. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6516. which @code{fieldmatch} is based on. While the semantic and usage are very
  6517. close, some behaviour and options names can differ.
  6518. The @ref{decimate} filter currently only works for constant frame rate input.
  6519. If your input has mixed telecined (30fps) and progressive content with a lower
  6520. framerate like 24fps use the following filterchain to produce the necessary cfr
  6521. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6522. The filter accepts the following options:
  6523. @table @option
  6524. @item order
  6525. Specify the assumed field order of the input stream. Available values are:
  6526. @table @samp
  6527. @item auto
  6528. Auto detect parity (use FFmpeg's internal parity value).
  6529. @item bff
  6530. Assume bottom field first.
  6531. @item tff
  6532. Assume top field first.
  6533. @end table
  6534. Note that it is sometimes recommended not to trust the parity announced by the
  6535. stream.
  6536. Default value is @var{auto}.
  6537. @item mode
  6538. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6539. sense that it won't risk creating jerkiness due to duplicate frames when
  6540. possible, but if there are bad edits or blended fields it will end up
  6541. outputting combed frames when a good match might actually exist. On the other
  6542. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6543. but will almost always find a good frame if there is one. The other values are
  6544. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6545. jerkiness and creating duplicate frames versus finding good matches in sections
  6546. with bad edits, orphaned fields, blended fields, etc.
  6547. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6548. Available values are:
  6549. @table @samp
  6550. @item pc
  6551. 2-way matching (p/c)
  6552. @item pc_n
  6553. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6554. @item pc_u
  6555. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6556. @item pc_n_ub
  6557. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6558. still combed (p/c + n + u/b)
  6559. @item pcn
  6560. 3-way matching (p/c/n)
  6561. @item pcn_ub
  6562. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6563. detected as combed (p/c/n + u/b)
  6564. @end table
  6565. The parenthesis at the end indicate the matches that would be used for that
  6566. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6567. @var{top}).
  6568. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6569. the slowest.
  6570. Default value is @var{pc_n}.
  6571. @item ppsrc
  6572. Mark the main input stream as a pre-processed input, and enable the secondary
  6573. input stream as the clean source to pick the fields from. See the filter
  6574. introduction for more details. It is similar to the @option{clip2} feature from
  6575. VFM/TFM.
  6576. Default value is @code{0} (disabled).
  6577. @item field
  6578. Set the field to match from. It is recommended to set this to the same value as
  6579. @option{order} unless you experience matching failures with that setting. In
  6580. certain circumstances changing the field that is used to match from can have a
  6581. large impact on matching performance. Available values are:
  6582. @table @samp
  6583. @item auto
  6584. Automatic (same value as @option{order}).
  6585. @item bottom
  6586. Match from the bottom field.
  6587. @item top
  6588. Match from the top field.
  6589. @end table
  6590. Default value is @var{auto}.
  6591. @item mchroma
  6592. Set whether or not chroma is included during the match comparisons. In most
  6593. cases it is recommended to leave this enabled. You should set this to @code{0}
  6594. only if your clip has bad chroma problems such as heavy rainbowing or other
  6595. artifacts. Setting this to @code{0} could also be used to speed things up at
  6596. the cost of some accuracy.
  6597. Default value is @code{1}.
  6598. @item y0
  6599. @item y1
  6600. These define an exclusion band which excludes the lines between @option{y0} and
  6601. @option{y1} from being included in the field matching decision. An exclusion
  6602. band can be used to ignore subtitles, a logo, or other things that may
  6603. interfere with the matching. @option{y0} sets the starting scan line and
  6604. @option{y1} sets the ending line; all lines in between @option{y0} and
  6605. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6606. @option{y0} and @option{y1} to the same value will disable the feature.
  6607. @option{y0} and @option{y1} defaults to @code{0}.
  6608. @item scthresh
  6609. Set the scene change detection threshold as a percentage of maximum change on
  6610. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6611. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6612. @option{scthresh} is @code{[0.0, 100.0]}.
  6613. Default value is @code{12.0}.
  6614. @item combmatch
  6615. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6616. account the combed scores of matches when deciding what match to use as the
  6617. final match. Available values are:
  6618. @table @samp
  6619. @item none
  6620. No final matching based on combed scores.
  6621. @item sc
  6622. Combed scores are only used when a scene change is detected.
  6623. @item full
  6624. Use combed scores all the time.
  6625. @end table
  6626. Default is @var{sc}.
  6627. @item combdbg
  6628. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6629. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6630. Available values are:
  6631. @table @samp
  6632. @item none
  6633. No forced calculation.
  6634. @item pcn
  6635. Force p/c/n calculations.
  6636. @item pcnub
  6637. Force p/c/n/u/b calculations.
  6638. @end table
  6639. Default value is @var{none}.
  6640. @item cthresh
  6641. This is the area combing threshold used for combed frame detection. This
  6642. essentially controls how "strong" or "visible" combing must be to be detected.
  6643. Larger values mean combing must be more visible and smaller values mean combing
  6644. can be less visible or strong and still be detected. Valid settings are from
  6645. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6646. be detected as combed). This is basically a pixel difference value. A good
  6647. range is @code{[8, 12]}.
  6648. Default value is @code{9}.
  6649. @item chroma
  6650. Sets whether or not chroma is considered in the combed frame decision. Only
  6651. disable this if your source has chroma problems (rainbowing, etc.) that are
  6652. causing problems for the combed frame detection with chroma enabled. Actually,
  6653. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6654. where there is chroma only combing in the source.
  6655. Default value is @code{0}.
  6656. @item blockx
  6657. @item blocky
  6658. Respectively set the x-axis and y-axis size of the window used during combed
  6659. frame detection. This has to do with the size of the area in which
  6660. @option{combpel} pixels are required to be detected as combed for a frame to be
  6661. declared combed. See the @option{combpel} parameter description for more info.
  6662. Possible values are any number that is a power of 2 starting at 4 and going up
  6663. to 512.
  6664. Default value is @code{16}.
  6665. @item combpel
  6666. The number of combed pixels inside any of the @option{blocky} by
  6667. @option{blockx} size blocks on the frame for the frame to be detected as
  6668. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6669. setting controls "how much" combing there must be in any localized area (a
  6670. window defined by the @option{blockx} and @option{blocky} settings) on the
  6671. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6672. which point no frames will ever be detected as combed). This setting is known
  6673. as @option{MI} in TFM/VFM vocabulary.
  6674. Default value is @code{80}.
  6675. @end table
  6676. @anchor{p/c/n/u/b meaning}
  6677. @subsection p/c/n/u/b meaning
  6678. @subsubsection p/c/n
  6679. We assume the following telecined stream:
  6680. @example
  6681. Top fields: 1 2 2 3 4
  6682. Bottom fields: 1 2 3 4 4
  6683. @end example
  6684. The numbers correspond to the progressive frame the fields relate to. Here, the
  6685. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6686. When @code{fieldmatch} is configured to run a matching from bottom
  6687. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6688. @example
  6689. Input stream:
  6690. T 1 2 2 3 4
  6691. B 1 2 3 4 4 <-- matching reference
  6692. Matches: c c n n c
  6693. Output stream:
  6694. T 1 2 3 4 4
  6695. B 1 2 3 4 4
  6696. @end example
  6697. As a result of the field matching, we can see that some frames get duplicated.
  6698. To perform a complete inverse telecine, you need to rely on a decimation filter
  6699. after this operation. See for instance the @ref{decimate} filter.
  6700. The same operation now matching from top fields (@option{field}=@var{top})
  6701. looks like this:
  6702. @example
  6703. Input stream:
  6704. T 1 2 2 3 4 <-- matching reference
  6705. B 1 2 3 4 4
  6706. Matches: c c p p c
  6707. Output stream:
  6708. T 1 2 2 3 4
  6709. B 1 2 2 3 4
  6710. @end example
  6711. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6712. basically, they refer to the frame and field of the opposite parity:
  6713. @itemize
  6714. @item @var{p} matches the field of the opposite parity in the previous frame
  6715. @item @var{c} matches the field of the opposite parity in the current frame
  6716. @item @var{n} matches the field of the opposite parity in the next frame
  6717. @end itemize
  6718. @subsubsection u/b
  6719. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6720. from the opposite parity flag. In the following examples, we assume that we are
  6721. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6722. 'x' is placed above and below each matched fields.
  6723. With bottom matching (@option{field}=@var{bottom}):
  6724. @example
  6725. Match: c p n b u
  6726. x x x x x
  6727. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6728. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6729. x x x x x
  6730. Output frames:
  6731. 2 1 2 2 2
  6732. 2 2 2 1 3
  6733. @end example
  6734. With top matching (@option{field}=@var{top}):
  6735. @example
  6736. Match: c p n b u
  6737. x x x x x
  6738. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6739. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6740. x x x x x
  6741. Output frames:
  6742. 2 2 2 1 2
  6743. 2 1 3 2 2
  6744. @end example
  6745. @subsection Examples
  6746. Simple IVTC of a top field first telecined stream:
  6747. @example
  6748. fieldmatch=order=tff:combmatch=none, decimate
  6749. @end example
  6750. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6751. @example
  6752. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6753. @end example
  6754. @section fieldorder
  6755. Transform the field order of the input video.
  6756. It accepts the following parameters:
  6757. @table @option
  6758. @item order
  6759. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6760. for bottom field first.
  6761. @end table
  6762. The default value is @samp{tff}.
  6763. The transformation is done by shifting the picture content up or down
  6764. by one line, and filling the remaining line with appropriate picture content.
  6765. This method is consistent with most broadcast field order converters.
  6766. If the input video is not flagged as being interlaced, or it is already
  6767. flagged as being of the required output field order, then this filter does
  6768. not alter the incoming video.
  6769. It is very useful when converting to or from PAL DV material,
  6770. which is bottom field first.
  6771. For example:
  6772. @example
  6773. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6774. @end example
  6775. @section fifo, afifo
  6776. Buffer input images and send them when they are requested.
  6777. It is mainly useful when auto-inserted by the libavfilter
  6778. framework.
  6779. It does not take parameters.
  6780. @section fillborders
  6781. Fill borders of the input video, without changing video stream dimensions.
  6782. Sometimes video can have garbage at the four edges and you may not want to
  6783. crop video input to keep size multiple of some number.
  6784. This filter accepts the following options:
  6785. @table @option
  6786. @item left
  6787. Number of pixels to fill from left border.
  6788. @item right
  6789. Number of pixels to fill from right border.
  6790. @item top
  6791. Number of pixels to fill from top border.
  6792. @item bottom
  6793. Number of pixels to fill from bottom border.
  6794. @item mode
  6795. Set fill mode.
  6796. It accepts the following values:
  6797. @table @samp
  6798. @item smear
  6799. fill pixels using outermost pixels
  6800. @item mirror
  6801. fill pixels using mirroring
  6802. @item fixed
  6803. fill pixels with constant value
  6804. @end table
  6805. Default is @var{smear}.
  6806. @item color
  6807. Set color for pixels in fixed mode. Default is @var{black}.
  6808. @end table
  6809. @section find_rect
  6810. Find a rectangular object
  6811. It accepts the following options:
  6812. @table @option
  6813. @item object
  6814. Filepath of the object image, needs to be in gray8.
  6815. @item threshold
  6816. Detection threshold, default is 0.5.
  6817. @item mipmaps
  6818. Number of mipmaps, default is 3.
  6819. @item xmin, ymin, xmax, ymax
  6820. Specifies the rectangle in which to search.
  6821. @end table
  6822. @subsection Examples
  6823. @itemize
  6824. @item
  6825. Generate a representative palette of a given video using @command{ffmpeg}:
  6826. @example
  6827. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6828. @end example
  6829. @end itemize
  6830. @section cover_rect
  6831. Cover a rectangular object
  6832. It accepts the following options:
  6833. @table @option
  6834. @item cover
  6835. Filepath of the optional cover image, needs to be in yuv420.
  6836. @item mode
  6837. Set covering mode.
  6838. It accepts the following values:
  6839. @table @samp
  6840. @item cover
  6841. cover it by the supplied image
  6842. @item blur
  6843. cover it by interpolating the surrounding pixels
  6844. @end table
  6845. Default value is @var{blur}.
  6846. @end table
  6847. @subsection Examples
  6848. @itemize
  6849. @item
  6850. Generate a representative palette of a given video using @command{ffmpeg}:
  6851. @example
  6852. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6853. @end example
  6854. @end itemize
  6855. @section floodfill
  6856. Flood area with values of same pixel components with another values.
  6857. It accepts the following options:
  6858. @table @option
  6859. @item x
  6860. Set pixel x coordinate.
  6861. @item y
  6862. Set pixel y coordinate.
  6863. @item s0
  6864. Set source #0 component value.
  6865. @item s1
  6866. Set source #1 component value.
  6867. @item s2
  6868. Set source #2 component value.
  6869. @item s3
  6870. Set source #3 component value.
  6871. @item d0
  6872. Set destination #0 component value.
  6873. @item d1
  6874. Set destination #1 component value.
  6875. @item d2
  6876. Set destination #2 component value.
  6877. @item d3
  6878. Set destination #3 component value.
  6879. @end table
  6880. @anchor{format}
  6881. @section format
  6882. Convert the input video to one of the specified pixel formats.
  6883. Libavfilter will try to pick one that is suitable as input to
  6884. the next filter.
  6885. It accepts the following parameters:
  6886. @table @option
  6887. @item pix_fmts
  6888. A '|'-separated list of pixel format names, such as
  6889. "pix_fmts=yuv420p|monow|rgb24".
  6890. @end table
  6891. @subsection Examples
  6892. @itemize
  6893. @item
  6894. Convert the input video to the @var{yuv420p} format
  6895. @example
  6896. format=pix_fmts=yuv420p
  6897. @end example
  6898. Convert the input video to any of the formats in the list
  6899. @example
  6900. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6901. @end example
  6902. @end itemize
  6903. @anchor{fps}
  6904. @section fps
  6905. Convert the video to specified constant frame rate by duplicating or dropping
  6906. frames as necessary.
  6907. It accepts the following parameters:
  6908. @table @option
  6909. @item fps
  6910. The desired output frame rate. The default is @code{25}.
  6911. @item start_time
  6912. Assume the first PTS should be the given value, in seconds. This allows for
  6913. padding/trimming at the start of stream. By default, no assumption is made
  6914. about the first frame's expected PTS, so no padding or trimming is done.
  6915. For example, this could be set to 0 to pad the beginning with duplicates of
  6916. the first frame if a video stream starts after the audio stream or to trim any
  6917. frames with a negative PTS.
  6918. @item round
  6919. Timestamp (PTS) rounding method.
  6920. Possible values are:
  6921. @table @option
  6922. @item zero
  6923. round towards 0
  6924. @item inf
  6925. round away from 0
  6926. @item down
  6927. round towards -infinity
  6928. @item up
  6929. round towards +infinity
  6930. @item near
  6931. round to nearest
  6932. @end table
  6933. The default is @code{near}.
  6934. @item eof_action
  6935. Action performed when reading the last frame.
  6936. Possible values are:
  6937. @table @option
  6938. @item round
  6939. Use same timestamp rounding method as used for other frames.
  6940. @item pass
  6941. Pass through last frame if input duration has not been reached yet.
  6942. @end table
  6943. The default is @code{round}.
  6944. @end table
  6945. Alternatively, the options can be specified as a flat string:
  6946. @var{fps}[:@var{start_time}[:@var{round}]].
  6947. See also the @ref{setpts} filter.
  6948. @subsection Examples
  6949. @itemize
  6950. @item
  6951. A typical usage in order to set the fps to 25:
  6952. @example
  6953. fps=fps=25
  6954. @end example
  6955. @item
  6956. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6957. @example
  6958. fps=fps=film:round=near
  6959. @end example
  6960. @end itemize
  6961. @section framepack
  6962. Pack two different video streams into a stereoscopic video, setting proper
  6963. metadata on supported codecs. The two views should have the same size and
  6964. framerate and processing will stop when the shorter video ends. Please note
  6965. that you may conveniently adjust view properties with the @ref{scale} and
  6966. @ref{fps} filters.
  6967. It accepts the following parameters:
  6968. @table @option
  6969. @item format
  6970. The desired packing format. Supported values are:
  6971. @table @option
  6972. @item sbs
  6973. The views are next to each other (default).
  6974. @item tab
  6975. The views are on top of each other.
  6976. @item lines
  6977. The views are packed by line.
  6978. @item columns
  6979. The views are packed by column.
  6980. @item frameseq
  6981. The views are temporally interleaved.
  6982. @end table
  6983. @end table
  6984. Some examples:
  6985. @example
  6986. # Convert left and right views into a frame-sequential video
  6987. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6988. # Convert views into a side-by-side video with the same output resolution as the input
  6989. 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
  6990. @end example
  6991. @section framerate
  6992. Change the frame rate by interpolating new video output frames from the source
  6993. frames.
  6994. This filter is not designed to function correctly with interlaced media. If
  6995. you wish to change the frame rate of interlaced media then you are required
  6996. to deinterlace before this filter and re-interlace after this filter.
  6997. A description of the accepted options follows.
  6998. @table @option
  6999. @item fps
  7000. Specify the output frames per second. This option can also be specified
  7001. as a value alone. The default is @code{50}.
  7002. @item interp_start
  7003. Specify the start of a range where the output frame will be created as a
  7004. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7005. the default is @code{15}.
  7006. @item interp_end
  7007. Specify the end of a range where the output frame will be created as a
  7008. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7009. the default is @code{240}.
  7010. @item scene
  7011. Specify the level at which a scene change is detected as a value between
  7012. 0 and 100 to indicate a new scene; a low value reflects a low
  7013. probability for the current frame to introduce a new scene, while a higher
  7014. value means the current frame is more likely to be one.
  7015. The default is @code{7}.
  7016. @item flags
  7017. Specify flags influencing the filter process.
  7018. Available value for @var{flags} is:
  7019. @table @option
  7020. @item scene_change_detect, scd
  7021. Enable scene change detection using the value of the option @var{scene}.
  7022. This flag is enabled by default.
  7023. @end table
  7024. @end table
  7025. @section framestep
  7026. Select one frame every N-th frame.
  7027. This filter accepts the following option:
  7028. @table @option
  7029. @item step
  7030. Select frame after every @code{step} frames.
  7031. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7032. @end table
  7033. @anchor{frei0r}
  7034. @section frei0r
  7035. Apply a frei0r effect to the input video.
  7036. To enable the compilation of this filter, you need to install the frei0r
  7037. header and configure FFmpeg with @code{--enable-frei0r}.
  7038. It accepts the following parameters:
  7039. @table @option
  7040. @item filter_name
  7041. The name of the frei0r effect to load. If the environment variable
  7042. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7043. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7044. Otherwise, the standard frei0r paths are searched, in this order:
  7045. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7046. @file{/usr/lib/frei0r-1/}.
  7047. @item filter_params
  7048. A '|'-separated list of parameters to pass to the frei0r effect.
  7049. @end table
  7050. A frei0r effect parameter can be a boolean (its value is either
  7051. "y" or "n"), a double, a color (specified as
  7052. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7053. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  7054. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  7055. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7056. The number and types of parameters depend on the loaded effect. If an
  7057. effect parameter is not specified, the default value is set.
  7058. @subsection Examples
  7059. @itemize
  7060. @item
  7061. Apply the distort0r effect, setting the first two double parameters:
  7062. @example
  7063. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7064. @end example
  7065. @item
  7066. Apply the colordistance effect, taking a color as the first parameter:
  7067. @example
  7068. frei0r=colordistance:0.2/0.3/0.4
  7069. frei0r=colordistance:violet
  7070. frei0r=colordistance:0x112233
  7071. @end example
  7072. @item
  7073. Apply the perspective effect, specifying the top left and top right image
  7074. positions:
  7075. @example
  7076. frei0r=perspective:0.2/0.2|0.8/0.2
  7077. @end example
  7078. @end itemize
  7079. For more information, see
  7080. @url{http://frei0r.dyne.org}
  7081. @section fspp
  7082. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7083. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7084. processing filter, one of them is performed once per block, not per pixel.
  7085. This allows for much higher speed.
  7086. The filter accepts the following options:
  7087. @table @option
  7088. @item quality
  7089. Set quality. This option defines the number of levels for averaging. It accepts
  7090. an integer in the range 4-5. Default value is @code{4}.
  7091. @item qp
  7092. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7093. If not set, the filter will use the QP from the video stream (if available).
  7094. @item strength
  7095. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7096. more details but also more artifacts, while higher values make the image smoother
  7097. but also blurrier. Default value is @code{0} − PSNR optimal.
  7098. @item use_bframe_qp
  7099. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7100. option may cause flicker since the B-Frames have often larger QP. Default is
  7101. @code{0} (not enabled).
  7102. @end table
  7103. @section gblur
  7104. Apply Gaussian blur filter.
  7105. The filter accepts the following options:
  7106. @table @option
  7107. @item sigma
  7108. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7109. @item steps
  7110. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7111. @item planes
  7112. Set which planes to filter. By default all planes are filtered.
  7113. @item sigmaV
  7114. Set vertical sigma, if negative it will be same as @code{sigma}.
  7115. Default is @code{-1}.
  7116. @end table
  7117. @section geq
  7118. The filter accepts the following options:
  7119. @table @option
  7120. @item lum_expr, lum
  7121. Set the luminance expression.
  7122. @item cb_expr, cb
  7123. Set the chrominance blue expression.
  7124. @item cr_expr, cr
  7125. Set the chrominance red expression.
  7126. @item alpha_expr, a
  7127. Set the alpha expression.
  7128. @item red_expr, r
  7129. Set the red expression.
  7130. @item green_expr, g
  7131. Set the green expression.
  7132. @item blue_expr, b
  7133. Set the blue expression.
  7134. @end table
  7135. The colorspace is selected according to the specified options. If one
  7136. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7137. options is specified, the filter will automatically select a YCbCr
  7138. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7139. @option{blue_expr} options is specified, it will select an RGB
  7140. colorspace.
  7141. If one of the chrominance expression is not defined, it falls back on the other
  7142. one. If no alpha expression is specified it will evaluate to opaque value.
  7143. If none of chrominance expressions are specified, they will evaluate
  7144. to the luminance expression.
  7145. The expressions can use the following variables and functions:
  7146. @table @option
  7147. @item N
  7148. The sequential number of the filtered frame, starting from @code{0}.
  7149. @item X
  7150. @item Y
  7151. The coordinates of the current sample.
  7152. @item W
  7153. @item H
  7154. The width and height of the image.
  7155. @item SW
  7156. @item SH
  7157. Width and height scale depending on the currently filtered plane. It is the
  7158. ratio between the corresponding luma plane number of pixels and the current
  7159. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7160. @code{0.5,0.5} for chroma planes.
  7161. @item T
  7162. Time of the current frame, expressed in seconds.
  7163. @item p(x, y)
  7164. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7165. plane.
  7166. @item lum(x, y)
  7167. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7168. plane.
  7169. @item cb(x, y)
  7170. Return the value of the pixel at location (@var{x},@var{y}) of the
  7171. blue-difference chroma plane. Return 0 if there is no such plane.
  7172. @item cr(x, y)
  7173. Return the value of the pixel at location (@var{x},@var{y}) of the
  7174. red-difference chroma plane. Return 0 if there is no such plane.
  7175. @item r(x, y)
  7176. @item g(x, y)
  7177. @item b(x, y)
  7178. Return the value of the pixel at location (@var{x},@var{y}) of the
  7179. red/green/blue component. Return 0 if there is no such component.
  7180. @item alpha(x, y)
  7181. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7182. plane. Return 0 if there is no such plane.
  7183. @end table
  7184. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7185. automatically clipped to the closer edge.
  7186. @subsection Examples
  7187. @itemize
  7188. @item
  7189. Flip the image horizontally:
  7190. @example
  7191. geq=p(W-X\,Y)
  7192. @end example
  7193. @item
  7194. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7195. wavelength of 100 pixels:
  7196. @example
  7197. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7198. @end example
  7199. @item
  7200. Generate a fancy enigmatic moving light:
  7201. @example
  7202. 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
  7203. @end example
  7204. @item
  7205. Generate a quick emboss effect:
  7206. @example
  7207. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7208. @end example
  7209. @item
  7210. Modify RGB components depending on pixel position:
  7211. @example
  7212. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7213. @end example
  7214. @item
  7215. Create a radial gradient that is the same size as the input (also see
  7216. the @ref{vignette} filter):
  7217. @example
  7218. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7219. @end example
  7220. @end itemize
  7221. @section gradfun
  7222. Fix the banding artifacts that are sometimes introduced into nearly flat
  7223. regions by truncation to 8-bit color depth.
  7224. Interpolate the gradients that should go where the bands are, and
  7225. dither them.
  7226. It is designed for playback only. Do not use it prior to
  7227. lossy compression, because compression tends to lose the dither and
  7228. bring back the bands.
  7229. It accepts the following parameters:
  7230. @table @option
  7231. @item strength
  7232. The maximum amount by which the filter will change any one pixel. This is also
  7233. the threshold for detecting nearly flat regions. Acceptable values range from
  7234. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7235. valid range.
  7236. @item radius
  7237. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7238. gradients, but also prevents the filter from modifying the pixels near detailed
  7239. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7240. values will be clipped to the valid range.
  7241. @end table
  7242. Alternatively, the options can be specified as a flat string:
  7243. @var{strength}[:@var{radius}]
  7244. @subsection Examples
  7245. @itemize
  7246. @item
  7247. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7248. @example
  7249. gradfun=3.5:8
  7250. @end example
  7251. @item
  7252. Specify radius, omitting the strength (which will fall-back to the default
  7253. value):
  7254. @example
  7255. gradfun=radius=8
  7256. @end example
  7257. @end itemize
  7258. @anchor{haldclut}
  7259. @section haldclut
  7260. Apply a Hald CLUT to a video stream.
  7261. First input is the video stream to process, and second one is the Hald CLUT.
  7262. The Hald CLUT input can be a simple picture or a complete video stream.
  7263. The filter accepts the following options:
  7264. @table @option
  7265. @item shortest
  7266. Force termination when the shortest input terminates. Default is @code{0}.
  7267. @item repeatlast
  7268. Continue applying the last CLUT after the end of the stream. A value of
  7269. @code{0} disable the filter after the last frame of the CLUT is reached.
  7270. Default is @code{1}.
  7271. @end table
  7272. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7273. filters share the same internals).
  7274. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7275. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7276. @subsection Workflow examples
  7277. @subsubsection Hald CLUT video stream
  7278. Generate an identity Hald CLUT stream altered with various effects:
  7279. @example
  7280. 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
  7281. @end example
  7282. Note: make sure you use a lossless codec.
  7283. Then use it with @code{haldclut} to apply it on some random stream:
  7284. @example
  7285. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7286. @end example
  7287. The Hald CLUT will be applied to the 10 first seconds (duration of
  7288. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7289. to the remaining frames of the @code{mandelbrot} stream.
  7290. @subsubsection Hald CLUT with preview
  7291. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7292. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7293. biggest possible square starting at the top left of the picture. The remaining
  7294. padding pixels (bottom or right) will be ignored. This area can be used to add
  7295. a preview of the Hald CLUT.
  7296. Typically, the following generated Hald CLUT will be supported by the
  7297. @code{haldclut} filter:
  7298. @example
  7299. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7300. pad=iw+320 [padded_clut];
  7301. smptebars=s=320x256, split [a][b];
  7302. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7303. [main][b] overlay=W-320" -frames:v 1 clut.png
  7304. @end example
  7305. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7306. bars are displayed on the right-top, and below the same color bars processed by
  7307. the color changes.
  7308. Then, the effect of this Hald CLUT can be visualized with:
  7309. @example
  7310. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7311. @end example
  7312. @section hflip
  7313. Flip the input video horizontally.
  7314. For example, to horizontally flip the input video with @command{ffmpeg}:
  7315. @example
  7316. ffmpeg -i in.avi -vf "hflip" out.avi
  7317. @end example
  7318. @section histeq
  7319. This filter applies a global color histogram equalization on a
  7320. per-frame basis.
  7321. It can be used to correct video that has a compressed range of pixel
  7322. intensities. The filter redistributes the pixel intensities to
  7323. equalize their distribution across the intensity range. It may be
  7324. viewed as an "automatically adjusting contrast filter". This filter is
  7325. useful only for correcting degraded or poorly captured source
  7326. video.
  7327. The filter accepts the following options:
  7328. @table @option
  7329. @item strength
  7330. Determine the amount of equalization to be applied. As the strength
  7331. is reduced, the distribution of pixel intensities more-and-more
  7332. approaches that of the input frame. The value must be a float number
  7333. in the range [0,1] and defaults to 0.200.
  7334. @item intensity
  7335. Set the maximum intensity that can generated and scale the output
  7336. values appropriately. The strength should be set as desired and then
  7337. the intensity can be limited if needed to avoid washing-out. The value
  7338. must be a float number in the range [0,1] and defaults to 0.210.
  7339. @item antibanding
  7340. Set the antibanding level. If enabled the filter will randomly vary
  7341. the luminance of output pixels by a small amount to avoid banding of
  7342. the histogram. Possible values are @code{none}, @code{weak} or
  7343. @code{strong}. It defaults to @code{none}.
  7344. @end table
  7345. @section histogram
  7346. Compute and draw a color distribution histogram for the input video.
  7347. The computed histogram is a representation of the color component
  7348. distribution in an image.
  7349. Standard histogram displays the color components distribution in an image.
  7350. Displays color graph for each color component. Shows distribution of
  7351. the Y, U, V, A or R, G, B components, depending on input format, in the
  7352. current frame. Below each graph a color component scale meter is shown.
  7353. The filter accepts the following options:
  7354. @table @option
  7355. @item level_height
  7356. Set height of level. Default value is @code{200}.
  7357. Allowed range is [50, 2048].
  7358. @item scale_height
  7359. Set height of color scale. Default value is @code{12}.
  7360. Allowed range is [0, 40].
  7361. @item display_mode
  7362. Set display mode.
  7363. It accepts the following values:
  7364. @table @samp
  7365. @item stack
  7366. Per color component graphs are placed below each other.
  7367. @item parade
  7368. Per color component graphs are placed side by side.
  7369. @item overlay
  7370. Presents information identical to that in the @code{parade}, except
  7371. that the graphs representing color components are superimposed directly
  7372. over one another.
  7373. @end table
  7374. Default is @code{stack}.
  7375. @item levels_mode
  7376. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7377. Default is @code{linear}.
  7378. @item components
  7379. Set what color components to display.
  7380. Default is @code{7}.
  7381. @item fgopacity
  7382. Set foreground opacity. Default is @code{0.7}.
  7383. @item bgopacity
  7384. Set background opacity. Default is @code{0.5}.
  7385. @end table
  7386. @subsection Examples
  7387. @itemize
  7388. @item
  7389. Calculate and draw histogram:
  7390. @example
  7391. ffplay -i input -vf histogram
  7392. @end example
  7393. @end itemize
  7394. @anchor{hqdn3d}
  7395. @section hqdn3d
  7396. This is a high precision/quality 3d denoise filter. It aims to reduce
  7397. image noise, producing smooth images and making still images really
  7398. still. It should enhance compressibility.
  7399. It accepts the following optional parameters:
  7400. @table @option
  7401. @item luma_spatial
  7402. A non-negative floating point number which specifies spatial luma strength.
  7403. It defaults to 4.0.
  7404. @item chroma_spatial
  7405. A non-negative floating point number which specifies spatial chroma strength.
  7406. It defaults to 3.0*@var{luma_spatial}/4.0.
  7407. @item luma_tmp
  7408. A floating point number which specifies luma temporal strength. It defaults to
  7409. 6.0*@var{luma_spatial}/4.0.
  7410. @item chroma_tmp
  7411. A floating point number which specifies chroma temporal strength. It defaults to
  7412. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7413. @end table
  7414. @section hwdownload
  7415. Download hardware frames to system memory.
  7416. The input must be in hardware frames, and the output a non-hardware format.
  7417. Not all formats will be supported on the output - it may be necessary to insert
  7418. an additional @option{format} filter immediately following in the graph to get
  7419. the output in a supported format.
  7420. @section hwmap
  7421. Map hardware frames to system memory or to another device.
  7422. This filter has several different modes of operation; which one is used depends
  7423. on the input and output formats:
  7424. @itemize
  7425. @item
  7426. Hardware frame input, normal frame output
  7427. Map the input frames to system memory and pass them to the output. If the
  7428. original hardware frame is later required (for example, after overlaying
  7429. something else on part of it), the @option{hwmap} filter can be used again
  7430. in the next mode to retrieve it.
  7431. @item
  7432. Normal frame input, hardware frame output
  7433. If the input is actually a software-mapped hardware frame, then unmap it -
  7434. that is, return the original hardware frame.
  7435. Otherwise, a device must be provided. Create new hardware surfaces on that
  7436. device for the output, then map them back to the software format at the input
  7437. and give those frames to the preceding filter. This will then act like the
  7438. @option{hwupload} filter, but may be able to avoid an additional copy when
  7439. the input is already in a compatible format.
  7440. @item
  7441. Hardware frame input and output
  7442. A device must be supplied for the output, either directly or with the
  7443. @option{derive_device} option. The input and output devices must be of
  7444. different types and compatible - the exact meaning of this is
  7445. system-dependent, but typically it means that they must refer to the same
  7446. underlying hardware context (for example, refer to the same graphics card).
  7447. If the input frames were originally created on the output device, then unmap
  7448. to retrieve the original frames.
  7449. Otherwise, map the frames to the output device - create new hardware frames
  7450. on the output corresponding to the frames on the input.
  7451. @end itemize
  7452. The following additional parameters are accepted:
  7453. @table @option
  7454. @item mode
  7455. Set the frame mapping mode. Some combination of:
  7456. @table @var
  7457. @item read
  7458. The mapped frame should be readable.
  7459. @item write
  7460. The mapped frame should be writeable.
  7461. @item overwrite
  7462. The mapping will always overwrite the entire frame.
  7463. This may improve performance in some cases, as the original contents of the
  7464. frame need not be loaded.
  7465. @item direct
  7466. The mapping must not involve any copying.
  7467. Indirect mappings to copies of frames are created in some cases where either
  7468. direct mapping is not possible or it would have unexpected properties.
  7469. Setting this flag ensures that the mapping is direct and will fail if that is
  7470. not possible.
  7471. @end table
  7472. Defaults to @var{read+write} if not specified.
  7473. @item derive_device @var{type}
  7474. Rather than using the device supplied at initialisation, instead derive a new
  7475. device of type @var{type} from the device the input frames exist on.
  7476. @item reverse
  7477. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7478. and map them back to the source. This may be necessary in some cases where
  7479. a mapping in one direction is required but only the opposite direction is
  7480. supported by the devices being used.
  7481. This option is dangerous - it may break the preceding filter in undefined
  7482. ways if there are any additional constraints on that filter's output.
  7483. Do not use it without fully understanding the implications of its use.
  7484. @end table
  7485. @section hwupload
  7486. Upload system memory frames to hardware surfaces.
  7487. The device to upload to must be supplied when the filter is initialised. If
  7488. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7489. option.
  7490. @anchor{hwupload_cuda}
  7491. @section hwupload_cuda
  7492. Upload system memory frames to a CUDA device.
  7493. It accepts the following optional parameters:
  7494. @table @option
  7495. @item device
  7496. The number of the CUDA device to use
  7497. @end table
  7498. @section hqx
  7499. Apply a high-quality magnification filter designed for pixel art. This filter
  7500. was originally created by Maxim Stepin.
  7501. It accepts the following option:
  7502. @table @option
  7503. @item n
  7504. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7505. @code{hq3x} and @code{4} for @code{hq4x}.
  7506. Default is @code{3}.
  7507. @end table
  7508. @section hstack
  7509. Stack input videos horizontally.
  7510. All streams must be of same pixel format and of same height.
  7511. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7512. to create same output.
  7513. The filter accept the following option:
  7514. @table @option
  7515. @item inputs
  7516. Set number of input streams. Default is 2.
  7517. @item shortest
  7518. If set to 1, force the output to terminate when the shortest input
  7519. terminates. Default value is 0.
  7520. @end table
  7521. @section hue
  7522. Modify the hue and/or the saturation of the input.
  7523. It accepts the following parameters:
  7524. @table @option
  7525. @item h
  7526. Specify the hue angle as a number of degrees. It accepts an expression,
  7527. and defaults to "0".
  7528. @item s
  7529. Specify the saturation in the [-10,10] range. It accepts an expression and
  7530. defaults to "1".
  7531. @item H
  7532. Specify the hue angle as a number of radians. It accepts an
  7533. expression, and defaults to "0".
  7534. @item b
  7535. Specify the brightness in the [-10,10] range. It accepts an expression and
  7536. defaults to "0".
  7537. @end table
  7538. @option{h} and @option{H} are mutually exclusive, and can't be
  7539. specified at the same time.
  7540. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7541. expressions containing the following constants:
  7542. @table @option
  7543. @item n
  7544. frame count of the input frame starting from 0
  7545. @item pts
  7546. presentation timestamp of the input frame expressed in time base units
  7547. @item r
  7548. frame rate of the input video, NAN if the input frame rate is unknown
  7549. @item t
  7550. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7551. @item tb
  7552. time base of the input video
  7553. @end table
  7554. @subsection Examples
  7555. @itemize
  7556. @item
  7557. Set the hue to 90 degrees and the saturation to 1.0:
  7558. @example
  7559. hue=h=90:s=1
  7560. @end example
  7561. @item
  7562. Same command but expressing the hue in radians:
  7563. @example
  7564. hue=H=PI/2:s=1
  7565. @end example
  7566. @item
  7567. Rotate hue and make the saturation swing between 0
  7568. and 2 over a period of 1 second:
  7569. @example
  7570. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7571. @end example
  7572. @item
  7573. Apply a 3 seconds saturation fade-in effect starting at 0:
  7574. @example
  7575. hue="s=min(t/3\,1)"
  7576. @end example
  7577. The general fade-in expression can be written as:
  7578. @example
  7579. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7580. @end example
  7581. @item
  7582. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7583. @example
  7584. hue="s=max(0\, min(1\, (8-t)/3))"
  7585. @end example
  7586. The general fade-out expression can be written as:
  7587. @example
  7588. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7589. @end example
  7590. @end itemize
  7591. @subsection Commands
  7592. This filter supports the following commands:
  7593. @table @option
  7594. @item b
  7595. @item s
  7596. @item h
  7597. @item H
  7598. Modify the hue and/or the saturation and/or brightness of the input video.
  7599. The command accepts the same syntax of the corresponding option.
  7600. If the specified expression is not valid, it is kept at its current
  7601. value.
  7602. @end table
  7603. @section hysteresis
  7604. Grow first stream into second stream by connecting components.
  7605. This makes it possible to build more robust edge masks.
  7606. This filter accepts the following options:
  7607. @table @option
  7608. @item planes
  7609. Set which planes will be processed as bitmap, unprocessed planes will be
  7610. copied from first stream.
  7611. By default value 0xf, all planes will be processed.
  7612. @item threshold
  7613. Set threshold which is used in filtering. If pixel component value is higher than
  7614. this value filter algorithm for connecting components is activated.
  7615. By default value is 0.
  7616. @end table
  7617. @section idet
  7618. Detect video interlacing type.
  7619. This filter tries to detect if the input frames are interlaced, progressive,
  7620. top or bottom field first. It will also try to detect fields that are
  7621. repeated between adjacent frames (a sign of telecine).
  7622. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7623. Multiple frame detection incorporates the classification history of previous frames.
  7624. The filter will log these metadata values:
  7625. @table @option
  7626. @item single.current_frame
  7627. Detected type of current frame using single-frame detection. One of:
  7628. ``tff'' (top field first), ``bff'' (bottom field first),
  7629. ``progressive'', or ``undetermined''
  7630. @item single.tff
  7631. Cumulative number of frames detected as top field first using single-frame detection.
  7632. @item multiple.tff
  7633. Cumulative number of frames detected as top field first using multiple-frame detection.
  7634. @item single.bff
  7635. Cumulative number of frames detected as bottom field first using single-frame detection.
  7636. @item multiple.current_frame
  7637. Detected type of current frame using multiple-frame detection. One of:
  7638. ``tff'' (top field first), ``bff'' (bottom field first),
  7639. ``progressive'', or ``undetermined''
  7640. @item multiple.bff
  7641. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7642. @item single.progressive
  7643. Cumulative number of frames detected as progressive using single-frame detection.
  7644. @item multiple.progressive
  7645. Cumulative number of frames detected as progressive using multiple-frame detection.
  7646. @item single.undetermined
  7647. Cumulative number of frames that could not be classified using single-frame detection.
  7648. @item multiple.undetermined
  7649. Cumulative number of frames that could not be classified using multiple-frame detection.
  7650. @item repeated.current_frame
  7651. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7652. @item repeated.neither
  7653. Cumulative number of frames with no repeated field.
  7654. @item repeated.top
  7655. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7656. @item repeated.bottom
  7657. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7658. @end table
  7659. The filter accepts the following options:
  7660. @table @option
  7661. @item intl_thres
  7662. Set interlacing threshold.
  7663. @item prog_thres
  7664. Set progressive threshold.
  7665. @item rep_thres
  7666. Threshold for repeated field detection.
  7667. @item half_life
  7668. Number of frames after which a given frame's contribution to the
  7669. statistics is halved (i.e., it contributes only 0.5 to its
  7670. classification). The default of 0 means that all frames seen are given
  7671. full weight of 1.0 forever.
  7672. @item analyze_interlaced_flag
  7673. When this is not 0 then idet will use the specified number of frames to determine
  7674. if the interlaced flag is accurate, it will not count undetermined frames.
  7675. If the flag is found to be accurate it will be used without any further
  7676. computations, if it is found to be inaccurate it will be cleared without any
  7677. further computations. This allows inserting the idet filter as a low computational
  7678. method to clean up the interlaced flag
  7679. @end table
  7680. @section il
  7681. Deinterleave or interleave fields.
  7682. This filter allows one to process interlaced images fields without
  7683. deinterlacing them. Deinterleaving splits the input frame into 2
  7684. fields (so called half pictures). Odd lines are moved to the top
  7685. half of the output image, even lines to the bottom half.
  7686. You can process (filter) them independently and then re-interleave them.
  7687. The filter accepts the following options:
  7688. @table @option
  7689. @item luma_mode, l
  7690. @item chroma_mode, c
  7691. @item alpha_mode, a
  7692. Available values for @var{luma_mode}, @var{chroma_mode} and
  7693. @var{alpha_mode} are:
  7694. @table @samp
  7695. @item none
  7696. Do nothing.
  7697. @item deinterleave, d
  7698. Deinterleave fields, placing one above the other.
  7699. @item interleave, i
  7700. Interleave fields. Reverse the effect of deinterleaving.
  7701. @end table
  7702. Default value is @code{none}.
  7703. @item luma_swap, ls
  7704. @item chroma_swap, cs
  7705. @item alpha_swap, as
  7706. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7707. @end table
  7708. @section inflate
  7709. Apply inflate effect to the video.
  7710. This filter replaces the pixel by the local(3x3) average by taking into account
  7711. only values higher than the pixel.
  7712. It accepts the following options:
  7713. @table @option
  7714. @item threshold0
  7715. @item threshold1
  7716. @item threshold2
  7717. @item threshold3
  7718. Limit the maximum change for each plane, default is 65535.
  7719. If 0, plane will remain unchanged.
  7720. @end table
  7721. @section interlace
  7722. Simple interlacing filter from progressive contents. This interleaves upper (or
  7723. lower) lines from odd frames with lower (or upper) lines from even frames,
  7724. halving the frame rate and preserving image height.
  7725. @example
  7726. Original Original New Frame
  7727. Frame 'j' Frame 'j+1' (tff)
  7728. ========== =========== ==================
  7729. Line 0 --------------------> Frame 'j' Line 0
  7730. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7731. Line 2 ---------------------> Frame 'j' Line 2
  7732. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7733. ... ... ...
  7734. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7735. @end example
  7736. It accepts the following optional parameters:
  7737. @table @option
  7738. @item scan
  7739. This determines whether the interlaced frame is taken from the even
  7740. (tff - default) or odd (bff) lines of the progressive frame.
  7741. @item lowpass
  7742. Vertical lowpass filter to avoid twitter interlacing and
  7743. reduce moire patterns.
  7744. @table @samp
  7745. @item 0, off
  7746. Disable vertical lowpass filter
  7747. @item 1, linear
  7748. Enable linear filter (default)
  7749. @item 2, complex
  7750. Enable complex filter. This will slightly less reduce twitter and moire
  7751. but better retain detail and subjective sharpness impression.
  7752. @end table
  7753. @end table
  7754. @section kerndeint
  7755. Deinterlace input video by applying Donald Graft's adaptive kernel
  7756. deinterling. Work on interlaced parts of a video to produce
  7757. progressive frames.
  7758. The description of the accepted parameters follows.
  7759. @table @option
  7760. @item thresh
  7761. Set the threshold which affects the filter's tolerance when
  7762. determining if a pixel line must be processed. It must be an integer
  7763. in the range [0,255] and defaults to 10. A value of 0 will result in
  7764. applying the process on every pixels.
  7765. @item map
  7766. Paint pixels exceeding the threshold value to white if set to 1.
  7767. Default is 0.
  7768. @item order
  7769. Set the fields order. Swap fields if set to 1, leave fields alone if
  7770. 0. Default is 0.
  7771. @item sharp
  7772. Enable additional sharpening if set to 1. Default is 0.
  7773. @item twoway
  7774. Enable twoway sharpening if set to 1. Default is 0.
  7775. @end table
  7776. @subsection Examples
  7777. @itemize
  7778. @item
  7779. Apply default values:
  7780. @example
  7781. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7782. @end example
  7783. @item
  7784. Enable additional sharpening:
  7785. @example
  7786. kerndeint=sharp=1
  7787. @end example
  7788. @item
  7789. Paint processed pixels in white:
  7790. @example
  7791. kerndeint=map=1
  7792. @end example
  7793. @end itemize
  7794. @section lenscorrection
  7795. Correct radial lens distortion
  7796. This filter can be used to correct for radial distortion as can result from the use
  7797. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7798. one can use tools available for example as part of opencv or simply trial-and-error.
  7799. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7800. and extract the k1 and k2 coefficients from the resulting matrix.
  7801. Note that effectively the same filter is available in the open-source tools Krita and
  7802. Digikam from the KDE project.
  7803. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7804. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7805. brightness distribution, so you may want to use both filters together in certain
  7806. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7807. be applied before or after lens correction.
  7808. @subsection Options
  7809. The filter accepts the following options:
  7810. @table @option
  7811. @item cx
  7812. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7813. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7814. width.
  7815. @item cy
  7816. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7817. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7818. height.
  7819. @item k1
  7820. Coefficient of the quadratic correction term. 0.5 means no correction.
  7821. @item k2
  7822. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7823. @end table
  7824. The formula that generates the correction is:
  7825. @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)
  7826. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7827. distances from the focal point in the source and target images, respectively.
  7828. @section libvmaf
  7829. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7830. score between two input videos.
  7831. The obtained VMAF score is printed through the logging system.
  7832. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7833. After installing the library it can be enabled using:
  7834. @code{./configure --enable-libvmaf}.
  7835. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7836. The filter has following options:
  7837. @table @option
  7838. @item model_path
  7839. Set the model path which is to be used for SVM.
  7840. Default value: @code{"vmaf_v0.6.1.pkl"}
  7841. @item log_path
  7842. Set the file path to be used to store logs.
  7843. @item log_fmt
  7844. Set the format of the log file (xml or json).
  7845. @item enable_transform
  7846. Enables transform for computing vmaf.
  7847. @item phone_model
  7848. Invokes the phone model which will generate VMAF scores higher than in the
  7849. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7850. @item psnr
  7851. Enables computing psnr along with vmaf.
  7852. @item ssim
  7853. Enables computing ssim along with vmaf.
  7854. @item ms_ssim
  7855. Enables computing ms_ssim along with vmaf.
  7856. @item pool
  7857. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7858. @end table
  7859. This filter also supports the @ref{framesync} options.
  7860. On the below examples the input file @file{main.mpg} being processed is
  7861. compared with the reference file @file{ref.mpg}.
  7862. @example
  7863. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7864. @end example
  7865. Example with options:
  7866. @example
  7867. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7868. @end example
  7869. @section limiter
  7870. Limits the pixel components values to the specified range [min, max].
  7871. The filter accepts the following options:
  7872. @table @option
  7873. @item min
  7874. Lower bound. Defaults to the lowest allowed value for the input.
  7875. @item max
  7876. Upper bound. Defaults to the highest allowed value for the input.
  7877. @item planes
  7878. Specify which planes will be processed. Defaults to all available.
  7879. @end table
  7880. @section loop
  7881. Loop video frames.
  7882. The filter accepts the following options:
  7883. @table @option
  7884. @item loop
  7885. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7886. Default is 0.
  7887. @item size
  7888. Set maximal size in number of frames. Default is 0.
  7889. @item start
  7890. Set first frame of loop. Default is 0.
  7891. @end table
  7892. @anchor{lut3d}
  7893. @section lut3d
  7894. Apply a 3D LUT to an input video.
  7895. The filter accepts the following options:
  7896. @table @option
  7897. @item file
  7898. Set the 3D LUT file name.
  7899. Currently supported formats:
  7900. @table @samp
  7901. @item 3dl
  7902. AfterEffects
  7903. @item cube
  7904. Iridas
  7905. @item dat
  7906. DaVinci
  7907. @item m3d
  7908. Pandora
  7909. @end table
  7910. @item interp
  7911. Select interpolation mode.
  7912. Available values are:
  7913. @table @samp
  7914. @item nearest
  7915. Use values from the nearest defined point.
  7916. @item trilinear
  7917. Interpolate values using the 8 points defining a cube.
  7918. @item tetrahedral
  7919. Interpolate values using a tetrahedron.
  7920. @end table
  7921. @end table
  7922. This filter also supports the @ref{framesync} options.
  7923. @section lumakey
  7924. Turn certain luma values into transparency.
  7925. The filter accepts the following options:
  7926. @table @option
  7927. @item threshold
  7928. Set the luma which will be used as base for transparency.
  7929. Default value is @code{0}.
  7930. @item tolerance
  7931. Set the range of luma values to be keyed out.
  7932. Default value is @code{0}.
  7933. @item softness
  7934. Set the range of softness. Default value is @code{0}.
  7935. Use this to control gradual transition from zero to full transparency.
  7936. @end table
  7937. @section lut, lutrgb, lutyuv
  7938. Compute a look-up table for binding each pixel component input value
  7939. to an output value, and apply it to the input video.
  7940. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7941. to an RGB input video.
  7942. These filters accept the following parameters:
  7943. @table @option
  7944. @item c0
  7945. set first pixel component expression
  7946. @item c1
  7947. set second pixel component expression
  7948. @item c2
  7949. set third pixel component expression
  7950. @item c3
  7951. set fourth pixel component expression, corresponds to the alpha component
  7952. @item r
  7953. set red component expression
  7954. @item g
  7955. set green component expression
  7956. @item b
  7957. set blue component expression
  7958. @item a
  7959. alpha component expression
  7960. @item y
  7961. set Y/luminance component expression
  7962. @item u
  7963. set U/Cb component expression
  7964. @item v
  7965. set V/Cr component expression
  7966. @end table
  7967. Each of them specifies the expression to use for computing the lookup table for
  7968. the corresponding pixel component values.
  7969. The exact component associated to each of the @var{c*} options depends on the
  7970. format in input.
  7971. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7972. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7973. The expressions can contain the following constants and functions:
  7974. @table @option
  7975. @item w
  7976. @item h
  7977. The input width and height.
  7978. @item val
  7979. The input value for the pixel component.
  7980. @item clipval
  7981. The input value, clipped to the @var{minval}-@var{maxval} range.
  7982. @item maxval
  7983. The maximum value for the pixel component.
  7984. @item minval
  7985. The minimum value for the pixel component.
  7986. @item negval
  7987. The negated value for the pixel component value, clipped to the
  7988. @var{minval}-@var{maxval} range; it corresponds to the expression
  7989. "maxval-clipval+minval".
  7990. @item clip(val)
  7991. The computed value in @var{val}, clipped to the
  7992. @var{minval}-@var{maxval} range.
  7993. @item gammaval(gamma)
  7994. The computed gamma correction value of the pixel component value,
  7995. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7996. expression
  7997. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7998. @end table
  7999. All expressions default to "val".
  8000. @subsection Examples
  8001. @itemize
  8002. @item
  8003. Negate input video:
  8004. @example
  8005. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8006. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8007. @end example
  8008. The above is the same as:
  8009. @example
  8010. lutrgb="r=negval:g=negval:b=negval"
  8011. lutyuv="y=negval:u=negval:v=negval"
  8012. @end example
  8013. @item
  8014. Negate luminance:
  8015. @example
  8016. lutyuv=y=negval
  8017. @end example
  8018. @item
  8019. Remove chroma components, turning the video into a graytone image:
  8020. @example
  8021. lutyuv="u=128:v=128"
  8022. @end example
  8023. @item
  8024. Apply a luma burning effect:
  8025. @example
  8026. lutyuv="y=2*val"
  8027. @end example
  8028. @item
  8029. Remove green and blue components:
  8030. @example
  8031. lutrgb="g=0:b=0"
  8032. @end example
  8033. @item
  8034. Set a constant alpha channel value on input:
  8035. @example
  8036. format=rgba,lutrgb=a="maxval-minval/2"
  8037. @end example
  8038. @item
  8039. Correct luminance gamma by a factor of 0.5:
  8040. @example
  8041. lutyuv=y=gammaval(0.5)
  8042. @end example
  8043. @item
  8044. Discard least significant bits of luma:
  8045. @example
  8046. lutyuv=y='bitand(val, 128+64+32)'
  8047. @end example
  8048. @item
  8049. Technicolor like effect:
  8050. @example
  8051. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8052. @end example
  8053. @end itemize
  8054. @section lut2, tlut2
  8055. The @code{lut2} filter takes two input streams and outputs one
  8056. stream.
  8057. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8058. from one single stream.
  8059. This filter accepts the following parameters:
  8060. @table @option
  8061. @item c0
  8062. set first pixel component expression
  8063. @item c1
  8064. set second pixel component expression
  8065. @item c2
  8066. set third pixel component expression
  8067. @item c3
  8068. set fourth pixel component expression, corresponds to the alpha component
  8069. @end table
  8070. Each of them specifies the expression to use for computing the lookup table for
  8071. the corresponding pixel component values.
  8072. The exact component associated to each of the @var{c*} options depends on the
  8073. format in inputs.
  8074. The expressions can contain the following constants:
  8075. @table @option
  8076. @item w
  8077. @item h
  8078. The input width and height.
  8079. @item x
  8080. The first input value for the pixel component.
  8081. @item y
  8082. The second input value for the pixel component.
  8083. @item bdx
  8084. The first input video bit depth.
  8085. @item bdy
  8086. The second input video bit depth.
  8087. @end table
  8088. All expressions default to "x".
  8089. @subsection Examples
  8090. @itemize
  8091. @item
  8092. Highlight differences between two RGB video streams:
  8093. @example
  8094. 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)'
  8095. @end example
  8096. @item
  8097. Highlight differences between two YUV video streams:
  8098. @example
  8099. 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)'
  8100. @end example
  8101. @item
  8102. Show max difference between two video streams:
  8103. @example
  8104. 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)))'
  8105. @end example
  8106. @end itemize
  8107. @section maskedclamp
  8108. Clamp the first input stream with the second input and third input stream.
  8109. Returns the value of first stream to be between second input
  8110. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8111. This filter accepts the following options:
  8112. @table @option
  8113. @item undershoot
  8114. Default value is @code{0}.
  8115. @item overshoot
  8116. Default value is @code{0}.
  8117. @item planes
  8118. Set which planes will be processed as bitmap, unprocessed planes will be
  8119. copied from first stream.
  8120. By default value 0xf, all planes will be processed.
  8121. @end table
  8122. @section maskedmerge
  8123. Merge the first input stream with the second input stream using per pixel
  8124. weights in the third input stream.
  8125. A value of 0 in the third stream pixel component means that pixel component
  8126. from first stream is returned unchanged, while maximum value (eg. 255 for
  8127. 8-bit videos) means that pixel component from second stream is returned
  8128. unchanged. Intermediate values define the amount of merging between both
  8129. input stream's pixel components.
  8130. This filter accepts the following options:
  8131. @table @option
  8132. @item planes
  8133. Set which planes will be processed as bitmap, unprocessed planes will be
  8134. copied from first stream.
  8135. By default value 0xf, all planes will be processed.
  8136. @end table
  8137. @section mcdeint
  8138. Apply motion-compensation deinterlacing.
  8139. It needs one field per frame as input and must thus be used together
  8140. with yadif=1/3 or equivalent.
  8141. This filter accepts the following options:
  8142. @table @option
  8143. @item mode
  8144. Set the deinterlacing mode.
  8145. It accepts one of the following values:
  8146. @table @samp
  8147. @item fast
  8148. @item medium
  8149. @item slow
  8150. use iterative motion estimation
  8151. @item extra_slow
  8152. like @samp{slow}, but use multiple reference frames.
  8153. @end table
  8154. Default value is @samp{fast}.
  8155. @item parity
  8156. Set the picture field parity assumed for the input video. It must be
  8157. one of the following values:
  8158. @table @samp
  8159. @item 0, tff
  8160. assume top field first
  8161. @item 1, bff
  8162. assume bottom field first
  8163. @end table
  8164. Default value is @samp{bff}.
  8165. @item qp
  8166. Set per-block quantization parameter (QP) used by the internal
  8167. encoder.
  8168. Higher values should result in a smoother motion vector field but less
  8169. optimal individual vectors. Default value is 1.
  8170. @end table
  8171. @section mergeplanes
  8172. Merge color channel components from several video streams.
  8173. The filter accepts up to 4 input streams, and merge selected input
  8174. planes to the output video.
  8175. This filter accepts the following options:
  8176. @table @option
  8177. @item mapping
  8178. Set input to output plane mapping. Default is @code{0}.
  8179. The mappings is specified as a bitmap. It should be specified as a
  8180. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8181. mapping for the first plane of the output stream. 'A' sets the number of
  8182. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8183. corresponding input to use (from 0 to 3). The rest of the mappings is
  8184. similar, 'Bb' describes the mapping for the output stream second
  8185. plane, 'Cc' describes the mapping for the output stream third plane and
  8186. 'Dd' describes the mapping for the output stream fourth plane.
  8187. @item format
  8188. Set output pixel format. Default is @code{yuva444p}.
  8189. @end table
  8190. @subsection Examples
  8191. @itemize
  8192. @item
  8193. Merge three gray video streams of same width and height into single video stream:
  8194. @example
  8195. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8196. @end example
  8197. @item
  8198. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8199. @example
  8200. [a0][a1]mergeplanes=0x00010210:yuva444p
  8201. @end example
  8202. @item
  8203. Swap Y and A plane in yuva444p stream:
  8204. @example
  8205. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8206. @end example
  8207. @item
  8208. Swap U and V plane in yuv420p stream:
  8209. @example
  8210. format=yuv420p,mergeplanes=0x000201:yuv420p
  8211. @end example
  8212. @item
  8213. Cast a rgb24 clip to yuv444p:
  8214. @example
  8215. format=rgb24,mergeplanes=0x000102:yuv444p
  8216. @end example
  8217. @end itemize
  8218. @section mestimate
  8219. Estimate and export motion vectors using block matching algorithms.
  8220. Motion vectors are stored in frame side data to be used by other filters.
  8221. This filter accepts the following options:
  8222. @table @option
  8223. @item method
  8224. Specify the motion estimation method. Accepts one of the following values:
  8225. @table @samp
  8226. @item esa
  8227. Exhaustive search algorithm.
  8228. @item tss
  8229. Three step search algorithm.
  8230. @item tdls
  8231. Two dimensional logarithmic search algorithm.
  8232. @item ntss
  8233. New three step search algorithm.
  8234. @item fss
  8235. Four step search algorithm.
  8236. @item ds
  8237. Diamond search algorithm.
  8238. @item hexbs
  8239. Hexagon-based search algorithm.
  8240. @item epzs
  8241. Enhanced predictive zonal search algorithm.
  8242. @item umh
  8243. Uneven multi-hexagon search algorithm.
  8244. @end table
  8245. Default value is @samp{esa}.
  8246. @item mb_size
  8247. Macroblock size. Default @code{16}.
  8248. @item search_param
  8249. Search parameter. Default @code{7}.
  8250. @end table
  8251. @section midequalizer
  8252. Apply Midway Image Equalization effect using two video streams.
  8253. Midway Image Equalization adjusts a pair of images to have the same
  8254. histogram, while maintaining their dynamics as much as possible. It's
  8255. useful for e.g. matching exposures from a pair of stereo cameras.
  8256. This filter has two inputs and one output, which must be of same pixel format, but
  8257. may be of different sizes. The output of filter is first input adjusted with
  8258. midway histogram of both inputs.
  8259. This filter accepts the following option:
  8260. @table @option
  8261. @item planes
  8262. Set which planes to process. Default is @code{15}, which is all available planes.
  8263. @end table
  8264. @section minterpolate
  8265. Convert the video to specified frame rate using motion interpolation.
  8266. This filter accepts the following options:
  8267. @table @option
  8268. @item fps
  8269. 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}.
  8270. @item mi_mode
  8271. Motion interpolation mode. Following values are accepted:
  8272. @table @samp
  8273. @item dup
  8274. Duplicate previous or next frame for interpolating new ones.
  8275. @item blend
  8276. Blend source frames. Interpolated frame is mean of previous and next frames.
  8277. @item mci
  8278. Motion compensated interpolation. Following options are effective when this mode is selected:
  8279. @table @samp
  8280. @item mc_mode
  8281. Motion compensation mode. Following values are accepted:
  8282. @table @samp
  8283. @item obmc
  8284. Overlapped block motion compensation.
  8285. @item aobmc
  8286. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8287. @end table
  8288. Default mode is @samp{obmc}.
  8289. @item me_mode
  8290. Motion estimation mode. Following values are accepted:
  8291. @table @samp
  8292. @item bidir
  8293. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8294. @item bilat
  8295. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8296. @end table
  8297. Default mode is @samp{bilat}.
  8298. @item me
  8299. The algorithm to be used for motion estimation. Following values are accepted:
  8300. @table @samp
  8301. @item esa
  8302. Exhaustive search algorithm.
  8303. @item tss
  8304. Three step search algorithm.
  8305. @item tdls
  8306. Two dimensional logarithmic search algorithm.
  8307. @item ntss
  8308. New three step search algorithm.
  8309. @item fss
  8310. Four step search algorithm.
  8311. @item ds
  8312. Diamond search algorithm.
  8313. @item hexbs
  8314. Hexagon-based search algorithm.
  8315. @item epzs
  8316. Enhanced predictive zonal search algorithm.
  8317. @item umh
  8318. Uneven multi-hexagon search algorithm.
  8319. @end table
  8320. Default algorithm is @samp{epzs}.
  8321. @item mb_size
  8322. Macroblock size. Default @code{16}.
  8323. @item search_param
  8324. Motion estimation search parameter. Default @code{32}.
  8325. @item vsbmc
  8326. 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).
  8327. @end table
  8328. @end table
  8329. @item scd
  8330. 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:
  8331. @table @samp
  8332. @item none
  8333. Disable scene change detection.
  8334. @item fdiff
  8335. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8336. @end table
  8337. Default method is @samp{fdiff}.
  8338. @item scd_threshold
  8339. Scene change detection threshold. Default is @code{5.0}.
  8340. @end table
  8341. @section mix
  8342. Mix several video input streams into one video stream.
  8343. A description of the accepted options follows.
  8344. @table @option
  8345. @item nb_inputs
  8346. The number of inputs. If unspecified, it defaults to 2.
  8347. @item weights
  8348. Specify weight of each input video stream as sequence.
  8349. Each weight is separated by space.
  8350. @item duration
  8351. Specify how end of stream is determined.
  8352. @table @samp
  8353. @item longest
  8354. The duration of the longest input. (default)
  8355. @item shortest
  8356. The duration of the shortest input.
  8357. @item first
  8358. The duration of the first input.
  8359. @end table
  8360. @end table
  8361. @section mpdecimate
  8362. Drop frames that do not differ greatly from the previous frame in
  8363. order to reduce frame rate.
  8364. The main use of this filter is for very-low-bitrate encoding
  8365. (e.g. streaming over dialup modem), but it could in theory be used for
  8366. fixing movies that were inverse-telecined incorrectly.
  8367. A description of the accepted options follows.
  8368. @table @option
  8369. @item max
  8370. Set the maximum number of consecutive frames which can be dropped (if
  8371. positive), or the minimum interval between dropped frames (if
  8372. negative). If the value is 0, the frame is dropped disregarding the
  8373. number of previous sequentially dropped frames.
  8374. Default value is 0.
  8375. @item hi
  8376. @item lo
  8377. @item frac
  8378. Set the dropping threshold values.
  8379. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8380. represent actual pixel value differences, so a threshold of 64
  8381. corresponds to 1 unit of difference for each pixel, or the same spread
  8382. out differently over the block.
  8383. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8384. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8385. meaning the whole image) differ by more than a threshold of @option{lo}.
  8386. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8387. 64*5, and default value for @option{frac} is 0.33.
  8388. @end table
  8389. @section negate
  8390. Negate input video.
  8391. It accepts an integer in input; if non-zero it negates the
  8392. alpha component (if available). The default value in input is 0.
  8393. @section nlmeans
  8394. Denoise frames using Non-Local Means algorithm.
  8395. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8396. context similarity is defined by comparing their surrounding patches of size
  8397. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8398. around the pixel.
  8399. Note that the research area defines centers for patches, which means some
  8400. patches will be made of pixels outside that research area.
  8401. The filter accepts the following options.
  8402. @table @option
  8403. @item s
  8404. Set denoising strength.
  8405. @item p
  8406. Set patch size.
  8407. @item pc
  8408. Same as @option{p} but for chroma planes.
  8409. The default value is @var{0} and means automatic.
  8410. @item r
  8411. Set research size.
  8412. @item rc
  8413. Same as @option{r} but for chroma planes.
  8414. The default value is @var{0} and means automatic.
  8415. @end table
  8416. @section nnedi
  8417. Deinterlace video using neural network edge directed interpolation.
  8418. This filter accepts the following options:
  8419. @table @option
  8420. @item weights
  8421. Mandatory option, without binary file filter can not work.
  8422. Currently file can be found here:
  8423. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8424. @item deint
  8425. Set which frames to deinterlace, by default it is @code{all}.
  8426. Can be @code{all} or @code{interlaced}.
  8427. @item field
  8428. Set mode of operation.
  8429. Can be one of the following:
  8430. @table @samp
  8431. @item af
  8432. Use frame flags, both fields.
  8433. @item a
  8434. Use frame flags, single field.
  8435. @item t
  8436. Use top field only.
  8437. @item b
  8438. Use bottom field only.
  8439. @item tf
  8440. Use both fields, top first.
  8441. @item bf
  8442. Use both fields, bottom first.
  8443. @end table
  8444. @item planes
  8445. Set which planes to process, by default filter process all frames.
  8446. @item nsize
  8447. Set size of local neighborhood around each pixel, used by the predictor neural
  8448. network.
  8449. Can be one of the following:
  8450. @table @samp
  8451. @item s8x6
  8452. @item s16x6
  8453. @item s32x6
  8454. @item s48x6
  8455. @item s8x4
  8456. @item s16x4
  8457. @item s32x4
  8458. @end table
  8459. @item nns
  8460. Set the number of neurons in predictor neural network.
  8461. Can be one of the following:
  8462. @table @samp
  8463. @item n16
  8464. @item n32
  8465. @item n64
  8466. @item n128
  8467. @item n256
  8468. @end table
  8469. @item qual
  8470. Controls the number of different neural network predictions that are blended
  8471. together to compute the final output value. Can be @code{fast}, default or
  8472. @code{slow}.
  8473. @item etype
  8474. Set which set of weights to use in the predictor.
  8475. Can be one of the following:
  8476. @table @samp
  8477. @item a
  8478. weights trained to minimize absolute error
  8479. @item s
  8480. weights trained to minimize squared error
  8481. @end table
  8482. @item pscrn
  8483. Controls whether or not the prescreener neural network is used to decide
  8484. which pixels should be processed by the predictor neural network and which
  8485. can be handled by simple cubic interpolation.
  8486. The prescreener is trained to know whether cubic interpolation will be
  8487. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8488. The computational complexity of the prescreener nn is much less than that of
  8489. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8490. using the prescreener generally results in much faster processing.
  8491. The prescreener is pretty accurate, so the difference between using it and not
  8492. using it is almost always unnoticeable.
  8493. Can be one of the following:
  8494. @table @samp
  8495. @item none
  8496. @item original
  8497. @item new
  8498. @end table
  8499. Default is @code{new}.
  8500. @item fapprox
  8501. Set various debugging flags.
  8502. @end table
  8503. @section noformat
  8504. Force libavfilter not to use any of the specified pixel formats for the
  8505. input to the next filter.
  8506. It accepts the following parameters:
  8507. @table @option
  8508. @item pix_fmts
  8509. A '|'-separated list of pixel format names, such as
  8510. pix_fmts=yuv420p|monow|rgb24".
  8511. @end table
  8512. @subsection Examples
  8513. @itemize
  8514. @item
  8515. Force libavfilter to use a format different from @var{yuv420p} for the
  8516. input to the vflip filter:
  8517. @example
  8518. noformat=pix_fmts=yuv420p,vflip
  8519. @end example
  8520. @item
  8521. Convert the input video to any of the formats not contained in the list:
  8522. @example
  8523. noformat=yuv420p|yuv444p|yuv410p
  8524. @end example
  8525. @end itemize
  8526. @section noise
  8527. Add noise on video input frame.
  8528. The filter accepts the following options:
  8529. @table @option
  8530. @item all_seed
  8531. @item c0_seed
  8532. @item c1_seed
  8533. @item c2_seed
  8534. @item c3_seed
  8535. Set noise seed for specific pixel component or all pixel components in case
  8536. of @var{all_seed}. Default value is @code{123457}.
  8537. @item all_strength, alls
  8538. @item c0_strength, c0s
  8539. @item c1_strength, c1s
  8540. @item c2_strength, c2s
  8541. @item c3_strength, c3s
  8542. Set noise strength for specific pixel component or all pixel components in case
  8543. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8544. @item all_flags, allf
  8545. @item c0_flags, c0f
  8546. @item c1_flags, c1f
  8547. @item c2_flags, c2f
  8548. @item c3_flags, c3f
  8549. Set pixel component flags or set flags for all components if @var{all_flags}.
  8550. Available values for component flags are:
  8551. @table @samp
  8552. @item a
  8553. averaged temporal noise (smoother)
  8554. @item p
  8555. mix random noise with a (semi)regular pattern
  8556. @item t
  8557. temporal noise (noise pattern changes between frames)
  8558. @item u
  8559. uniform noise (gaussian otherwise)
  8560. @end table
  8561. @end table
  8562. @subsection Examples
  8563. Add temporal and uniform noise to input video:
  8564. @example
  8565. noise=alls=20:allf=t+u
  8566. @end example
  8567. @section normalize
  8568. Normalize RGB video (aka histogram stretching, contrast stretching).
  8569. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8570. For each channel of each frame, the filter computes the input range and maps
  8571. it linearly to the user-specified output range. The output range defaults
  8572. to the full dynamic range from pure black to pure white.
  8573. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8574. changes in brightness) caused when small dark or bright objects enter or leave
  8575. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8576. video camera, and, like a video camera, it may cause a period of over- or
  8577. under-exposure of the video.
  8578. The R,G,B channels can be normalized independently, which may cause some
  8579. color shifting, or linked together as a single channel, which prevents
  8580. color shifting. Linked normalization preserves hue. Independent normalization
  8581. does not, so it can be used to remove some color casts. Independent and linked
  8582. normalization can be combined in any ratio.
  8583. The normalize filter accepts the following options:
  8584. @table @option
  8585. @item blackpt
  8586. @item whitept
  8587. Colors which define the output range. The minimum input value is mapped to
  8588. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8589. The defaults are black and white respectively. Specifying white for
  8590. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8591. normalized video. Shades of grey can be used to reduce the dynamic range
  8592. (contrast). Specifying saturated colors here can create some interesting
  8593. effects.
  8594. @item smoothing
  8595. The number of previous frames to use for temporal smoothing. The input range
  8596. of each channel is smoothed using a rolling average over the current frame
  8597. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8598. smoothing).
  8599. @item independence
  8600. Controls the ratio of independent (color shifting) channel normalization to
  8601. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8602. independent. Defaults to 1.0 (fully independent).
  8603. @item strength
  8604. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8605. expensive no-op. Defaults to 1.0 (full strength).
  8606. @end table
  8607. @subsection Examples
  8608. Stretch video contrast to use the full dynamic range, with no temporal
  8609. smoothing; may flicker depending on the source content:
  8610. @example
  8611. normalize=blackpt=black:whitept=white:smoothing=0
  8612. @end example
  8613. As above, but with 50 frames of temporal smoothing; flicker should be
  8614. reduced, depending on the source content:
  8615. @example
  8616. normalize=blackpt=black:whitept=white:smoothing=50
  8617. @end example
  8618. As above, but with hue-preserving linked channel normalization:
  8619. @example
  8620. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8621. @end example
  8622. As above, but with half strength:
  8623. @example
  8624. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8625. @end example
  8626. Map the darkest input color to red, the brightest input color to cyan:
  8627. @example
  8628. normalize=blackpt=red:whitept=cyan
  8629. @end example
  8630. @section null
  8631. Pass the video source unchanged to the output.
  8632. @section ocr
  8633. Optical Character Recognition
  8634. This filter uses Tesseract for optical character recognition.
  8635. It accepts the following options:
  8636. @table @option
  8637. @item datapath
  8638. Set datapath to tesseract data. Default is to use whatever was
  8639. set at installation.
  8640. @item language
  8641. Set language, default is "eng".
  8642. @item whitelist
  8643. Set character whitelist.
  8644. @item blacklist
  8645. Set character blacklist.
  8646. @end table
  8647. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8648. @section ocv
  8649. Apply a video transform using libopencv.
  8650. To enable this filter, install the libopencv library and headers and
  8651. configure FFmpeg with @code{--enable-libopencv}.
  8652. It accepts the following parameters:
  8653. @table @option
  8654. @item filter_name
  8655. The name of the libopencv filter to apply.
  8656. @item filter_params
  8657. The parameters to pass to the libopencv filter. If not specified, the default
  8658. values are assumed.
  8659. @end table
  8660. Refer to the official libopencv documentation for more precise
  8661. information:
  8662. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8663. Several libopencv filters are supported; see the following subsections.
  8664. @anchor{dilate}
  8665. @subsection dilate
  8666. Dilate an image by using a specific structuring element.
  8667. It corresponds to the libopencv function @code{cvDilate}.
  8668. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8669. @var{struct_el} represents a structuring element, and has the syntax:
  8670. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8671. @var{cols} and @var{rows} represent the number of columns and rows of
  8672. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8673. point, and @var{shape} the shape for the structuring element. @var{shape}
  8674. must be "rect", "cross", "ellipse", or "custom".
  8675. If the value for @var{shape} is "custom", it must be followed by a
  8676. string of the form "=@var{filename}". The file with name
  8677. @var{filename} is assumed to represent a binary image, with each
  8678. printable character corresponding to a bright pixel. When a custom
  8679. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8680. or columns and rows of the read file are assumed instead.
  8681. The default value for @var{struct_el} is "3x3+0x0/rect".
  8682. @var{nb_iterations} specifies the number of times the transform is
  8683. applied to the image, and defaults to 1.
  8684. Some examples:
  8685. @example
  8686. # Use the default values
  8687. ocv=dilate
  8688. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8689. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8690. # Read the shape from the file diamond.shape, iterating two times.
  8691. # The file diamond.shape may contain a pattern of characters like this
  8692. # *
  8693. # ***
  8694. # *****
  8695. # ***
  8696. # *
  8697. # The specified columns and rows are ignored
  8698. # but the anchor point coordinates are not
  8699. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8700. @end example
  8701. @subsection erode
  8702. Erode an image by using a specific structuring element.
  8703. It corresponds to the libopencv function @code{cvErode}.
  8704. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8705. with the same syntax and semantics as the @ref{dilate} filter.
  8706. @subsection smooth
  8707. Smooth the input video.
  8708. The filter takes the following parameters:
  8709. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8710. @var{type} is the type of smooth filter to apply, and must be one of
  8711. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8712. or "bilateral". The default value is "gaussian".
  8713. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8714. depend on the smooth type. @var{param1} and
  8715. @var{param2} accept integer positive values or 0. @var{param3} and
  8716. @var{param4} accept floating point values.
  8717. The default value for @var{param1} is 3. The default value for the
  8718. other parameters is 0.
  8719. These parameters correspond to the parameters assigned to the
  8720. libopencv function @code{cvSmooth}.
  8721. @section oscilloscope
  8722. 2D Video Oscilloscope.
  8723. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8724. It accepts the following parameters:
  8725. @table @option
  8726. @item x
  8727. Set scope center x position.
  8728. @item y
  8729. Set scope center y position.
  8730. @item s
  8731. Set scope size, relative to frame diagonal.
  8732. @item t
  8733. Set scope tilt/rotation.
  8734. @item o
  8735. Set trace opacity.
  8736. @item tx
  8737. Set trace center x position.
  8738. @item ty
  8739. Set trace center y position.
  8740. @item tw
  8741. Set trace width, relative to width of frame.
  8742. @item th
  8743. Set trace height, relative to height of frame.
  8744. @item c
  8745. Set which components to trace. By default it traces first three components.
  8746. @item g
  8747. Draw trace grid. By default is enabled.
  8748. @item st
  8749. Draw some statistics. By default is enabled.
  8750. @item sc
  8751. Draw scope. By default is enabled.
  8752. @end table
  8753. @subsection Examples
  8754. @itemize
  8755. @item
  8756. Inspect full first row of video frame.
  8757. @example
  8758. oscilloscope=x=0.5:y=0:s=1
  8759. @end example
  8760. @item
  8761. Inspect full last row of video frame.
  8762. @example
  8763. oscilloscope=x=0.5:y=1:s=1
  8764. @end example
  8765. @item
  8766. Inspect full 5th line of video frame of height 1080.
  8767. @example
  8768. oscilloscope=x=0.5:y=5/1080:s=1
  8769. @end example
  8770. @item
  8771. Inspect full last column of video frame.
  8772. @example
  8773. oscilloscope=x=1:y=0.5:s=1:t=1
  8774. @end example
  8775. @end itemize
  8776. @anchor{overlay}
  8777. @section overlay
  8778. Overlay one video on top of another.
  8779. It takes two inputs and has one output. The first input is the "main"
  8780. video on which the second input is overlaid.
  8781. It accepts the following parameters:
  8782. A description of the accepted options follows.
  8783. @table @option
  8784. @item x
  8785. @item y
  8786. Set the expression for the x and y coordinates of the overlaid video
  8787. on the main video. Default value is "0" for both expressions. In case
  8788. the expression is invalid, it is set to a huge value (meaning that the
  8789. overlay will not be displayed within the output visible area).
  8790. @item eof_action
  8791. See @ref{framesync}.
  8792. @item eval
  8793. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8794. It accepts the following values:
  8795. @table @samp
  8796. @item init
  8797. only evaluate expressions once during the filter initialization or
  8798. when a command is processed
  8799. @item frame
  8800. evaluate expressions for each incoming frame
  8801. @end table
  8802. Default value is @samp{frame}.
  8803. @item shortest
  8804. See @ref{framesync}.
  8805. @item format
  8806. Set the format for the output video.
  8807. It accepts the following values:
  8808. @table @samp
  8809. @item yuv420
  8810. force YUV420 output
  8811. @item yuv422
  8812. force YUV422 output
  8813. @item yuv444
  8814. force YUV444 output
  8815. @item rgb
  8816. force packed RGB output
  8817. @item gbrp
  8818. force planar RGB output
  8819. @item auto
  8820. automatically pick format
  8821. @end table
  8822. Default value is @samp{yuv420}.
  8823. @item repeatlast
  8824. See @ref{framesync}.
  8825. @item alpha
  8826. Set format of alpha of the overlaid video, it can be @var{straight} or
  8827. @var{premultiplied}. Default is @var{straight}.
  8828. @end table
  8829. The @option{x}, and @option{y} expressions can contain the following
  8830. parameters.
  8831. @table @option
  8832. @item main_w, W
  8833. @item main_h, H
  8834. The main input width and height.
  8835. @item overlay_w, w
  8836. @item overlay_h, h
  8837. The overlay input width and height.
  8838. @item x
  8839. @item y
  8840. The computed values for @var{x} and @var{y}. They are evaluated for
  8841. each new frame.
  8842. @item hsub
  8843. @item vsub
  8844. horizontal and vertical chroma subsample values of the output
  8845. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8846. @var{vsub} is 1.
  8847. @item n
  8848. the number of input frame, starting from 0
  8849. @item pos
  8850. the position in the file of the input frame, NAN if unknown
  8851. @item t
  8852. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8853. @end table
  8854. This filter also supports the @ref{framesync} options.
  8855. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8856. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8857. when @option{eval} is set to @samp{init}.
  8858. Be aware that frames are taken from each input video in timestamp
  8859. order, hence, if their initial timestamps differ, it is a good idea
  8860. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8861. have them begin in the same zero timestamp, as the example for
  8862. the @var{movie} filter does.
  8863. You can chain together more overlays but you should test the
  8864. efficiency of such approach.
  8865. @subsection Commands
  8866. This filter supports the following commands:
  8867. @table @option
  8868. @item x
  8869. @item y
  8870. Modify the x and y of the overlay input.
  8871. The command accepts the same syntax of the corresponding option.
  8872. If the specified expression is not valid, it is kept at its current
  8873. value.
  8874. @end table
  8875. @subsection Examples
  8876. @itemize
  8877. @item
  8878. Draw the overlay at 10 pixels from the bottom right corner of the main
  8879. video:
  8880. @example
  8881. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8882. @end example
  8883. Using named options the example above becomes:
  8884. @example
  8885. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8886. @end example
  8887. @item
  8888. Insert a transparent PNG logo in the bottom left corner of the input,
  8889. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8890. @example
  8891. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8892. @end example
  8893. @item
  8894. Insert 2 different transparent PNG logos (second logo on bottom
  8895. right corner) using the @command{ffmpeg} tool:
  8896. @example
  8897. 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
  8898. @end example
  8899. @item
  8900. Add a transparent color layer on top of the main video; @code{WxH}
  8901. must specify the size of the main input to the overlay filter:
  8902. @example
  8903. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8904. @end example
  8905. @item
  8906. Play an original video and a filtered version (here with the deshake
  8907. filter) side by side using the @command{ffplay} tool:
  8908. @example
  8909. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8910. @end example
  8911. The above command is the same as:
  8912. @example
  8913. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8914. @end example
  8915. @item
  8916. Make a sliding overlay appearing from the left to the right top part of the
  8917. screen starting since time 2:
  8918. @example
  8919. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8920. @end example
  8921. @item
  8922. Compose output by putting two input videos side to side:
  8923. @example
  8924. ffmpeg -i left.avi -i right.avi -filter_complex "
  8925. nullsrc=size=200x100 [background];
  8926. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8927. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8928. [background][left] overlay=shortest=1 [background+left];
  8929. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8930. "
  8931. @end example
  8932. @item
  8933. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8934. @example
  8935. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8936. -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]'
  8937. masked.avi
  8938. @end example
  8939. @item
  8940. Chain several overlays in cascade:
  8941. @example
  8942. nullsrc=s=200x200 [bg];
  8943. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8944. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8945. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8946. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8947. [in3] null, [mid2] overlay=100:100 [out0]
  8948. @end example
  8949. @end itemize
  8950. @section owdenoise
  8951. Apply Overcomplete Wavelet denoiser.
  8952. The filter accepts the following options:
  8953. @table @option
  8954. @item depth
  8955. Set depth.
  8956. Larger depth values will denoise lower frequency components more, but
  8957. slow down filtering.
  8958. Must be an int in the range 8-16, default is @code{8}.
  8959. @item luma_strength, ls
  8960. Set luma strength.
  8961. Must be a double value in the range 0-1000, default is @code{1.0}.
  8962. @item chroma_strength, cs
  8963. Set chroma strength.
  8964. Must be a double value in the range 0-1000, default is @code{1.0}.
  8965. @end table
  8966. @anchor{pad}
  8967. @section pad
  8968. Add paddings to the input image, and place the original input at the
  8969. provided @var{x}, @var{y} coordinates.
  8970. It accepts the following parameters:
  8971. @table @option
  8972. @item width, w
  8973. @item height, h
  8974. Specify an expression for the size of the output image with the
  8975. paddings added. If the value for @var{width} or @var{height} is 0, the
  8976. corresponding input size is used for the output.
  8977. The @var{width} expression can reference the value set by the
  8978. @var{height} expression, and vice versa.
  8979. The default value of @var{width} and @var{height} is 0.
  8980. @item x
  8981. @item y
  8982. Specify the offsets to place the input image at within the padded area,
  8983. with respect to the top/left border of the output image.
  8984. The @var{x} expression can reference the value set by the @var{y}
  8985. expression, and vice versa.
  8986. The default value of @var{x} and @var{y} is 0.
  8987. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8988. so the input image is centered on the padded area.
  8989. @item color
  8990. Specify the color of the padded area. For the syntax of this option,
  8991. check the "Color" section in the ffmpeg-utils manual.
  8992. The default value of @var{color} is "black".
  8993. @item eval
  8994. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8995. It accepts the following values:
  8996. @table @samp
  8997. @item init
  8998. Only evaluate expressions once during the filter initialization or when
  8999. a command is processed.
  9000. @item frame
  9001. Evaluate expressions for each incoming frame.
  9002. @end table
  9003. Default value is @samp{init}.
  9004. @item aspect
  9005. Pad to aspect instead to a resolution.
  9006. @end table
  9007. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9008. options are expressions containing the following constants:
  9009. @table @option
  9010. @item in_w
  9011. @item in_h
  9012. The input video width and height.
  9013. @item iw
  9014. @item ih
  9015. These are the same as @var{in_w} and @var{in_h}.
  9016. @item out_w
  9017. @item out_h
  9018. The output width and height (the size of the padded area), as
  9019. specified by the @var{width} and @var{height} expressions.
  9020. @item ow
  9021. @item oh
  9022. These are the same as @var{out_w} and @var{out_h}.
  9023. @item x
  9024. @item y
  9025. The x and y offsets as specified by the @var{x} and @var{y}
  9026. expressions, or NAN if not yet specified.
  9027. @item a
  9028. same as @var{iw} / @var{ih}
  9029. @item sar
  9030. input sample aspect ratio
  9031. @item dar
  9032. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9033. @item hsub
  9034. @item vsub
  9035. The horizontal and vertical chroma subsample values. For example for the
  9036. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9037. @end table
  9038. @subsection Examples
  9039. @itemize
  9040. @item
  9041. Add paddings with the color "violet" to the input video. The output video
  9042. size is 640x480, and the top-left corner of the input video is placed at
  9043. column 0, row 40
  9044. @example
  9045. pad=640:480:0:40:violet
  9046. @end example
  9047. The example above is equivalent to the following command:
  9048. @example
  9049. pad=width=640:height=480:x=0:y=40:color=violet
  9050. @end example
  9051. @item
  9052. Pad the input to get an output with dimensions increased by 3/2,
  9053. and put the input video at the center of the padded area:
  9054. @example
  9055. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9056. @end example
  9057. @item
  9058. Pad the input to get a squared output with size equal to the maximum
  9059. value between the input width and height, and put the input video at
  9060. the center of the padded area:
  9061. @example
  9062. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9063. @end example
  9064. @item
  9065. Pad the input to get a final w/h ratio of 16:9:
  9066. @example
  9067. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9068. @end example
  9069. @item
  9070. In case of anamorphic video, in order to set the output display aspect
  9071. correctly, it is necessary to use @var{sar} in the expression,
  9072. according to the relation:
  9073. @example
  9074. (ih * X / ih) * sar = output_dar
  9075. X = output_dar / sar
  9076. @end example
  9077. Thus the previous example needs to be modified to:
  9078. @example
  9079. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9080. @end example
  9081. @item
  9082. Double the output size and put the input video in the bottom-right
  9083. corner of the output padded area:
  9084. @example
  9085. pad="2*iw:2*ih:ow-iw:oh-ih"
  9086. @end example
  9087. @end itemize
  9088. @anchor{palettegen}
  9089. @section palettegen
  9090. Generate one palette for a whole video stream.
  9091. It accepts the following options:
  9092. @table @option
  9093. @item max_colors
  9094. Set the maximum number of colors to quantize in the palette.
  9095. Note: the palette will still contain 256 colors; the unused palette entries
  9096. will be black.
  9097. @item reserve_transparent
  9098. Create a palette of 255 colors maximum and reserve the last one for
  9099. transparency. Reserving the transparency color is useful for GIF optimization.
  9100. If not set, the maximum of colors in the palette will be 256. You probably want
  9101. to disable this option for a standalone image.
  9102. Set by default.
  9103. @item transparency_color
  9104. Set the color that will be used as background for transparency.
  9105. @item stats_mode
  9106. Set statistics mode.
  9107. It accepts the following values:
  9108. @table @samp
  9109. @item full
  9110. Compute full frame histograms.
  9111. @item diff
  9112. Compute histograms only for the part that differs from previous frame. This
  9113. might be relevant to give more importance to the moving part of your input if
  9114. the background is static.
  9115. @item single
  9116. Compute new histogram for each frame.
  9117. @end table
  9118. Default value is @var{full}.
  9119. @end table
  9120. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9121. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9122. color quantization of the palette. This information is also visible at
  9123. @var{info} logging level.
  9124. @subsection Examples
  9125. @itemize
  9126. @item
  9127. Generate a representative palette of a given video using @command{ffmpeg}:
  9128. @example
  9129. ffmpeg -i input.mkv -vf palettegen palette.png
  9130. @end example
  9131. @end itemize
  9132. @section paletteuse
  9133. Use a palette to downsample an input video stream.
  9134. The filter takes two inputs: one video stream and a palette. The palette must
  9135. be a 256 pixels image.
  9136. It accepts the following options:
  9137. @table @option
  9138. @item dither
  9139. Select dithering mode. Available algorithms are:
  9140. @table @samp
  9141. @item bayer
  9142. Ordered 8x8 bayer dithering (deterministic)
  9143. @item heckbert
  9144. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9145. Note: this dithering is sometimes considered "wrong" and is included as a
  9146. reference.
  9147. @item floyd_steinberg
  9148. Floyd and Steingberg dithering (error diffusion)
  9149. @item sierra2
  9150. Frankie Sierra dithering v2 (error diffusion)
  9151. @item sierra2_4a
  9152. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9153. @end table
  9154. Default is @var{sierra2_4a}.
  9155. @item bayer_scale
  9156. When @var{bayer} dithering is selected, this option defines the scale of the
  9157. pattern (how much the crosshatch pattern is visible). A low value means more
  9158. visible pattern for less banding, and higher value means less visible pattern
  9159. at the cost of more banding.
  9160. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9161. @item diff_mode
  9162. If set, define the zone to process
  9163. @table @samp
  9164. @item rectangle
  9165. Only the changing rectangle will be reprocessed. This is similar to GIF
  9166. cropping/offsetting compression mechanism. This option can be useful for speed
  9167. if only a part of the image is changing, and has use cases such as limiting the
  9168. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9169. moving scene (it leads to more deterministic output if the scene doesn't change
  9170. much, and as a result less moving noise and better GIF compression).
  9171. @end table
  9172. Default is @var{none}.
  9173. @item new
  9174. Take new palette for each output frame.
  9175. @item alpha_threshold
  9176. Sets the alpha threshold for transparency. Alpha values above this threshold
  9177. will be treated as completely opaque, and values below this threshold will be
  9178. treated as completely transparent.
  9179. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9180. @end table
  9181. @subsection Examples
  9182. @itemize
  9183. @item
  9184. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9185. using @command{ffmpeg}:
  9186. @example
  9187. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9188. @end example
  9189. @end itemize
  9190. @section perspective
  9191. Correct perspective of video not recorded perpendicular to the screen.
  9192. A description of the accepted parameters follows.
  9193. @table @option
  9194. @item x0
  9195. @item y0
  9196. @item x1
  9197. @item y1
  9198. @item x2
  9199. @item y2
  9200. @item x3
  9201. @item y3
  9202. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9203. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9204. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9205. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9206. then the corners of the source will be sent to the specified coordinates.
  9207. The expressions can use the following variables:
  9208. @table @option
  9209. @item W
  9210. @item H
  9211. the width and height of video frame.
  9212. @item in
  9213. Input frame count.
  9214. @item on
  9215. Output frame count.
  9216. @end table
  9217. @item interpolation
  9218. Set interpolation for perspective correction.
  9219. It accepts the following values:
  9220. @table @samp
  9221. @item linear
  9222. @item cubic
  9223. @end table
  9224. Default value is @samp{linear}.
  9225. @item sense
  9226. Set interpretation of coordinate options.
  9227. It accepts the following values:
  9228. @table @samp
  9229. @item 0, source
  9230. Send point in the source specified by the given coordinates to
  9231. the corners of the destination.
  9232. @item 1, destination
  9233. Send the corners of the source to the point in the destination specified
  9234. by the given coordinates.
  9235. Default value is @samp{source}.
  9236. @end table
  9237. @item eval
  9238. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9239. It accepts the following values:
  9240. @table @samp
  9241. @item init
  9242. only evaluate expressions once during the filter initialization or
  9243. when a command is processed
  9244. @item frame
  9245. evaluate expressions for each incoming frame
  9246. @end table
  9247. Default value is @samp{init}.
  9248. @end table
  9249. @section phase
  9250. Delay interlaced video by one field time so that the field order changes.
  9251. The intended use is to fix PAL movies that have been captured with the
  9252. opposite field order to the film-to-video transfer.
  9253. A description of the accepted parameters follows.
  9254. @table @option
  9255. @item mode
  9256. Set phase mode.
  9257. It accepts the following values:
  9258. @table @samp
  9259. @item t
  9260. Capture field order top-first, transfer bottom-first.
  9261. Filter will delay the bottom field.
  9262. @item b
  9263. Capture field order bottom-first, transfer top-first.
  9264. Filter will delay the top field.
  9265. @item p
  9266. Capture and transfer with the same field order. This mode only exists
  9267. for the documentation of the other options to refer to, but if you
  9268. actually select it, the filter will faithfully do nothing.
  9269. @item a
  9270. Capture field order determined automatically by field flags, transfer
  9271. opposite.
  9272. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9273. basis using field flags. If no field information is available,
  9274. then this works just like @samp{u}.
  9275. @item u
  9276. Capture unknown or varying, transfer opposite.
  9277. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9278. analyzing the images and selecting the alternative that produces best
  9279. match between the fields.
  9280. @item T
  9281. Capture top-first, transfer unknown or varying.
  9282. Filter selects among @samp{t} and @samp{p} using image analysis.
  9283. @item B
  9284. Capture bottom-first, transfer unknown or varying.
  9285. Filter selects among @samp{b} and @samp{p} using image analysis.
  9286. @item A
  9287. Capture determined by field flags, transfer unknown or varying.
  9288. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9289. image analysis. If no field information is available, then this works just
  9290. like @samp{U}. This is the default mode.
  9291. @item U
  9292. Both capture and transfer unknown or varying.
  9293. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9294. @end table
  9295. @end table
  9296. @section pixdesctest
  9297. Pixel format descriptor test filter, mainly useful for internal
  9298. testing. The output video should be equal to the input video.
  9299. For example:
  9300. @example
  9301. format=monow, pixdesctest
  9302. @end example
  9303. can be used to test the monowhite pixel format descriptor definition.
  9304. @section pixscope
  9305. Display sample values of color channels. Mainly useful for checking color
  9306. and levels. Minimum supported resolution is 640x480.
  9307. The filters accept the following options:
  9308. @table @option
  9309. @item x
  9310. Set scope X position, relative offset on X axis.
  9311. @item y
  9312. Set scope Y position, relative offset on Y axis.
  9313. @item w
  9314. Set scope width.
  9315. @item h
  9316. Set scope height.
  9317. @item o
  9318. Set window opacity. This window also holds statistics about pixel area.
  9319. @item wx
  9320. Set window X position, relative offset on X axis.
  9321. @item wy
  9322. Set window Y position, relative offset on Y axis.
  9323. @end table
  9324. @section pp
  9325. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9326. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9327. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9328. Each subfilter and some options have a short and a long name that can be used
  9329. interchangeably, i.e. dr/dering are the same.
  9330. The filters accept the following options:
  9331. @table @option
  9332. @item subfilters
  9333. Set postprocessing subfilters string.
  9334. @end table
  9335. All subfilters share common options to determine their scope:
  9336. @table @option
  9337. @item a/autoq
  9338. Honor the quality commands for this subfilter.
  9339. @item c/chrom
  9340. Do chrominance filtering, too (default).
  9341. @item y/nochrom
  9342. Do luminance filtering only (no chrominance).
  9343. @item n/noluma
  9344. Do chrominance filtering only (no luminance).
  9345. @end table
  9346. These options can be appended after the subfilter name, separated by a '|'.
  9347. Available subfilters are:
  9348. @table @option
  9349. @item hb/hdeblock[|difference[|flatness]]
  9350. Horizontal deblocking filter
  9351. @table @option
  9352. @item difference
  9353. Difference factor where higher values mean more deblocking (default: @code{32}).
  9354. @item flatness
  9355. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9356. @end table
  9357. @item vb/vdeblock[|difference[|flatness]]
  9358. Vertical deblocking filter
  9359. @table @option
  9360. @item difference
  9361. Difference factor where higher values mean more deblocking (default: @code{32}).
  9362. @item flatness
  9363. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9364. @end table
  9365. @item ha/hadeblock[|difference[|flatness]]
  9366. Accurate horizontal deblocking filter
  9367. @table @option
  9368. @item difference
  9369. Difference factor where higher values mean more deblocking (default: @code{32}).
  9370. @item flatness
  9371. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9372. @end table
  9373. @item va/vadeblock[|difference[|flatness]]
  9374. Accurate vertical deblocking filter
  9375. @table @option
  9376. @item difference
  9377. Difference factor where higher values mean more deblocking (default: @code{32}).
  9378. @item flatness
  9379. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9380. @end table
  9381. @end table
  9382. The horizontal and vertical deblocking filters share the difference and
  9383. flatness values so you cannot set different horizontal and vertical
  9384. thresholds.
  9385. @table @option
  9386. @item h1/x1hdeblock
  9387. Experimental horizontal deblocking filter
  9388. @item v1/x1vdeblock
  9389. Experimental vertical deblocking filter
  9390. @item dr/dering
  9391. Deringing filter
  9392. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9393. @table @option
  9394. @item threshold1
  9395. larger -> stronger filtering
  9396. @item threshold2
  9397. larger -> stronger filtering
  9398. @item threshold3
  9399. larger -> stronger filtering
  9400. @end table
  9401. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9402. @table @option
  9403. @item f/fullyrange
  9404. Stretch luminance to @code{0-255}.
  9405. @end table
  9406. @item lb/linblenddeint
  9407. Linear blend deinterlacing filter that deinterlaces the given block by
  9408. filtering all lines with a @code{(1 2 1)} filter.
  9409. @item li/linipoldeint
  9410. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9411. linearly interpolating every second line.
  9412. @item ci/cubicipoldeint
  9413. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9414. cubically interpolating every second line.
  9415. @item md/mediandeint
  9416. Median deinterlacing filter that deinterlaces the given block by applying a
  9417. median filter to every second line.
  9418. @item fd/ffmpegdeint
  9419. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9420. second line with a @code{(-1 4 2 4 -1)} filter.
  9421. @item l5/lowpass5
  9422. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9423. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9424. @item fq/forceQuant[|quantizer]
  9425. Overrides the quantizer table from the input with the constant quantizer you
  9426. specify.
  9427. @table @option
  9428. @item quantizer
  9429. Quantizer to use
  9430. @end table
  9431. @item de/default
  9432. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9433. @item fa/fast
  9434. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9435. @item ac
  9436. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9437. @end table
  9438. @subsection Examples
  9439. @itemize
  9440. @item
  9441. Apply horizontal and vertical deblocking, deringing and automatic
  9442. brightness/contrast:
  9443. @example
  9444. pp=hb/vb/dr/al
  9445. @end example
  9446. @item
  9447. Apply default filters without brightness/contrast correction:
  9448. @example
  9449. pp=de/-al
  9450. @end example
  9451. @item
  9452. Apply default filters and temporal denoiser:
  9453. @example
  9454. pp=default/tmpnoise|1|2|3
  9455. @end example
  9456. @item
  9457. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9458. automatically depending on available CPU time:
  9459. @example
  9460. pp=hb|y/vb|a
  9461. @end example
  9462. @end itemize
  9463. @section pp7
  9464. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9465. similar to spp = 6 with 7 point DCT, where only the center sample is
  9466. used after IDCT.
  9467. The filter accepts the following options:
  9468. @table @option
  9469. @item qp
  9470. Force a constant quantization parameter. It accepts an integer in range
  9471. 0 to 63. If not set, the filter will use the QP from the video stream
  9472. (if available).
  9473. @item mode
  9474. Set thresholding mode. Available modes are:
  9475. @table @samp
  9476. @item hard
  9477. Set hard thresholding.
  9478. @item soft
  9479. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9480. @item medium
  9481. Set medium thresholding (good results, default).
  9482. @end table
  9483. @end table
  9484. @section premultiply
  9485. Apply alpha premultiply effect to input video stream using first plane
  9486. of second stream as alpha.
  9487. Both streams must have same dimensions and same pixel format.
  9488. The filter accepts the following option:
  9489. @table @option
  9490. @item planes
  9491. Set which planes will be processed, unprocessed planes will be copied.
  9492. By default value 0xf, all planes will be processed.
  9493. @item inplace
  9494. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9495. @end table
  9496. @section prewitt
  9497. Apply prewitt operator to input video stream.
  9498. The filter accepts the following option:
  9499. @table @option
  9500. @item planes
  9501. Set which planes will be processed, unprocessed planes will be copied.
  9502. By default value 0xf, all planes will be processed.
  9503. @item scale
  9504. Set value which will be multiplied with filtered result.
  9505. @item delta
  9506. Set value which will be added to filtered result.
  9507. @end table
  9508. @section pseudocolor
  9509. Alter frame colors in video with pseudocolors.
  9510. This filter accept the following options:
  9511. @table @option
  9512. @item c0
  9513. set pixel first component expression
  9514. @item c1
  9515. set pixel second component expression
  9516. @item c2
  9517. set pixel third component expression
  9518. @item c3
  9519. set pixel fourth component expression, corresponds to the alpha component
  9520. @item i
  9521. set component to use as base for altering colors
  9522. @end table
  9523. Each of them specifies the expression to use for computing the lookup table for
  9524. the corresponding pixel component values.
  9525. The expressions can contain the following constants and functions:
  9526. @table @option
  9527. @item w
  9528. @item h
  9529. The input width and height.
  9530. @item val
  9531. The input value for the pixel component.
  9532. @item ymin, umin, vmin, amin
  9533. The minimum allowed component value.
  9534. @item ymax, umax, vmax, amax
  9535. The maximum allowed component value.
  9536. @end table
  9537. All expressions default to "val".
  9538. @subsection Examples
  9539. @itemize
  9540. @item
  9541. Change too high luma values to gradient:
  9542. @example
  9543. 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'"
  9544. @end example
  9545. @end itemize
  9546. @section psnr
  9547. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9548. Ratio) between two input videos.
  9549. This filter takes in input two input videos, the first input is
  9550. considered the "main" source and is passed unchanged to the
  9551. output. The second input is used as a "reference" video for computing
  9552. the PSNR.
  9553. Both video inputs must have the same resolution and pixel format for
  9554. this filter to work correctly. Also it assumes that both inputs
  9555. have the same number of frames, which are compared one by one.
  9556. The obtained average PSNR is printed through the logging system.
  9557. The filter stores the accumulated MSE (mean squared error) of each
  9558. frame, and at the end of the processing it is averaged across all frames
  9559. equally, and the following formula is applied to obtain the PSNR:
  9560. @example
  9561. PSNR = 10*log10(MAX^2/MSE)
  9562. @end example
  9563. Where MAX is the average of the maximum values of each component of the
  9564. image.
  9565. The description of the accepted parameters follows.
  9566. @table @option
  9567. @item stats_file, f
  9568. If specified the filter will use the named file to save the PSNR of
  9569. each individual frame. When filename equals "-" the data is sent to
  9570. standard output.
  9571. @item stats_version
  9572. Specifies which version of the stats file format to use. Details of
  9573. each format are written below.
  9574. Default value is 1.
  9575. @item stats_add_max
  9576. Determines whether the max value is output to the stats log.
  9577. Default value is 0.
  9578. Requires stats_version >= 2. If this is set and stats_version < 2,
  9579. the filter will return an error.
  9580. @end table
  9581. This filter also supports the @ref{framesync} options.
  9582. The file printed if @var{stats_file} is selected, contains a sequence of
  9583. key/value pairs of the form @var{key}:@var{value} for each compared
  9584. couple of frames.
  9585. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9586. the list of per-frame-pair stats, with key value pairs following the frame
  9587. format with the following parameters:
  9588. @table @option
  9589. @item psnr_log_version
  9590. The version of the log file format. Will match @var{stats_version}.
  9591. @item fields
  9592. A comma separated list of the per-frame-pair parameters included in
  9593. the log.
  9594. @end table
  9595. A description of each shown per-frame-pair parameter follows:
  9596. @table @option
  9597. @item n
  9598. sequential number of the input frame, starting from 1
  9599. @item mse_avg
  9600. Mean Square Error pixel-by-pixel average difference of the compared
  9601. frames, averaged over all the image components.
  9602. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9603. Mean Square Error pixel-by-pixel average difference of the compared
  9604. frames for the component specified by the suffix.
  9605. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9606. Peak Signal to Noise ratio of the compared frames for the component
  9607. specified by the suffix.
  9608. @item max_avg, max_y, max_u, max_v
  9609. Maximum allowed value for each channel, and average over all
  9610. channels.
  9611. @end table
  9612. For example:
  9613. @example
  9614. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9615. [main][ref] psnr="stats_file=stats.log" [out]
  9616. @end example
  9617. On this example the input file being processed is compared with the
  9618. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9619. is stored in @file{stats.log}.
  9620. @anchor{pullup}
  9621. @section pullup
  9622. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9623. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9624. content.
  9625. The pullup filter is designed to take advantage of future context in making
  9626. its decisions. This filter is stateless in the sense that it does not lock
  9627. onto a pattern to follow, but it instead looks forward to the following
  9628. fields in order to identify matches and rebuild progressive frames.
  9629. To produce content with an even framerate, insert the fps filter after
  9630. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9631. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9632. The filter accepts the following options:
  9633. @table @option
  9634. @item jl
  9635. @item jr
  9636. @item jt
  9637. @item jb
  9638. These options set the amount of "junk" to ignore at the left, right, top, and
  9639. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9640. while top and bottom are in units of 2 lines.
  9641. The default is 8 pixels on each side.
  9642. @item sb
  9643. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9644. filter generating an occasional mismatched frame, but it may also cause an
  9645. excessive number of frames to be dropped during high motion sequences.
  9646. Conversely, setting it to -1 will make filter match fields more easily.
  9647. This may help processing of video where there is slight blurring between
  9648. the fields, but may also cause there to be interlaced frames in the output.
  9649. Default value is @code{0}.
  9650. @item mp
  9651. Set the metric plane to use. It accepts the following values:
  9652. @table @samp
  9653. @item l
  9654. Use luma plane.
  9655. @item u
  9656. Use chroma blue plane.
  9657. @item v
  9658. Use chroma red plane.
  9659. @end table
  9660. This option may be set to use chroma plane instead of the default luma plane
  9661. for doing filter's computations. This may improve accuracy on very clean
  9662. source material, but more likely will decrease accuracy, especially if there
  9663. is chroma noise (rainbow effect) or any grayscale video.
  9664. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9665. load and make pullup usable in realtime on slow machines.
  9666. @end table
  9667. For best results (without duplicated frames in the output file) it is
  9668. necessary to change the output frame rate. For example, to inverse
  9669. telecine NTSC input:
  9670. @example
  9671. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9672. @end example
  9673. @section qp
  9674. Change video quantization parameters (QP).
  9675. The filter accepts the following option:
  9676. @table @option
  9677. @item qp
  9678. Set expression for quantization parameter.
  9679. @end table
  9680. The expression is evaluated through the eval API and can contain, among others,
  9681. the following constants:
  9682. @table @var
  9683. @item known
  9684. 1 if index is not 129, 0 otherwise.
  9685. @item qp
  9686. Sequential index starting from -129 to 128.
  9687. @end table
  9688. @subsection Examples
  9689. @itemize
  9690. @item
  9691. Some equation like:
  9692. @example
  9693. qp=2+2*sin(PI*qp)
  9694. @end example
  9695. @end itemize
  9696. @section random
  9697. Flush video frames from internal cache of frames into a random order.
  9698. No frame is discarded.
  9699. Inspired by @ref{frei0r} nervous filter.
  9700. @table @option
  9701. @item frames
  9702. Set size in number of frames of internal cache, in range from @code{2} to
  9703. @code{512}. Default is @code{30}.
  9704. @item seed
  9705. Set seed for random number generator, must be an integer included between
  9706. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9707. less than @code{0}, the filter will try to use a good random seed on a
  9708. best effort basis.
  9709. @end table
  9710. @section readeia608
  9711. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9712. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9713. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9714. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9715. @table @option
  9716. @item lavfi.readeia608.X.cc
  9717. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9718. @item lavfi.readeia608.X.line
  9719. The number of the line on which the EIA-608 data was identified and read.
  9720. @end table
  9721. This filter accepts the following options:
  9722. @table @option
  9723. @item scan_min
  9724. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9725. @item scan_max
  9726. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9727. @item mac
  9728. Set minimal acceptable amplitude change for sync codes detection.
  9729. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9730. @item spw
  9731. Set the ratio of width reserved for sync code detection.
  9732. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9733. @item mhd
  9734. Set the max peaks height difference for sync code detection.
  9735. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9736. @item mpd
  9737. Set max peaks period difference for sync code detection.
  9738. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9739. @item msd
  9740. Set the first two max start code bits differences.
  9741. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9742. @item bhd
  9743. Set the minimum ratio of bits height compared to 3rd start code bit.
  9744. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9745. @item th_w
  9746. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9747. @item th_b
  9748. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9749. @item chp
  9750. Enable checking the parity bit. In the event of a parity error, the filter will output
  9751. @code{0x00} for that character. Default is false.
  9752. @end table
  9753. @subsection Examples
  9754. @itemize
  9755. @item
  9756. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9757. @example
  9758. 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
  9759. @end example
  9760. @end itemize
  9761. @section readvitc
  9762. Read vertical interval timecode (VITC) information from the top lines of a
  9763. video frame.
  9764. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9765. timecode value, if a valid timecode has been detected. Further metadata key
  9766. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9767. timecode data has been found or not.
  9768. This filter accepts the following options:
  9769. @table @option
  9770. @item scan_max
  9771. Set the maximum number of lines to scan for VITC data. If the value is set to
  9772. @code{-1} the full video frame is scanned. Default is @code{45}.
  9773. @item thr_b
  9774. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9775. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9776. @item thr_w
  9777. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9778. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9779. @end table
  9780. @subsection Examples
  9781. @itemize
  9782. @item
  9783. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9784. draw @code{--:--:--:--} as a placeholder:
  9785. @example
  9786. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9787. @end example
  9788. @end itemize
  9789. @section remap
  9790. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9791. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9792. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9793. value for pixel will be used for destination pixel.
  9794. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9795. will have Xmap/Ymap video stream dimensions.
  9796. Xmap and Ymap input video streams are 16bit depth, single channel.
  9797. @section removegrain
  9798. The removegrain filter is a spatial denoiser for progressive video.
  9799. @table @option
  9800. @item m0
  9801. Set mode for the first plane.
  9802. @item m1
  9803. Set mode for the second plane.
  9804. @item m2
  9805. Set mode for the third plane.
  9806. @item m3
  9807. Set mode for the fourth plane.
  9808. @end table
  9809. Range of mode is from 0 to 24. Description of each mode follows:
  9810. @table @var
  9811. @item 0
  9812. Leave input plane unchanged. Default.
  9813. @item 1
  9814. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9815. @item 2
  9816. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9817. @item 3
  9818. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9819. @item 4
  9820. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9821. This is equivalent to a median filter.
  9822. @item 5
  9823. Line-sensitive clipping giving the minimal change.
  9824. @item 6
  9825. Line-sensitive clipping, intermediate.
  9826. @item 7
  9827. Line-sensitive clipping, intermediate.
  9828. @item 8
  9829. Line-sensitive clipping, intermediate.
  9830. @item 9
  9831. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9832. @item 10
  9833. Replaces the target pixel with the closest neighbour.
  9834. @item 11
  9835. [1 2 1] horizontal and vertical kernel blur.
  9836. @item 12
  9837. Same as mode 11.
  9838. @item 13
  9839. Bob mode, interpolates top field from the line where the neighbours
  9840. pixels are the closest.
  9841. @item 14
  9842. Bob mode, interpolates bottom field from the line where the neighbours
  9843. pixels are the closest.
  9844. @item 15
  9845. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9846. interpolation formula.
  9847. @item 16
  9848. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9849. interpolation formula.
  9850. @item 17
  9851. Clips the pixel with the minimum and maximum of respectively the maximum and
  9852. minimum of each pair of opposite neighbour pixels.
  9853. @item 18
  9854. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9855. the current pixel is minimal.
  9856. @item 19
  9857. Replaces the pixel with the average of its 8 neighbours.
  9858. @item 20
  9859. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9860. @item 21
  9861. Clips pixels using the averages of opposite neighbour.
  9862. @item 22
  9863. Same as mode 21 but simpler and faster.
  9864. @item 23
  9865. Small edge and halo removal, but reputed useless.
  9866. @item 24
  9867. Similar as 23.
  9868. @end table
  9869. @section removelogo
  9870. Suppress a TV station logo, using an image file to determine which
  9871. pixels comprise the logo. It works by filling in the pixels that
  9872. comprise the logo with neighboring pixels.
  9873. The filter accepts the following options:
  9874. @table @option
  9875. @item filename, f
  9876. Set the filter bitmap file, which can be any image format supported by
  9877. libavformat. The width and height of the image file must match those of the
  9878. video stream being processed.
  9879. @end table
  9880. Pixels in the provided bitmap image with a value of zero are not
  9881. considered part of the logo, non-zero pixels are considered part of
  9882. the logo. If you use white (255) for the logo and black (0) for the
  9883. rest, you will be safe. For making the filter bitmap, it is
  9884. recommended to take a screen capture of a black frame with the logo
  9885. visible, and then using a threshold filter followed by the erode
  9886. filter once or twice.
  9887. If needed, little splotches can be fixed manually. Remember that if
  9888. logo pixels are not covered, the filter quality will be much
  9889. reduced. Marking too many pixels as part of the logo does not hurt as
  9890. much, but it will increase the amount of blurring needed to cover over
  9891. the image and will destroy more information than necessary, and extra
  9892. pixels will slow things down on a large logo.
  9893. @section repeatfields
  9894. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9895. fields based on its value.
  9896. @section reverse
  9897. Reverse a video clip.
  9898. Warning: This filter requires memory to buffer the entire clip, so trimming
  9899. is suggested.
  9900. @subsection Examples
  9901. @itemize
  9902. @item
  9903. Take the first 5 seconds of a clip, and reverse it.
  9904. @example
  9905. trim=end=5,reverse
  9906. @end example
  9907. @end itemize
  9908. @section roberts
  9909. Apply roberts cross operator to input video stream.
  9910. The filter accepts the following option:
  9911. @table @option
  9912. @item planes
  9913. Set which planes will be processed, unprocessed planes will be copied.
  9914. By default value 0xf, all planes will be processed.
  9915. @item scale
  9916. Set value which will be multiplied with filtered result.
  9917. @item delta
  9918. Set value which will be added to filtered result.
  9919. @end table
  9920. @section rotate
  9921. Rotate video by an arbitrary angle expressed in radians.
  9922. The filter accepts the following options:
  9923. A description of the optional parameters follows.
  9924. @table @option
  9925. @item angle, a
  9926. Set an expression for the angle by which to rotate the input video
  9927. clockwise, expressed as a number of radians. A negative value will
  9928. result in a counter-clockwise rotation. By default it is set to "0".
  9929. This expression is evaluated for each frame.
  9930. @item out_w, ow
  9931. Set the output width expression, default value is "iw".
  9932. This expression is evaluated just once during configuration.
  9933. @item out_h, oh
  9934. Set the output height expression, default value is "ih".
  9935. This expression is evaluated just once during configuration.
  9936. @item bilinear
  9937. Enable bilinear interpolation if set to 1, a value of 0 disables
  9938. it. Default value is 1.
  9939. @item fillcolor, c
  9940. Set the color used to fill the output area not covered by the rotated
  9941. image. For the general syntax of this option, check the "Color" section in the
  9942. ffmpeg-utils manual. If the special value "none" is selected then no
  9943. background is printed (useful for example if the background is never shown).
  9944. Default value is "black".
  9945. @end table
  9946. The expressions for the angle and the output size can contain the
  9947. following constants and functions:
  9948. @table @option
  9949. @item n
  9950. sequential number of the input frame, starting from 0. It is always NAN
  9951. before the first frame is filtered.
  9952. @item t
  9953. time in seconds of the input frame, it is set to 0 when the filter is
  9954. configured. It is always NAN before the first frame is filtered.
  9955. @item hsub
  9956. @item vsub
  9957. horizontal and vertical chroma subsample values. For example for the
  9958. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9959. @item in_w, iw
  9960. @item in_h, ih
  9961. the input video width and height
  9962. @item out_w, ow
  9963. @item out_h, oh
  9964. the output width and height, that is the size of the padded area as
  9965. specified by the @var{width} and @var{height} expressions
  9966. @item rotw(a)
  9967. @item roth(a)
  9968. the minimal width/height required for completely containing the input
  9969. video rotated by @var{a} radians.
  9970. These are only available when computing the @option{out_w} and
  9971. @option{out_h} expressions.
  9972. @end table
  9973. @subsection Examples
  9974. @itemize
  9975. @item
  9976. Rotate the input by PI/6 radians clockwise:
  9977. @example
  9978. rotate=PI/6
  9979. @end example
  9980. @item
  9981. Rotate the input by PI/6 radians counter-clockwise:
  9982. @example
  9983. rotate=-PI/6
  9984. @end example
  9985. @item
  9986. Rotate the input by 45 degrees clockwise:
  9987. @example
  9988. rotate=45*PI/180
  9989. @end example
  9990. @item
  9991. Apply a constant rotation with period T, starting from an angle of PI/3:
  9992. @example
  9993. rotate=PI/3+2*PI*t/T
  9994. @end example
  9995. @item
  9996. Make the input video rotation oscillating with a period of T
  9997. seconds and an amplitude of A radians:
  9998. @example
  9999. rotate=A*sin(2*PI/T*t)
  10000. @end example
  10001. @item
  10002. Rotate the video, output size is chosen so that the whole rotating
  10003. input video is always completely contained in the output:
  10004. @example
  10005. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10006. @end example
  10007. @item
  10008. Rotate the video, reduce the output size so that no background is ever
  10009. shown:
  10010. @example
  10011. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10012. @end example
  10013. @end itemize
  10014. @subsection Commands
  10015. The filter supports the following commands:
  10016. @table @option
  10017. @item a, angle
  10018. Set the angle expression.
  10019. The command accepts the same syntax of the corresponding option.
  10020. If the specified expression is not valid, it is kept at its current
  10021. value.
  10022. @end table
  10023. @section sab
  10024. Apply Shape Adaptive Blur.
  10025. The filter accepts the following options:
  10026. @table @option
  10027. @item luma_radius, lr
  10028. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10029. value is 1.0. A greater value will result in a more blurred image, and
  10030. in slower processing.
  10031. @item luma_pre_filter_radius, lpfr
  10032. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10033. value is 1.0.
  10034. @item luma_strength, ls
  10035. Set luma maximum difference between pixels to still be considered, must
  10036. be a value in the 0.1-100.0 range, default value is 1.0.
  10037. @item chroma_radius, cr
  10038. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10039. greater value will result in a more blurred image, and in slower
  10040. processing.
  10041. @item chroma_pre_filter_radius, cpfr
  10042. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10043. @item chroma_strength, cs
  10044. Set chroma maximum difference between pixels to still be considered,
  10045. must be a value in the -0.9-100.0 range.
  10046. @end table
  10047. Each chroma option value, if not explicitly specified, is set to the
  10048. corresponding luma option value.
  10049. @anchor{scale}
  10050. @section scale
  10051. Scale (resize) the input video, using the libswscale library.
  10052. The scale filter forces the output display aspect ratio to be the same
  10053. of the input, by changing the output sample aspect ratio.
  10054. If the input image format is different from the format requested by
  10055. the next filter, the scale filter will convert the input to the
  10056. requested format.
  10057. @subsection Options
  10058. The filter accepts the following options, or any of the options
  10059. supported by the libswscale scaler.
  10060. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10061. the complete list of scaler options.
  10062. @table @option
  10063. @item width, w
  10064. @item height, h
  10065. Set the output video dimension expression. Default value is the input
  10066. dimension.
  10067. If the @var{width} or @var{w} value is 0, the input width is used for
  10068. the output. If the @var{height} or @var{h} value is 0, the input height
  10069. is used for the output.
  10070. If one and only one of the values is -n with n >= 1, the scale filter
  10071. will use a value that maintains the aspect ratio of the input image,
  10072. calculated from the other specified dimension. After that it will,
  10073. however, make sure that the calculated dimension is divisible by n and
  10074. adjust the value if necessary.
  10075. If both values are -n with n >= 1, the behavior will be identical to
  10076. both values being set to 0 as previously detailed.
  10077. See below for the list of accepted constants for use in the dimension
  10078. expression.
  10079. @item eval
  10080. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10081. @table @samp
  10082. @item init
  10083. Only evaluate expressions once during the filter initialization or when a command is processed.
  10084. @item frame
  10085. Evaluate expressions for each incoming frame.
  10086. @end table
  10087. Default value is @samp{init}.
  10088. @item interl
  10089. Set the interlacing mode. It accepts the following values:
  10090. @table @samp
  10091. @item 1
  10092. Force interlaced aware scaling.
  10093. @item 0
  10094. Do not apply interlaced scaling.
  10095. @item -1
  10096. Select interlaced aware scaling depending on whether the source frames
  10097. are flagged as interlaced or not.
  10098. @end table
  10099. Default value is @samp{0}.
  10100. @item flags
  10101. Set libswscale scaling flags. See
  10102. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10103. complete list of values. If not explicitly specified the filter applies
  10104. the default flags.
  10105. @item param0, param1
  10106. Set libswscale input parameters for scaling algorithms that need them. See
  10107. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10108. complete documentation. If not explicitly specified the filter applies
  10109. empty parameters.
  10110. @item size, s
  10111. Set the video size. For the syntax of this option, check the
  10112. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10113. @item in_color_matrix
  10114. @item out_color_matrix
  10115. Set in/output YCbCr color space type.
  10116. This allows the autodetected value to be overridden as well as allows forcing
  10117. a specific value used for the output and encoder.
  10118. If not specified, the color space type depends on the pixel format.
  10119. Possible values:
  10120. @table @samp
  10121. @item auto
  10122. Choose automatically.
  10123. @item bt709
  10124. Format conforming to International Telecommunication Union (ITU)
  10125. Recommendation BT.709.
  10126. @item fcc
  10127. Set color space conforming to the United States Federal Communications
  10128. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10129. @item bt601
  10130. Set color space conforming to:
  10131. @itemize
  10132. @item
  10133. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10134. @item
  10135. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10136. @item
  10137. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10138. @end itemize
  10139. @item smpte240m
  10140. Set color space conforming to SMPTE ST 240:1999.
  10141. @end table
  10142. @item in_range
  10143. @item out_range
  10144. Set in/output YCbCr sample range.
  10145. This allows the autodetected value to be overridden as well as allows forcing
  10146. a specific value used for the output and encoder. If not specified, the
  10147. range depends on the pixel format. Possible values:
  10148. @table @samp
  10149. @item auto/unknown
  10150. Choose automatically.
  10151. @item jpeg/full/pc
  10152. Set full range (0-255 in case of 8-bit luma).
  10153. @item mpeg/limited/tv
  10154. Set "MPEG" range (16-235 in case of 8-bit luma).
  10155. @end table
  10156. @item force_original_aspect_ratio
  10157. Enable decreasing or increasing output video width or height if necessary to
  10158. keep the original aspect ratio. Possible values:
  10159. @table @samp
  10160. @item disable
  10161. Scale the video as specified and disable this feature.
  10162. @item decrease
  10163. The output video dimensions will automatically be decreased if needed.
  10164. @item increase
  10165. The output video dimensions will automatically be increased if needed.
  10166. @end table
  10167. One useful instance of this option is that when you know a specific device's
  10168. maximum allowed resolution, you can use this to limit the output video to
  10169. that, while retaining the aspect ratio. For example, device A allows
  10170. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10171. decrease) and specifying 1280x720 to the command line makes the output
  10172. 1280x533.
  10173. Please note that this is a different thing than specifying -1 for @option{w}
  10174. or @option{h}, you still need to specify the output resolution for this option
  10175. to work.
  10176. @end table
  10177. The values of the @option{w} and @option{h} options are expressions
  10178. containing the following constants:
  10179. @table @var
  10180. @item in_w
  10181. @item in_h
  10182. The input width and height
  10183. @item iw
  10184. @item ih
  10185. These are the same as @var{in_w} and @var{in_h}.
  10186. @item out_w
  10187. @item out_h
  10188. The output (scaled) width and height
  10189. @item ow
  10190. @item oh
  10191. These are the same as @var{out_w} and @var{out_h}
  10192. @item a
  10193. The same as @var{iw} / @var{ih}
  10194. @item sar
  10195. input sample aspect ratio
  10196. @item dar
  10197. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10198. @item hsub
  10199. @item vsub
  10200. horizontal and vertical input chroma subsample values. For example for the
  10201. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10202. @item ohsub
  10203. @item ovsub
  10204. horizontal and vertical output chroma subsample values. For example for the
  10205. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10206. @end table
  10207. @subsection Examples
  10208. @itemize
  10209. @item
  10210. Scale the input video to a size of 200x100
  10211. @example
  10212. scale=w=200:h=100
  10213. @end example
  10214. This is equivalent to:
  10215. @example
  10216. scale=200:100
  10217. @end example
  10218. or:
  10219. @example
  10220. scale=200x100
  10221. @end example
  10222. @item
  10223. Specify a size abbreviation for the output size:
  10224. @example
  10225. scale=qcif
  10226. @end example
  10227. which can also be written as:
  10228. @example
  10229. scale=size=qcif
  10230. @end example
  10231. @item
  10232. Scale the input to 2x:
  10233. @example
  10234. scale=w=2*iw:h=2*ih
  10235. @end example
  10236. @item
  10237. The above is the same as:
  10238. @example
  10239. scale=2*in_w:2*in_h
  10240. @end example
  10241. @item
  10242. Scale the input to 2x with forced interlaced scaling:
  10243. @example
  10244. scale=2*iw:2*ih:interl=1
  10245. @end example
  10246. @item
  10247. Scale the input to half size:
  10248. @example
  10249. scale=w=iw/2:h=ih/2
  10250. @end example
  10251. @item
  10252. Increase the width, and set the height to the same size:
  10253. @example
  10254. scale=3/2*iw:ow
  10255. @end example
  10256. @item
  10257. Seek Greek harmony:
  10258. @example
  10259. scale=iw:1/PHI*iw
  10260. scale=ih*PHI:ih
  10261. @end example
  10262. @item
  10263. Increase the height, and set the width to 3/2 of the height:
  10264. @example
  10265. scale=w=3/2*oh:h=3/5*ih
  10266. @end example
  10267. @item
  10268. Increase the size, making the size a multiple of the chroma
  10269. subsample values:
  10270. @example
  10271. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10272. @end example
  10273. @item
  10274. Increase the width to a maximum of 500 pixels,
  10275. keeping the same aspect ratio as the input:
  10276. @example
  10277. scale=w='min(500\, iw*3/2):h=-1'
  10278. @end example
  10279. @end itemize
  10280. @subsection Commands
  10281. This filter supports the following commands:
  10282. @table @option
  10283. @item width, w
  10284. @item height, h
  10285. Set the output video dimension expression.
  10286. The command accepts the same syntax of the corresponding option.
  10287. If the specified expression is not valid, it is kept at its current
  10288. value.
  10289. @end table
  10290. @section scale_npp
  10291. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10292. format conversion on CUDA video frames. Setting the output width and height
  10293. works in the same way as for the @var{scale} filter.
  10294. The following additional options are accepted:
  10295. @table @option
  10296. @item format
  10297. The pixel format of the output CUDA frames. If set to the string "same" (the
  10298. default), the input format will be kept. Note that automatic format negotiation
  10299. and conversion is not yet supported for hardware frames
  10300. @item interp_algo
  10301. The interpolation algorithm used for resizing. One of the following:
  10302. @table @option
  10303. @item nn
  10304. Nearest neighbour.
  10305. @item linear
  10306. @item cubic
  10307. @item cubic2p_bspline
  10308. 2-parameter cubic (B=1, C=0)
  10309. @item cubic2p_catmullrom
  10310. 2-parameter cubic (B=0, C=1/2)
  10311. @item cubic2p_b05c03
  10312. 2-parameter cubic (B=1/2, C=3/10)
  10313. @item super
  10314. Supersampling
  10315. @item lanczos
  10316. @end table
  10317. @end table
  10318. @section scale2ref
  10319. Scale (resize) the input video, based on a reference video.
  10320. See the scale filter for available options, scale2ref supports the same but
  10321. uses the reference video instead of the main input as basis. scale2ref also
  10322. supports the following additional constants for the @option{w} and
  10323. @option{h} options:
  10324. @table @var
  10325. @item main_w
  10326. @item main_h
  10327. The main input video's width and height
  10328. @item main_a
  10329. The same as @var{main_w} / @var{main_h}
  10330. @item main_sar
  10331. The main input video's sample aspect ratio
  10332. @item main_dar, mdar
  10333. The main input video's display aspect ratio. Calculated from
  10334. @code{(main_w / main_h) * main_sar}.
  10335. @item main_hsub
  10336. @item main_vsub
  10337. The main input video's horizontal and vertical chroma subsample values.
  10338. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10339. is 1.
  10340. @end table
  10341. @subsection Examples
  10342. @itemize
  10343. @item
  10344. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10345. @example
  10346. 'scale2ref[b][a];[a][b]overlay'
  10347. @end example
  10348. @end itemize
  10349. @anchor{selectivecolor}
  10350. @section selectivecolor
  10351. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10352. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10353. by the "purity" of the color (that is, how saturated it already is).
  10354. This filter is similar to the Adobe Photoshop Selective Color tool.
  10355. The filter accepts the following options:
  10356. @table @option
  10357. @item correction_method
  10358. Select color correction method.
  10359. Available values are:
  10360. @table @samp
  10361. @item absolute
  10362. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10363. component value).
  10364. @item relative
  10365. Specified adjustments are relative to the original component value.
  10366. @end table
  10367. Default is @code{absolute}.
  10368. @item reds
  10369. Adjustments for red pixels (pixels where the red component is the maximum)
  10370. @item yellows
  10371. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10372. @item greens
  10373. Adjustments for green pixels (pixels where the green component is the maximum)
  10374. @item cyans
  10375. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10376. @item blues
  10377. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10378. @item magentas
  10379. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10380. @item whites
  10381. Adjustments for white pixels (pixels where all components are greater than 128)
  10382. @item neutrals
  10383. Adjustments for all pixels except pure black and pure white
  10384. @item blacks
  10385. Adjustments for black pixels (pixels where all components are lesser than 128)
  10386. @item psfile
  10387. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10388. @end table
  10389. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10390. 4 space separated floating point adjustment values in the [-1,1] range,
  10391. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10392. pixels of its range.
  10393. @subsection Examples
  10394. @itemize
  10395. @item
  10396. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10397. increase magenta by 27% in blue areas:
  10398. @example
  10399. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10400. @end example
  10401. @item
  10402. Use a Photoshop selective color preset:
  10403. @example
  10404. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10405. @end example
  10406. @end itemize
  10407. @anchor{separatefields}
  10408. @section separatefields
  10409. The @code{separatefields} takes a frame-based video input and splits
  10410. each frame into its components fields, producing a new half height clip
  10411. with twice the frame rate and twice the frame count.
  10412. This filter use field-dominance information in frame to decide which
  10413. of each pair of fields to place first in the output.
  10414. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10415. @section setdar, setsar
  10416. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10417. output video.
  10418. This is done by changing the specified Sample (aka Pixel) Aspect
  10419. Ratio, according to the following equation:
  10420. @example
  10421. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10422. @end example
  10423. Keep in mind that the @code{setdar} filter does not modify the pixel
  10424. dimensions of the video frame. Also, the display aspect ratio set by
  10425. this filter may be changed by later filters in the filterchain,
  10426. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10427. applied.
  10428. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10429. the filter output video.
  10430. Note that as a consequence of the application of this filter, the
  10431. output display aspect ratio will change according to the equation
  10432. above.
  10433. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10434. filter may be changed by later filters in the filterchain, e.g. if
  10435. another "setsar" or a "setdar" filter is applied.
  10436. It accepts the following parameters:
  10437. @table @option
  10438. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10439. Set the aspect ratio used by the filter.
  10440. The parameter can be a floating point number string, an expression, or
  10441. a string of the form @var{num}:@var{den}, where @var{num} and
  10442. @var{den} are the numerator and denominator of the aspect ratio. If
  10443. the parameter is not specified, it is assumed the value "0".
  10444. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10445. should be escaped.
  10446. @item max
  10447. Set the maximum integer value to use for expressing numerator and
  10448. denominator when reducing the expressed aspect ratio to a rational.
  10449. Default value is @code{100}.
  10450. @end table
  10451. The parameter @var{sar} is an expression containing
  10452. the following constants:
  10453. @table @option
  10454. @item E, PI, PHI
  10455. These are approximated values for the mathematical constants e
  10456. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10457. @item w, h
  10458. The input width and height.
  10459. @item a
  10460. These are the same as @var{w} / @var{h}.
  10461. @item sar
  10462. The input sample aspect ratio.
  10463. @item dar
  10464. The input display aspect ratio. It is the same as
  10465. (@var{w} / @var{h}) * @var{sar}.
  10466. @item hsub, vsub
  10467. Horizontal and vertical chroma subsample values. For example, for the
  10468. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10469. @end table
  10470. @subsection Examples
  10471. @itemize
  10472. @item
  10473. To change the display aspect ratio to 16:9, specify one of the following:
  10474. @example
  10475. setdar=dar=1.77777
  10476. setdar=dar=16/9
  10477. @end example
  10478. @item
  10479. To change the sample aspect ratio to 10:11, specify:
  10480. @example
  10481. setsar=sar=10/11
  10482. @end example
  10483. @item
  10484. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10485. 1000 in the aspect ratio reduction, use the command:
  10486. @example
  10487. setdar=ratio=16/9:max=1000
  10488. @end example
  10489. @end itemize
  10490. @anchor{setfield}
  10491. @section setfield
  10492. Force field for the output video frame.
  10493. The @code{setfield} filter marks the interlace type field for the
  10494. output frames. It does not change the input frame, but only sets the
  10495. corresponding property, which affects how the frame is treated by
  10496. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10497. The filter accepts the following options:
  10498. @table @option
  10499. @item mode
  10500. Available values are:
  10501. @table @samp
  10502. @item auto
  10503. Keep the same field property.
  10504. @item bff
  10505. Mark the frame as bottom-field-first.
  10506. @item tff
  10507. Mark the frame as top-field-first.
  10508. @item prog
  10509. Mark the frame as progressive.
  10510. @end table
  10511. @end table
  10512. @section showinfo
  10513. Show a line containing various information for each input video frame.
  10514. The input video is not modified.
  10515. The shown line contains a sequence of key/value pairs of the form
  10516. @var{key}:@var{value}.
  10517. The following values are shown in the output:
  10518. @table @option
  10519. @item n
  10520. The (sequential) number of the input frame, starting from 0.
  10521. @item pts
  10522. The Presentation TimeStamp of the input frame, expressed as a number of
  10523. time base units. The time base unit depends on the filter input pad.
  10524. @item pts_time
  10525. The Presentation TimeStamp of the input frame, expressed as a number of
  10526. seconds.
  10527. @item pos
  10528. The position of the frame in the input stream, or -1 if this information is
  10529. unavailable and/or meaningless (for example in case of synthetic video).
  10530. @item fmt
  10531. The pixel format name.
  10532. @item sar
  10533. The sample aspect ratio of the input frame, expressed in the form
  10534. @var{num}/@var{den}.
  10535. @item s
  10536. The size of the input frame. For the syntax of this option, check the
  10537. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10538. @item i
  10539. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10540. for bottom field first).
  10541. @item iskey
  10542. This is 1 if the frame is a key frame, 0 otherwise.
  10543. @item type
  10544. The picture type of the input frame ("I" for an I-frame, "P" for a
  10545. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10546. Also refer to the documentation of the @code{AVPictureType} enum and of
  10547. the @code{av_get_picture_type_char} function defined in
  10548. @file{libavutil/avutil.h}.
  10549. @item checksum
  10550. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10551. @item plane_checksum
  10552. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10553. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10554. @end table
  10555. @section showpalette
  10556. Displays the 256 colors palette of each frame. This filter is only relevant for
  10557. @var{pal8} pixel format frames.
  10558. It accepts the following option:
  10559. @table @option
  10560. @item s
  10561. Set the size of the box used to represent one palette color entry. Default is
  10562. @code{30} (for a @code{30x30} pixel box).
  10563. @end table
  10564. @section shuffleframes
  10565. Reorder and/or duplicate and/or drop video frames.
  10566. It accepts the following parameters:
  10567. @table @option
  10568. @item mapping
  10569. Set the destination indexes of input frames.
  10570. This is space or '|' separated list of indexes that maps input frames to output
  10571. frames. Number of indexes also sets maximal value that each index may have.
  10572. '-1' index have special meaning and that is to drop frame.
  10573. @end table
  10574. The first frame has the index 0. The default is to keep the input unchanged.
  10575. @subsection Examples
  10576. @itemize
  10577. @item
  10578. Swap second and third frame of every three frames of the input:
  10579. @example
  10580. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10581. @end example
  10582. @item
  10583. Swap 10th and 1st frame of every ten frames of the input:
  10584. @example
  10585. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10586. @end example
  10587. @end itemize
  10588. @section shuffleplanes
  10589. Reorder and/or duplicate video planes.
  10590. It accepts the following parameters:
  10591. @table @option
  10592. @item map0
  10593. The index of the input plane to be used as the first output plane.
  10594. @item map1
  10595. The index of the input plane to be used as the second output plane.
  10596. @item map2
  10597. The index of the input plane to be used as the third output plane.
  10598. @item map3
  10599. The index of the input plane to be used as the fourth output plane.
  10600. @end table
  10601. The first plane has the index 0. The default is to keep the input unchanged.
  10602. @subsection Examples
  10603. @itemize
  10604. @item
  10605. Swap the second and third planes of the input:
  10606. @example
  10607. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10608. @end example
  10609. @end itemize
  10610. @anchor{signalstats}
  10611. @section signalstats
  10612. Evaluate various visual metrics that assist in determining issues associated
  10613. with the digitization of analog video media.
  10614. By default the filter will log these metadata values:
  10615. @table @option
  10616. @item YMIN
  10617. Display the minimal Y value contained within the input frame. Expressed in
  10618. range of [0-255].
  10619. @item YLOW
  10620. Display the Y value at the 10% percentile within the input frame. Expressed in
  10621. range of [0-255].
  10622. @item YAVG
  10623. Display the average Y value within the input frame. Expressed in range of
  10624. [0-255].
  10625. @item YHIGH
  10626. Display the Y value at the 90% percentile within the input frame. Expressed in
  10627. range of [0-255].
  10628. @item YMAX
  10629. Display the maximum Y value contained within the input frame. Expressed in
  10630. range of [0-255].
  10631. @item UMIN
  10632. Display the minimal U value contained within the input frame. Expressed in
  10633. range of [0-255].
  10634. @item ULOW
  10635. Display the U value at the 10% percentile within the input frame. Expressed in
  10636. range of [0-255].
  10637. @item UAVG
  10638. Display the average U value within the input frame. Expressed in range of
  10639. [0-255].
  10640. @item UHIGH
  10641. Display the U value at the 90% percentile within the input frame. Expressed in
  10642. range of [0-255].
  10643. @item UMAX
  10644. Display the maximum U value contained within the input frame. Expressed in
  10645. range of [0-255].
  10646. @item VMIN
  10647. Display the minimal V value contained within the input frame. Expressed in
  10648. range of [0-255].
  10649. @item VLOW
  10650. Display the V value at the 10% percentile within the input frame. Expressed in
  10651. range of [0-255].
  10652. @item VAVG
  10653. Display the average V value within the input frame. Expressed in range of
  10654. [0-255].
  10655. @item VHIGH
  10656. Display the V value at the 90% percentile within the input frame. Expressed in
  10657. range of [0-255].
  10658. @item VMAX
  10659. Display the maximum V value contained within the input frame. Expressed in
  10660. range of [0-255].
  10661. @item SATMIN
  10662. Display the minimal saturation value contained within the input frame.
  10663. Expressed in range of [0-~181.02].
  10664. @item SATLOW
  10665. Display the saturation value at the 10% percentile within the input frame.
  10666. Expressed in range of [0-~181.02].
  10667. @item SATAVG
  10668. Display the average saturation value within the input frame. Expressed in range
  10669. of [0-~181.02].
  10670. @item SATHIGH
  10671. Display the saturation value at the 90% percentile within the input frame.
  10672. Expressed in range of [0-~181.02].
  10673. @item SATMAX
  10674. Display the maximum saturation value contained within the input frame.
  10675. Expressed in range of [0-~181.02].
  10676. @item HUEMED
  10677. Display the median value for hue within the input frame. Expressed in range of
  10678. [0-360].
  10679. @item HUEAVG
  10680. Display the average value for hue within the input frame. Expressed in range of
  10681. [0-360].
  10682. @item YDIF
  10683. Display the average of sample value difference between all values of the Y
  10684. plane in the current frame and corresponding values of the previous input frame.
  10685. Expressed in range of [0-255].
  10686. @item UDIF
  10687. Display the average of sample value difference between all values of the U
  10688. plane in the current frame and corresponding values of the previous input frame.
  10689. Expressed in range of [0-255].
  10690. @item VDIF
  10691. Display the average of sample value difference between all values of the V
  10692. plane in the current frame and corresponding values of the previous input frame.
  10693. Expressed in range of [0-255].
  10694. @item YBITDEPTH
  10695. Display bit depth of Y plane in current frame.
  10696. Expressed in range of [0-16].
  10697. @item UBITDEPTH
  10698. Display bit depth of U plane in current frame.
  10699. Expressed in range of [0-16].
  10700. @item VBITDEPTH
  10701. Display bit depth of V plane in current frame.
  10702. Expressed in range of [0-16].
  10703. @end table
  10704. The filter accepts the following options:
  10705. @table @option
  10706. @item stat
  10707. @item out
  10708. @option{stat} specify an additional form of image analysis.
  10709. @option{out} output video with the specified type of pixel highlighted.
  10710. Both options accept the following values:
  10711. @table @samp
  10712. @item tout
  10713. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10714. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10715. include the results of video dropouts, head clogs, or tape tracking issues.
  10716. @item vrep
  10717. Identify @var{vertical line repetition}. Vertical line repetition includes
  10718. similar rows of pixels within a frame. In born-digital video vertical line
  10719. repetition is common, but this pattern is uncommon in video digitized from an
  10720. analog source. When it occurs in video that results from the digitization of an
  10721. analog source it can indicate concealment from a dropout compensator.
  10722. @item brng
  10723. Identify pixels that fall outside of legal broadcast range.
  10724. @end table
  10725. @item color, c
  10726. Set the highlight color for the @option{out} option. The default color is
  10727. yellow.
  10728. @end table
  10729. @subsection Examples
  10730. @itemize
  10731. @item
  10732. Output data of various video metrics:
  10733. @example
  10734. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10735. @end example
  10736. @item
  10737. Output specific data about the minimum and maximum values of the Y plane per frame:
  10738. @example
  10739. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10740. @end example
  10741. @item
  10742. Playback video while highlighting pixels that are outside of broadcast range in red.
  10743. @example
  10744. ffplay example.mov -vf signalstats="out=brng:color=red"
  10745. @end example
  10746. @item
  10747. Playback video with signalstats metadata drawn over the frame.
  10748. @example
  10749. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10750. @end example
  10751. The contents of signalstat_drawtext.txt used in the command are:
  10752. @example
  10753. time %@{pts:hms@}
  10754. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10755. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10756. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10757. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10758. @end example
  10759. @end itemize
  10760. @anchor{signature}
  10761. @section signature
  10762. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10763. input. In this case the matching between the inputs can be calculated additionally.
  10764. The filter always passes through the first input. The signature of each stream can
  10765. be written into a file.
  10766. It accepts the following options:
  10767. @table @option
  10768. @item detectmode
  10769. Enable or disable the matching process.
  10770. Available values are:
  10771. @table @samp
  10772. @item off
  10773. Disable the calculation of a matching (default).
  10774. @item full
  10775. Calculate the matching for the whole video and output whether the whole video
  10776. matches or only parts.
  10777. @item fast
  10778. Calculate only until a matching is found or the video ends. Should be faster in
  10779. some cases.
  10780. @end table
  10781. @item nb_inputs
  10782. Set the number of inputs. The option value must be a non negative integer.
  10783. Default value is 1.
  10784. @item filename
  10785. Set the path to which the output is written. If there is more than one input,
  10786. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10787. integer), that will be replaced with the input number. If no filename is
  10788. specified, no output will be written. This is the default.
  10789. @item format
  10790. Choose the output format.
  10791. Available values are:
  10792. @table @samp
  10793. @item binary
  10794. Use the specified binary representation (default).
  10795. @item xml
  10796. Use the specified xml representation.
  10797. @end table
  10798. @item th_d
  10799. Set threshold to detect one word as similar. The option value must be an integer
  10800. greater than zero. The default value is 9000.
  10801. @item th_dc
  10802. Set threshold to detect all words as similar. The option value must be an integer
  10803. greater than zero. The default value is 60000.
  10804. @item th_xh
  10805. Set threshold to detect frames as similar. The option value must be an integer
  10806. greater than zero. The default value is 116.
  10807. @item th_di
  10808. Set the minimum length of a sequence in frames to recognize it as matching
  10809. sequence. The option value must be a non negative integer value.
  10810. The default value is 0.
  10811. @item th_it
  10812. Set the minimum relation, that matching frames to all frames must have.
  10813. The option value must be a double value between 0 and 1. The default value is 0.5.
  10814. @end table
  10815. @subsection Examples
  10816. @itemize
  10817. @item
  10818. To calculate the signature of an input video and store it in signature.bin:
  10819. @example
  10820. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10821. @end example
  10822. @item
  10823. To detect whether two videos match and store the signatures in XML format in
  10824. signature0.xml and signature1.xml:
  10825. @example
  10826. 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 -
  10827. @end example
  10828. @end itemize
  10829. @anchor{smartblur}
  10830. @section smartblur
  10831. Blur the input video without impacting the outlines.
  10832. It accepts the following options:
  10833. @table @option
  10834. @item luma_radius, lr
  10835. Set the luma radius. The option value must be a float number in
  10836. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10837. used to blur the image (slower if larger). Default value is 1.0.
  10838. @item luma_strength, ls
  10839. Set the luma strength. The option value must be a float number
  10840. in the range [-1.0,1.0] that configures the blurring. A value included
  10841. in [0.0,1.0] will blur the image whereas a value included in
  10842. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10843. @item luma_threshold, lt
  10844. Set the luma threshold used as a coefficient to determine
  10845. whether a pixel should be blurred or not. The option value must be an
  10846. integer in the range [-30,30]. A value of 0 will filter all the image,
  10847. a value included in [0,30] will filter flat areas and a value included
  10848. in [-30,0] will filter edges. Default value is 0.
  10849. @item chroma_radius, cr
  10850. Set the chroma radius. The option value must be a float number in
  10851. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10852. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10853. @item chroma_strength, cs
  10854. Set the chroma strength. The option value must be a float number
  10855. in the range [-1.0,1.0] that configures the blurring. A value included
  10856. in [0.0,1.0] will blur the image whereas a value included in
  10857. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10858. @item chroma_threshold, ct
  10859. Set the chroma threshold used as a coefficient to determine
  10860. whether a pixel should be blurred or not. The option value must be an
  10861. integer in the range [-30,30]. A value of 0 will filter all the image,
  10862. a value included in [0,30] will filter flat areas and a value included
  10863. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10864. @end table
  10865. If a chroma option is not explicitly set, the corresponding luma value
  10866. is set.
  10867. @section ssim
  10868. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10869. This filter takes in input two input videos, the first input is
  10870. considered the "main" source and is passed unchanged to the
  10871. output. The second input is used as a "reference" video for computing
  10872. the SSIM.
  10873. Both video inputs must have the same resolution and pixel format for
  10874. this filter to work correctly. Also it assumes that both inputs
  10875. have the same number of frames, which are compared one by one.
  10876. The filter stores the calculated SSIM of each frame.
  10877. The description of the accepted parameters follows.
  10878. @table @option
  10879. @item stats_file, f
  10880. If specified the filter will use the named file to save the SSIM of
  10881. each individual frame. When filename equals "-" the data is sent to
  10882. standard output.
  10883. @end table
  10884. The file printed if @var{stats_file} is selected, contains a sequence of
  10885. key/value pairs of the form @var{key}:@var{value} for each compared
  10886. couple of frames.
  10887. A description of each shown parameter follows:
  10888. @table @option
  10889. @item n
  10890. sequential number of the input frame, starting from 1
  10891. @item Y, U, V, R, G, B
  10892. SSIM of the compared frames for the component specified by the suffix.
  10893. @item All
  10894. SSIM of the compared frames for the whole frame.
  10895. @item dB
  10896. Same as above but in dB representation.
  10897. @end table
  10898. This filter also supports the @ref{framesync} options.
  10899. For example:
  10900. @example
  10901. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10902. [main][ref] ssim="stats_file=stats.log" [out]
  10903. @end example
  10904. On this example the input file being processed is compared with the
  10905. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10906. is stored in @file{stats.log}.
  10907. Another example with both psnr and ssim at same time:
  10908. @example
  10909. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10910. @end example
  10911. @section stereo3d
  10912. Convert between different stereoscopic image formats.
  10913. The filters accept the following options:
  10914. @table @option
  10915. @item in
  10916. Set stereoscopic image format of input.
  10917. Available values for input image formats are:
  10918. @table @samp
  10919. @item sbsl
  10920. side by side parallel (left eye left, right eye right)
  10921. @item sbsr
  10922. side by side crosseye (right eye left, left eye right)
  10923. @item sbs2l
  10924. side by side parallel with half width resolution
  10925. (left eye left, right eye right)
  10926. @item sbs2r
  10927. side by side crosseye with half width resolution
  10928. (right eye left, left eye right)
  10929. @item abl
  10930. above-below (left eye above, right eye below)
  10931. @item abr
  10932. above-below (right eye above, left eye below)
  10933. @item ab2l
  10934. above-below with half height resolution
  10935. (left eye above, right eye below)
  10936. @item ab2r
  10937. above-below with half height resolution
  10938. (right eye above, left eye below)
  10939. @item al
  10940. alternating frames (left eye first, right eye second)
  10941. @item ar
  10942. alternating frames (right eye first, left eye second)
  10943. @item irl
  10944. interleaved rows (left eye has top row, right eye starts on next row)
  10945. @item irr
  10946. interleaved rows (right eye has top row, left eye starts on next row)
  10947. @item icl
  10948. interleaved columns, left eye first
  10949. @item icr
  10950. interleaved columns, right eye first
  10951. Default value is @samp{sbsl}.
  10952. @end table
  10953. @item out
  10954. Set stereoscopic image format of output.
  10955. @table @samp
  10956. @item sbsl
  10957. side by side parallel (left eye left, right eye right)
  10958. @item sbsr
  10959. side by side crosseye (right eye left, left eye right)
  10960. @item sbs2l
  10961. side by side parallel with half width resolution
  10962. (left eye left, right eye right)
  10963. @item sbs2r
  10964. side by side crosseye with half width resolution
  10965. (right eye left, left eye right)
  10966. @item abl
  10967. above-below (left eye above, right eye below)
  10968. @item abr
  10969. above-below (right eye above, left eye below)
  10970. @item ab2l
  10971. above-below with half height resolution
  10972. (left eye above, right eye below)
  10973. @item ab2r
  10974. above-below with half height resolution
  10975. (right eye above, left eye below)
  10976. @item al
  10977. alternating frames (left eye first, right eye second)
  10978. @item ar
  10979. alternating frames (right eye first, left eye second)
  10980. @item irl
  10981. interleaved rows (left eye has top row, right eye starts on next row)
  10982. @item irr
  10983. interleaved rows (right eye has top row, left eye starts on next row)
  10984. @item arbg
  10985. anaglyph red/blue gray
  10986. (red filter on left eye, blue filter on right eye)
  10987. @item argg
  10988. anaglyph red/green gray
  10989. (red filter on left eye, green filter on right eye)
  10990. @item arcg
  10991. anaglyph red/cyan gray
  10992. (red filter on left eye, cyan filter on right eye)
  10993. @item arch
  10994. anaglyph red/cyan half colored
  10995. (red filter on left eye, cyan filter on right eye)
  10996. @item arcc
  10997. anaglyph red/cyan color
  10998. (red filter on left eye, cyan filter on right eye)
  10999. @item arcd
  11000. anaglyph red/cyan color optimized with the least squares projection of dubois
  11001. (red filter on left eye, cyan filter on right eye)
  11002. @item agmg
  11003. anaglyph green/magenta gray
  11004. (green filter on left eye, magenta filter on right eye)
  11005. @item agmh
  11006. anaglyph green/magenta half colored
  11007. (green filter on left eye, magenta filter on right eye)
  11008. @item agmc
  11009. anaglyph green/magenta colored
  11010. (green filter on left eye, magenta filter on right eye)
  11011. @item agmd
  11012. anaglyph green/magenta color optimized with the least squares projection of dubois
  11013. (green filter on left eye, magenta filter on right eye)
  11014. @item aybg
  11015. anaglyph yellow/blue gray
  11016. (yellow filter on left eye, blue filter on right eye)
  11017. @item aybh
  11018. anaglyph yellow/blue half colored
  11019. (yellow filter on left eye, blue filter on right eye)
  11020. @item aybc
  11021. anaglyph yellow/blue colored
  11022. (yellow filter on left eye, blue filter on right eye)
  11023. @item aybd
  11024. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11025. (yellow filter on left eye, blue filter on right eye)
  11026. @item ml
  11027. mono output (left eye only)
  11028. @item mr
  11029. mono output (right eye only)
  11030. @item chl
  11031. checkerboard, left eye first
  11032. @item chr
  11033. checkerboard, right eye first
  11034. @item icl
  11035. interleaved columns, left eye first
  11036. @item icr
  11037. interleaved columns, right eye first
  11038. @item hdmi
  11039. HDMI frame pack
  11040. @end table
  11041. Default value is @samp{arcd}.
  11042. @end table
  11043. @subsection Examples
  11044. @itemize
  11045. @item
  11046. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11047. @example
  11048. stereo3d=sbsl:aybd
  11049. @end example
  11050. @item
  11051. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11052. @example
  11053. stereo3d=abl:sbsr
  11054. @end example
  11055. @end itemize
  11056. @section streamselect, astreamselect
  11057. Select video or audio streams.
  11058. The filter accepts the following options:
  11059. @table @option
  11060. @item inputs
  11061. Set number of inputs. Default is 2.
  11062. @item map
  11063. Set input indexes to remap to outputs.
  11064. @end table
  11065. @subsection Commands
  11066. The @code{streamselect} and @code{astreamselect} filter supports the following
  11067. commands:
  11068. @table @option
  11069. @item map
  11070. Set input indexes to remap to outputs.
  11071. @end table
  11072. @subsection Examples
  11073. @itemize
  11074. @item
  11075. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11076. @example
  11077. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11078. @end example
  11079. @item
  11080. Same as above, but for audio:
  11081. @example
  11082. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11083. @end example
  11084. @end itemize
  11085. @section sobel
  11086. Apply sobel operator to input video stream.
  11087. The filter accepts the following option:
  11088. @table @option
  11089. @item planes
  11090. Set which planes will be processed, unprocessed planes will be copied.
  11091. By default value 0xf, all planes will be processed.
  11092. @item scale
  11093. Set value which will be multiplied with filtered result.
  11094. @item delta
  11095. Set value which will be added to filtered result.
  11096. @end table
  11097. @anchor{spp}
  11098. @section spp
  11099. Apply a simple postprocessing filter that compresses and decompresses the image
  11100. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11101. and average the results.
  11102. The filter accepts the following options:
  11103. @table @option
  11104. @item quality
  11105. Set quality. This option defines the number of levels for averaging. It accepts
  11106. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11107. effect. A value of @code{6} means the higher quality. For each increment of
  11108. that value the speed drops by a factor of approximately 2. Default value is
  11109. @code{3}.
  11110. @item qp
  11111. Force a constant quantization parameter. If not set, the filter will use the QP
  11112. from the video stream (if available).
  11113. @item mode
  11114. Set thresholding mode. Available modes are:
  11115. @table @samp
  11116. @item hard
  11117. Set hard thresholding (default).
  11118. @item soft
  11119. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11120. @end table
  11121. @item use_bframe_qp
  11122. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11123. option may cause flicker since the B-Frames have often larger QP. Default is
  11124. @code{0} (not enabled).
  11125. @end table
  11126. @anchor{subtitles}
  11127. @section subtitles
  11128. Draw subtitles on top of input video using the libass library.
  11129. To enable compilation of this filter you need to configure FFmpeg with
  11130. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11131. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11132. Alpha) subtitles format.
  11133. The filter accepts the following options:
  11134. @table @option
  11135. @item filename, f
  11136. Set the filename of the subtitle file to read. It must be specified.
  11137. @item original_size
  11138. Specify the size of the original video, the video for which the ASS file
  11139. was composed. For the syntax of this option, check the
  11140. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11141. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11142. correctly scale the fonts if the aspect ratio has been changed.
  11143. @item fontsdir
  11144. Set a directory path containing fonts that can be used by the filter.
  11145. These fonts will be used in addition to whatever the font provider uses.
  11146. @item alpha
  11147. Process alpha channel, by default alpha channel is untouched.
  11148. @item charenc
  11149. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11150. useful if not UTF-8.
  11151. @item stream_index, si
  11152. Set subtitles stream index. @code{subtitles} filter only.
  11153. @item force_style
  11154. Override default style or script info parameters of the subtitles. It accepts a
  11155. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11156. @end table
  11157. If the first key is not specified, it is assumed that the first value
  11158. specifies the @option{filename}.
  11159. For example, to render the file @file{sub.srt} on top of the input
  11160. video, use the command:
  11161. @example
  11162. subtitles=sub.srt
  11163. @end example
  11164. which is equivalent to:
  11165. @example
  11166. subtitles=filename=sub.srt
  11167. @end example
  11168. To render the default subtitles stream from file @file{video.mkv}, use:
  11169. @example
  11170. subtitles=video.mkv
  11171. @end example
  11172. To render the second subtitles stream from that file, use:
  11173. @example
  11174. subtitles=video.mkv:si=1
  11175. @end example
  11176. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11177. @code{DejaVu Serif}, use:
  11178. @example
  11179. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11180. @end example
  11181. @section super2xsai
  11182. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11183. Interpolate) pixel art scaling algorithm.
  11184. Useful for enlarging pixel art images without reducing sharpness.
  11185. @section swaprect
  11186. Swap two rectangular objects in video.
  11187. This filter accepts the following options:
  11188. @table @option
  11189. @item w
  11190. Set object width.
  11191. @item h
  11192. Set object height.
  11193. @item x1
  11194. Set 1st rect x coordinate.
  11195. @item y1
  11196. Set 1st rect y coordinate.
  11197. @item x2
  11198. Set 2nd rect x coordinate.
  11199. @item y2
  11200. Set 2nd rect y coordinate.
  11201. All expressions are evaluated once for each frame.
  11202. @end table
  11203. The all options are expressions containing the following constants:
  11204. @table @option
  11205. @item w
  11206. @item h
  11207. The input width and height.
  11208. @item a
  11209. same as @var{w} / @var{h}
  11210. @item sar
  11211. input sample aspect ratio
  11212. @item dar
  11213. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11214. @item n
  11215. The number of the input frame, starting from 0.
  11216. @item t
  11217. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11218. @item pos
  11219. the position in the file of the input frame, NAN if unknown
  11220. @end table
  11221. @section swapuv
  11222. Swap U & V plane.
  11223. @section telecine
  11224. Apply telecine process to the video.
  11225. This filter accepts the following options:
  11226. @table @option
  11227. @item first_field
  11228. @table @samp
  11229. @item top, t
  11230. top field first
  11231. @item bottom, b
  11232. bottom field first
  11233. The default value is @code{top}.
  11234. @end table
  11235. @item pattern
  11236. A string of numbers representing the pulldown pattern you wish to apply.
  11237. The default value is @code{23}.
  11238. @end table
  11239. @example
  11240. Some typical patterns:
  11241. NTSC output (30i):
  11242. 27.5p: 32222
  11243. 24p: 23 (classic)
  11244. 24p: 2332 (preferred)
  11245. 20p: 33
  11246. 18p: 334
  11247. 16p: 3444
  11248. PAL output (25i):
  11249. 27.5p: 12222
  11250. 24p: 222222222223 ("Euro pulldown")
  11251. 16.67p: 33
  11252. 16p: 33333334
  11253. @end example
  11254. @section threshold
  11255. Apply threshold effect to video stream.
  11256. This filter needs four video streams to perform thresholding.
  11257. First stream is stream we are filtering.
  11258. Second stream is holding threshold values, third stream is holding min values,
  11259. and last, fourth stream is holding max values.
  11260. The filter accepts the following option:
  11261. @table @option
  11262. @item planes
  11263. Set which planes will be processed, unprocessed planes will be copied.
  11264. By default value 0xf, all planes will be processed.
  11265. @end table
  11266. For example if first stream pixel's component value is less then threshold value
  11267. of pixel component from 2nd threshold stream, third stream value will picked,
  11268. otherwise fourth stream pixel component value will be picked.
  11269. Using color source filter one can perform various types of thresholding:
  11270. @subsection Examples
  11271. @itemize
  11272. @item
  11273. Binary threshold, using gray color as threshold:
  11274. @example
  11275. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11276. @end example
  11277. @item
  11278. Inverted binary threshold, using gray color as threshold:
  11279. @example
  11280. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11281. @end example
  11282. @item
  11283. Truncate binary threshold, using gray color as threshold:
  11284. @example
  11285. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11286. @end example
  11287. @item
  11288. Threshold to zero, using gray color as threshold:
  11289. @example
  11290. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11291. @end example
  11292. @item
  11293. Inverted threshold to zero, using gray color as threshold:
  11294. @example
  11295. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11296. @end example
  11297. @end itemize
  11298. @section thumbnail
  11299. Select the most representative frame in a given sequence of consecutive frames.
  11300. The filter accepts the following options:
  11301. @table @option
  11302. @item n
  11303. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11304. will pick one of them, and then handle the next batch of @var{n} frames until
  11305. the end. Default is @code{100}.
  11306. @end table
  11307. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11308. value will result in a higher memory usage, so a high value is not recommended.
  11309. @subsection Examples
  11310. @itemize
  11311. @item
  11312. Extract one picture each 50 frames:
  11313. @example
  11314. thumbnail=50
  11315. @end example
  11316. @item
  11317. Complete example of a thumbnail creation with @command{ffmpeg}:
  11318. @example
  11319. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11320. @end example
  11321. @end itemize
  11322. @section tile
  11323. Tile several successive frames together.
  11324. The filter accepts the following options:
  11325. @table @option
  11326. @item layout
  11327. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11328. this option, check the
  11329. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11330. @item nb_frames
  11331. Set the maximum number of frames to render in the given area. It must be less
  11332. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11333. the area will be used.
  11334. @item margin
  11335. Set the outer border margin in pixels.
  11336. @item padding
  11337. Set the inner border thickness (i.e. the number of pixels between frames). For
  11338. more advanced padding options (such as having different values for the edges),
  11339. refer to the pad video filter.
  11340. @item color
  11341. Specify the color of the unused area. For the syntax of this option, check the
  11342. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11343. is "black".
  11344. @item overlap
  11345. Set the number of frames to overlap when tiling several successive frames together.
  11346. The value must be between @code{0} and @var{nb_frames - 1}.
  11347. @item init_padding
  11348. Set the number of frames to initially be empty before displaying first output frame.
  11349. This controls how soon will one get first output frame.
  11350. The value must be between @code{0} and @var{nb_frames - 1}.
  11351. @end table
  11352. @subsection Examples
  11353. @itemize
  11354. @item
  11355. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11356. @example
  11357. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11358. @end example
  11359. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11360. duplicating each output frame to accommodate the originally detected frame
  11361. rate.
  11362. @item
  11363. Display @code{5} pictures in an area of @code{3x2} frames,
  11364. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11365. mixed flat and named options:
  11366. @example
  11367. tile=3x2:nb_frames=5:padding=7:margin=2
  11368. @end example
  11369. @end itemize
  11370. @section tinterlace
  11371. Perform various types of temporal field interlacing.
  11372. Frames are counted starting from 1, so the first input frame is
  11373. considered odd.
  11374. The filter accepts the following options:
  11375. @table @option
  11376. @item mode
  11377. Specify the mode of the interlacing. This option can also be specified
  11378. as a value alone. See below for a list of values for this option.
  11379. Available values are:
  11380. @table @samp
  11381. @item merge, 0
  11382. Move odd frames into the upper field, even into the lower field,
  11383. generating a double height frame at half frame rate.
  11384. @example
  11385. ------> time
  11386. Input:
  11387. Frame 1 Frame 2 Frame 3 Frame 4
  11388. 11111 22222 33333 44444
  11389. 11111 22222 33333 44444
  11390. 11111 22222 33333 44444
  11391. 11111 22222 33333 44444
  11392. Output:
  11393. 11111 33333
  11394. 22222 44444
  11395. 11111 33333
  11396. 22222 44444
  11397. 11111 33333
  11398. 22222 44444
  11399. 11111 33333
  11400. 22222 44444
  11401. @end example
  11402. @item drop_even, 1
  11403. Only output odd frames, even frames are dropped, generating a frame with
  11404. unchanged height at half frame rate.
  11405. @example
  11406. ------> time
  11407. Input:
  11408. Frame 1 Frame 2 Frame 3 Frame 4
  11409. 11111 22222 33333 44444
  11410. 11111 22222 33333 44444
  11411. 11111 22222 33333 44444
  11412. 11111 22222 33333 44444
  11413. Output:
  11414. 11111 33333
  11415. 11111 33333
  11416. 11111 33333
  11417. 11111 33333
  11418. @end example
  11419. @item drop_odd, 2
  11420. Only output even frames, odd frames are dropped, generating a frame with
  11421. unchanged height at half frame rate.
  11422. @example
  11423. ------> time
  11424. Input:
  11425. Frame 1 Frame 2 Frame 3 Frame 4
  11426. 11111 22222 33333 44444
  11427. 11111 22222 33333 44444
  11428. 11111 22222 33333 44444
  11429. 11111 22222 33333 44444
  11430. Output:
  11431. 22222 44444
  11432. 22222 44444
  11433. 22222 44444
  11434. 22222 44444
  11435. @end example
  11436. @item pad, 3
  11437. Expand each frame to full height, but pad alternate lines with black,
  11438. generating a frame with double height at the same input frame rate.
  11439. @example
  11440. ------> time
  11441. Input:
  11442. Frame 1 Frame 2 Frame 3 Frame 4
  11443. 11111 22222 33333 44444
  11444. 11111 22222 33333 44444
  11445. 11111 22222 33333 44444
  11446. 11111 22222 33333 44444
  11447. Output:
  11448. 11111 ..... 33333 .....
  11449. ..... 22222 ..... 44444
  11450. 11111 ..... 33333 .....
  11451. ..... 22222 ..... 44444
  11452. 11111 ..... 33333 .....
  11453. ..... 22222 ..... 44444
  11454. 11111 ..... 33333 .....
  11455. ..... 22222 ..... 44444
  11456. @end example
  11457. @item interleave_top, 4
  11458. Interleave the upper field from odd frames with the lower field from
  11459. even frames, generating a frame with unchanged height at half frame rate.
  11460. @example
  11461. ------> time
  11462. Input:
  11463. Frame 1 Frame 2 Frame 3 Frame 4
  11464. 11111<- 22222 33333<- 44444
  11465. 11111 22222<- 33333 44444<-
  11466. 11111<- 22222 33333<- 44444
  11467. 11111 22222<- 33333 44444<-
  11468. Output:
  11469. 11111 33333
  11470. 22222 44444
  11471. 11111 33333
  11472. 22222 44444
  11473. @end example
  11474. @item interleave_bottom, 5
  11475. Interleave the lower field from odd frames with the upper field from
  11476. even frames, generating a frame with unchanged height at half frame rate.
  11477. @example
  11478. ------> time
  11479. Input:
  11480. Frame 1 Frame 2 Frame 3 Frame 4
  11481. 11111 22222<- 33333 44444<-
  11482. 11111<- 22222 33333<- 44444
  11483. 11111 22222<- 33333 44444<-
  11484. 11111<- 22222 33333<- 44444
  11485. Output:
  11486. 22222 44444
  11487. 11111 33333
  11488. 22222 44444
  11489. 11111 33333
  11490. @end example
  11491. @item interlacex2, 6
  11492. Double frame rate with unchanged height. Frames are inserted each
  11493. containing the second temporal field from the previous input frame and
  11494. the first temporal field from the next input frame. This mode relies on
  11495. the top_field_first flag. Useful for interlaced video displays with no
  11496. field synchronisation.
  11497. @example
  11498. ------> time
  11499. Input:
  11500. Frame 1 Frame 2 Frame 3 Frame 4
  11501. 11111 22222 33333 44444
  11502. 11111 22222 33333 44444
  11503. 11111 22222 33333 44444
  11504. 11111 22222 33333 44444
  11505. Output:
  11506. 11111 22222 22222 33333 33333 44444 44444
  11507. 11111 11111 22222 22222 33333 33333 44444
  11508. 11111 22222 22222 33333 33333 44444 44444
  11509. 11111 11111 22222 22222 33333 33333 44444
  11510. @end example
  11511. @item mergex2, 7
  11512. Move odd frames into the upper field, even into the lower field,
  11513. generating a double height frame at same frame rate.
  11514. @example
  11515. ------> time
  11516. Input:
  11517. Frame 1 Frame 2 Frame 3 Frame 4
  11518. 11111 22222 33333 44444
  11519. 11111 22222 33333 44444
  11520. 11111 22222 33333 44444
  11521. 11111 22222 33333 44444
  11522. Output:
  11523. 11111 33333 33333 55555
  11524. 22222 22222 44444 44444
  11525. 11111 33333 33333 55555
  11526. 22222 22222 44444 44444
  11527. 11111 33333 33333 55555
  11528. 22222 22222 44444 44444
  11529. 11111 33333 33333 55555
  11530. 22222 22222 44444 44444
  11531. @end example
  11532. @end table
  11533. Numeric values are deprecated but are accepted for backward
  11534. compatibility reasons.
  11535. Default mode is @code{merge}.
  11536. @item flags
  11537. Specify flags influencing the filter process.
  11538. Available value for @var{flags} is:
  11539. @table @option
  11540. @item low_pass_filter, vlfp
  11541. Enable linear vertical low-pass filtering in the filter.
  11542. Vertical low-pass filtering is required when creating an interlaced
  11543. destination from a progressive source which contains high-frequency
  11544. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11545. patterning.
  11546. @item complex_filter, cvlfp
  11547. Enable complex vertical low-pass filtering.
  11548. This will slightly less reduce interlace 'twitter' and Moire
  11549. patterning but better retain detail and subjective sharpness impression.
  11550. @end table
  11551. Vertical low-pass filtering can only be enabled for @option{mode}
  11552. @var{interleave_top} and @var{interleave_bottom}.
  11553. @end table
  11554. @section tonemap
  11555. Tone map colors from different dynamic ranges.
  11556. This filter expects data in single precision floating point, as it needs to
  11557. operate on (and can output) out-of-range values. Another filter, such as
  11558. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11559. The tonemapping algorithms implemented only work on linear light, so input
  11560. data should be linearized beforehand (and possibly correctly tagged).
  11561. @example
  11562. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11563. @end example
  11564. @subsection Options
  11565. The filter accepts the following options.
  11566. @table @option
  11567. @item tonemap
  11568. Set the tone map algorithm to use.
  11569. Possible values are:
  11570. @table @var
  11571. @item none
  11572. Do not apply any tone map, only desaturate overbright pixels.
  11573. @item clip
  11574. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11575. in-range values, while distorting out-of-range values.
  11576. @item linear
  11577. Stretch the entire reference gamut to a linear multiple of the display.
  11578. @item gamma
  11579. Fit a logarithmic transfer between the tone curves.
  11580. @item reinhard
  11581. Preserve overall image brightness with a simple curve, using nonlinear
  11582. contrast, which results in flattening details and degrading color accuracy.
  11583. @item hable
  11584. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11585. of slightly darkening everything. Use it when detail preservation is more
  11586. important than color and brightness accuracy.
  11587. @item mobius
  11588. Smoothly map out-of-range values, while retaining contrast and colors for
  11589. in-range material as much as possible. Use it when color accuracy is more
  11590. important than detail preservation.
  11591. @end table
  11592. Default is none.
  11593. @item param
  11594. Tune the tone mapping algorithm.
  11595. This affects the following algorithms:
  11596. @table @var
  11597. @item none
  11598. Ignored.
  11599. @item linear
  11600. Specifies the scale factor to use while stretching.
  11601. Default to 1.0.
  11602. @item gamma
  11603. Specifies the exponent of the function.
  11604. Default to 1.8.
  11605. @item clip
  11606. Specify an extra linear coefficient to multiply into the signal before clipping.
  11607. Default to 1.0.
  11608. @item reinhard
  11609. Specify the local contrast coefficient at the display peak.
  11610. Default to 0.5, which means that in-gamut values will be about half as bright
  11611. as when clipping.
  11612. @item hable
  11613. Ignored.
  11614. @item mobius
  11615. Specify the transition point from linear to mobius transform. Every value
  11616. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11617. more accurate the result will be, at the cost of losing bright details.
  11618. Default to 0.3, which due to the steep initial slope still preserves in-range
  11619. colors fairly accurately.
  11620. @end table
  11621. @item desat
  11622. Apply desaturation for highlights that exceed this level of brightness. The
  11623. higher the parameter, the more color information will be preserved. This
  11624. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11625. (smoothly) turning into white instead. This makes images feel more natural,
  11626. at the cost of reducing information about out-of-range colors.
  11627. The default of 2.0 is somewhat conservative and will mostly just apply to
  11628. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11629. This option works only if the input frame has a supported color tag.
  11630. @item peak
  11631. Override signal/nominal/reference peak with this value. Useful when the
  11632. embedded peak information in display metadata is not reliable or when tone
  11633. mapping from a lower range to a higher range.
  11634. @end table
  11635. @section transpose
  11636. Transpose rows with columns in the input video and optionally flip it.
  11637. It accepts the following parameters:
  11638. @table @option
  11639. @item dir
  11640. Specify the transposition direction.
  11641. Can assume the following values:
  11642. @table @samp
  11643. @item 0, 4, cclock_flip
  11644. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11645. @example
  11646. L.R L.l
  11647. . . -> . .
  11648. l.r R.r
  11649. @end example
  11650. @item 1, 5, clock
  11651. Rotate by 90 degrees clockwise, that is:
  11652. @example
  11653. L.R l.L
  11654. . . -> . .
  11655. l.r r.R
  11656. @end example
  11657. @item 2, 6, cclock
  11658. Rotate by 90 degrees counterclockwise, that is:
  11659. @example
  11660. L.R R.r
  11661. . . -> . .
  11662. l.r L.l
  11663. @end example
  11664. @item 3, 7, clock_flip
  11665. Rotate by 90 degrees clockwise and vertically flip, that is:
  11666. @example
  11667. L.R r.R
  11668. . . -> . .
  11669. l.r l.L
  11670. @end example
  11671. @end table
  11672. For values between 4-7, the transposition is only done if the input
  11673. video geometry is portrait and not landscape. These values are
  11674. deprecated, the @code{passthrough} option should be used instead.
  11675. Numerical values are deprecated, and should be dropped in favor of
  11676. symbolic constants.
  11677. @item passthrough
  11678. Do not apply the transposition if the input geometry matches the one
  11679. specified by the specified value. It accepts the following values:
  11680. @table @samp
  11681. @item none
  11682. Always apply transposition.
  11683. @item portrait
  11684. Preserve portrait geometry (when @var{height} >= @var{width}).
  11685. @item landscape
  11686. Preserve landscape geometry (when @var{width} >= @var{height}).
  11687. @end table
  11688. Default value is @code{none}.
  11689. @end table
  11690. For example to rotate by 90 degrees clockwise and preserve portrait
  11691. layout:
  11692. @example
  11693. transpose=dir=1:passthrough=portrait
  11694. @end example
  11695. The command above can also be specified as:
  11696. @example
  11697. transpose=1:portrait
  11698. @end example
  11699. @section trim
  11700. Trim the input so that the output contains one continuous subpart of the input.
  11701. It accepts the following parameters:
  11702. @table @option
  11703. @item start
  11704. Specify the time of the start of the kept section, i.e. the frame with the
  11705. timestamp @var{start} will be the first frame in the output.
  11706. @item end
  11707. Specify the time of the first frame that will be dropped, i.e. the frame
  11708. immediately preceding the one with the timestamp @var{end} will be the last
  11709. frame in the output.
  11710. @item start_pts
  11711. This is the same as @var{start}, except this option sets the start timestamp
  11712. in timebase units instead of seconds.
  11713. @item end_pts
  11714. This is the same as @var{end}, except this option sets the end timestamp
  11715. in timebase units instead of seconds.
  11716. @item duration
  11717. The maximum duration of the output in seconds.
  11718. @item start_frame
  11719. The number of the first frame that should be passed to the output.
  11720. @item end_frame
  11721. The number of the first frame that should be dropped.
  11722. @end table
  11723. @option{start}, @option{end}, and @option{duration} are expressed as time
  11724. duration specifications; see
  11725. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11726. for the accepted syntax.
  11727. Note that the first two sets of the start/end options and the @option{duration}
  11728. option look at the frame timestamp, while the _frame variants simply count the
  11729. frames that pass through the filter. Also note that this filter does not modify
  11730. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11731. setpts filter after the trim filter.
  11732. If multiple start or end options are set, this filter tries to be greedy and
  11733. keep all the frames that match at least one of the specified constraints. To keep
  11734. only the part that matches all the constraints at once, chain multiple trim
  11735. filters.
  11736. The defaults are such that all the input is kept. So it is possible to set e.g.
  11737. just the end values to keep everything before the specified time.
  11738. Examples:
  11739. @itemize
  11740. @item
  11741. Drop everything except the second minute of input:
  11742. @example
  11743. ffmpeg -i INPUT -vf trim=60:120
  11744. @end example
  11745. @item
  11746. Keep only the first second:
  11747. @example
  11748. ffmpeg -i INPUT -vf trim=duration=1
  11749. @end example
  11750. @end itemize
  11751. @section unpremultiply
  11752. Apply alpha unpremultiply effect to input video stream using first plane
  11753. of second stream as alpha.
  11754. Both streams must have same dimensions and same pixel format.
  11755. The filter accepts the following option:
  11756. @table @option
  11757. @item planes
  11758. Set which planes will be processed, unprocessed planes will be copied.
  11759. By default value 0xf, all planes will be processed.
  11760. If the format has 1 or 2 components, then luma is bit 0.
  11761. If the format has 3 or 4 components:
  11762. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11763. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11764. If present, the alpha channel is always the last bit.
  11765. @item inplace
  11766. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11767. @end table
  11768. @anchor{unsharp}
  11769. @section unsharp
  11770. Sharpen or blur the input video.
  11771. It accepts the following parameters:
  11772. @table @option
  11773. @item luma_msize_x, lx
  11774. Set the luma matrix horizontal size. It must be an odd integer between
  11775. 3 and 23. The default value is 5.
  11776. @item luma_msize_y, ly
  11777. Set the luma matrix vertical size. It must be an odd integer between 3
  11778. and 23. The default value is 5.
  11779. @item luma_amount, la
  11780. Set the luma effect strength. It must be a floating point number, reasonable
  11781. values lay between -1.5 and 1.5.
  11782. Negative values will blur the input video, while positive values will
  11783. sharpen it, a value of zero will disable the effect.
  11784. Default value is 1.0.
  11785. @item chroma_msize_x, cx
  11786. Set the chroma matrix horizontal size. It must be an odd integer
  11787. between 3 and 23. The default value is 5.
  11788. @item chroma_msize_y, cy
  11789. Set the chroma matrix vertical size. It must be an odd integer
  11790. between 3 and 23. The default value is 5.
  11791. @item chroma_amount, ca
  11792. Set the chroma effect strength. It must be a floating point number, reasonable
  11793. values lay between -1.5 and 1.5.
  11794. Negative values will blur the input video, while positive values will
  11795. sharpen it, a value of zero will disable the effect.
  11796. Default value is 0.0.
  11797. @end table
  11798. All parameters are optional and default to the equivalent of the
  11799. string '5:5:1.0:5:5:0.0'.
  11800. @subsection Examples
  11801. @itemize
  11802. @item
  11803. Apply strong luma sharpen effect:
  11804. @example
  11805. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11806. @end example
  11807. @item
  11808. Apply a strong blur of both luma and chroma parameters:
  11809. @example
  11810. unsharp=7:7:-2:7:7:-2
  11811. @end example
  11812. @end itemize
  11813. @section uspp
  11814. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11815. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11816. shifts and average the results.
  11817. The way this differs from the behavior of spp is that uspp actually encodes &
  11818. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11819. DCT similar to MJPEG.
  11820. The filter accepts the following options:
  11821. @table @option
  11822. @item quality
  11823. Set quality. This option defines the number of levels for averaging. It accepts
  11824. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11825. effect. A value of @code{8} means the higher quality. For each increment of
  11826. that value the speed drops by a factor of approximately 2. Default value is
  11827. @code{3}.
  11828. @item qp
  11829. Force a constant quantization parameter. If not set, the filter will use the QP
  11830. from the video stream (if available).
  11831. @end table
  11832. @section vaguedenoiser
  11833. Apply a wavelet based denoiser.
  11834. It transforms each frame from the video input into the wavelet domain,
  11835. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11836. the obtained coefficients. It does an inverse wavelet transform after.
  11837. Due to wavelet properties, it should give a nice smoothed result, and
  11838. reduced noise, without blurring picture features.
  11839. This filter accepts the following options:
  11840. @table @option
  11841. @item threshold
  11842. The filtering strength. The higher, the more filtered the video will be.
  11843. Hard thresholding can use a higher threshold than soft thresholding
  11844. before the video looks overfiltered. Default value is 2.
  11845. @item method
  11846. The filtering method the filter will use.
  11847. It accepts the following values:
  11848. @table @samp
  11849. @item hard
  11850. All values under the threshold will be zeroed.
  11851. @item soft
  11852. All values under the threshold will be zeroed. All values above will be
  11853. reduced by the threshold.
  11854. @item garrote
  11855. Scales or nullifies coefficients - intermediary between (more) soft and
  11856. (less) hard thresholding.
  11857. @end table
  11858. Default is garrote.
  11859. @item nsteps
  11860. Number of times, the wavelet will decompose the picture. Picture can't
  11861. be decomposed beyond a particular point (typically, 8 for a 640x480
  11862. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11863. @item percent
  11864. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11865. @item planes
  11866. A list of the planes to process. By default all planes are processed.
  11867. @end table
  11868. @section vectorscope
  11869. Display 2 color component values in the two dimensional graph (which is called
  11870. a vectorscope).
  11871. This filter accepts the following options:
  11872. @table @option
  11873. @item mode, m
  11874. Set vectorscope mode.
  11875. It accepts the following values:
  11876. @table @samp
  11877. @item gray
  11878. Gray values are displayed on graph, higher brightness means more pixels have
  11879. same component color value on location in graph. This is the default mode.
  11880. @item color
  11881. Gray values are displayed on graph. Surrounding pixels values which are not
  11882. present in video frame are drawn in gradient of 2 color components which are
  11883. set by option @code{x} and @code{y}. The 3rd color component is static.
  11884. @item color2
  11885. Actual color components values present in video frame are displayed on graph.
  11886. @item color3
  11887. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11888. on graph increases value of another color component, which is luminance by
  11889. default values of @code{x} and @code{y}.
  11890. @item color4
  11891. Actual colors present in video frame are displayed on graph. If two different
  11892. colors map to same position on graph then color with higher value of component
  11893. not present in graph is picked.
  11894. @item color5
  11895. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11896. component picked from radial gradient.
  11897. @end table
  11898. @item x
  11899. Set which color component will be represented on X-axis. Default is @code{1}.
  11900. @item y
  11901. Set which color component will be represented on Y-axis. Default is @code{2}.
  11902. @item intensity, i
  11903. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11904. of color component which represents frequency of (X, Y) location in graph.
  11905. @item envelope, e
  11906. @table @samp
  11907. @item none
  11908. No envelope, this is default.
  11909. @item instant
  11910. Instant envelope, even darkest single pixel will be clearly highlighted.
  11911. @item peak
  11912. Hold maximum and minimum values presented in graph over time. This way you
  11913. can still spot out of range values without constantly looking at vectorscope.
  11914. @item peak+instant
  11915. Peak and instant envelope combined together.
  11916. @end table
  11917. @item graticule, g
  11918. Set what kind of graticule to draw.
  11919. @table @samp
  11920. @item none
  11921. @item green
  11922. @item color
  11923. @end table
  11924. @item opacity, o
  11925. Set graticule opacity.
  11926. @item flags, f
  11927. Set graticule flags.
  11928. @table @samp
  11929. @item white
  11930. Draw graticule for white point.
  11931. @item black
  11932. Draw graticule for black point.
  11933. @item name
  11934. Draw color points short names.
  11935. @end table
  11936. @item bgopacity, b
  11937. Set background opacity.
  11938. @item lthreshold, l
  11939. Set low threshold for color component not represented on X or Y axis.
  11940. Values lower than this value will be ignored. Default is 0.
  11941. Note this value is multiplied with actual max possible value one pixel component
  11942. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11943. is 0.1 * 255 = 25.
  11944. @item hthreshold, h
  11945. Set high threshold for color component not represented on X or Y axis.
  11946. Values higher than this value will be ignored. Default is 1.
  11947. Note this value is multiplied with actual max possible value one pixel component
  11948. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11949. is 0.9 * 255 = 230.
  11950. @item colorspace, c
  11951. Set what kind of colorspace to use when drawing graticule.
  11952. @table @samp
  11953. @item auto
  11954. @item 601
  11955. @item 709
  11956. @end table
  11957. Default is auto.
  11958. @end table
  11959. @anchor{vidstabdetect}
  11960. @section vidstabdetect
  11961. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11962. @ref{vidstabtransform} for pass 2.
  11963. This filter generates a file with relative translation and rotation
  11964. transform information about subsequent frames, which is then used by
  11965. the @ref{vidstabtransform} filter.
  11966. To enable compilation of this filter you need to configure FFmpeg with
  11967. @code{--enable-libvidstab}.
  11968. This filter accepts the following options:
  11969. @table @option
  11970. @item result
  11971. Set the path to the file used to write the transforms information.
  11972. Default value is @file{transforms.trf}.
  11973. @item shakiness
  11974. Set how shaky the video is and how quick the camera is. It accepts an
  11975. integer in the range 1-10, a value of 1 means little shakiness, a
  11976. value of 10 means strong shakiness. Default value is 5.
  11977. @item accuracy
  11978. Set the accuracy of the detection process. It must be a value in the
  11979. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11980. accuracy. Default value is 15.
  11981. @item stepsize
  11982. Set stepsize of the search process. The region around minimum is
  11983. scanned with 1 pixel resolution. Default value is 6.
  11984. @item mincontrast
  11985. Set minimum contrast. Below this value a local measurement field is
  11986. discarded. Must be a floating point value in the range 0-1. Default
  11987. value is 0.3.
  11988. @item tripod
  11989. Set reference frame number for tripod mode.
  11990. If enabled, the motion of the frames is compared to a reference frame
  11991. in the filtered stream, identified by the specified number. The idea
  11992. is to compensate all movements in a more-or-less static scene and keep
  11993. the camera view absolutely still.
  11994. If set to 0, it is disabled. The frames are counted starting from 1.
  11995. @item show
  11996. Show fields and transforms in the resulting frames. It accepts an
  11997. integer in the range 0-2. Default value is 0, which disables any
  11998. visualization.
  11999. @end table
  12000. @subsection Examples
  12001. @itemize
  12002. @item
  12003. Use default values:
  12004. @example
  12005. vidstabdetect
  12006. @end example
  12007. @item
  12008. Analyze strongly shaky movie and put the results in file
  12009. @file{mytransforms.trf}:
  12010. @example
  12011. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12012. @end example
  12013. @item
  12014. Visualize the result of internal transformations in the resulting
  12015. video:
  12016. @example
  12017. vidstabdetect=show=1
  12018. @end example
  12019. @item
  12020. Analyze a video with medium shakiness using @command{ffmpeg}:
  12021. @example
  12022. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12023. @end example
  12024. @end itemize
  12025. @anchor{vidstabtransform}
  12026. @section vidstabtransform
  12027. Video stabilization/deshaking: pass 2 of 2,
  12028. see @ref{vidstabdetect} for pass 1.
  12029. Read a file with transform information for each frame and
  12030. apply/compensate them. Together with the @ref{vidstabdetect}
  12031. filter this can be used to deshake videos. See also
  12032. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12033. the @ref{unsharp} filter, see below.
  12034. To enable compilation of this filter you need to configure FFmpeg with
  12035. @code{--enable-libvidstab}.
  12036. @subsection Options
  12037. @table @option
  12038. @item input
  12039. Set path to the file used to read the transforms. Default value is
  12040. @file{transforms.trf}.
  12041. @item smoothing
  12042. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12043. camera movements. Default value is 10.
  12044. For example a number of 10 means that 21 frames are used (10 in the
  12045. past and 10 in the future) to smoothen the motion in the video. A
  12046. larger value leads to a smoother video, but limits the acceleration of
  12047. the camera (pan/tilt movements). 0 is a special case where a static
  12048. camera is simulated.
  12049. @item optalgo
  12050. Set the camera path optimization algorithm.
  12051. Accepted values are:
  12052. @table @samp
  12053. @item gauss
  12054. gaussian kernel low-pass filter on camera motion (default)
  12055. @item avg
  12056. averaging on transformations
  12057. @end table
  12058. @item maxshift
  12059. Set maximal number of pixels to translate frames. Default value is -1,
  12060. meaning no limit.
  12061. @item maxangle
  12062. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12063. value is -1, meaning no limit.
  12064. @item crop
  12065. Specify how to deal with borders that may be visible due to movement
  12066. compensation.
  12067. Available values are:
  12068. @table @samp
  12069. @item keep
  12070. keep image information from previous frame (default)
  12071. @item black
  12072. fill the border black
  12073. @end table
  12074. @item invert
  12075. Invert transforms if set to 1. Default value is 0.
  12076. @item relative
  12077. Consider transforms as relative to previous frame if set to 1,
  12078. absolute if set to 0. Default value is 0.
  12079. @item zoom
  12080. Set percentage to zoom. A positive value will result in a zoom-in
  12081. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12082. zoom).
  12083. @item optzoom
  12084. Set optimal zooming to avoid borders.
  12085. Accepted values are:
  12086. @table @samp
  12087. @item 0
  12088. disabled
  12089. @item 1
  12090. optimal static zoom value is determined (only very strong movements
  12091. will lead to visible borders) (default)
  12092. @item 2
  12093. optimal adaptive zoom value is determined (no borders will be
  12094. visible), see @option{zoomspeed}
  12095. @end table
  12096. Note that the value given at zoom is added to the one calculated here.
  12097. @item zoomspeed
  12098. Set percent to zoom maximally each frame (enabled when
  12099. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12100. 0.25.
  12101. @item interpol
  12102. Specify type of interpolation.
  12103. Available values are:
  12104. @table @samp
  12105. @item no
  12106. no interpolation
  12107. @item linear
  12108. linear only horizontal
  12109. @item bilinear
  12110. linear in both directions (default)
  12111. @item bicubic
  12112. cubic in both directions (slow)
  12113. @end table
  12114. @item tripod
  12115. Enable virtual tripod mode if set to 1, which is equivalent to
  12116. @code{relative=0:smoothing=0}. Default value is 0.
  12117. Use also @code{tripod} option of @ref{vidstabdetect}.
  12118. @item debug
  12119. Increase log verbosity if set to 1. Also the detected global motions
  12120. are written to the temporary file @file{global_motions.trf}. Default
  12121. value is 0.
  12122. @end table
  12123. @subsection Examples
  12124. @itemize
  12125. @item
  12126. Use @command{ffmpeg} for a typical stabilization with default values:
  12127. @example
  12128. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12129. @end example
  12130. Note the use of the @ref{unsharp} filter which is always recommended.
  12131. @item
  12132. Zoom in a bit more and load transform data from a given file:
  12133. @example
  12134. vidstabtransform=zoom=5:input="mytransforms.trf"
  12135. @end example
  12136. @item
  12137. Smoothen the video even more:
  12138. @example
  12139. vidstabtransform=smoothing=30
  12140. @end example
  12141. @end itemize
  12142. @section vflip
  12143. Flip the input video vertically.
  12144. For example, to vertically flip a video with @command{ffmpeg}:
  12145. @example
  12146. ffmpeg -i in.avi -vf "vflip" out.avi
  12147. @end example
  12148. @anchor{vignette}
  12149. @section vignette
  12150. Make or reverse a natural vignetting effect.
  12151. The filter accepts the following options:
  12152. @table @option
  12153. @item angle, a
  12154. Set lens angle expression as a number of radians.
  12155. The value is clipped in the @code{[0,PI/2]} range.
  12156. Default value: @code{"PI/5"}
  12157. @item x0
  12158. @item y0
  12159. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12160. by default.
  12161. @item mode
  12162. Set forward/backward mode.
  12163. Available modes are:
  12164. @table @samp
  12165. @item forward
  12166. The larger the distance from the central point, the darker the image becomes.
  12167. @item backward
  12168. The larger the distance from the central point, the brighter the image becomes.
  12169. This can be used to reverse a vignette effect, though there is no automatic
  12170. detection to extract the lens @option{angle} and other settings (yet). It can
  12171. also be used to create a burning effect.
  12172. @end table
  12173. Default value is @samp{forward}.
  12174. @item eval
  12175. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12176. It accepts the following values:
  12177. @table @samp
  12178. @item init
  12179. Evaluate expressions only once during the filter initialization.
  12180. @item frame
  12181. Evaluate expressions for each incoming frame. This is way slower than the
  12182. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12183. allows advanced dynamic expressions.
  12184. @end table
  12185. Default value is @samp{init}.
  12186. @item dither
  12187. Set dithering to reduce the circular banding effects. Default is @code{1}
  12188. (enabled).
  12189. @item aspect
  12190. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12191. Setting this value to the SAR of the input will make a rectangular vignetting
  12192. following the dimensions of the video.
  12193. Default is @code{1/1}.
  12194. @end table
  12195. @subsection Expressions
  12196. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12197. following parameters.
  12198. @table @option
  12199. @item w
  12200. @item h
  12201. input width and height
  12202. @item n
  12203. the number of input frame, starting from 0
  12204. @item pts
  12205. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12206. @var{TB} units, NAN if undefined
  12207. @item r
  12208. frame rate of the input video, NAN if the input frame rate is unknown
  12209. @item t
  12210. the PTS (Presentation TimeStamp) of the filtered video frame,
  12211. expressed in seconds, NAN if undefined
  12212. @item tb
  12213. time base of the input video
  12214. @end table
  12215. @subsection Examples
  12216. @itemize
  12217. @item
  12218. Apply simple strong vignetting effect:
  12219. @example
  12220. vignette=PI/4
  12221. @end example
  12222. @item
  12223. Make a flickering vignetting:
  12224. @example
  12225. vignette='PI/4+random(1)*PI/50':eval=frame
  12226. @end example
  12227. @end itemize
  12228. @section vmafmotion
  12229. Obtain the average vmaf motion score of a video.
  12230. It is one of the component filters of VMAF.
  12231. The obtained average motion score is printed through the logging system.
  12232. In the below example the input file @file{ref.mpg} is being processed and score
  12233. is computed.
  12234. @example
  12235. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12236. @end example
  12237. @section vstack
  12238. Stack input videos vertically.
  12239. All streams must be of same pixel format and of same width.
  12240. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12241. to create same output.
  12242. The filter accept the following option:
  12243. @table @option
  12244. @item inputs
  12245. Set number of input streams. Default is 2.
  12246. @item shortest
  12247. If set to 1, force the output to terminate when the shortest input
  12248. terminates. Default value is 0.
  12249. @end table
  12250. @section w3fdif
  12251. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12252. Deinterlacing Filter").
  12253. Based on the process described by Martin Weston for BBC R&D, and
  12254. implemented based on the de-interlace algorithm written by Jim
  12255. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12256. uses filter coefficients calculated by BBC R&D.
  12257. There are two sets of filter coefficients, so called "simple":
  12258. and "complex". Which set of filter coefficients is used can
  12259. be set by passing an optional parameter:
  12260. @table @option
  12261. @item filter
  12262. Set the interlacing filter coefficients. Accepts one of the following values:
  12263. @table @samp
  12264. @item simple
  12265. Simple filter coefficient set.
  12266. @item complex
  12267. More-complex filter coefficient set.
  12268. @end table
  12269. Default value is @samp{complex}.
  12270. @item deint
  12271. Specify which frames to deinterlace. Accept one of the following values:
  12272. @table @samp
  12273. @item all
  12274. Deinterlace all frames,
  12275. @item interlaced
  12276. Only deinterlace frames marked as interlaced.
  12277. @end table
  12278. Default value is @samp{all}.
  12279. @end table
  12280. @section waveform
  12281. Video waveform monitor.
  12282. The waveform monitor plots color component intensity. By default luminance
  12283. only. Each column of the waveform corresponds to a column of pixels in the
  12284. source video.
  12285. It accepts the following options:
  12286. @table @option
  12287. @item mode, m
  12288. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12289. In row mode, the graph on the left side represents color component value 0 and
  12290. the right side represents value = 255. In column mode, the top side represents
  12291. color component value = 0 and bottom side represents value = 255.
  12292. @item intensity, i
  12293. Set intensity. Smaller values are useful to find out how many values of the same
  12294. luminance are distributed across input rows/columns.
  12295. Default value is @code{0.04}. Allowed range is [0, 1].
  12296. @item mirror, r
  12297. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12298. In mirrored mode, higher values will be represented on the left
  12299. side for @code{row} mode and at the top for @code{column} mode. Default is
  12300. @code{1} (mirrored).
  12301. @item display, d
  12302. Set display mode.
  12303. It accepts the following values:
  12304. @table @samp
  12305. @item overlay
  12306. Presents information identical to that in the @code{parade}, except
  12307. that the graphs representing color components are superimposed directly
  12308. over one another.
  12309. This display mode makes it easier to spot relative differences or similarities
  12310. in overlapping areas of the color components that are supposed to be identical,
  12311. such as neutral whites, grays, or blacks.
  12312. @item stack
  12313. Display separate graph for the color components side by side in
  12314. @code{row} mode or one below the other in @code{column} mode.
  12315. @item parade
  12316. Display separate graph for the color components side by side in
  12317. @code{column} mode or one below the other in @code{row} mode.
  12318. Using this display mode makes it easy to spot color casts in the highlights
  12319. and shadows of an image, by comparing the contours of the top and the bottom
  12320. graphs of each waveform. Since whites, grays, and blacks are characterized
  12321. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12322. should display three waveforms of roughly equal width/height. If not, the
  12323. correction is easy to perform by making level adjustments the three waveforms.
  12324. @end table
  12325. Default is @code{stack}.
  12326. @item components, c
  12327. Set which color components to display. Default is 1, which means only luminance
  12328. or red color component if input is in RGB colorspace. If is set for example to
  12329. 7 it will display all 3 (if) available color components.
  12330. @item envelope, e
  12331. @table @samp
  12332. @item none
  12333. No envelope, this is default.
  12334. @item instant
  12335. Instant envelope, minimum and maximum values presented in graph will be easily
  12336. visible even with small @code{step} value.
  12337. @item peak
  12338. Hold minimum and maximum values presented in graph across time. This way you
  12339. can still spot out of range values without constantly looking at waveforms.
  12340. @item peak+instant
  12341. Peak and instant envelope combined together.
  12342. @end table
  12343. @item filter, f
  12344. @table @samp
  12345. @item lowpass
  12346. No filtering, this is default.
  12347. @item flat
  12348. Luma and chroma combined together.
  12349. @item aflat
  12350. Similar as above, but shows difference between blue and red chroma.
  12351. @item chroma
  12352. Displays only chroma.
  12353. @item color
  12354. Displays actual color value on waveform.
  12355. @item acolor
  12356. Similar as above, but with luma showing frequency of chroma values.
  12357. @end table
  12358. @item graticule, g
  12359. Set which graticule to display.
  12360. @table @samp
  12361. @item none
  12362. Do not display graticule.
  12363. @item green
  12364. Display green graticule showing legal broadcast ranges.
  12365. @end table
  12366. @item opacity, o
  12367. Set graticule opacity.
  12368. @item flags, fl
  12369. Set graticule flags.
  12370. @table @samp
  12371. @item numbers
  12372. Draw numbers above lines. By default enabled.
  12373. @item dots
  12374. Draw dots instead of lines.
  12375. @end table
  12376. @item scale, s
  12377. Set scale used for displaying graticule.
  12378. @table @samp
  12379. @item digital
  12380. @item millivolts
  12381. @item ire
  12382. @end table
  12383. Default is digital.
  12384. @item bgopacity, b
  12385. Set background opacity.
  12386. @end table
  12387. @section weave, doubleweave
  12388. The @code{weave} takes a field-based video input and join
  12389. each two sequential fields into single frame, producing a new double
  12390. height clip with half the frame rate and half the frame count.
  12391. The @code{doubleweave} works same as @code{weave} but without
  12392. halving frame rate and frame count.
  12393. It accepts the following option:
  12394. @table @option
  12395. @item first_field
  12396. Set first field. Available values are:
  12397. @table @samp
  12398. @item top, t
  12399. Set the frame as top-field-first.
  12400. @item bottom, b
  12401. Set the frame as bottom-field-first.
  12402. @end table
  12403. @end table
  12404. @subsection Examples
  12405. @itemize
  12406. @item
  12407. Interlace video using @ref{select} and @ref{separatefields} filter:
  12408. @example
  12409. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12410. @end example
  12411. @end itemize
  12412. @section xbr
  12413. Apply the xBR high-quality magnification filter which is designed for pixel
  12414. art. It follows a set of edge-detection rules, see
  12415. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12416. It accepts the following option:
  12417. @table @option
  12418. @item n
  12419. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12420. @code{3xBR} and @code{4} for @code{4xBR}.
  12421. Default is @code{3}.
  12422. @end table
  12423. @anchor{yadif}
  12424. @section yadif
  12425. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12426. filter").
  12427. It accepts the following parameters:
  12428. @table @option
  12429. @item mode
  12430. The interlacing mode to adopt. It accepts one of the following values:
  12431. @table @option
  12432. @item 0, send_frame
  12433. Output one frame for each frame.
  12434. @item 1, send_field
  12435. Output one frame for each field.
  12436. @item 2, send_frame_nospatial
  12437. Like @code{send_frame}, but it skips the spatial interlacing check.
  12438. @item 3, send_field_nospatial
  12439. Like @code{send_field}, but it skips the spatial interlacing check.
  12440. @end table
  12441. The default value is @code{send_frame}.
  12442. @item parity
  12443. The picture field parity assumed for the input interlaced video. It accepts one
  12444. of the following values:
  12445. @table @option
  12446. @item 0, tff
  12447. Assume the top field is first.
  12448. @item 1, bff
  12449. Assume the bottom field is first.
  12450. @item -1, auto
  12451. Enable automatic detection of field parity.
  12452. @end table
  12453. The default value is @code{auto}.
  12454. If the interlacing is unknown or the decoder does not export this information,
  12455. top field first will be assumed.
  12456. @item deint
  12457. Specify which frames to deinterlace. Accept one of the following
  12458. values:
  12459. @table @option
  12460. @item 0, all
  12461. Deinterlace all frames.
  12462. @item 1, interlaced
  12463. Only deinterlace frames marked as interlaced.
  12464. @end table
  12465. The default value is @code{all}.
  12466. @end table
  12467. @section zoompan
  12468. Apply Zoom & Pan effect.
  12469. This filter accepts the following options:
  12470. @table @option
  12471. @item zoom, z
  12472. Set the zoom expression. Default is 1.
  12473. @item x
  12474. @item y
  12475. Set the x and y expression. Default is 0.
  12476. @item d
  12477. Set the duration expression in number of frames.
  12478. This sets for how many number of frames effect will last for
  12479. single input image.
  12480. @item s
  12481. Set the output image size, default is 'hd720'.
  12482. @item fps
  12483. Set the output frame rate, default is '25'.
  12484. @end table
  12485. Each expression can contain the following constants:
  12486. @table @option
  12487. @item in_w, iw
  12488. Input width.
  12489. @item in_h, ih
  12490. Input height.
  12491. @item out_w, ow
  12492. Output width.
  12493. @item out_h, oh
  12494. Output height.
  12495. @item in
  12496. Input frame count.
  12497. @item on
  12498. Output frame count.
  12499. @item x
  12500. @item y
  12501. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12502. for current input frame.
  12503. @item px
  12504. @item py
  12505. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12506. not yet such frame (first input frame).
  12507. @item zoom
  12508. Last calculated zoom from 'z' expression for current input frame.
  12509. @item pzoom
  12510. Last calculated zoom of last output frame of previous input frame.
  12511. @item duration
  12512. Number of output frames for current input frame. Calculated from 'd' expression
  12513. for each input frame.
  12514. @item pduration
  12515. number of output frames created for previous input frame
  12516. @item a
  12517. Rational number: input width / input height
  12518. @item sar
  12519. sample aspect ratio
  12520. @item dar
  12521. display aspect ratio
  12522. @end table
  12523. @subsection Examples
  12524. @itemize
  12525. @item
  12526. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12527. @example
  12528. 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
  12529. @end example
  12530. @item
  12531. Zoom-in up to 1.5 and pan always at center of picture:
  12532. @example
  12533. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12534. @end example
  12535. @item
  12536. Same as above but without pausing:
  12537. @example
  12538. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12539. @end example
  12540. @end itemize
  12541. @anchor{zscale}
  12542. @section zscale
  12543. Scale (resize) the input video, using the z.lib library:
  12544. https://github.com/sekrit-twc/zimg.
  12545. The zscale filter forces the output display aspect ratio to be the same
  12546. as the input, by changing the output sample aspect ratio.
  12547. If the input image format is different from the format requested by
  12548. the next filter, the zscale filter will convert the input to the
  12549. requested format.
  12550. @subsection Options
  12551. The filter accepts the following options.
  12552. @table @option
  12553. @item width, w
  12554. @item height, h
  12555. Set the output video dimension expression. Default value is the input
  12556. dimension.
  12557. If the @var{width} or @var{w} value is 0, the input width is used for
  12558. the output. If the @var{height} or @var{h} value is 0, the input height
  12559. is used for the output.
  12560. If one and only one of the values is -n with n >= 1, the zscale filter
  12561. will use a value that maintains the aspect ratio of the input image,
  12562. calculated from the other specified dimension. After that it will,
  12563. however, make sure that the calculated dimension is divisible by n and
  12564. adjust the value if necessary.
  12565. If both values are -n with n >= 1, the behavior will be identical to
  12566. both values being set to 0 as previously detailed.
  12567. See below for the list of accepted constants for use in the dimension
  12568. expression.
  12569. @item size, s
  12570. Set the video size. For the syntax of this option, check the
  12571. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12572. @item dither, d
  12573. Set the dither type.
  12574. Possible values are:
  12575. @table @var
  12576. @item none
  12577. @item ordered
  12578. @item random
  12579. @item error_diffusion
  12580. @end table
  12581. Default is none.
  12582. @item filter, f
  12583. Set the resize filter type.
  12584. Possible values are:
  12585. @table @var
  12586. @item point
  12587. @item bilinear
  12588. @item bicubic
  12589. @item spline16
  12590. @item spline36
  12591. @item lanczos
  12592. @end table
  12593. Default is bilinear.
  12594. @item range, r
  12595. Set the color range.
  12596. Possible values are:
  12597. @table @var
  12598. @item input
  12599. @item limited
  12600. @item full
  12601. @end table
  12602. Default is same as input.
  12603. @item primaries, p
  12604. Set the color primaries.
  12605. Possible values are:
  12606. @table @var
  12607. @item input
  12608. @item 709
  12609. @item unspecified
  12610. @item 170m
  12611. @item 240m
  12612. @item 2020
  12613. @end table
  12614. Default is same as input.
  12615. @item transfer, t
  12616. Set the transfer characteristics.
  12617. Possible values are:
  12618. @table @var
  12619. @item input
  12620. @item 709
  12621. @item unspecified
  12622. @item 601
  12623. @item linear
  12624. @item 2020_10
  12625. @item 2020_12
  12626. @item smpte2084
  12627. @item iec61966-2-1
  12628. @item arib-std-b67
  12629. @end table
  12630. Default is same as input.
  12631. @item matrix, m
  12632. Set the colorspace matrix.
  12633. Possible value are:
  12634. @table @var
  12635. @item input
  12636. @item 709
  12637. @item unspecified
  12638. @item 470bg
  12639. @item 170m
  12640. @item 2020_ncl
  12641. @item 2020_cl
  12642. @end table
  12643. Default is same as input.
  12644. @item rangein, rin
  12645. Set the input color range.
  12646. Possible values are:
  12647. @table @var
  12648. @item input
  12649. @item limited
  12650. @item full
  12651. @end table
  12652. Default is same as input.
  12653. @item primariesin, pin
  12654. Set the input color primaries.
  12655. Possible values are:
  12656. @table @var
  12657. @item input
  12658. @item 709
  12659. @item unspecified
  12660. @item 170m
  12661. @item 240m
  12662. @item 2020
  12663. @end table
  12664. Default is same as input.
  12665. @item transferin, tin
  12666. Set the input transfer characteristics.
  12667. Possible values are:
  12668. @table @var
  12669. @item input
  12670. @item 709
  12671. @item unspecified
  12672. @item 601
  12673. @item linear
  12674. @item 2020_10
  12675. @item 2020_12
  12676. @end table
  12677. Default is same as input.
  12678. @item matrixin, min
  12679. Set the input colorspace matrix.
  12680. Possible value are:
  12681. @table @var
  12682. @item input
  12683. @item 709
  12684. @item unspecified
  12685. @item 470bg
  12686. @item 170m
  12687. @item 2020_ncl
  12688. @item 2020_cl
  12689. @end table
  12690. @item chromal, c
  12691. Set the output chroma location.
  12692. Possible values are:
  12693. @table @var
  12694. @item input
  12695. @item left
  12696. @item center
  12697. @item topleft
  12698. @item top
  12699. @item bottomleft
  12700. @item bottom
  12701. @end table
  12702. @item chromalin, cin
  12703. Set the input chroma location.
  12704. Possible values are:
  12705. @table @var
  12706. @item input
  12707. @item left
  12708. @item center
  12709. @item topleft
  12710. @item top
  12711. @item bottomleft
  12712. @item bottom
  12713. @end table
  12714. @item npl
  12715. Set the nominal peak luminance.
  12716. @end table
  12717. The values of the @option{w} and @option{h} options are expressions
  12718. containing the following constants:
  12719. @table @var
  12720. @item in_w
  12721. @item in_h
  12722. The input width and height
  12723. @item iw
  12724. @item ih
  12725. These are the same as @var{in_w} and @var{in_h}.
  12726. @item out_w
  12727. @item out_h
  12728. The output (scaled) width and height
  12729. @item ow
  12730. @item oh
  12731. These are the same as @var{out_w} and @var{out_h}
  12732. @item a
  12733. The same as @var{iw} / @var{ih}
  12734. @item sar
  12735. input sample aspect ratio
  12736. @item dar
  12737. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12738. @item hsub
  12739. @item vsub
  12740. horizontal and vertical input chroma subsample values. For example for the
  12741. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12742. @item ohsub
  12743. @item ovsub
  12744. horizontal and vertical output chroma subsample values. For example for the
  12745. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12746. @end table
  12747. @table @option
  12748. @end table
  12749. @c man end VIDEO FILTERS
  12750. @chapter Video Sources
  12751. @c man begin VIDEO SOURCES
  12752. Below is a description of the currently available video sources.
  12753. @section buffer
  12754. Buffer video frames, and make them available to the filter chain.
  12755. This source is mainly intended for a programmatic use, in particular
  12756. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12757. It accepts the following parameters:
  12758. @table @option
  12759. @item video_size
  12760. Specify the size (width and height) of the buffered video frames. For the
  12761. syntax of this option, check the
  12762. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12763. @item width
  12764. The input video width.
  12765. @item height
  12766. The input video height.
  12767. @item pix_fmt
  12768. A string representing the pixel format of the buffered video frames.
  12769. It may be a number corresponding to a pixel format, or a pixel format
  12770. name.
  12771. @item time_base
  12772. Specify the timebase assumed by the timestamps of the buffered frames.
  12773. @item frame_rate
  12774. Specify the frame rate expected for the video stream.
  12775. @item pixel_aspect, sar
  12776. The sample (pixel) aspect ratio of the input video.
  12777. @item sws_param
  12778. Specify the optional parameters to be used for the scale filter which
  12779. is automatically inserted when an input change is detected in the
  12780. input size or format.
  12781. @item hw_frames_ctx
  12782. When using a hardware pixel format, this should be a reference to an
  12783. AVHWFramesContext describing input frames.
  12784. @end table
  12785. For example:
  12786. @example
  12787. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12788. @end example
  12789. will instruct the source to accept video frames with size 320x240 and
  12790. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12791. square pixels (1:1 sample aspect ratio).
  12792. Since the pixel format with name "yuv410p" corresponds to the number 6
  12793. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12794. this example corresponds to:
  12795. @example
  12796. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12797. @end example
  12798. Alternatively, the options can be specified as a flat string, but this
  12799. syntax is deprecated:
  12800. @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}]
  12801. @section cellauto
  12802. Create a pattern generated by an elementary cellular automaton.
  12803. The initial state of the cellular automaton can be defined through the
  12804. @option{filename} and @option{pattern} options. If such options are
  12805. not specified an initial state is created randomly.
  12806. At each new frame a new row in the video is filled with the result of
  12807. the cellular automaton next generation. The behavior when the whole
  12808. frame is filled is defined by the @option{scroll} option.
  12809. This source accepts the following options:
  12810. @table @option
  12811. @item filename, f
  12812. Read the initial cellular automaton state, i.e. the starting row, from
  12813. the specified file.
  12814. In the file, each non-whitespace character is considered an alive
  12815. cell, a newline will terminate the row, and further characters in the
  12816. file will be ignored.
  12817. @item pattern, p
  12818. Read the initial cellular automaton state, i.e. the starting row, from
  12819. the specified string.
  12820. Each non-whitespace character in the string is considered an alive
  12821. cell, a newline will terminate the row, and further characters in the
  12822. string will be ignored.
  12823. @item rate, r
  12824. Set the video rate, that is the number of frames generated per second.
  12825. Default is 25.
  12826. @item random_fill_ratio, ratio
  12827. Set the random fill ratio for the initial cellular automaton row. It
  12828. is a floating point number value ranging from 0 to 1, defaults to
  12829. 1/PHI.
  12830. This option is ignored when a file or a pattern is specified.
  12831. @item random_seed, seed
  12832. Set the seed for filling randomly the initial row, must be an integer
  12833. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12834. set to -1, the filter will try to use a good random seed on a best
  12835. effort basis.
  12836. @item rule
  12837. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12838. Default value is 110.
  12839. @item size, s
  12840. Set the size of the output video. For the syntax of this option, check the
  12841. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12842. If @option{filename} or @option{pattern} is specified, the size is set
  12843. by default to the width of the specified initial state row, and the
  12844. height is set to @var{width} * PHI.
  12845. If @option{size} is set, it must contain the width of the specified
  12846. pattern string, and the specified pattern will be centered in the
  12847. larger row.
  12848. If a filename or a pattern string is not specified, the size value
  12849. defaults to "320x518" (used for a randomly generated initial state).
  12850. @item scroll
  12851. If set to 1, scroll the output upward when all the rows in the output
  12852. have been already filled. If set to 0, the new generated row will be
  12853. written over the top row just after the bottom row is filled.
  12854. Defaults to 1.
  12855. @item start_full, full
  12856. If set to 1, completely fill the output with generated rows before
  12857. outputting the first frame.
  12858. This is the default behavior, for disabling set the value to 0.
  12859. @item stitch
  12860. If set to 1, stitch the left and right row edges together.
  12861. This is the default behavior, for disabling set the value to 0.
  12862. @end table
  12863. @subsection Examples
  12864. @itemize
  12865. @item
  12866. Read the initial state from @file{pattern}, and specify an output of
  12867. size 200x400.
  12868. @example
  12869. cellauto=f=pattern:s=200x400
  12870. @end example
  12871. @item
  12872. Generate a random initial row with a width of 200 cells, with a fill
  12873. ratio of 2/3:
  12874. @example
  12875. cellauto=ratio=2/3:s=200x200
  12876. @end example
  12877. @item
  12878. Create a pattern generated by rule 18 starting by a single alive cell
  12879. centered on an initial row with width 100:
  12880. @example
  12881. cellauto=p=@@:s=100x400:full=0:rule=18
  12882. @end example
  12883. @item
  12884. Specify a more elaborated initial pattern:
  12885. @example
  12886. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12887. @end example
  12888. @end itemize
  12889. @anchor{coreimagesrc}
  12890. @section coreimagesrc
  12891. Video source generated on GPU using Apple's CoreImage API on OSX.
  12892. This video source is a specialized version of the @ref{coreimage} video filter.
  12893. Use a core image generator at the beginning of the applied filterchain to
  12894. generate the content.
  12895. The coreimagesrc video source accepts the following options:
  12896. @table @option
  12897. @item list_generators
  12898. List all available generators along with all their respective options as well as
  12899. possible minimum and maximum values along with the default values.
  12900. @example
  12901. list_generators=true
  12902. @end example
  12903. @item size, s
  12904. Specify the size of the sourced video. For the syntax of this option, check the
  12905. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12906. The default value is @code{320x240}.
  12907. @item rate, r
  12908. Specify the frame rate of the sourced video, as the number of frames
  12909. generated per second. It has to be a string in the format
  12910. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12911. number or a valid video frame rate abbreviation. The default value is
  12912. "25".
  12913. @item sar
  12914. Set the sample aspect ratio of the sourced video.
  12915. @item duration, d
  12916. Set the duration of the sourced video. See
  12917. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12918. for the accepted syntax.
  12919. If not specified, or the expressed duration is negative, the video is
  12920. supposed to be generated forever.
  12921. @end table
  12922. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12923. A complete filterchain can be used for further processing of the
  12924. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12925. and examples for details.
  12926. @subsection Examples
  12927. @itemize
  12928. @item
  12929. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12930. given as complete and escaped command-line for Apple's standard bash shell:
  12931. @example
  12932. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12933. @end example
  12934. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12935. need for a nullsrc video source.
  12936. @end itemize
  12937. @section mandelbrot
  12938. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12939. point specified with @var{start_x} and @var{start_y}.
  12940. This source accepts the following options:
  12941. @table @option
  12942. @item end_pts
  12943. Set the terminal pts value. Default value is 400.
  12944. @item end_scale
  12945. Set the terminal scale value.
  12946. Must be a floating point value. Default value is 0.3.
  12947. @item inner
  12948. Set the inner coloring mode, that is the algorithm used to draw the
  12949. Mandelbrot fractal internal region.
  12950. It shall assume one of the following values:
  12951. @table @option
  12952. @item black
  12953. Set black mode.
  12954. @item convergence
  12955. Show time until convergence.
  12956. @item mincol
  12957. Set color based on point closest to the origin of the iterations.
  12958. @item period
  12959. Set period mode.
  12960. @end table
  12961. Default value is @var{mincol}.
  12962. @item bailout
  12963. Set the bailout value. Default value is 10.0.
  12964. @item maxiter
  12965. Set the maximum of iterations performed by the rendering
  12966. algorithm. Default value is 7189.
  12967. @item outer
  12968. Set outer coloring mode.
  12969. It shall assume one of following values:
  12970. @table @option
  12971. @item iteration_count
  12972. Set iteration cound mode.
  12973. @item normalized_iteration_count
  12974. set normalized iteration count mode.
  12975. @end table
  12976. Default value is @var{normalized_iteration_count}.
  12977. @item rate, r
  12978. Set frame rate, expressed as number of frames per second. Default
  12979. value is "25".
  12980. @item size, s
  12981. Set frame size. For the syntax of this option, check the "Video
  12982. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12983. @item start_scale
  12984. Set the initial scale value. Default value is 3.0.
  12985. @item start_x
  12986. Set the initial x position. Must be a floating point value between
  12987. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12988. @item start_y
  12989. Set the initial y position. Must be a floating point value between
  12990. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12991. @end table
  12992. @section mptestsrc
  12993. Generate various test patterns, as generated by the MPlayer test filter.
  12994. The size of the generated video is fixed, and is 256x256.
  12995. This source is useful in particular for testing encoding features.
  12996. This source accepts the following options:
  12997. @table @option
  12998. @item rate, r
  12999. Specify the frame rate of the sourced video, as the number of frames
  13000. generated per second. It has to be a string in the format
  13001. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13002. number or a valid video frame rate abbreviation. The default value is
  13003. "25".
  13004. @item duration, d
  13005. Set the duration of the sourced video. See
  13006. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13007. for the accepted syntax.
  13008. If not specified, or the expressed duration is negative, the video is
  13009. supposed to be generated forever.
  13010. @item test, t
  13011. Set the number or the name of the test to perform. Supported tests are:
  13012. @table @option
  13013. @item dc_luma
  13014. @item dc_chroma
  13015. @item freq_luma
  13016. @item freq_chroma
  13017. @item amp_luma
  13018. @item amp_chroma
  13019. @item cbp
  13020. @item mv
  13021. @item ring1
  13022. @item ring2
  13023. @item all
  13024. @end table
  13025. Default value is "all", which will cycle through the list of all tests.
  13026. @end table
  13027. Some examples:
  13028. @example
  13029. mptestsrc=t=dc_luma
  13030. @end example
  13031. will generate a "dc_luma" test pattern.
  13032. @section frei0r_src
  13033. Provide a frei0r source.
  13034. To enable compilation of this filter you need to install the frei0r
  13035. header and configure FFmpeg with @code{--enable-frei0r}.
  13036. This source accepts the following parameters:
  13037. @table @option
  13038. @item size
  13039. The size of the video to generate. For the syntax of this option, check the
  13040. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13041. @item framerate
  13042. The framerate of the generated video. It may be a string of the form
  13043. @var{num}/@var{den} or a frame rate abbreviation.
  13044. @item filter_name
  13045. The name to the frei0r source to load. For more information regarding frei0r and
  13046. how to set the parameters, read the @ref{frei0r} section in the video filters
  13047. documentation.
  13048. @item filter_params
  13049. A '|'-separated list of parameters to pass to the frei0r source.
  13050. @end table
  13051. For example, to generate a frei0r partik0l source with size 200x200
  13052. and frame rate 10 which is overlaid on the overlay filter main input:
  13053. @example
  13054. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13055. @end example
  13056. @section life
  13057. Generate a life pattern.
  13058. This source is based on a generalization of John Conway's life game.
  13059. The sourced input represents a life grid, each pixel represents a cell
  13060. which can be in one of two possible states, alive or dead. Every cell
  13061. interacts with its eight neighbours, which are the cells that are
  13062. horizontally, vertically, or diagonally adjacent.
  13063. At each interaction the grid evolves according to the adopted rule,
  13064. which specifies the number of neighbor alive cells which will make a
  13065. cell stay alive or born. The @option{rule} option allows one to specify
  13066. the rule to adopt.
  13067. This source accepts the following options:
  13068. @table @option
  13069. @item filename, f
  13070. Set the file from which to read the initial grid state. In the file,
  13071. each non-whitespace character is considered an alive cell, and newline
  13072. is used to delimit the end of each row.
  13073. If this option is not specified, the initial grid is generated
  13074. randomly.
  13075. @item rate, r
  13076. Set the video rate, that is the number of frames generated per second.
  13077. Default is 25.
  13078. @item random_fill_ratio, ratio
  13079. Set the random fill ratio for the initial random grid. It is a
  13080. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13081. It is ignored when a file is specified.
  13082. @item random_seed, seed
  13083. Set the seed for filling the initial random grid, must be an integer
  13084. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13085. set to -1, the filter will try to use a good random seed on a best
  13086. effort basis.
  13087. @item rule
  13088. Set the life rule.
  13089. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13090. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13091. @var{NS} specifies the number of alive neighbor cells which make a
  13092. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13093. which make a dead cell to become alive (i.e. to "born").
  13094. "s" and "b" can be used in place of "S" and "B", respectively.
  13095. Alternatively a rule can be specified by an 18-bits integer. The 9
  13096. high order bits are used to encode the next cell state if it is alive
  13097. for each number of neighbor alive cells, the low order bits specify
  13098. the rule for "borning" new cells. Higher order bits encode for an
  13099. higher number of neighbor cells.
  13100. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13101. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13102. Default value is "S23/B3", which is the original Conway's game of life
  13103. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13104. cells, and will born a new cell if there are three alive cells around
  13105. a dead cell.
  13106. @item size, s
  13107. Set the size of the output video. For the syntax of this option, check the
  13108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13109. If @option{filename} is specified, the size is set by default to the
  13110. same size of the input file. If @option{size} is set, it must contain
  13111. the size specified in the input file, and the initial grid defined in
  13112. that file is centered in the larger resulting area.
  13113. If a filename is not specified, the size value defaults to "320x240"
  13114. (used for a randomly generated initial grid).
  13115. @item stitch
  13116. If set to 1, stitch the left and right grid edges together, and the
  13117. top and bottom edges also. Defaults to 1.
  13118. @item mold
  13119. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13120. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13121. value from 0 to 255.
  13122. @item life_color
  13123. Set the color of living (or new born) cells.
  13124. @item death_color
  13125. Set the color of dead cells. If @option{mold} is set, this is the first color
  13126. used to represent a dead cell.
  13127. @item mold_color
  13128. Set mold color, for definitely dead and moldy cells.
  13129. For the syntax of these 3 color options, check the "Color" section in the
  13130. ffmpeg-utils manual.
  13131. @end table
  13132. @subsection Examples
  13133. @itemize
  13134. @item
  13135. Read a grid from @file{pattern}, and center it on a grid of size
  13136. 300x300 pixels:
  13137. @example
  13138. life=f=pattern:s=300x300
  13139. @end example
  13140. @item
  13141. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13142. @example
  13143. life=ratio=2/3:s=200x200
  13144. @end example
  13145. @item
  13146. Specify a custom rule for evolving a randomly generated grid:
  13147. @example
  13148. life=rule=S14/B34
  13149. @end example
  13150. @item
  13151. Full example with slow death effect (mold) using @command{ffplay}:
  13152. @example
  13153. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13154. @end example
  13155. @end itemize
  13156. @anchor{allrgb}
  13157. @anchor{allyuv}
  13158. @anchor{color}
  13159. @anchor{haldclutsrc}
  13160. @anchor{nullsrc}
  13161. @anchor{rgbtestsrc}
  13162. @anchor{smptebars}
  13163. @anchor{smptehdbars}
  13164. @anchor{testsrc}
  13165. @anchor{testsrc2}
  13166. @anchor{yuvtestsrc}
  13167. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13168. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13169. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13170. The @code{color} source provides an uniformly colored input.
  13171. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13172. @ref{haldclut} filter.
  13173. The @code{nullsrc} source returns unprocessed video frames. It is
  13174. mainly useful to be employed in analysis / debugging tools, or as the
  13175. source for filters which ignore the input data.
  13176. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13177. detecting RGB vs BGR issues. You should see a red, green and blue
  13178. stripe from top to bottom.
  13179. The @code{smptebars} source generates a color bars pattern, based on
  13180. the SMPTE Engineering Guideline EG 1-1990.
  13181. The @code{smptehdbars} source generates a color bars pattern, based on
  13182. the SMPTE RP 219-2002.
  13183. The @code{testsrc} source generates a test video pattern, showing a
  13184. color pattern, a scrolling gradient and a timestamp. This is mainly
  13185. intended for testing purposes.
  13186. The @code{testsrc2} source is similar to testsrc, but supports more
  13187. pixel formats instead of just @code{rgb24}. This allows using it as an
  13188. input for other tests without requiring a format conversion.
  13189. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13190. see a y, cb and cr stripe from top to bottom.
  13191. The sources accept the following parameters:
  13192. @table @option
  13193. @item level
  13194. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13195. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13196. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13197. coded on a @code{1/(N*N)} scale.
  13198. @item color, c
  13199. Specify the color of the source, only available in the @code{color}
  13200. source. For the syntax of this option, check the "Color" section in the
  13201. ffmpeg-utils manual.
  13202. @item size, s
  13203. Specify the size of the sourced video. For the syntax of this option, check the
  13204. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13205. The default value is @code{320x240}.
  13206. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13207. @code{haldclutsrc} filters.
  13208. @item rate, r
  13209. Specify the frame rate of the sourced video, as the number of frames
  13210. generated per second. It has to be a string in the format
  13211. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13212. number or a valid video frame rate abbreviation. The default value is
  13213. "25".
  13214. @item duration, d
  13215. Set the duration of the sourced video. See
  13216. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13217. for the accepted syntax.
  13218. If not specified, or the expressed duration is negative, the video is
  13219. supposed to be generated forever.
  13220. @item sar
  13221. Set the sample aspect ratio of the sourced video.
  13222. @item alpha
  13223. Specify the alpha (opacity) of the background, only available in the
  13224. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13225. 255 (fully opaque, the default).
  13226. @item decimals, n
  13227. Set the number of decimals to show in the timestamp, only available in the
  13228. @code{testsrc} source.
  13229. The displayed timestamp value will correspond to the original
  13230. timestamp value multiplied by the power of 10 of the specified
  13231. value. Default value is 0.
  13232. @end table
  13233. @subsection Examples
  13234. @itemize
  13235. @item
  13236. Generate a video with a duration of 5.3 seconds, with size
  13237. 176x144 and a frame rate of 10 frames per second:
  13238. @example
  13239. testsrc=duration=5.3:size=qcif:rate=10
  13240. @end example
  13241. @item
  13242. The following graph description will generate a red source
  13243. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13244. frames per second:
  13245. @example
  13246. color=c=red@@0.2:s=qcif:r=10
  13247. @end example
  13248. @item
  13249. If the input content is to be ignored, @code{nullsrc} can be used. The
  13250. following command generates noise in the luminance plane by employing
  13251. the @code{geq} filter:
  13252. @example
  13253. nullsrc=s=256x256, geq=random(1)*255:128:128
  13254. @end example
  13255. @end itemize
  13256. @subsection Commands
  13257. The @code{color} source supports the following commands:
  13258. @table @option
  13259. @item c, color
  13260. Set the color of the created image. Accepts the same syntax of the
  13261. corresponding @option{color} option.
  13262. @end table
  13263. @c man end VIDEO SOURCES
  13264. @chapter Video Sinks
  13265. @c man begin VIDEO SINKS
  13266. Below is a description of the currently available video sinks.
  13267. @section buffersink
  13268. Buffer video frames, and make them available to the end of the filter
  13269. graph.
  13270. This sink is mainly intended for programmatic use, in particular
  13271. through the interface defined in @file{libavfilter/buffersink.h}
  13272. or the options system.
  13273. It accepts a pointer to an AVBufferSinkContext structure, which
  13274. defines the incoming buffers' formats, to be passed as the opaque
  13275. parameter to @code{avfilter_init_filter} for initialization.
  13276. @section nullsink
  13277. Null video sink: do absolutely nothing with the input video. It is
  13278. mainly useful as a template and for use in analysis / debugging
  13279. tools.
  13280. @c man end VIDEO SINKS
  13281. @chapter Multimedia Filters
  13282. @c man begin MULTIMEDIA FILTERS
  13283. Below is a description of the currently available multimedia filters.
  13284. @section abitscope
  13285. Convert input audio to a video output, displaying the audio bit scope.
  13286. The filter accepts the following options:
  13287. @table @option
  13288. @item rate, r
  13289. Set frame rate, expressed as number of frames per second. Default
  13290. value is "25".
  13291. @item size, s
  13292. Specify the video size for the output. For the syntax of this option, check the
  13293. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13294. Default value is @code{1024x256}.
  13295. @item colors
  13296. Specify list of colors separated by space or by '|' which will be used to
  13297. draw channels. Unrecognized or missing colors will be replaced
  13298. by white color.
  13299. @end table
  13300. @section ahistogram
  13301. Convert input audio to a video output, displaying the volume histogram.
  13302. The filter accepts the following options:
  13303. @table @option
  13304. @item dmode
  13305. Specify how histogram is calculated.
  13306. It accepts the following values:
  13307. @table @samp
  13308. @item single
  13309. Use single histogram for all channels.
  13310. @item separate
  13311. Use separate histogram for each channel.
  13312. @end table
  13313. Default is @code{single}.
  13314. @item rate, r
  13315. Set frame rate, expressed as number of frames per second. Default
  13316. value is "25".
  13317. @item size, s
  13318. Specify the video size for the output. For the syntax of this option, check the
  13319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13320. Default value is @code{hd720}.
  13321. @item scale
  13322. Set display scale.
  13323. It accepts the following values:
  13324. @table @samp
  13325. @item log
  13326. logarithmic
  13327. @item sqrt
  13328. square root
  13329. @item cbrt
  13330. cubic root
  13331. @item lin
  13332. linear
  13333. @item rlog
  13334. reverse logarithmic
  13335. @end table
  13336. Default is @code{log}.
  13337. @item ascale
  13338. Set amplitude scale.
  13339. It accepts the following values:
  13340. @table @samp
  13341. @item log
  13342. logarithmic
  13343. @item lin
  13344. linear
  13345. @end table
  13346. Default is @code{log}.
  13347. @item acount
  13348. Set how much frames to accumulate in histogram.
  13349. Defauls is 1. Setting this to -1 accumulates all frames.
  13350. @item rheight
  13351. Set histogram ratio of window height.
  13352. @item slide
  13353. Set sonogram sliding.
  13354. It accepts the following values:
  13355. @table @samp
  13356. @item replace
  13357. replace old rows with new ones.
  13358. @item scroll
  13359. scroll from top to bottom.
  13360. @end table
  13361. Default is @code{replace}.
  13362. @end table
  13363. @section aphasemeter
  13364. Convert input audio to a video output, displaying the audio phase.
  13365. The filter accepts the following options:
  13366. @table @option
  13367. @item rate, r
  13368. Set the output frame rate. Default value is @code{25}.
  13369. @item size, s
  13370. Set the video size for the output. For the syntax of this option, check the
  13371. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13372. Default value is @code{800x400}.
  13373. @item rc
  13374. @item gc
  13375. @item bc
  13376. Specify the red, green, blue contrast. Default values are @code{2},
  13377. @code{7} and @code{1}.
  13378. Allowed range is @code{[0, 255]}.
  13379. @item mpc
  13380. Set color which will be used for drawing median phase. If color is
  13381. @code{none} which is default, no median phase value will be drawn.
  13382. @item video
  13383. Enable video output. Default is enabled.
  13384. @end table
  13385. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13386. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13387. The @code{-1} means left and right channels are completely out of phase and
  13388. @code{1} means channels are in phase.
  13389. @section avectorscope
  13390. Convert input audio to a video output, representing the audio vector
  13391. scope.
  13392. The filter is used to measure the difference between channels of stereo
  13393. audio stream. A monoaural signal, consisting of identical left and right
  13394. signal, results in straight vertical line. Any stereo separation is visible
  13395. as a deviation from this line, creating a Lissajous figure.
  13396. If the straight (or deviation from it) but horizontal line appears this
  13397. indicates that the left and right channels are out of phase.
  13398. The filter accepts the following options:
  13399. @table @option
  13400. @item mode, m
  13401. Set the vectorscope mode.
  13402. Available values are:
  13403. @table @samp
  13404. @item lissajous
  13405. Lissajous rotated by 45 degrees.
  13406. @item lissajous_xy
  13407. Same as above but not rotated.
  13408. @item polar
  13409. Shape resembling half of circle.
  13410. @end table
  13411. Default value is @samp{lissajous}.
  13412. @item size, s
  13413. Set the video size for the output. For the syntax of this option, check the
  13414. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13415. Default value is @code{400x400}.
  13416. @item rate, r
  13417. Set the output frame rate. Default value is @code{25}.
  13418. @item rc
  13419. @item gc
  13420. @item bc
  13421. @item ac
  13422. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13423. @code{160}, @code{80} and @code{255}.
  13424. Allowed range is @code{[0, 255]}.
  13425. @item rf
  13426. @item gf
  13427. @item bf
  13428. @item af
  13429. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13430. @code{10}, @code{5} and @code{5}.
  13431. Allowed range is @code{[0, 255]}.
  13432. @item zoom
  13433. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13434. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13435. @item draw
  13436. Set the vectorscope drawing mode.
  13437. Available values are:
  13438. @table @samp
  13439. @item dot
  13440. Draw dot for each sample.
  13441. @item line
  13442. Draw line between previous and current sample.
  13443. @end table
  13444. Default value is @samp{dot}.
  13445. @item scale
  13446. Specify amplitude scale of audio samples.
  13447. Available values are:
  13448. @table @samp
  13449. @item lin
  13450. Linear.
  13451. @item sqrt
  13452. Square root.
  13453. @item cbrt
  13454. Cubic root.
  13455. @item log
  13456. Logarithmic.
  13457. @end table
  13458. @item swap
  13459. Swap left channel axis with right channel axis.
  13460. @item mirror
  13461. Mirror axis.
  13462. @table @samp
  13463. @item none
  13464. No mirror.
  13465. @item x
  13466. Mirror only x axis.
  13467. @item y
  13468. Mirror only y axis.
  13469. @item xy
  13470. Mirror both axis.
  13471. @end table
  13472. @end table
  13473. @subsection Examples
  13474. @itemize
  13475. @item
  13476. Complete example using @command{ffplay}:
  13477. @example
  13478. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13479. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13480. @end example
  13481. @end itemize
  13482. @section bench, abench
  13483. Benchmark part of a filtergraph.
  13484. The filter accepts the following options:
  13485. @table @option
  13486. @item action
  13487. Start or stop a timer.
  13488. Available values are:
  13489. @table @samp
  13490. @item start
  13491. Get the current time, set it as frame metadata (using the key
  13492. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13493. @item stop
  13494. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13495. the input frame metadata to get the time difference. Time difference, average,
  13496. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13497. @code{min}) are then printed. The timestamps are expressed in seconds.
  13498. @end table
  13499. @end table
  13500. @subsection Examples
  13501. @itemize
  13502. @item
  13503. Benchmark @ref{selectivecolor} filter:
  13504. @example
  13505. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13506. @end example
  13507. @end itemize
  13508. @section concat
  13509. Concatenate audio and video streams, joining them together one after the
  13510. other.
  13511. The filter works on segments of synchronized video and audio streams. All
  13512. segments must have the same number of streams of each type, and that will
  13513. also be the number of streams at output.
  13514. The filter accepts the following options:
  13515. @table @option
  13516. @item n
  13517. Set the number of segments. Default is 2.
  13518. @item v
  13519. Set the number of output video streams, that is also the number of video
  13520. streams in each segment. Default is 1.
  13521. @item a
  13522. Set the number of output audio streams, that is also the number of audio
  13523. streams in each segment. Default is 0.
  13524. @item unsafe
  13525. Activate unsafe mode: do not fail if segments have a different format.
  13526. @end table
  13527. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13528. @var{a} audio outputs.
  13529. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13530. segment, in the same order as the outputs, then the inputs for the second
  13531. segment, etc.
  13532. Related streams do not always have exactly the same duration, for various
  13533. reasons including codec frame size or sloppy authoring. For that reason,
  13534. related synchronized streams (e.g. a video and its audio track) should be
  13535. concatenated at once. The concat filter will use the duration of the longest
  13536. stream in each segment (except the last one), and if necessary pad shorter
  13537. audio streams with silence.
  13538. For this filter to work correctly, all segments must start at timestamp 0.
  13539. All corresponding streams must have the same parameters in all segments; the
  13540. filtering system will automatically select a common pixel format for video
  13541. streams, and a common sample format, sample rate and channel layout for
  13542. audio streams, but other settings, such as resolution, must be converted
  13543. explicitly by the user.
  13544. Different frame rates are acceptable but will result in variable frame rate
  13545. at output; be sure to configure the output file to handle it.
  13546. @subsection Examples
  13547. @itemize
  13548. @item
  13549. Concatenate an opening, an episode and an ending, all in bilingual version
  13550. (video in stream 0, audio in streams 1 and 2):
  13551. @example
  13552. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13553. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13554. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13555. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13556. @end example
  13557. @item
  13558. Concatenate two parts, handling audio and video separately, using the
  13559. (a)movie sources, and adjusting the resolution:
  13560. @example
  13561. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13562. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13563. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13564. @end example
  13565. Note that a desync will happen at the stitch if the audio and video streams
  13566. do not have exactly the same duration in the first file.
  13567. @end itemize
  13568. @section drawgraph, adrawgraph
  13569. Draw a graph using input video or audio metadata.
  13570. It accepts the following parameters:
  13571. @table @option
  13572. @item m1
  13573. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13574. @item fg1
  13575. Set 1st foreground color expression.
  13576. @item m2
  13577. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13578. @item fg2
  13579. Set 2nd foreground color expression.
  13580. @item m3
  13581. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13582. @item fg3
  13583. Set 3rd foreground color expression.
  13584. @item m4
  13585. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13586. @item fg4
  13587. Set 4th foreground color expression.
  13588. @item min
  13589. Set minimal value of metadata value.
  13590. @item max
  13591. Set maximal value of metadata value.
  13592. @item bg
  13593. Set graph background color. Default is white.
  13594. @item mode
  13595. Set graph mode.
  13596. Available values for mode is:
  13597. @table @samp
  13598. @item bar
  13599. @item dot
  13600. @item line
  13601. @end table
  13602. Default is @code{line}.
  13603. @item slide
  13604. Set slide mode.
  13605. Available values for slide is:
  13606. @table @samp
  13607. @item frame
  13608. Draw new frame when right border is reached.
  13609. @item replace
  13610. Replace old columns with new ones.
  13611. @item scroll
  13612. Scroll from right to left.
  13613. @item rscroll
  13614. Scroll from left to right.
  13615. @item picture
  13616. Draw single picture.
  13617. @end table
  13618. Default is @code{frame}.
  13619. @item size
  13620. Set size of graph video. For the syntax of this option, check the
  13621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13622. The default value is @code{900x256}.
  13623. The foreground color expressions can use the following variables:
  13624. @table @option
  13625. @item MIN
  13626. Minimal value of metadata value.
  13627. @item MAX
  13628. Maximal value of metadata value.
  13629. @item VAL
  13630. Current metadata key value.
  13631. @end table
  13632. The color is defined as 0xAABBGGRR.
  13633. @end table
  13634. Example using metadata from @ref{signalstats} filter:
  13635. @example
  13636. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13637. @end example
  13638. Example using metadata from @ref{ebur128} filter:
  13639. @example
  13640. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13641. @end example
  13642. @anchor{ebur128}
  13643. @section ebur128
  13644. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13645. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13646. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13647. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13648. The filter also has a video output (see the @var{video} option) with a real
  13649. time graph to observe the loudness evolution. The graphic contains the logged
  13650. message mentioned above, so it is not printed anymore when this option is set,
  13651. unless the verbose logging is set. The main graphing area contains the
  13652. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13653. the momentary loudness (400 milliseconds).
  13654. More information about the Loudness Recommendation EBU R128 on
  13655. @url{http://tech.ebu.ch/loudness}.
  13656. The filter accepts the following options:
  13657. @table @option
  13658. @item video
  13659. Activate the video output. The audio stream is passed unchanged whether this
  13660. option is set or no. The video stream will be the first output stream if
  13661. activated. Default is @code{0}.
  13662. @item size
  13663. Set the video size. This option is for video only. For the syntax of this
  13664. option, check the
  13665. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13666. Default and minimum resolution is @code{640x480}.
  13667. @item meter
  13668. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13669. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13670. other integer value between this range is allowed.
  13671. @item metadata
  13672. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13673. into 100ms output frames, each of them containing various loudness information
  13674. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13675. Default is @code{0}.
  13676. @item framelog
  13677. Force the frame logging level.
  13678. Available values are:
  13679. @table @samp
  13680. @item info
  13681. information logging level
  13682. @item verbose
  13683. verbose logging level
  13684. @end table
  13685. By default, the logging level is set to @var{info}. If the @option{video} or
  13686. the @option{metadata} options are set, it switches to @var{verbose}.
  13687. @item peak
  13688. Set peak mode(s).
  13689. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13690. values are:
  13691. @table @samp
  13692. @item none
  13693. Disable any peak mode (default).
  13694. @item sample
  13695. Enable sample-peak mode.
  13696. Simple peak mode looking for the higher sample value. It logs a message
  13697. for sample-peak (identified by @code{SPK}).
  13698. @item true
  13699. Enable true-peak mode.
  13700. If enabled, the peak lookup is done on an over-sampled version of the input
  13701. stream for better peak accuracy. It logs a message for true-peak.
  13702. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13703. This mode requires a build with @code{libswresample}.
  13704. @end table
  13705. @item dualmono
  13706. Treat mono input files as "dual mono". If a mono file is intended for playback
  13707. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13708. If set to @code{true}, this option will compensate for this effect.
  13709. Multi-channel input files are not affected by this option.
  13710. @item panlaw
  13711. Set a specific pan law to be used for the measurement of dual mono files.
  13712. This parameter is optional, and has a default value of -3.01dB.
  13713. @end table
  13714. @subsection Examples
  13715. @itemize
  13716. @item
  13717. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13718. @example
  13719. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13720. @end example
  13721. @item
  13722. Run an analysis with @command{ffmpeg}:
  13723. @example
  13724. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13725. @end example
  13726. @end itemize
  13727. @section interleave, ainterleave
  13728. Temporally interleave frames from several inputs.
  13729. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13730. These filters read frames from several inputs and send the oldest
  13731. queued frame to the output.
  13732. Input streams must have well defined, monotonically increasing frame
  13733. timestamp values.
  13734. In order to submit one frame to output, these filters need to enqueue
  13735. at least one frame for each input, so they cannot work in case one
  13736. input is not yet terminated and will not receive incoming frames.
  13737. For example consider the case when one input is a @code{select} filter
  13738. which always drops input frames. The @code{interleave} filter will keep
  13739. reading from that input, but it will never be able to send new frames
  13740. to output until the input sends an end-of-stream signal.
  13741. Also, depending on inputs synchronization, the filters will drop
  13742. frames in case one input receives more frames than the other ones, and
  13743. the queue is already filled.
  13744. These filters accept the following options:
  13745. @table @option
  13746. @item nb_inputs, n
  13747. Set the number of different inputs, it is 2 by default.
  13748. @end table
  13749. @subsection Examples
  13750. @itemize
  13751. @item
  13752. Interleave frames belonging to different streams using @command{ffmpeg}:
  13753. @example
  13754. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13755. @end example
  13756. @item
  13757. Add flickering blur effect:
  13758. @example
  13759. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13760. @end example
  13761. @end itemize
  13762. @section metadata, ametadata
  13763. Manipulate frame metadata.
  13764. This filter accepts the following options:
  13765. @table @option
  13766. @item mode
  13767. Set mode of operation of the filter.
  13768. Can be one of the following:
  13769. @table @samp
  13770. @item select
  13771. If both @code{value} and @code{key} is set, select frames
  13772. which have such metadata. If only @code{key} is set, select
  13773. every frame that has such key in metadata.
  13774. @item add
  13775. Add new metadata @code{key} and @code{value}. If key is already available
  13776. do nothing.
  13777. @item modify
  13778. Modify value of already present key.
  13779. @item delete
  13780. If @code{value} is set, delete only keys that have such value.
  13781. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13782. the frame.
  13783. @item print
  13784. Print key and its value if metadata was found. If @code{key} is not set print all
  13785. metadata values available in frame.
  13786. @end table
  13787. @item key
  13788. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13789. @item value
  13790. Set metadata value which will be used. This option is mandatory for
  13791. @code{modify} and @code{add} mode.
  13792. @item function
  13793. Which function to use when comparing metadata value and @code{value}.
  13794. Can be one of following:
  13795. @table @samp
  13796. @item same_str
  13797. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13798. @item starts_with
  13799. Values are interpreted as strings, returns true if metadata value starts with
  13800. the @code{value} option string.
  13801. @item less
  13802. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13803. @item equal
  13804. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13805. @item greater
  13806. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13807. @item expr
  13808. Values are interpreted as floats, returns true if expression from option @code{expr}
  13809. evaluates to true.
  13810. @end table
  13811. @item expr
  13812. Set expression which is used when @code{function} is set to @code{expr}.
  13813. The expression is evaluated through the eval API and can contain the following
  13814. constants:
  13815. @table @option
  13816. @item VALUE1
  13817. Float representation of @code{value} from metadata key.
  13818. @item VALUE2
  13819. Float representation of @code{value} as supplied by user in @code{value} option.
  13820. @end table
  13821. @item file
  13822. If specified in @code{print} mode, output is written to the named file. Instead of
  13823. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13824. for standard output. If @code{file} option is not set, output is written to the log
  13825. with AV_LOG_INFO loglevel.
  13826. @end table
  13827. @subsection Examples
  13828. @itemize
  13829. @item
  13830. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13831. between 0 and 1.
  13832. @example
  13833. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13834. @end example
  13835. @item
  13836. Print silencedetect output to file @file{metadata.txt}.
  13837. @example
  13838. silencedetect,ametadata=mode=print:file=metadata.txt
  13839. @end example
  13840. @item
  13841. Direct all metadata to a pipe with file descriptor 4.
  13842. @example
  13843. metadata=mode=print:file='pipe\:4'
  13844. @end example
  13845. @end itemize
  13846. @section perms, aperms
  13847. Set read/write permissions for the output frames.
  13848. These filters are mainly aimed at developers to test direct path in the
  13849. following filter in the filtergraph.
  13850. The filters accept the following options:
  13851. @table @option
  13852. @item mode
  13853. Select the permissions mode.
  13854. It accepts the following values:
  13855. @table @samp
  13856. @item none
  13857. Do nothing. This is the default.
  13858. @item ro
  13859. Set all the output frames read-only.
  13860. @item rw
  13861. Set all the output frames directly writable.
  13862. @item toggle
  13863. Make the frame read-only if writable, and writable if read-only.
  13864. @item random
  13865. Set each output frame read-only or writable randomly.
  13866. @end table
  13867. @item seed
  13868. Set the seed for the @var{random} mode, must be an integer included between
  13869. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13870. @code{-1}, the filter will try to use a good random seed on a best effort
  13871. basis.
  13872. @end table
  13873. Note: in case of auto-inserted filter between the permission filter and the
  13874. following one, the permission might not be received as expected in that
  13875. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13876. perms/aperms filter can avoid this problem.
  13877. @section realtime, arealtime
  13878. Slow down filtering to match real time approximately.
  13879. These filters will pause the filtering for a variable amount of time to
  13880. match the output rate with the input timestamps.
  13881. They are similar to the @option{re} option to @code{ffmpeg}.
  13882. They accept the following options:
  13883. @table @option
  13884. @item limit
  13885. Time limit for the pauses. Any pause longer than that will be considered
  13886. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13887. @end table
  13888. @anchor{select}
  13889. @section select, aselect
  13890. Select frames to pass in output.
  13891. This filter accepts the following options:
  13892. @table @option
  13893. @item expr, e
  13894. Set expression, which is evaluated for each input frame.
  13895. If the expression is evaluated to zero, the frame is discarded.
  13896. If the evaluation result is negative or NaN, the frame is sent to the
  13897. first output; otherwise it is sent to the output with index
  13898. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13899. For example a value of @code{1.2} corresponds to the output with index
  13900. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13901. @item outputs, n
  13902. Set the number of outputs. The output to which to send the selected
  13903. frame is based on the result of the evaluation. Default value is 1.
  13904. @end table
  13905. The expression can contain the following constants:
  13906. @table @option
  13907. @item n
  13908. The (sequential) number of the filtered frame, starting from 0.
  13909. @item selected_n
  13910. The (sequential) number of the selected frame, starting from 0.
  13911. @item prev_selected_n
  13912. The sequential number of the last selected frame. It's NAN if undefined.
  13913. @item TB
  13914. The timebase of the input timestamps.
  13915. @item pts
  13916. The PTS (Presentation TimeStamp) of the filtered video frame,
  13917. expressed in @var{TB} units. It's NAN if undefined.
  13918. @item t
  13919. The PTS of the filtered video frame,
  13920. expressed in seconds. It's NAN if undefined.
  13921. @item prev_pts
  13922. The PTS of the previously filtered video frame. It's NAN if undefined.
  13923. @item prev_selected_pts
  13924. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13925. @item prev_selected_t
  13926. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13927. @item start_pts
  13928. The PTS of the first video frame in the video. It's NAN if undefined.
  13929. @item start_t
  13930. The time of the first video frame in the video. It's NAN if undefined.
  13931. @item pict_type @emph{(video only)}
  13932. The type of the filtered frame. It can assume one of the following
  13933. values:
  13934. @table @option
  13935. @item I
  13936. @item P
  13937. @item B
  13938. @item S
  13939. @item SI
  13940. @item SP
  13941. @item BI
  13942. @end table
  13943. @item interlace_type @emph{(video only)}
  13944. The frame interlace type. It can assume one of the following values:
  13945. @table @option
  13946. @item PROGRESSIVE
  13947. The frame is progressive (not interlaced).
  13948. @item TOPFIRST
  13949. The frame is top-field-first.
  13950. @item BOTTOMFIRST
  13951. The frame is bottom-field-first.
  13952. @end table
  13953. @item consumed_sample_n @emph{(audio only)}
  13954. the number of selected samples before the current frame
  13955. @item samples_n @emph{(audio only)}
  13956. the number of samples in the current frame
  13957. @item sample_rate @emph{(audio only)}
  13958. the input sample rate
  13959. @item key
  13960. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13961. @item pos
  13962. the position in the file of the filtered frame, -1 if the information
  13963. is not available (e.g. for synthetic video)
  13964. @item scene @emph{(video only)}
  13965. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13966. probability for the current frame to introduce a new scene, while a higher
  13967. value means the current frame is more likely to be one (see the example below)
  13968. @item concatdec_select
  13969. The concat demuxer can select only part of a concat input file by setting an
  13970. inpoint and an outpoint, but the output packets may not be entirely contained
  13971. in the selected interval. By using this variable, it is possible to skip frames
  13972. generated by the concat demuxer which are not exactly contained in the selected
  13973. interval.
  13974. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13975. and the @var{lavf.concat.duration} packet metadata values which are also
  13976. present in the decoded frames.
  13977. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13978. start_time and either the duration metadata is missing or the frame pts is less
  13979. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13980. missing.
  13981. That basically means that an input frame is selected if its pts is within the
  13982. interval set by the concat demuxer.
  13983. @end table
  13984. The default value of the select expression is "1".
  13985. @subsection Examples
  13986. @itemize
  13987. @item
  13988. Select all frames in input:
  13989. @example
  13990. select
  13991. @end example
  13992. The example above is the same as:
  13993. @example
  13994. select=1
  13995. @end example
  13996. @item
  13997. Skip all frames:
  13998. @example
  13999. select=0
  14000. @end example
  14001. @item
  14002. Select only I-frames:
  14003. @example
  14004. select='eq(pict_type\,I)'
  14005. @end example
  14006. @item
  14007. Select one frame every 100:
  14008. @example
  14009. select='not(mod(n\,100))'
  14010. @end example
  14011. @item
  14012. Select only frames contained in the 10-20 time interval:
  14013. @example
  14014. select=between(t\,10\,20)
  14015. @end example
  14016. @item
  14017. Select only I-frames contained in the 10-20 time interval:
  14018. @example
  14019. select=between(t\,10\,20)*eq(pict_type\,I)
  14020. @end example
  14021. @item
  14022. Select frames with a minimum distance of 10 seconds:
  14023. @example
  14024. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14025. @end example
  14026. @item
  14027. Use aselect to select only audio frames with samples number > 100:
  14028. @example
  14029. aselect='gt(samples_n\,100)'
  14030. @end example
  14031. @item
  14032. Create a mosaic of the first scenes:
  14033. @example
  14034. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14035. @end example
  14036. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14037. choice.
  14038. @item
  14039. Send even and odd frames to separate outputs, and compose them:
  14040. @example
  14041. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14042. @end example
  14043. @item
  14044. Select useful frames from an ffconcat file which is using inpoints and
  14045. outpoints but where the source files are not intra frame only.
  14046. @example
  14047. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14048. @end example
  14049. @end itemize
  14050. @section sendcmd, asendcmd
  14051. Send commands to filters in the filtergraph.
  14052. These filters read commands to be sent to other filters in the
  14053. filtergraph.
  14054. @code{sendcmd} must be inserted between two video filters,
  14055. @code{asendcmd} must be inserted between two audio filters, but apart
  14056. from that they act the same way.
  14057. The specification of commands can be provided in the filter arguments
  14058. with the @var{commands} option, or in a file specified by the
  14059. @var{filename} option.
  14060. These filters accept the following options:
  14061. @table @option
  14062. @item commands, c
  14063. Set the commands to be read and sent to the other filters.
  14064. @item filename, f
  14065. Set the filename of the commands to be read and sent to the other
  14066. filters.
  14067. @end table
  14068. @subsection Commands syntax
  14069. A commands description consists of a sequence of interval
  14070. specifications, comprising a list of commands to be executed when a
  14071. particular event related to that interval occurs. The occurring event
  14072. is typically the current frame time entering or leaving a given time
  14073. interval.
  14074. An interval is specified by the following syntax:
  14075. @example
  14076. @var{START}[-@var{END}] @var{COMMANDS};
  14077. @end example
  14078. The time interval is specified by the @var{START} and @var{END} times.
  14079. @var{END} is optional and defaults to the maximum time.
  14080. The current frame time is considered within the specified interval if
  14081. it is included in the interval [@var{START}, @var{END}), that is when
  14082. the time is greater or equal to @var{START} and is lesser than
  14083. @var{END}.
  14084. @var{COMMANDS} consists of a sequence of one or more command
  14085. specifications, separated by ",", relating to that interval. The
  14086. syntax of a command specification is given by:
  14087. @example
  14088. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14089. @end example
  14090. @var{FLAGS} is optional and specifies the type of events relating to
  14091. the time interval which enable sending the specified command, and must
  14092. be a non-null sequence of identifier flags separated by "+" or "|" and
  14093. enclosed between "[" and "]".
  14094. The following flags are recognized:
  14095. @table @option
  14096. @item enter
  14097. The command is sent when the current frame timestamp enters the
  14098. specified interval. In other words, the command is sent when the
  14099. previous frame timestamp was not in the given interval, and the
  14100. current is.
  14101. @item leave
  14102. The command is sent when the current frame timestamp leaves the
  14103. specified interval. In other words, the command is sent when the
  14104. previous frame timestamp was in the given interval, and the
  14105. current is not.
  14106. @end table
  14107. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14108. assumed.
  14109. @var{TARGET} specifies the target of the command, usually the name of
  14110. the filter class or a specific filter instance name.
  14111. @var{COMMAND} specifies the name of the command for the target filter.
  14112. @var{ARG} is optional and specifies the optional list of argument for
  14113. the given @var{COMMAND}.
  14114. Between one interval specification and another, whitespaces, or
  14115. sequences of characters starting with @code{#} until the end of line,
  14116. are ignored and can be used to annotate comments.
  14117. A simplified BNF description of the commands specification syntax
  14118. follows:
  14119. @example
  14120. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14121. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14122. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14123. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14124. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14125. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14126. @end example
  14127. @subsection Examples
  14128. @itemize
  14129. @item
  14130. Specify audio tempo change at second 4:
  14131. @example
  14132. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14133. @end example
  14134. @item
  14135. Target a specific filter instance:
  14136. @example
  14137. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14138. @end example
  14139. @item
  14140. Specify a list of drawtext and hue commands in a file.
  14141. @example
  14142. # show text in the interval 5-10
  14143. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14144. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14145. # desaturate the image in the interval 15-20
  14146. 15.0-20.0 [enter] hue s 0,
  14147. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14148. [leave] hue s 1,
  14149. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14150. # apply an exponential saturation fade-out effect, starting from time 25
  14151. 25 [enter] hue s exp(25-t)
  14152. @end example
  14153. A filtergraph allowing to read and process the above command list
  14154. stored in a file @file{test.cmd}, can be specified with:
  14155. @example
  14156. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14157. @end example
  14158. @end itemize
  14159. @anchor{setpts}
  14160. @section setpts, asetpts
  14161. Change the PTS (presentation timestamp) of the input frames.
  14162. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14163. This filter accepts the following options:
  14164. @table @option
  14165. @item expr
  14166. The expression which is evaluated for each frame to construct its timestamp.
  14167. @end table
  14168. The expression is evaluated through the eval API and can contain the following
  14169. constants:
  14170. @table @option
  14171. @item FRAME_RATE
  14172. frame rate, only defined for constant frame-rate video
  14173. @item PTS
  14174. The presentation timestamp in input
  14175. @item N
  14176. The count of the input frame for video or the number of consumed samples,
  14177. not including the current frame for audio, starting from 0.
  14178. @item NB_CONSUMED_SAMPLES
  14179. The number of consumed samples, not including the current frame (only
  14180. audio)
  14181. @item NB_SAMPLES, S
  14182. The number of samples in the current frame (only audio)
  14183. @item SAMPLE_RATE, SR
  14184. The audio sample rate.
  14185. @item STARTPTS
  14186. The PTS of the first frame.
  14187. @item STARTT
  14188. the time in seconds of the first frame
  14189. @item INTERLACED
  14190. State whether the current frame is interlaced.
  14191. @item T
  14192. the time in seconds of the current frame
  14193. @item POS
  14194. original position in the file of the frame, or undefined if undefined
  14195. for the current frame
  14196. @item PREV_INPTS
  14197. The previous input PTS.
  14198. @item PREV_INT
  14199. previous input time in seconds
  14200. @item PREV_OUTPTS
  14201. The previous output PTS.
  14202. @item PREV_OUTT
  14203. previous output time in seconds
  14204. @item RTCTIME
  14205. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14206. instead.
  14207. @item RTCSTART
  14208. The wallclock (RTC) time at the start of the movie in microseconds.
  14209. @item TB
  14210. The timebase of the input timestamps.
  14211. @end table
  14212. @subsection Examples
  14213. @itemize
  14214. @item
  14215. Start counting PTS from zero
  14216. @example
  14217. setpts=PTS-STARTPTS
  14218. @end example
  14219. @item
  14220. Apply fast motion effect:
  14221. @example
  14222. setpts=0.5*PTS
  14223. @end example
  14224. @item
  14225. Apply slow motion effect:
  14226. @example
  14227. setpts=2.0*PTS
  14228. @end example
  14229. @item
  14230. Set fixed rate of 25 frames per second:
  14231. @example
  14232. setpts=N/(25*TB)
  14233. @end example
  14234. @item
  14235. Set fixed rate 25 fps with some jitter:
  14236. @example
  14237. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14238. @end example
  14239. @item
  14240. Apply an offset of 10 seconds to the input PTS:
  14241. @example
  14242. setpts=PTS+10/TB
  14243. @end example
  14244. @item
  14245. Generate timestamps from a "live source" and rebase onto the current timebase:
  14246. @example
  14247. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14248. @end example
  14249. @item
  14250. Generate timestamps by counting samples:
  14251. @example
  14252. asetpts=N/SR/TB
  14253. @end example
  14254. @end itemize
  14255. @section setrange
  14256. Force color range for the output video frame.
  14257. The @code{setrange} filter marks the color range property for the
  14258. output frames. It does not change the input frame, but only sets the
  14259. corresponding property, which affects how the frame is treated by
  14260. following filters.
  14261. The filter accepts the following options:
  14262. @table @option
  14263. @item range
  14264. Available values are:
  14265. @table @samp
  14266. @item auto
  14267. Keep the same color range property.
  14268. @item unspecified, unknown
  14269. Set the color range as unspecified.
  14270. @item limited, tv, mpeg
  14271. Set the color range as limited.
  14272. @item full, pc, jpeg
  14273. Set the color range as full.
  14274. @end table
  14275. @end table
  14276. @section settb, asettb
  14277. Set the timebase to use for the output frames timestamps.
  14278. It is mainly useful for testing timebase configuration.
  14279. It accepts the following parameters:
  14280. @table @option
  14281. @item expr, tb
  14282. The expression which is evaluated into the output timebase.
  14283. @end table
  14284. The value for @option{tb} is an arithmetic expression representing a
  14285. rational. The expression can contain the constants "AVTB" (the default
  14286. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14287. audio only). Default value is "intb".
  14288. @subsection Examples
  14289. @itemize
  14290. @item
  14291. Set the timebase to 1/25:
  14292. @example
  14293. settb=expr=1/25
  14294. @end example
  14295. @item
  14296. Set the timebase to 1/10:
  14297. @example
  14298. settb=expr=0.1
  14299. @end example
  14300. @item
  14301. Set the timebase to 1001/1000:
  14302. @example
  14303. settb=1+0.001
  14304. @end example
  14305. @item
  14306. Set the timebase to 2*intb:
  14307. @example
  14308. settb=2*intb
  14309. @end example
  14310. @item
  14311. Set the default timebase value:
  14312. @example
  14313. settb=AVTB
  14314. @end example
  14315. @end itemize
  14316. @section showcqt
  14317. Convert input audio to a video output representing frequency spectrum
  14318. logarithmically using Brown-Puckette constant Q transform algorithm with
  14319. direct frequency domain coefficient calculation (but the transform itself
  14320. is not really constant Q, instead the Q factor is actually variable/clamped),
  14321. with musical tone scale, from E0 to D#10.
  14322. The filter accepts the following options:
  14323. @table @option
  14324. @item size, s
  14325. Specify the video size for the output. It must be even. For the syntax of this option,
  14326. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14327. Default value is @code{1920x1080}.
  14328. @item fps, rate, r
  14329. Set the output frame rate. Default value is @code{25}.
  14330. @item bar_h
  14331. Set the bargraph height. It must be even. Default value is @code{-1} which
  14332. computes the bargraph height automatically.
  14333. @item axis_h
  14334. Set the axis height. It must be even. Default value is @code{-1} which computes
  14335. the axis height automatically.
  14336. @item sono_h
  14337. Set the sonogram height. It must be even. Default value is @code{-1} which
  14338. computes the sonogram height automatically.
  14339. @item fullhd
  14340. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14341. instead. Default value is @code{1}.
  14342. @item sono_v, volume
  14343. Specify the sonogram volume expression. It can contain variables:
  14344. @table @option
  14345. @item bar_v
  14346. the @var{bar_v} evaluated expression
  14347. @item frequency, freq, f
  14348. the frequency where it is evaluated
  14349. @item timeclamp, tc
  14350. the value of @var{timeclamp} option
  14351. @end table
  14352. and functions:
  14353. @table @option
  14354. @item a_weighting(f)
  14355. A-weighting of equal loudness
  14356. @item b_weighting(f)
  14357. B-weighting of equal loudness
  14358. @item c_weighting(f)
  14359. C-weighting of equal loudness.
  14360. @end table
  14361. Default value is @code{16}.
  14362. @item bar_v, volume2
  14363. Specify the bargraph volume expression. It can contain variables:
  14364. @table @option
  14365. @item sono_v
  14366. the @var{sono_v} evaluated expression
  14367. @item frequency, freq, f
  14368. the frequency where it is evaluated
  14369. @item timeclamp, tc
  14370. the value of @var{timeclamp} option
  14371. @end table
  14372. and functions:
  14373. @table @option
  14374. @item a_weighting(f)
  14375. A-weighting of equal loudness
  14376. @item b_weighting(f)
  14377. B-weighting of equal loudness
  14378. @item c_weighting(f)
  14379. C-weighting of equal loudness.
  14380. @end table
  14381. Default value is @code{sono_v}.
  14382. @item sono_g, gamma
  14383. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14384. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14385. Acceptable range is @code{[1, 7]}.
  14386. @item bar_g, gamma2
  14387. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14388. @code{[1, 7]}.
  14389. @item bar_t
  14390. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14391. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14392. @item timeclamp, tc
  14393. Specify the transform timeclamp. At low frequency, there is trade-off between
  14394. accuracy in time domain and frequency domain. If timeclamp is lower,
  14395. event in time domain is represented more accurately (such as fast bass drum),
  14396. otherwise event in frequency domain is represented more accurately
  14397. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14398. @item attack
  14399. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14400. limits future samples by applying asymmetric windowing in time domain, useful
  14401. when low latency is required. Accepted range is @code{[0, 1]}.
  14402. @item basefreq
  14403. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14404. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14405. @item endfreq
  14406. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14407. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14408. @item coeffclamp
  14409. This option is deprecated and ignored.
  14410. @item tlength
  14411. Specify the transform length in time domain. Use this option to control accuracy
  14412. trade-off between time domain and frequency domain at every frequency sample.
  14413. It can contain variables:
  14414. @table @option
  14415. @item frequency, freq, f
  14416. the frequency where it is evaluated
  14417. @item timeclamp, tc
  14418. the value of @var{timeclamp} option.
  14419. @end table
  14420. Default value is @code{384*tc/(384+tc*f)}.
  14421. @item count
  14422. Specify the transform count for every video frame. Default value is @code{6}.
  14423. Acceptable range is @code{[1, 30]}.
  14424. @item fcount
  14425. Specify the transform count for every single pixel. Default value is @code{0},
  14426. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14427. @item fontfile
  14428. Specify font file for use with freetype to draw the axis. If not specified,
  14429. use embedded font. Note that drawing with font file or embedded font is not
  14430. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14431. option instead.
  14432. @item font
  14433. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14434. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14435. @item fontcolor
  14436. Specify font color expression. This is arithmetic expression that should return
  14437. integer value 0xRRGGBB. It can contain variables:
  14438. @table @option
  14439. @item frequency, freq, f
  14440. the frequency where it is evaluated
  14441. @item timeclamp, tc
  14442. the value of @var{timeclamp} option
  14443. @end table
  14444. and functions:
  14445. @table @option
  14446. @item midi(f)
  14447. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14448. @item r(x), g(x), b(x)
  14449. red, green, and blue value of intensity x.
  14450. @end table
  14451. Default value is @code{st(0, (midi(f)-59.5)/12);
  14452. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14453. r(1-ld(1)) + b(ld(1))}.
  14454. @item axisfile
  14455. Specify image file to draw the axis. This option override @var{fontfile} and
  14456. @var{fontcolor} option.
  14457. @item axis, text
  14458. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14459. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14460. Default value is @code{1}.
  14461. @item csp
  14462. Set colorspace. The accepted values are:
  14463. @table @samp
  14464. @item unspecified
  14465. Unspecified (default)
  14466. @item bt709
  14467. BT.709
  14468. @item fcc
  14469. FCC
  14470. @item bt470bg
  14471. BT.470BG or BT.601-6 625
  14472. @item smpte170m
  14473. SMPTE-170M or BT.601-6 525
  14474. @item smpte240m
  14475. SMPTE-240M
  14476. @item bt2020ncl
  14477. BT.2020 with non-constant luminance
  14478. @end table
  14479. @item cscheme
  14480. Set spectrogram color scheme. This is list of floating point values with format
  14481. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14482. The default is @code{1|0.5|0|0|0.5|1}.
  14483. @end table
  14484. @subsection Examples
  14485. @itemize
  14486. @item
  14487. Playing audio while showing the spectrum:
  14488. @example
  14489. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14490. @end example
  14491. @item
  14492. Same as above, but with frame rate 30 fps:
  14493. @example
  14494. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14495. @end example
  14496. @item
  14497. Playing at 1280x720:
  14498. @example
  14499. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14500. @end example
  14501. @item
  14502. Disable sonogram display:
  14503. @example
  14504. sono_h=0
  14505. @end example
  14506. @item
  14507. A1 and its harmonics: A1, A2, (near)E3, A3:
  14508. @example
  14509. 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),
  14510. asplit[a][out1]; [a] showcqt [out0]'
  14511. @end example
  14512. @item
  14513. Same as above, but with more accuracy in frequency domain:
  14514. @example
  14515. 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),
  14516. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14517. @end example
  14518. @item
  14519. Custom volume:
  14520. @example
  14521. bar_v=10:sono_v=bar_v*a_weighting(f)
  14522. @end example
  14523. @item
  14524. Custom gamma, now spectrum is linear to the amplitude.
  14525. @example
  14526. bar_g=2:sono_g=2
  14527. @end example
  14528. @item
  14529. Custom tlength equation:
  14530. @example
  14531. 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)))'
  14532. @end example
  14533. @item
  14534. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14535. @example
  14536. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14537. @end example
  14538. @item
  14539. Custom font using fontconfig:
  14540. @example
  14541. font='Courier New,Monospace,mono|bold'
  14542. @end example
  14543. @item
  14544. Custom frequency range with custom axis using image file:
  14545. @example
  14546. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14547. @end example
  14548. @end itemize
  14549. @section showfreqs
  14550. Convert input audio to video output representing the audio power spectrum.
  14551. Audio amplitude is on Y-axis while frequency is on X-axis.
  14552. The filter accepts the following options:
  14553. @table @option
  14554. @item size, s
  14555. Specify size of video. For the syntax of this option, check the
  14556. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14557. Default is @code{1024x512}.
  14558. @item mode
  14559. Set display mode.
  14560. This set how each frequency bin will be represented.
  14561. It accepts the following values:
  14562. @table @samp
  14563. @item line
  14564. @item bar
  14565. @item dot
  14566. @end table
  14567. Default is @code{bar}.
  14568. @item ascale
  14569. Set amplitude scale.
  14570. It accepts the following values:
  14571. @table @samp
  14572. @item lin
  14573. Linear scale.
  14574. @item sqrt
  14575. Square root scale.
  14576. @item cbrt
  14577. Cubic root scale.
  14578. @item log
  14579. Logarithmic scale.
  14580. @end table
  14581. Default is @code{log}.
  14582. @item fscale
  14583. Set frequency scale.
  14584. It accepts the following values:
  14585. @table @samp
  14586. @item lin
  14587. Linear scale.
  14588. @item log
  14589. Logarithmic scale.
  14590. @item rlog
  14591. Reverse logarithmic scale.
  14592. @end table
  14593. Default is @code{lin}.
  14594. @item win_size
  14595. Set window size.
  14596. It accepts the following values:
  14597. @table @samp
  14598. @item w16
  14599. @item w32
  14600. @item w64
  14601. @item w128
  14602. @item w256
  14603. @item w512
  14604. @item w1024
  14605. @item w2048
  14606. @item w4096
  14607. @item w8192
  14608. @item w16384
  14609. @item w32768
  14610. @item w65536
  14611. @end table
  14612. Default is @code{w2048}
  14613. @item win_func
  14614. Set windowing function.
  14615. It accepts the following values:
  14616. @table @samp
  14617. @item rect
  14618. @item bartlett
  14619. @item hanning
  14620. @item hamming
  14621. @item blackman
  14622. @item welch
  14623. @item flattop
  14624. @item bharris
  14625. @item bnuttall
  14626. @item bhann
  14627. @item sine
  14628. @item nuttall
  14629. @item lanczos
  14630. @item gauss
  14631. @item tukey
  14632. @item dolph
  14633. @item cauchy
  14634. @item parzen
  14635. @item poisson
  14636. @end table
  14637. Default is @code{hanning}.
  14638. @item overlap
  14639. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14640. which means optimal overlap for selected window function will be picked.
  14641. @item averaging
  14642. Set time averaging. Setting this to 0 will display current maximal peaks.
  14643. Default is @code{1}, which means time averaging is disabled.
  14644. @item colors
  14645. Specify list of colors separated by space or by '|' which will be used to
  14646. draw channel frequencies. Unrecognized or missing colors will be replaced
  14647. by white color.
  14648. @item cmode
  14649. Set channel display mode.
  14650. It accepts the following values:
  14651. @table @samp
  14652. @item combined
  14653. @item separate
  14654. @end table
  14655. Default is @code{combined}.
  14656. @item minamp
  14657. Set minimum amplitude used in @code{log} amplitude scaler.
  14658. @end table
  14659. @anchor{showspectrum}
  14660. @section showspectrum
  14661. Convert input audio to a video output, representing the audio frequency
  14662. spectrum.
  14663. The filter accepts the following options:
  14664. @table @option
  14665. @item size, s
  14666. Specify the video size for the output. For the syntax of this option, check the
  14667. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14668. Default value is @code{640x512}.
  14669. @item slide
  14670. Specify how the spectrum should slide along the window.
  14671. It accepts the following values:
  14672. @table @samp
  14673. @item replace
  14674. the samples start again on the left when they reach the right
  14675. @item scroll
  14676. the samples scroll from right to left
  14677. @item fullframe
  14678. frames are only produced when the samples reach the right
  14679. @item rscroll
  14680. the samples scroll from left to right
  14681. @end table
  14682. Default value is @code{replace}.
  14683. @item mode
  14684. Specify display mode.
  14685. It accepts the following values:
  14686. @table @samp
  14687. @item combined
  14688. all channels are displayed in the same row
  14689. @item separate
  14690. all channels are displayed in separate rows
  14691. @end table
  14692. Default value is @samp{combined}.
  14693. @item color
  14694. Specify display color mode.
  14695. It accepts the following values:
  14696. @table @samp
  14697. @item channel
  14698. each channel is displayed in a separate color
  14699. @item intensity
  14700. each channel is displayed using the same color scheme
  14701. @item rainbow
  14702. each channel is displayed using the rainbow color scheme
  14703. @item moreland
  14704. each channel is displayed using the moreland color scheme
  14705. @item nebulae
  14706. each channel is displayed using the nebulae color scheme
  14707. @item fire
  14708. each channel is displayed using the fire color scheme
  14709. @item fiery
  14710. each channel is displayed using the fiery color scheme
  14711. @item fruit
  14712. each channel is displayed using the fruit color scheme
  14713. @item cool
  14714. each channel is displayed using the cool color scheme
  14715. @end table
  14716. Default value is @samp{channel}.
  14717. @item scale
  14718. Specify scale used for calculating intensity color values.
  14719. It accepts the following values:
  14720. @table @samp
  14721. @item lin
  14722. linear
  14723. @item sqrt
  14724. square root, default
  14725. @item cbrt
  14726. cubic root
  14727. @item log
  14728. logarithmic
  14729. @item 4thrt
  14730. 4th root
  14731. @item 5thrt
  14732. 5th root
  14733. @end table
  14734. Default value is @samp{sqrt}.
  14735. @item saturation
  14736. Set saturation modifier for displayed colors. Negative values provide
  14737. alternative color scheme. @code{0} is no saturation at all.
  14738. Saturation must be in [-10.0, 10.0] range.
  14739. Default value is @code{1}.
  14740. @item win_func
  14741. Set window function.
  14742. It accepts the following values:
  14743. @table @samp
  14744. @item rect
  14745. @item bartlett
  14746. @item hann
  14747. @item hanning
  14748. @item hamming
  14749. @item blackman
  14750. @item welch
  14751. @item flattop
  14752. @item bharris
  14753. @item bnuttall
  14754. @item bhann
  14755. @item sine
  14756. @item nuttall
  14757. @item lanczos
  14758. @item gauss
  14759. @item tukey
  14760. @item dolph
  14761. @item cauchy
  14762. @item parzen
  14763. @item poisson
  14764. @end table
  14765. Default value is @code{hann}.
  14766. @item orientation
  14767. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14768. @code{horizontal}. Default is @code{vertical}.
  14769. @item overlap
  14770. Set ratio of overlap window. Default value is @code{0}.
  14771. When value is @code{1} overlap is set to recommended size for specific
  14772. window function currently used.
  14773. @item gain
  14774. Set scale gain for calculating intensity color values.
  14775. Default value is @code{1}.
  14776. @item data
  14777. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14778. @item rotation
  14779. Set color rotation, must be in [-1.0, 1.0] range.
  14780. Default value is @code{0}.
  14781. @end table
  14782. The usage is very similar to the showwaves filter; see the examples in that
  14783. section.
  14784. @subsection Examples
  14785. @itemize
  14786. @item
  14787. Large window with logarithmic color scaling:
  14788. @example
  14789. showspectrum=s=1280x480:scale=log
  14790. @end example
  14791. @item
  14792. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14793. @example
  14794. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14795. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14796. @end example
  14797. @end itemize
  14798. @section showspectrumpic
  14799. Convert input audio to a single video frame, representing the audio frequency
  14800. spectrum.
  14801. The filter accepts the following options:
  14802. @table @option
  14803. @item size, s
  14804. Specify the video size for the output. For the syntax of this option, check the
  14805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14806. Default value is @code{4096x2048}.
  14807. @item mode
  14808. Specify display mode.
  14809. It accepts the following values:
  14810. @table @samp
  14811. @item combined
  14812. all channels are displayed in the same row
  14813. @item separate
  14814. all channels are displayed in separate rows
  14815. @end table
  14816. Default value is @samp{combined}.
  14817. @item color
  14818. Specify display color mode.
  14819. It accepts the following values:
  14820. @table @samp
  14821. @item channel
  14822. each channel is displayed in a separate color
  14823. @item intensity
  14824. each channel is displayed using the same color scheme
  14825. @item rainbow
  14826. each channel is displayed using the rainbow color scheme
  14827. @item moreland
  14828. each channel is displayed using the moreland color scheme
  14829. @item nebulae
  14830. each channel is displayed using the nebulae color scheme
  14831. @item fire
  14832. each channel is displayed using the fire color scheme
  14833. @item fiery
  14834. each channel is displayed using the fiery color scheme
  14835. @item fruit
  14836. each channel is displayed using the fruit color scheme
  14837. @item cool
  14838. each channel is displayed using the cool color scheme
  14839. @end table
  14840. Default value is @samp{intensity}.
  14841. @item scale
  14842. Specify scale used for calculating intensity color values.
  14843. It accepts the following values:
  14844. @table @samp
  14845. @item lin
  14846. linear
  14847. @item sqrt
  14848. square root, default
  14849. @item cbrt
  14850. cubic root
  14851. @item log
  14852. logarithmic
  14853. @item 4thrt
  14854. 4th root
  14855. @item 5thrt
  14856. 5th root
  14857. @end table
  14858. Default value is @samp{log}.
  14859. @item saturation
  14860. Set saturation modifier for displayed colors. Negative values provide
  14861. alternative color scheme. @code{0} is no saturation at all.
  14862. Saturation must be in [-10.0, 10.0] range.
  14863. Default value is @code{1}.
  14864. @item win_func
  14865. Set window function.
  14866. It accepts the following values:
  14867. @table @samp
  14868. @item rect
  14869. @item bartlett
  14870. @item hann
  14871. @item hanning
  14872. @item hamming
  14873. @item blackman
  14874. @item welch
  14875. @item flattop
  14876. @item bharris
  14877. @item bnuttall
  14878. @item bhann
  14879. @item sine
  14880. @item nuttall
  14881. @item lanczos
  14882. @item gauss
  14883. @item tukey
  14884. @item dolph
  14885. @item cauchy
  14886. @item parzen
  14887. @item poisson
  14888. @end table
  14889. Default value is @code{hann}.
  14890. @item orientation
  14891. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14892. @code{horizontal}. Default is @code{vertical}.
  14893. @item gain
  14894. Set scale gain for calculating intensity color values.
  14895. Default value is @code{1}.
  14896. @item legend
  14897. Draw time and frequency axes and legends. Default is enabled.
  14898. @item rotation
  14899. Set color rotation, must be in [-1.0, 1.0] range.
  14900. Default value is @code{0}.
  14901. @end table
  14902. @subsection Examples
  14903. @itemize
  14904. @item
  14905. Extract an audio spectrogram of a whole audio track
  14906. in a 1024x1024 picture using @command{ffmpeg}:
  14907. @example
  14908. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14909. @end example
  14910. @end itemize
  14911. @section showvolume
  14912. Convert input audio volume to a video output.
  14913. The filter accepts the following options:
  14914. @table @option
  14915. @item rate, r
  14916. Set video rate.
  14917. @item b
  14918. Set border width, allowed range is [0, 5]. Default is 1.
  14919. @item w
  14920. Set channel width, allowed range is [80, 8192]. Default is 400.
  14921. @item h
  14922. Set channel height, allowed range is [1, 900]. Default is 20.
  14923. @item f
  14924. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14925. @item c
  14926. Set volume color expression.
  14927. The expression can use the following variables:
  14928. @table @option
  14929. @item VOLUME
  14930. Current max volume of channel in dB.
  14931. @item PEAK
  14932. Current peak.
  14933. @item CHANNEL
  14934. Current channel number, starting from 0.
  14935. @end table
  14936. @item t
  14937. If set, displays channel names. Default is enabled.
  14938. @item v
  14939. If set, displays volume values. Default is enabled.
  14940. @item o
  14941. Set orientation, can be @code{horizontal} or @code{vertical},
  14942. default is @code{horizontal}.
  14943. @item s
  14944. Set step size, allowed range s [0, 5]. Default is 0, which means
  14945. step is disabled.
  14946. @end table
  14947. @section showwaves
  14948. Convert input audio to a video output, representing the samples waves.
  14949. The filter accepts the following options:
  14950. @table @option
  14951. @item size, s
  14952. Specify the video size for the output. For the syntax of this option, check the
  14953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14954. Default value is @code{600x240}.
  14955. @item mode
  14956. Set display mode.
  14957. Available values are:
  14958. @table @samp
  14959. @item point
  14960. Draw a point for each sample.
  14961. @item line
  14962. Draw a vertical line for each sample.
  14963. @item p2p
  14964. Draw a point for each sample and a line between them.
  14965. @item cline
  14966. Draw a centered vertical line for each sample.
  14967. @end table
  14968. Default value is @code{point}.
  14969. @item n
  14970. Set the number of samples which are printed on the same column. A
  14971. larger value will decrease the frame rate. Must be a positive
  14972. integer. This option can be set only if the value for @var{rate}
  14973. is not explicitly specified.
  14974. @item rate, r
  14975. Set the (approximate) output frame rate. This is done by setting the
  14976. option @var{n}. Default value is "25".
  14977. @item split_channels
  14978. Set if channels should be drawn separately or overlap. Default value is 0.
  14979. @item colors
  14980. Set colors separated by '|' which are going to be used for drawing of each channel.
  14981. @item scale
  14982. Set amplitude scale.
  14983. Available values are:
  14984. @table @samp
  14985. @item lin
  14986. Linear.
  14987. @item log
  14988. Logarithmic.
  14989. @item sqrt
  14990. Square root.
  14991. @item cbrt
  14992. Cubic root.
  14993. @end table
  14994. Default is linear.
  14995. @end table
  14996. @subsection Examples
  14997. @itemize
  14998. @item
  14999. Output the input file audio and the corresponding video representation
  15000. at the same time:
  15001. @example
  15002. amovie=a.mp3,asplit[out0],showwaves[out1]
  15003. @end example
  15004. @item
  15005. Create a synthetic signal and show it with showwaves, forcing a
  15006. frame rate of 30 frames per second:
  15007. @example
  15008. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15009. @end example
  15010. @end itemize
  15011. @section showwavespic
  15012. Convert input audio to a single video frame, representing the samples waves.
  15013. The filter accepts the following options:
  15014. @table @option
  15015. @item size, s
  15016. Specify the video size for the output. For the syntax of this option, check the
  15017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15018. Default value is @code{600x240}.
  15019. @item split_channels
  15020. Set if channels should be drawn separately or overlap. Default value is 0.
  15021. @item colors
  15022. Set colors separated by '|' which are going to be used for drawing of each channel.
  15023. @item scale
  15024. Set amplitude scale.
  15025. Available values are:
  15026. @table @samp
  15027. @item lin
  15028. Linear.
  15029. @item log
  15030. Logarithmic.
  15031. @item sqrt
  15032. Square root.
  15033. @item cbrt
  15034. Cubic root.
  15035. @end table
  15036. Default is linear.
  15037. @end table
  15038. @subsection Examples
  15039. @itemize
  15040. @item
  15041. Extract a channel split representation of the wave form of a whole audio track
  15042. in a 1024x800 picture using @command{ffmpeg}:
  15043. @example
  15044. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15045. @end example
  15046. @end itemize
  15047. @section sidedata, asidedata
  15048. Delete frame side data, or select frames based on it.
  15049. This filter accepts the following options:
  15050. @table @option
  15051. @item mode
  15052. Set mode of operation of the filter.
  15053. Can be one of the following:
  15054. @table @samp
  15055. @item select
  15056. Select every frame with side data of @code{type}.
  15057. @item delete
  15058. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15059. data in the frame.
  15060. @end table
  15061. @item type
  15062. Set side data type used with all modes. Must be set for @code{select} mode. For
  15063. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15064. in @file{libavutil/frame.h}. For example, to choose
  15065. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15066. @end table
  15067. @section spectrumsynth
  15068. Sythesize audio from 2 input video spectrums, first input stream represents
  15069. magnitude across time and second represents phase across time.
  15070. The filter will transform from frequency domain as displayed in videos back
  15071. to time domain as presented in audio output.
  15072. This filter is primarily created for reversing processed @ref{showspectrum}
  15073. filter outputs, but can synthesize sound from other spectrograms too.
  15074. But in such case results are going to be poor if the phase data is not
  15075. available, because in such cases phase data need to be recreated, usually
  15076. its just recreated from random noise.
  15077. For best results use gray only output (@code{channel} color mode in
  15078. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15079. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15080. @code{data} option. Inputs videos should generally use @code{fullframe}
  15081. slide mode as that saves resources needed for decoding video.
  15082. The filter accepts the following options:
  15083. @table @option
  15084. @item sample_rate
  15085. Specify sample rate of output audio, the sample rate of audio from which
  15086. spectrum was generated may differ.
  15087. @item channels
  15088. Set number of channels represented in input video spectrums.
  15089. @item scale
  15090. Set scale which was used when generating magnitude input spectrum.
  15091. Can be @code{lin} or @code{log}. Default is @code{log}.
  15092. @item slide
  15093. Set slide which was used when generating inputs spectrums.
  15094. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15095. Default is @code{fullframe}.
  15096. @item win_func
  15097. Set window function used for resynthesis.
  15098. @item overlap
  15099. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15100. which means optimal overlap for selected window function will be picked.
  15101. @item orientation
  15102. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15103. Default is @code{vertical}.
  15104. @end table
  15105. @subsection Examples
  15106. @itemize
  15107. @item
  15108. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15109. then resynthesize videos back to audio with spectrumsynth:
  15110. @example
  15111. 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
  15112. 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
  15113. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15114. @end example
  15115. @end itemize
  15116. @section split, asplit
  15117. Split input into several identical outputs.
  15118. @code{asplit} works with audio input, @code{split} with video.
  15119. The filter accepts a single parameter which specifies the number of outputs. If
  15120. unspecified, it defaults to 2.
  15121. @subsection Examples
  15122. @itemize
  15123. @item
  15124. Create two separate outputs from the same input:
  15125. @example
  15126. [in] split [out0][out1]
  15127. @end example
  15128. @item
  15129. To create 3 or more outputs, you need to specify the number of
  15130. outputs, like in:
  15131. @example
  15132. [in] asplit=3 [out0][out1][out2]
  15133. @end example
  15134. @item
  15135. Create two separate outputs from the same input, one cropped and
  15136. one padded:
  15137. @example
  15138. [in] split [splitout1][splitout2];
  15139. [splitout1] crop=100:100:0:0 [cropout];
  15140. [splitout2] pad=200:200:100:100 [padout];
  15141. @end example
  15142. @item
  15143. Create 5 copies of the input audio with @command{ffmpeg}:
  15144. @example
  15145. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15146. @end example
  15147. @end itemize
  15148. @section zmq, azmq
  15149. Receive commands sent through a libzmq client, and forward them to
  15150. filters in the filtergraph.
  15151. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15152. must be inserted between two video filters, @code{azmq} between two
  15153. audio filters.
  15154. To enable these filters you need to install the libzmq library and
  15155. headers and configure FFmpeg with @code{--enable-libzmq}.
  15156. For more information about libzmq see:
  15157. @url{http://www.zeromq.org/}
  15158. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15159. receives messages sent through a network interface defined by the
  15160. @option{bind_address} option.
  15161. The received message must be in the form:
  15162. @example
  15163. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15164. @end example
  15165. @var{TARGET} specifies the target of the command, usually the name of
  15166. the filter class or a specific filter instance name.
  15167. @var{COMMAND} specifies the name of the command for the target filter.
  15168. @var{ARG} is optional and specifies the optional argument list for the
  15169. given @var{COMMAND}.
  15170. Upon reception, the message is processed and the corresponding command
  15171. is injected into the filtergraph. Depending on the result, the filter
  15172. will send a reply to the client, adopting the format:
  15173. @example
  15174. @var{ERROR_CODE} @var{ERROR_REASON}
  15175. @var{MESSAGE}
  15176. @end example
  15177. @var{MESSAGE} is optional.
  15178. @subsection Examples
  15179. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15180. be used to send commands processed by these filters.
  15181. Consider the following filtergraph generated by @command{ffplay}
  15182. @example
  15183. ffplay -dumpgraph 1 -f lavfi "
  15184. color=s=100x100:c=red [l];
  15185. color=s=100x100:c=blue [r];
  15186. nullsrc=s=200x100, zmq [bg];
  15187. [bg][l] overlay [bg+l];
  15188. [bg+l][r] overlay=x=100 "
  15189. @end example
  15190. To change the color of the left side of the video, the following
  15191. command can be used:
  15192. @example
  15193. echo Parsed_color_0 c yellow | tools/zmqsend
  15194. @end example
  15195. To change the right side:
  15196. @example
  15197. echo Parsed_color_1 c pink | tools/zmqsend
  15198. @end example
  15199. @c man end MULTIMEDIA FILTERS
  15200. @chapter Multimedia Sources
  15201. @c man begin MULTIMEDIA SOURCES
  15202. Below is a description of the currently available multimedia sources.
  15203. @section amovie
  15204. This is the same as @ref{movie} source, except it selects an audio
  15205. stream by default.
  15206. @anchor{movie}
  15207. @section movie
  15208. Read audio and/or video stream(s) from a movie container.
  15209. It accepts the following parameters:
  15210. @table @option
  15211. @item filename
  15212. The name of the resource to read (not necessarily a file; it can also be a
  15213. device or a stream accessed through some protocol).
  15214. @item format_name, f
  15215. Specifies the format assumed for the movie to read, and can be either
  15216. the name of a container or an input device. If not specified, the
  15217. format is guessed from @var{movie_name} or by probing.
  15218. @item seek_point, sp
  15219. Specifies the seek point in seconds. The frames will be output
  15220. starting from this seek point. The parameter is evaluated with
  15221. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15222. postfix. The default value is "0".
  15223. @item streams, s
  15224. Specifies the streams to read. Several streams can be specified,
  15225. separated by "+". The source will then have as many outputs, in the
  15226. same order. The syntax is explained in the ``Stream specifiers''
  15227. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15228. respectively the default (best suited) video and audio stream. Default
  15229. is "dv", or "da" if the filter is called as "amovie".
  15230. @item stream_index, si
  15231. Specifies the index of the video stream to read. If the value is -1,
  15232. the most suitable video stream will be automatically selected. The default
  15233. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15234. audio instead of video.
  15235. @item loop
  15236. Specifies how many times to read the stream in sequence.
  15237. If the value is 0, the stream will be looped infinitely.
  15238. Default value is "1".
  15239. Note that when the movie is looped the source timestamps are not
  15240. changed, so it will generate non monotonically increasing timestamps.
  15241. @item discontinuity
  15242. Specifies the time difference between frames above which the point is
  15243. considered a timestamp discontinuity which is removed by adjusting the later
  15244. timestamps.
  15245. @end table
  15246. It allows overlaying a second video on top of the main input of
  15247. a filtergraph, as shown in this graph:
  15248. @example
  15249. input -----------> deltapts0 --> overlay --> output
  15250. ^
  15251. |
  15252. movie --> scale--> deltapts1 -------+
  15253. @end example
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15258. on top of the input labelled "in":
  15259. @example
  15260. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15261. [in] setpts=PTS-STARTPTS [main];
  15262. [main][over] overlay=16:16 [out]
  15263. @end example
  15264. @item
  15265. Read from a video4linux2 device, and overlay it on top of the input
  15266. labelled "in":
  15267. @example
  15268. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15269. [in] setpts=PTS-STARTPTS [main];
  15270. [main][over] overlay=16:16 [out]
  15271. @end example
  15272. @item
  15273. Read the first video stream and the audio stream with id 0x81 from
  15274. dvd.vob; the video is connected to the pad named "video" and the audio is
  15275. connected to the pad named "audio":
  15276. @example
  15277. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15278. @end example
  15279. @end itemize
  15280. @subsection Commands
  15281. Both movie and amovie support the following commands:
  15282. @table @option
  15283. @item seek
  15284. Perform seek using "av_seek_frame".
  15285. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15286. @itemize
  15287. @item
  15288. @var{stream_index}: If stream_index is -1, a default
  15289. stream is selected, and @var{timestamp} is automatically converted
  15290. from AV_TIME_BASE units to the stream specific time_base.
  15291. @item
  15292. @var{timestamp}: Timestamp in AVStream.time_base units
  15293. or, if no stream is specified, in AV_TIME_BASE units.
  15294. @item
  15295. @var{flags}: Flags which select direction and seeking mode.
  15296. @end itemize
  15297. @item get_duration
  15298. Get movie duration in AV_TIME_BASE units.
  15299. @end table
  15300. @c man end MULTIMEDIA SOURCES