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.

18323 lines
488KB

  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{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.
  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{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. See @code{ffmpeg -filters} to view which filters have timeline support.
  248. @c man end FILTERGRAPH DESCRIPTION
  249. @chapter Audio Filters
  250. @c man begin AUDIO FILTERS
  251. When you configure your FFmpeg build, you can disable any of the
  252. existing filters using @code{--disable-filters}.
  253. The configure output will show the audio filters included in your
  254. build.
  255. Below is a description of the currently available audio filters.
  256. @section acompressor
  257. A compressor is mainly used to reduce the dynamic range of a signal.
  258. Especially modern music is mostly compressed at a high ratio to
  259. improve the overall loudness. It's done to get the highest attention
  260. of a listener, "fatten" the sound and bring more "power" to the track.
  261. If a signal is compressed too much it may sound dull or "dead"
  262. afterwards or it may start to "pump" (which could be a powerful effect
  263. but can also destroy a track completely).
  264. The right compression is the key to reach a professional sound and is
  265. the high art of mixing and mastering. Because of its complex settings
  266. it may take a long time to get the right feeling for this kind of effect.
  267. Compression is done by detecting the volume above a chosen level
  268. @code{threshold} and dividing it by the factor set with @code{ratio}.
  269. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  270. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  271. the signal would cause distortion of the waveform the reduction can be
  272. levelled over the time. This is done by setting "Attack" and "Release".
  273. @code{attack} determines how long the signal has to rise above the threshold
  274. before any reduction will occur and @code{release} sets the time the signal
  275. has to fall below the threshold to reduce the reduction again. Shorter signals
  276. than the chosen attack time will be left untouched.
  277. The overall reduction of the signal can be made up afterwards with the
  278. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  279. raising the makeup to this level results in a signal twice as loud than the
  280. source. To gain a softer entry in the compression the @code{knee} flattens the
  281. hard edge at the threshold in the range of the chosen decibels.
  282. The filter accepts the following options:
  283. @table @option
  284. @item level_in
  285. Set input gain. Default is 1. Range is between 0.015625 and 64.
  286. @item threshold
  287. If a signal of second stream rises above this level it will affect the gain
  288. reduction of the first stream.
  289. By default it is 0.125. Range is between 0.00097563 and 1.
  290. @item ratio
  291. Set a ratio by which the signal is reduced. 1:2 means that if the level
  292. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  293. Default is 2. Range is between 1 and 20.
  294. @item attack
  295. Amount of milliseconds the signal has to rise above the threshold before gain
  296. reduction starts. Default is 20. Range is between 0.01 and 2000.
  297. @item release
  298. Amount of milliseconds the signal has to fall below the threshold before
  299. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  300. @item makeup
  301. Set the amount by how much signal will be amplified after processing.
  302. Default is 2. Range is from 1 and 64.
  303. @item knee
  304. Curve the sharp knee around the threshold to enter gain reduction more softly.
  305. Default is 2.82843. Range is between 1 and 8.
  306. @item link
  307. Choose if the @code{average} level between all channels of input stream
  308. or the louder(@code{maximum}) channel of input stream affects the
  309. reduction. Default is @code{average}.
  310. @item detection
  311. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  312. of @code{rms}. Default is @code{rms} which is mostly smoother.
  313. @item mix
  314. How much to use compressed signal in output. Default is 1.
  315. Range is between 0 and 1.
  316. @end table
  317. @section acrossfade
  318. Apply cross fade from one input audio stream to another input audio stream.
  319. The cross fade is applied for specified duration near the end of first stream.
  320. The filter accepts the following options:
  321. @table @option
  322. @item nb_samples, ns
  323. Specify the number of samples for which the cross fade effect has to last.
  324. At the end of the cross fade effect the first input audio will be completely
  325. silent. Default is 44100.
  326. @item duration, d
  327. Specify the duration of the cross fade effect. See
  328. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  329. for the accepted syntax.
  330. By default the duration is determined by @var{nb_samples}.
  331. If set this option is used instead of @var{nb_samples}.
  332. @item overlap, o
  333. Should first stream end overlap with second stream start. Default is enabled.
  334. @item curve1
  335. Set curve for cross fade transition for first stream.
  336. @item curve2
  337. Set curve for cross fade transition for second stream.
  338. For description of available curve types see @ref{afade} filter description.
  339. @end table
  340. @subsection Examples
  341. @itemize
  342. @item
  343. Cross fade from one input to another:
  344. @example
  345. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  346. @end example
  347. @item
  348. Cross fade from one input to another but without overlapping:
  349. @example
  350. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  351. @end example
  352. @end itemize
  353. @section acrusher
  354. Reduce audio bit resolution.
  355. This filter is bit crusher with enhanced functionality. A bit crusher
  356. is used to audibly reduce number of bits an audio signal is sampled
  357. with. This doesn't change the bit depth at all, it just produces the
  358. effect. Material reduced in bit depth sounds more harsh and "digital".
  359. This filter is able to even round to continuous values instead of discrete
  360. bit depths.
  361. Additionally it has a D/C offset which results in different crushing of
  362. the lower and the upper half of the signal.
  363. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  364. Another feature of this filter is the logarithmic mode.
  365. This setting switches from linear distances between bits to logarithmic ones.
  366. The result is a much more "natural" sounding crusher which doesn't gate low
  367. signals for example. The human ear has a logarithmic perception, too
  368. so this kind of crushing is much more pleasant.
  369. Logarithmic crushing is also able to get anti-aliased.
  370. The filter accepts the following options:
  371. @table @option
  372. @item level_in
  373. Set level in.
  374. @item level_out
  375. Set level out.
  376. @item bits
  377. Set bit reduction.
  378. @item mix
  379. Set mixing amount.
  380. @item mode
  381. Can be linear: @code{lin} or logarithmic: @code{log}.
  382. @item dc
  383. Set DC.
  384. @item aa
  385. Set anti-aliasing.
  386. @item samples
  387. Set sample reduction.
  388. @item lfo
  389. Enable LFO. By default disabled.
  390. @item lforange
  391. Set LFO range.
  392. @item lforate
  393. Set LFO rate.
  394. @end table
  395. @section adelay
  396. Delay one or more audio channels.
  397. Samples in delayed channel are filled with silence.
  398. The filter accepts the following option:
  399. @table @option
  400. @item delays
  401. Set list of delays in milliseconds for each channel separated by '|'.
  402. At least one delay greater than 0 should be provided.
  403. Unused delays will be silently ignored. If number of given delays is
  404. smaller than number of channels all remaining channels will not be delayed.
  405. If you want to delay exact number of samples, append 'S' to number.
  406. @end table
  407. @subsection Examples
  408. @itemize
  409. @item
  410. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  411. the second channel (and any other channels that may be present) unchanged.
  412. @example
  413. adelay=1500|0|500
  414. @end example
  415. @item
  416. Delay second channel by 500 samples, the third channel by 700 samples and leave
  417. the first channel (and any other channels that may be present) unchanged.
  418. @example
  419. adelay=0|500S|700S
  420. @end example
  421. @end itemize
  422. @section aecho
  423. Apply echoing to the input audio.
  424. Echoes are reflected sound and can occur naturally amongst mountains
  425. (and sometimes large buildings) when talking or shouting; digital echo
  426. effects emulate this behaviour and are often used to help fill out the
  427. sound of a single instrument or vocal. The time difference between the
  428. original signal and the reflection is the @code{delay}, and the
  429. loudness of the reflected signal is the @code{decay}.
  430. Multiple echoes can have different delays and decays.
  431. A description of the accepted parameters follows.
  432. @table @option
  433. @item in_gain
  434. Set input gain of reflected signal. Default is @code{0.6}.
  435. @item out_gain
  436. Set output gain of reflected signal. Default is @code{0.3}.
  437. @item delays
  438. Set list of time intervals in milliseconds between original signal and reflections
  439. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  440. Default is @code{1000}.
  441. @item decays
  442. Set list of loudnesses of reflected signals separated by '|'.
  443. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  444. Default is @code{0.5}.
  445. @end table
  446. @subsection Examples
  447. @itemize
  448. @item
  449. Make it sound as if there are twice as many instruments as are actually playing:
  450. @example
  451. aecho=0.8:0.88:60:0.4
  452. @end example
  453. @item
  454. If delay is very short, then it sound like a (metallic) robot playing music:
  455. @example
  456. aecho=0.8:0.88:6:0.4
  457. @end example
  458. @item
  459. A longer delay will sound like an open air concert in the mountains:
  460. @example
  461. aecho=0.8:0.9:1000:0.3
  462. @end example
  463. @item
  464. Same as above but with one more mountain:
  465. @example
  466. aecho=0.8:0.9:1000|1800:0.3|0.25
  467. @end example
  468. @end itemize
  469. @section aemphasis
  470. Audio emphasis filter creates or restores material directly taken from LPs or
  471. emphased CDs with different filter curves. E.g. to store music on vinyl the
  472. signal has to be altered by a filter first to even out the disadvantages of
  473. this recording medium.
  474. Once the material is played back the inverse filter has to be applied to
  475. restore the distortion of the frequency response.
  476. The filter accepts the following options:
  477. @table @option
  478. @item level_in
  479. Set input gain.
  480. @item level_out
  481. Set output gain.
  482. @item mode
  483. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  484. use @code{production} mode. Default is @code{reproduction} mode.
  485. @item type
  486. Set filter type. Selects medium. Can be one of the following:
  487. @table @option
  488. @item col
  489. select Columbia.
  490. @item emi
  491. select EMI.
  492. @item bsi
  493. select BSI (78RPM).
  494. @item riaa
  495. select RIAA.
  496. @item cd
  497. select Compact Disc (CD).
  498. @item 50fm
  499. select 50µs (FM).
  500. @item 75fm
  501. select 75µs (FM).
  502. @item 50kf
  503. select 50µs (FM-KF).
  504. @item 75kf
  505. select 75µs (FM-KF).
  506. @end table
  507. @end table
  508. @section aeval
  509. Modify an audio signal according to the specified expressions.
  510. This filter accepts one or more expressions (one for each channel),
  511. which are evaluated and used to modify a corresponding audio signal.
  512. It accepts the following parameters:
  513. @table @option
  514. @item exprs
  515. Set the '|'-separated expressions list for each separate channel. If
  516. the number of input channels is greater than the number of
  517. expressions, the last specified expression is used for the remaining
  518. output channels.
  519. @item channel_layout, c
  520. Set output channel layout. If not specified, the channel layout is
  521. specified by the number of expressions. If set to @samp{same}, it will
  522. use by default the same input channel layout.
  523. @end table
  524. Each expression in @var{exprs} can contain the following constants and functions:
  525. @table @option
  526. @item ch
  527. channel number of the current expression
  528. @item n
  529. number of the evaluated sample, starting from 0
  530. @item s
  531. sample rate
  532. @item t
  533. time of the evaluated sample expressed in seconds
  534. @item nb_in_channels
  535. @item nb_out_channels
  536. input and output number of channels
  537. @item val(CH)
  538. the value of input channel with number @var{CH}
  539. @end table
  540. Note: this filter is slow. For faster processing you should use a
  541. dedicated filter.
  542. @subsection Examples
  543. @itemize
  544. @item
  545. Half volume:
  546. @example
  547. aeval=val(ch)/2:c=same
  548. @end example
  549. @item
  550. Invert phase of the second channel:
  551. @example
  552. aeval=val(0)|-val(1)
  553. @end example
  554. @end itemize
  555. @anchor{afade}
  556. @section afade
  557. Apply fade-in/out effect to input audio.
  558. A description of the accepted parameters follows.
  559. @table @option
  560. @item type, t
  561. Specify the effect type, can be either @code{in} for fade-in, or
  562. @code{out} for a fade-out effect. Default is @code{in}.
  563. @item start_sample, ss
  564. Specify the number of the start sample for starting to apply the fade
  565. effect. Default is 0.
  566. @item nb_samples, ns
  567. Specify the number of samples for which the fade effect has to last. At
  568. the end of the fade-in effect the output audio will have the same
  569. volume as the input audio, at the end of the fade-out transition
  570. the output audio will be silence. Default is 44100.
  571. @item start_time, st
  572. Specify the start time of the fade effect. Default is 0.
  573. The value must be specified as a time duration; see
  574. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  575. for the accepted syntax.
  576. If set this option is used instead of @var{start_sample}.
  577. @item duration, d
  578. Specify the duration of the fade effect. See
  579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  580. for the accepted syntax.
  581. At the end of the fade-in effect the output audio will have the same
  582. volume as the input audio, at the end of the fade-out transition
  583. the output audio will be silence.
  584. By default the duration is determined by @var{nb_samples}.
  585. If set this option is used instead of @var{nb_samples}.
  586. @item curve
  587. Set curve for fade transition.
  588. It accepts the following values:
  589. @table @option
  590. @item tri
  591. select triangular, linear slope (default)
  592. @item qsin
  593. select quarter of sine wave
  594. @item hsin
  595. select half of sine wave
  596. @item esin
  597. select exponential sine wave
  598. @item log
  599. select logarithmic
  600. @item ipar
  601. select inverted parabola
  602. @item qua
  603. select quadratic
  604. @item cub
  605. select cubic
  606. @item squ
  607. select square root
  608. @item cbr
  609. select cubic root
  610. @item par
  611. select parabola
  612. @item exp
  613. select exponential
  614. @item iqsin
  615. select inverted quarter of sine wave
  616. @item ihsin
  617. select inverted half of sine wave
  618. @item dese
  619. select double-exponential seat
  620. @item desi
  621. select double-exponential sigmoid
  622. @end table
  623. @end table
  624. @subsection Examples
  625. @itemize
  626. @item
  627. Fade in first 15 seconds of audio:
  628. @example
  629. afade=t=in:ss=0:d=15
  630. @end example
  631. @item
  632. Fade out last 25 seconds of a 900 seconds audio:
  633. @example
  634. afade=t=out:st=875:d=25
  635. @end example
  636. @end itemize
  637. @section afftfilt
  638. Apply arbitrary expressions to samples in frequency domain.
  639. @table @option
  640. @item real
  641. Set frequency domain real expression for each separate channel separated
  642. by '|'. Default is "1".
  643. If the number of input channels is greater than the number of
  644. expressions, the last specified expression is used for the remaining
  645. output channels.
  646. @item imag
  647. Set frequency domain imaginary expression for each separate channel
  648. separated by '|'. If not set, @var{real} option is used.
  649. Each expression in @var{real} and @var{imag} can contain the following
  650. constants:
  651. @table @option
  652. @item sr
  653. sample rate
  654. @item b
  655. current frequency bin number
  656. @item nb
  657. number of available bins
  658. @item ch
  659. channel number of the current expression
  660. @item chs
  661. number of channels
  662. @item pts
  663. current frame pts
  664. @end table
  665. @item win_size
  666. Set window size.
  667. It accepts the following values:
  668. @table @samp
  669. @item w16
  670. @item w32
  671. @item w64
  672. @item w128
  673. @item w256
  674. @item w512
  675. @item w1024
  676. @item w2048
  677. @item w4096
  678. @item w8192
  679. @item w16384
  680. @item w32768
  681. @item w65536
  682. @end table
  683. Default is @code{w4096}
  684. @item win_func
  685. Set window function. Default is @code{hann}.
  686. @item overlap
  687. Set window overlap. If set to 1, the recommended overlap for selected
  688. window function will be picked. Default is @code{0.75}.
  689. @end table
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Leave almost only low frequencies in audio:
  694. @example
  695. afftfilt="1-clip((b/nb)*b,0,1)"
  696. @end example
  697. @end itemize
  698. @anchor{aformat}
  699. @section aformat
  700. Set output format constraints for the input audio. The framework will
  701. negotiate the most appropriate format to minimize conversions.
  702. It accepts the following parameters:
  703. @table @option
  704. @item sample_fmts
  705. A '|'-separated list of requested sample formats.
  706. @item sample_rates
  707. A '|'-separated list of requested sample rates.
  708. @item channel_layouts
  709. A '|'-separated list of requested channel layouts.
  710. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  711. for the required syntax.
  712. @end table
  713. If a parameter is omitted, all values are allowed.
  714. Force the output to either unsigned 8-bit or signed 16-bit stereo
  715. @example
  716. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  717. @end example
  718. @section agate
  719. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  720. processing reduces disturbing noise between useful signals.
  721. Gating is done by detecting the volume below a chosen level @var{threshold}
  722. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  723. floor is set via @var{range}. Because an exact manipulation of the signal
  724. would cause distortion of the waveform the reduction can be levelled over
  725. time. This is done by setting @var{attack} and @var{release}.
  726. @var{attack} determines how long the signal has to fall below the threshold
  727. before any reduction will occur and @var{release} sets the time the signal
  728. has to rise above the threshold to reduce the reduction again.
  729. Shorter signals than the chosen attack time will be left untouched.
  730. @table @option
  731. @item level_in
  732. Set input level before filtering.
  733. Default is 1. Allowed range is from 0.015625 to 64.
  734. @item range
  735. Set the level of gain reduction when the signal is below the threshold.
  736. Default is 0.06125. Allowed range is from 0 to 1.
  737. @item threshold
  738. If a signal rises above this level the gain reduction is released.
  739. Default is 0.125. Allowed range is from 0 to 1.
  740. @item ratio
  741. Set a ratio by which the signal is reduced.
  742. Default is 2. Allowed range is from 1 to 9000.
  743. @item attack
  744. Amount of milliseconds the signal has to rise above the threshold before gain
  745. reduction stops.
  746. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  747. @item release
  748. Amount of milliseconds the signal has to fall below the threshold before the
  749. reduction is increased again. Default is 250 milliseconds.
  750. Allowed range is from 0.01 to 9000.
  751. @item makeup
  752. Set amount of amplification of signal after processing.
  753. Default is 1. Allowed range is from 1 to 64.
  754. @item knee
  755. Curve the sharp knee around the threshold to enter gain reduction more softly.
  756. Default is 2.828427125. Allowed range is from 1 to 8.
  757. @item detection
  758. Choose if exact signal should be taken for detection or an RMS like one.
  759. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  760. @item link
  761. Choose if the average level between all channels or the louder channel affects
  762. the reduction.
  763. Default is @code{average}. Can be @code{average} or @code{maximum}.
  764. @end table
  765. @section alimiter
  766. The limiter prevents an input signal from rising over a desired threshold.
  767. This limiter uses lookahead technology to prevent your signal from distorting.
  768. It means that there is a small delay after the signal is processed. Keep in mind
  769. that the delay it produces is the attack time you set.
  770. The filter accepts the following options:
  771. @table @option
  772. @item level_in
  773. Set input gain. Default is 1.
  774. @item level_out
  775. Set output gain. Default is 1.
  776. @item limit
  777. Don't let signals above this level pass the limiter. Default is 1.
  778. @item attack
  779. The limiter will reach its attenuation level in this amount of time in
  780. milliseconds. Default is 5 milliseconds.
  781. @item release
  782. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  783. Default is 50 milliseconds.
  784. @item asc
  785. When gain reduction is always needed ASC takes care of releasing to an
  786. average reduction level rather than reaching a reduction of 0 in the release
  787. time.
  788. @item asc_level
  789. Select how much the release time is affected by ASC, 0 means nearly no changes
  790. in release time while 1 produces higher release times.
  791. @item level
  792. Auto level output signal. Default is enabled.
  793. This normalizes audio back to 0dB if enabled.
  794. @end table
  795. Depending on picked setting it is recommended to upsample input 2x or 4x times
  796. with @ref{aresample} before applying this filter.
  797. @section allpass
  798. Apply a two-pole all-pass filter with central frequency (in Hz)
  799. @var{frequency}, and filter-width @var{width}.
  800. An all-pass filter changes the audio's frequency to phase relationship
  801. without changing its frequency to amplitude relationship.
  802. The filter accepts the following options:
  803. @table @option
  804. @item frequency, f
  805. Set frequency in Hz.
  806. @item width_type
  807. Set method to specify band-width of filter.
  808. @table @option
  809. @item h
  810. Hz
  811. @item q
  812. Q-Factor
  813. @item o
  814. octave
  815. @item s
  816. slope
  817. @end table
  818. @item width, w
  819. Specify the band-width of a filter in width_type units.
  820. @end table
  821. @section aloop
  822. Loop audio samples.
  823. The filter accepts the following options:
  824. @table @option
  825. @item loop
  826. Set the number of loops.
  827. @item size
  828. Set maximal number of samples.
  829. @item start
  830. Set first sample of loop.
  831. @end table
  832. @anchor{amerge}
  833. @section amerge
  834. Merge two or more audio streams into a single multi-channel stream.
  835. The filter accepts the following options:
  836. @table @option
  837. @item inputs
  838. Set the number of inputs. Default is 2.
  839. @end table
  840. If the channel layouts of the inputs are disjoint, and therefore compatible,
  841. the channel layout of the output will be set accordingly and the channels
  842. will be reordered as necessary. If the channel layouts of the inputs are not
  843. disjoint, the output will have all the channels of the first input then all
  844. the channels of the second input, in that order, and the channel layout of
  845. the output will be the default value corresponding to the total number of
  846. channels.
  847. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  848. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  849. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  850. first input, b1 is the first channel of the second input).
  851. On the other hand, if both input are in stereo, the output channels will be
  852. in the default order: a1, a2, b1, b2, and the channel layout will be
  853. arbitrarily set to 4.0, which may or may not be the expected value.
  854. All inputs must have the same sample rate, and format.
  855. If inputs do not have the same duration, the output will stop with the
  856. shortest.
  857. @subsection Examples
  858. @itemize
  859. @item
  860. Merge two mono files into a stereo stream:
  861. @example
  862. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  863. @end example
  864. @item
  865. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  866. @example
  867. 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
  868. @end example
  869. @end itemize
  870. @section amix
  871. Mixes multiple audio inputs into a single output.
  872. Note that this filter only supports float samples (the @var{amerge}
  873. and @var{pan} audio filters support many formats). If the @var{amix}
  874. input has integer samples then @ref{aresample} will be automatically
  875. inserted to perform the conversion to float samples.
  876. For example
  877. @example
  878. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  879. @end example
  880. will mix 3 input audio streams to a single output with the same duration as the
  881. first input and a dropout transition time of 3 seconds.
  882. It accepts the following parameters:
  883. @table @option
  884. @item inputs
  885. The number of inputs. If unspecified, it defaults to 2.
  886. @item duration
  887. How to determine the end-of-stream.
  888. @table @option
  889. @item longest
  890. The duration of the longest input. (default)
  891. @item shortest
  892. The duration of the shortest input.
  893. @item first
  894. The duration of the first input.
  895. @end table
  896. @item dropout_transition
  897. The transition time, in seconds, for volume renormalization when an input
  898. stream ends. The default value is 2 seconds.
  899. @end table
  900. @section anequalizer
  901. High-order parametric multiband equalizer for each channel.
  902. It accepts the following parameters:
  903. @table @option
  904. @item params
  905. This option string is in format:
  906. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  907. Each equalizer band is separated by '|'.
  908. @table @option
  909. @item chn
  910. Set channel number to which equalization will be applied.
  911. If input doesn't have that channel the entry is ignored.
  912. @item f
  913. Set central frequency for band.
  914. If input doesn't have that frequency the entry is ignored.
  915. @item w
  916. Set band width in hertz.
  917. @item g
  918. Set band gain in dB.
  919. @item t
  920. Set filter type for band, optional, can be:
  921. @table @samp
  922. @item 0
  923. Butterworth, this is default.
  924. @item 1
  925. Chebyshev type 1.
  926. @item 2
  927. Chebyshev type 2.
  928. @end table
  929. @end table
  930. @item curves
  931. With this option activated frequency response of anequalizer is displayed
  932. in video stream.
  933. @item size
  934. Set video stream size. Only useful if curves option is activated.
  935. @item mgain
  936. Set max gain that will be displayed. Only useful if curves option is activated.
  937. Setting this to a reasonable value makes it possible to display gain which is derived from
  938. neighbour bands which are too close to each other and thus produce higher gain
  939. when both are activated.
  940. @item fscale
  941. Set frequency scale used to draw frequency response in video output.
  942. Can be linear or logarithmic. Default is logarithmic.
  943. @item colors
  944. Set color for each channel curve which is going to be displayed in video stream.
  945. This is list of color names separated by space or by '|'.
  946. Unrecognised or missing colors will be replaced by white color.
  947. @end table
  948. @subsection Examples
  949. @itemize
  950. @item
  951. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  952. for first 2 channels using Chebyshev type 1 filter:
  953. @example
  954. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  955. @end example
  956. @end itemize
  957. @subsection Commands
  958. This filter supports the following commands:
  959. @table @option
  960. @item change
  961. Alter existing filter parameters.
  962. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  963. @var{fN} is existing filter number, starting from 0, if no such filter is available
  964. error is returned.
  965. @var{freq} set new frequency parameter.
  966. @var{width} set new width parameter in herz.
  967. @var{gain} set new gain parameter in dB.
  968. Full filter invocation with asendcmd may look like this:
  969. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  970. @end table
  971. @section anull
  972. Pass the audio source unchanged to the output.
  973. @section apad
  974. Pad the end of an audio stream with silence.
  975. This can be used together with @command{ffmpeg} @option{-shortest} to
  976. extend audio streams to the same length as the video stream.
  977. A description of the accepted options follows.
  978. @table @option
  979. @item packet_size
  980. Set silence packet size. Default value is 4096.
  981. @item pad_len
  982. Set the number of samples of silence to add to the end. After the
  983. value is reached, the stream is terminated. This option is mutually
  984. exclusive with @option{whole_len}.
  985. @item whole_len
  986. Set the minimum total number of samples in the output audio stream. If
  987. the value is longer than the input audio length, silence is added to
  988. the end, until the value is reached. This option is mutually exclusive
  989. with @option{pad_len}.
  990. @end table
  991. If neither the @option{pad_len} nor the @option{whole_len} option is
  992. set, the filter will add silence to the end of the input stream
  993. indefinitely.
  994. @subsection Examples
  995. @itemize
  996. @item
  997. Add 1024 samples of silence to the end of the input:
  998. @example
  999. apad=pad_len=1024
  1000. @end example
  1001. @item
  1002. Make sure the audio output will contain at least 10000 samples, pad
  1003. the input with silence if required:
  1004. @example
  1005. apad=whole_len=10000
  1006. @end example
  1007. @item
  1008. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1009. video stream will always result the shortest and will be converted
  1010. until the end in the output file when using the @option{shortest}
  1011. option:
  1012. @example
  1013. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1014. @end example
  1015. @end itemize
  1016. @section aphaser
  1017. Add a phasing effect to the input audio.
  1018. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1019. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1020. A description of the accepted parameters follows.
  1021. @table @option
  1022. @item in_gain
  1023. Set input gain. Default is 0.4.
  1024. @item out_gain
  1025. Set output gain. Default is 0.74
  1026. @item delay
  1027. Set delay in milliseconds. Default is 3.0.
  1028. @item decay
  1029. Set decay. Default is 0.4.
  1030. @item speed
  1031. Set modulation speed in Hz. Default is 0.5.
  1032. @item type
  1033. Set modulation type. Default is triangular.
  1034. It accepts the following values:
  1035. @table @samp
  1036. @item triangular, t
  1037. @item sinusoidal, s
  1038. @end table
  1039. @end table
  1040. @section apulsator
  1041. Audio pulsator is something between an autopanner and a tremolo.
  1042. But it can produce funny stereo effects as well. Pulsator changes the volume
  1043. of the left and right channel based on a LFO (low frequency oscillator) with
  1044. different waveforms and shifted phases.
  1045. This filter have the ability to define an offset between left and right
  1046. channel. An offset of 0 means that both LFO shapes match each other.
  1047. The left and right channel are altered equally - a conventional tremolo.
  1048. An offset of 50% means that the shape of the right channel is exactly shifted
  1049. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1050. an autopanner. At 1 both curves match again. Every setting in between moves the
  1051. phase shift gapless between all stages and produces some "bypassing" sounds with
  1052. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1053. the 0.5) the faster the signal passes from the left to the right speaker.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item level_in
  1057. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1058. @item level_out
  1059. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1060. @item mode
  1061. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1062. sawup or sawdown. Default is sine.
  1063. @item amount
  1064. Set modulation. Define how much of original signal is affected by the LFO.
  1065. @item offset_l
  1066. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1067. @item offset_r
  1068. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1069. @item width
  1070. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1071. @item timing
  1072. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1073. @item bpm
  1074. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1075. is set to bpm.
  1076. @item ms
  1077. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1078. is set to ms.
  1079. @item hz
  1080. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1081. if timing is set to hz.
  1082. @end table
  1083. @anchor{aresample}
  1084. @section aresample
  1085. Resample the input audio to the specified parameters, using the
  1086. libswresample library. If none are specified then the filter will
  1087. automatically convert between its input and output.
  1088. This filter is also able to stretch/squeeze the audio data to make it match
  1089. the timestamps or to inject silence / cut out audio to make it match the
  1090. timestamps, do a combination of both or do neither.
  1091. The filter accepts the syntax
  1092. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1093. expresses a sample rate and @var{resampler_options} is a list of
  1094. @var{key}=@var{value} pairs, separated by ":". See the
  1095. @ref{Resampler Options,,the "Resampler Options" section in the
  1096. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1097. for the complete list of supported options.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Resample the input audio to 44100Hz:
  1102. @example
  1103. aresample=44100
  1104. @end example
  1105. @item
  1106. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1107. samples per second compensation:
  1108. @example
  1109. aresample=async=1000
  1110. @end example
  1111. @end itemize
  1112. @section areverse
  1113. Reverse an audio clip.
  1114. Warning: This filter requires memory to buffer the entire clip, so trimming
  1115. is suggested.
  1116. @subsection Examples
  1117. @itemize
  1118. @item
  1119. Take the first 5 seconds of a clip, and reverse it.
  1120. @example
  1121. atrim=end=5,areverse
  1122. @end example
  1123. @end itemize
  1124. @section asetnsamples
  1125. Set the number of samples per each output audio frame.
  1126. The last output packet may contain a different number of samples, as
  1127. the filter will flush all the remaining samples when the input audio
  1128. signals its end.
  1129. The filter accepts the following options:
  1130. @table @option
  1131. @item nb_out_samples, n
  1132. Set the number of frames per each output audio frame. The number is
  1133. intended as the number of samples @emph{per each channel}.
  1134. Default value is 1024.
  1135. @item pad, p
  1136. If set to 1, the filter will pad the last audio frame with zeroes, so
  1137. that the last frame will contain the same number of samples as the
  1138. previous ones. Default value is 1.
  1139. @end table
  1140. For example, to set the number of per-frame samples to 1234 and
  1141. disable padding for the last frame, use:
  1142. @example
  1143. asetnsamples=n=1234:p=0
  1144. @end example
  1145. @section asetrate
  1146. Set the sample rate without altering the PCM data.
  1147. This will result in a change of speed and pitch.
  1148. The filter accepts the following options:
  1149. @table @option
  1150. @item sample_rate, r
  1151. Set the output sample rate. Default is 44100 Hz.
  1152. @end table
  1153. @section ashowinfo
  1154. Show a line containing various information for each input audio frame.
  1155. The input audio is not modified.
  1156. The shown line contains a sequence of key/value pairs of the form
  1157. @var{key}:@var{value}.
  1158. The following values are shown in the output:
  1159. @table @option
  1160. @item n
  1161. The (sequential) number of the input frame, starting from 0.
  1162. @item pts
  1163. The presentation timestamp of the input frame, in time base units; the time base
  1164. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1165. @item pts_time
  1166. The presentation timestamp of the input frame in seconds.
  1167. @item pos
  1168. position of the frame in the input stream, -1 if this information in
  1169. unavailable and/or meaningless (for example in case of synthetic audio)
  1170. @item fmt
  1171. The sample format.
  1172. @item chlayout
  1173. The channel layout.
  1174. @item rate
  1175. The sample rate for the audio frame.
  1176. @item nb_samples
  1177. The number of samples (per channel) in the frame.
  1178. @item checksum
  1179. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1180. audio, the data is treated as if all the planes were concatenated.
  1181. @item plane_checksums
  1182. A list of Adler-32 checksums for each data plane.
  1183. @end table
  1184. @anchor{astats}
  1185. @section astats
  1186. Display time domain statistical information about the audio channels.
  1187. Statistics are calculated and displayed for each audio channel and,
  1188. where applicable, an overall figure is also given.
  1189. It accepts the following option:
  1190. @table @option
  1191. @item length
  1192. Short window length in seconds, used for peak and trough RMS measurement.
  1193. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1194. @item metadata
  1195. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1196. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1197. disabled.
  1198. Available keys for each channel are:
  1199. DC_offset
  1200. Min_level
  1201. Max_level
  1202. Min_difference
  1203. Max_difference
  1204. Mean_difference
  1205. Peak_level
  1206. RMS_peak
  1207. RMS_trough
  1208. Crest_factor
  1209. Flat_factor
  1210. Peak_count
  1211. Bit_depth
  1212. and for Overall:
  1213. DC_offset
  1214. Min_level
  1215. Max_level
  1216. Min_difference
  1217. Max_difference
  1218. Mean_difference
  1219. Peak_level
  1220. RMS_level
  1221. RMS_peak
  1222. RMS_trough
  1223. Flat_factor
  1224. Peak_count
  1225. Bit_depth
  1226. Number_of_samples
  1227. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1228. this @code{lavfi.astats.Overall.Peak_count}.
  1229. For description what each key means read below.
  1230. @item reset
  1231. Set number of frame after which stats are going to be recalculated.
  1232. Default is disabled.
  1233. @end table
  1234. A description of each shown parameter follows:
  1235. @table @option
  1236. @item DC offset
  1237. Mean amplitude displacement from zero.
  1238. @item Min level
  1239. Minimal sample level.
  1240. @item Max level
  1241. Maximal sample level.
  1242. @item Min difference
  1243. Minimal difference between two consecutive samples.
  1244. @item Max difference
  1245. Maximal difference between two consecutive samples.
  1246. @item Mean difference
  1247. Mean difference between two consecutive samples.
  1248. The average of each difference between two consecutive samples.
  1249. @item Peak level dB
  1250. @item RMS level dB
  1251. Standard peak and RMS level measured in dBFS.
  1252. @item RMS peak dB
  1253. @item RMS trough dB
  1254. Peak and trough values for RMS level measured over a short window.
  1255. @item Crest factor
  1256. Standard ratio of peak to RMS level (note: not in dB).
  1257. @item Flat factor
  1258. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1259. (i.e. either @var{Min level} or @var{Max level}).
  1260. @item Peak count
  1261. Number of occasions (not the number of samples) that the signal attained either
  1262. @var{Min level} or @var{Max level}.
  1263. @item Bit depth
  1264. Overall bit depth of audio. Number of bits used for each sample.
  1265. @end table
  1266. @section atempo
  1267. Adjust audio tempo.
  1268. The filter accepts exactly one parameter, the audio tempo. If not
  1269. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1270. be in the [0.5, 2.0] range.
  1271. @subsection Examples
  1272. @itemize
  1273. @item
  1274. Slow down audio to 80% tempo:
  1275. @example
  1276. atempo=0.8
  1277. @end example
  1278. @item
  1279. To speed up audio to 125% tempo:
  1280. @example
  1281. atempo=1.25
  1282. @end example
  1283. @end itemize
  1284. @section atrim
  1285. Trim the input so that the output contains one continuous subpart of the input.
  1286. It accepts the following parameters:
  1287. @table @option
  1288. @item start
  1289. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1290. sample with the timestamp @var{start} will be the first sample in the output.
  1291. @item end
  1292. Specify time of the first audio sample that will be dropped, i.e. the
  1293. audio sample immediately preceding the one with the timestamp @var{end} will be
  1294. the last sample in the output.
  1295. @item start_pts
  1296. Same as @var{start}, except this option sets the start timestamp in samples
  1297. instead of seconds.
  1298. @item end_pts
  1299. Same as @var{end}, except this option sets the end timestamp in samples instead
  1300. of seconds.
  1301. @item duration
  1302. The maximum duration of the output in seconds.
  1303. @item start_sample
  1304. The number of the first sample that should be output.
  1305. @item end_sample
  1306. The number of the first sample that should be dropped.
  1307. @end table
  1308. @option{start}, @option{end}, and @option{duration} are expressed as time
  1309. duration specifications; see
  1310. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1311. Note that the first two sets of the start/end options and the @option{duration}
  1312. option look at the frame timestamp, while the _sample options simply count the
  1313. samples that pass through the filter. So start/end_pts and start/end_sample will
  1314. give different results when the timestamps are wrong, inexact or do not start at
  1315. zero. Also note that this filter does not modify the timestamps. If you wish
  1316. to have the output timestamps start at zero, insert the asetpts filter after the
  1317. atrim filter.
  1318. If multiple start or end options are set, this filter tries to be greedy and
  1319. keep all samples that match at least one of the specified constraints. To keep
  1320. only the part that matches all the constraints at once, chain multiple atrim
  1321. filters.
  1322. The defaults are such that all the input is kept. So it is possible to set e.g.
  1323. just the end values to keep everything before the specified time.
  1324. Examples:
  1325. @itemize
  1326. @item
  1327. Drop everything except the second minute of input:
  1328. @example
  1329. ffmpeg -i INPUT -af atrim=60:120
  1330. @end example
  1331. @item
  1332. Keep only the first 1000 samples:
  1333. @example
  1334. ffmpeg -i INPUT -af atrim=end_sample=1000
  1335. @end example
  1336. @end itemize
  1337. @section bandpass
  1338. Apply a two-pole Butterworth band-pass filter with central
  1339. frequency @var{frequency}, and (3dB-point) band-width width.
  1340. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1341. instead of the default: constant 0dB peak gain.
  1342. The filter roll off at 6dB per octave (20dB per decade).
  1343. The filter accepts the following options:
  1344. @table @option
  1345. @item frequency, f
  1346. Set the filter's central frequency. Default is @code{3000}.
  1347. @item csg
  1348. Constant skirt gain if set to 1. Defaults to 0.
  1349. @item width_type
  1350. Set method to specify band-width of filter.
  1351. @table @option
  1352. @item h
  1353. Hz
  1354. @item q
  1355. Q-Factor
  1356. @item o
  1357. octave
  1358. @item s
  1359. slope
  1360. @end table
  1361. @item width, w
  1362. Specify the band-width of a filter in width_type units.
  1363. @end table
  1364. @section bandreject
  1365. Apply a two-pole Butterworth band-reject filter with central
  1366. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1367. The filter roll off at 6dB per octave (20dB per decade).
  1368. The filter accepts the following options:
  1369. @table @option
  1370. @item frequency, f
  1371. Set the filter's central frequency. Default is @code{3000}.
  1372. @item width_type
  1373. Set method to specify band-width of filter.
  1374. @table @option
  1375. @item h
  1376. Hz
  1377. @item q
  1378. Q-Factor
  1379. @item o
  1380. octave
  1381. @item s
  1382. slope
  1383. @end table
  1384. @item width, w
  1385. Specify the band-width of a filter in width_type units.
  1386. @end table
  1387. @section bass
  1388. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1389. shelving filter with a response similar to that of a standard
  1390. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1391. The filter accepts the following options:
  1392. @table @option
  1393. @item gain, g
  1394. Give the gain at 0 Hz. Its useful range is about -20
  1395. (for a large cut) to +20 (for a large boost).
  1396. Beware of clipping when using a positive gain.
  1397. @item frequency, f
  1398. Set the filter's central frequency and so can be used
  1399. to extend or reduce the frequency range to be boosted or cut.
  1400. The default value is @code{100} Hz.
  1401. @item width_type
  1402. Set method to specify band-width of filter.
  1403. @table @option
  1404. @item h
  1405. Hz
  1406. @item q
  1407. Q-Factor
  1408. @item o
  1409. octave
  1410. @item s
  1411. slope
  1412. @end table
  1413. @item width, w
  1414. Determine how steep is the filter's shelf transition.
  1415. @end table
  1416. @section biquad
  1417. Apply a biquad IIR filter with the given coefficients.
  1418. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1419. are the numerator and denominator coefficients respectively.
  1420. @section bs2b
  1421. Bauer stereo to binaural transformation, which improves headphone listening of
  1422. stereo audio records.
  1423. It accepts the following parameters:
  1424. @table @option
  1425. @item profile
  1426. Pre-defined crossfeed level.
  1427. @table @option
  1428. @item default
  1429. Default level (fcut=700, feed=50).
  1430. @item cmoy
  1431. Chu Moy circuit (fcut=700, feed=60).
  1432. @item jmeier
  1433. Jan Meier circuit (fcut=650, feed=95).
  1434. @end table
  1435. @item fcut
  1436. Cut frequency (in Hz).
  1437. @item feed
  1438. Feed level (in Hz).
  1439. @end table
  1440. @section channelmap
  1441. Remap input channels to new locations.
  1442. It accepts the following parameters:
  1443. @table @option
  1444. @item map
  1445. Map channels from input to output. The argument is a '|'-separated list of
  1446. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1447. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1448. channel (e.g. FL for front left) or its index in the input channel layout.
  1449. @var{out_channel} is the name of the output channel or its index in the output
  1450. channel layout. If @var{out_channel} is not given then it is implicitly an
  1451. index, starting with zero and increasing by one for each mapping.
  1452. @item channel_layout
  1453. The channel layout of the output stream.
  1454. @end table
  1455. If no mapping is present, the filter will implicitly map input channels to
  1456. output channels, preserving indices.
  1457. For example, assuming a 5.1+downmix input MOV file,
  1458. @example
  1459. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1460. @end example
  1461. will create an output WAV file tagged as stereo from the downmix channels of
  1462. the input.
  1463. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1464. @example
  1465. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1466. @end example
  1467. @section channelsplit
  1468. Split each channel from an input audio stream into a separate output stream.
  1469. It accepts the following parameters:
  1470. @table @option
  1471. @item channel_layout
  1472. The channel layout of the input stream. The default is "stereo".
  1473. @end table
  1474. For example, assuming a stereo input MP3 file,
  1475. @example
  1476. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1477. @end example
  1478. will create an output Matroska file with two audio streams, one containing only
  1479. the left channel and the other the right channel.
  1480. Split a 5.1 WAV file into per-channel files:
  1481. @example
  1482. ffmpeg -i in.wav -filter_complex
  1483. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1484. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1485. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1486. side_right.wav
  1487. @end example
  1488. @section chorus
  1489. Add a chorus effect to the audio.
  1490. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1491. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1492. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1493. The modulation depth defines the range the modulated delay is played before or after
  1494. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1495. sound tuned around the original one, like in a chorus where some vocals are slightly
  1496. off key.
  1497. It accepts the following parameters:
  1498. @table @option
  1499. @item in_gain
  1500. Set input gain. Default is 0.4.
  1501. @item out_gain
  1502. Set output gain. Default is 0.4.
  1503. @item delays
  1504. Set delays. A typical delay is around 40ms to 60ms.
  1505. @item decays
  1506. Set decays.
  1507. @item speeds
  1508. Set speeds.
  1509. @item depths
  1510. Set depths.
  1511. @end table
  1512. @subsection Examples
  1513. @itemize
  1514. @item
  1515. A single delay:
  1516. @example
  1517. chorus=0.7:0.9:55:0.4:0.25:2
  1518. @end example
  1519. @item
  1520. Two delays:
  1521. @example
  1522. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1523. @end example
  1524. @item
  1525. Fuller sounding chorus with three delays:
  1526. @example
  1527. 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
  1528. @end example
  1529. @end itemize
  1530. @section compand
  1531. Compress or expand the audio's dynamic range.
  1532. It accepts the following parameters:
  1533. @table @option
  1534. @item attacks
  1535. @item decays
  1536. A list of times in seconds for each channel over which the instantaneous level
  1537. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1538. increase of volume and @var{decays} refers to decrease of volume. For most
  1539. situations, the attack time (response to the audio getting louder) should be
  1540. shorter than the decay time, because the human ear is more sensitive to sudden
  1541. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1542. a typical value for decay is 0.8 seconds.
  1543. If specified number of attacks & decays is lower than number of channels, the last
  1544. set attack/decay will be used for all remaining channels.
  1545. @item points
  1546. A list of points for the transfer function, specified in dB relative to the
  1547. maximum possible signal amplitude. Each key points list must be defined using
  1548. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1549. @code{x0/y0 x1/y1 x2/y2 ....}
  1550. The input values must be in strictly increasing order but the transfer function
  1551. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1552. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1553. function are @code{-70/-70|-60/-20}.
  1554. @item soft-knee
  1555. Set the curve radius in dB for all joints. It defaults to 0.01.
  1556. @item gain
  1557. Set the additional gain in dB to be applied at all points on the transfer
  1558. function. This allows for easy adjustment of the overall gain.
  1559. It defaults to 0.
  1560. @item volume
  1561. Set an initial volume, in dB, to be assumed for each channel when filtering
  1562. starts. This permits the user to supply a nominal level initially, so that, for
  1563. example, a very large gain is not applied to initial signal levels before the
  1564. companding has begun to operate. A typical value for audio which is initially
  1565. quiet is -90 dB. It defaults to 0.
  1566. @item delay
  1567. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1568. delayed before being fed to the volume adjuster. Specifying a delay
  1569. approximately equal to the attack/decay times allows the filter to effectively
  1570. operate in predictive rather than reactive mode. It defaults to 0.
  1571. @end table
  1572. @subsection Examples
  1573. @itemize
  1574. @item
  1575. Make music with both quiet and loud passages suitable for listening to in a
  1576. noisy environment:
  1577. @example
  1578. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1579. @end example
  1580. Another example for audio with whisper and explosion parts:
  1581. @example
  1582. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1583. @end example
  1584. @item
  1585. A noise gate for when the noise is at a lower level than the signal:
  1586. @example
  1587. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1588. @end example
  1589. @item
  1590. Here is another noise gate, this time for when the noise is at a higher level
  1591. than the signal (making it, in some ways, similar to squelch):
  1592. @example
  1593. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1594. @end example
  1595. @item
  1596. 2:1 compression starting at -6dB:
  1597. @example
  1598. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1599. @end example
  1600. @item
  1601. 2:1 compression starting at -9dB:
  1602. @example
  1603. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1604. @end example
  1605. @item
  1606. 2:1 compression starting at -12dB:
  1607. @example
  1608. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1609. @end example
  1610. @item
  1611. 2:1 compression starting at -18dB:
  1612. @example
  1613. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1614. @end example
  1615. @item
  1616. 3:1 compression starting at -15dB:
  1617. @example
  1618. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1619. @end example
  1620. @item
  1621. Compressor/Gate:
  1622. @example
  1623. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1624. @end example
  1625. @item
  1626. Expander:
  1627. @example
  1628. 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
  1629. @end example
  1630. @item
  1631. Hard limiter at -6dB:
  1632. @example
  1633. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1634. @end example
  1635. @item
  1636. Hard limiter at -12dB:
  1637. @example
  1638. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1639. @end example
  1640. @item
  1641. Hard noise gate at -35 dB:
  1642. @example
  1643. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1644. @end example
  1645. @item
  1646. Soft limiter:
  1647. @example
  1648. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1649. @end example
  1650. @end itemize
  1651. @section compensationdelay
  1652. Compensation Delay Line is a metric based delay to compensate differing
  1653. positions of microphones or speakers.
  1654. For example, you have recorded guitar with two microphones placed in
  1655. different location. Because the front of sound wave has fixed speed in
  1656. normal conditions, the phasing of microphones can vary and depends on
  1657. their location and interposition. The best sound mix can be achieved when
  1658. these microphones are in phase (synchronized). Note that distance of
  1659. ~30 cm between microphones makes one microphone to capture signal in
  1660. antiphase to another microphone. That makes the final mix sounding moody.
  1661. This filter helps to solve phasing problems by adding different delays
  1662. to each microphone track and make them synchronized.
  1663. The best result can be reached when you take one track as base and
  1664. synchronize other tracks one by one with it.
  1665. Remember that synchronization/delay tolerance depends on sample rate, too.
  1666. Higher sample rates will give more tolerance.
  1667. It accepts the following parameters:
  1668. @table @option
  1669. @item mm
  1670. Set millimeters distance. This is compensation distance for fine tuning.
  1671. Default is 0.
  1672. @item cm
  1673. Set cm distance. This is compensation distance for tightening distance setup.
  1674. Default is 0.
  1675. @item m
  1676. Set meters distance. This is compensation distance for hard distance setup.
  1677. Default is 0.
  1678. @item dry
  1679. Set dry amount. Amount of unprocessed (dry) signal.
  1680. Default is 0.
  1681. @item wet
  1682. Set wet amount. Amount of processed (wet) signal.
  1683. Default is 1.
  1684. @item temp
  1685. Set temperature degree in Celsius. This is the temperature of the environment.
  1686. Default is 20.
  1687. @end table
  1688. @section crystalizer
  1689. Simple algorithm to expand audio dynamic range.
  1690. The filter accepts the following options:
  1691. @table @option
  1692. @item i
  1693. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1694. (unchanged sound) to 10.0 (maximum effect).
  1695. @item c
  1696. Enable clipping. By default is enabled.
  1697. @end table
  1698. @section dcshift
  1699. Apply a DC shift to the audio.
  1700. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1701. in the recording chain) from the audio. The effect of a DC offset is reduced
  1702. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1703. a signal has a DC offset.
  1704. @table @option
  1705. @item shift
  1706. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1707. the audio.
  1708. @item limitergain
  1709. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1710. used to prevent clipping.
  1711. @end table
  1712. @section dynaudnorm
  1713. Dynamic Audio Normalizer.
  1714. This filter applies a certain amount of gain to the input audio in order
  1715. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1716. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1717. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1718. This allows for applying extra gain to the "quiet" sections of the audio
  1719. while avoiding distortions or clipping the "loud" sections. In other words:
  1720. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1721. sections, in the sense that the volume of each section is brought to the
  1722. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1723. this goal *without* applying "dynamic range compressing". It will retain 100%
  1724. of the dynamic range *within* each section of the audio file.
  1725. @table @option
  1726. @item f
  1727. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1728. Default is 500 milliseconds.
  1729. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1730. referred to as frames. This is required, because a peak magnitude has no
  1731. meaning for just a single sample value. Instead, we need to determine the
  1732. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1733. normalizer would simply use the peak magnitude of the complete file, the
  1734. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1735. frame. The length of a frame is specified in milliseconds. By default, the
  1736. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1737. been found to give good results with most files.
  1738. Note that the exact frame length, in number of samples, will be determined
  1739. automatically, based on the sampling rate of the individual input audio file.
  1740. @item g
  1741. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1742. number. Default is 31.
  1743. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1744. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1745. is specified in frames, centered around the current frame. For the sake of
  1746. simplicity, this must be an odd number. Consequently, the default value of 31
  1747. takes into account the current frame, as well as the 15 preceding frames and
  1748. the 15 subsequent frames. Using a larger window results in a stronger
  1749. smoothing effect and thus in less gain variation, i.e. slower gain
  1750. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1751. effect and thus in more gain variation, i.e. faster gain adaptation.
  1752. In other words, the more you increase this value, the more the Dynamic Audio
  1753. Normalizer will behave like a "traditional" normalization filter. On the
  1754. contrary, the more you decrease this value, the more the Dynamic Audio
  1755. Normalizer will behave like a dynamic range compressor.
  1756. @item p
  1757. Set the target peak value. This specifies the highest permissible magnitude
  1758. level for the normalized audio input. This filter will try to approach the
  1759. target peak magnitude as closely as possible, but at the same time it also
  1760. makes sure that the normalized signal will never exceed the peak magnitude.
  1761. A frame's maximum local gain factor is imposed directly by the target peak
  1762. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1763. It is not recommended to go above this value.
  1764. @item m
  1765. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1766. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1767. factor for each input frame, i.e. the maximum gain factor that does not
  1768. result in clipping or distortion. The maximum gain factor is determined by
  1769. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1770. additionally bounds the frame's maximum gain factor by a predetermined
  1771. (global) maximum gain factor. This is done in order to avoid excessive gain
  1772. factors in "silent" or almost silent frames. By default, the maximum gain
  1773. factor is 10.0, For most inputs the default value should be sufficient and
  1774. it usually is not recommended to increase this value. Though, for input
  1775. with an extremely low overall volume level, it may be necessary to allow even
  1776. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1777. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1778. Instead, a "sigmoid" threshold function will be applied. This way, the
  1779. gain factors will smoothly approach the threshold value, but never exceed that
  1780. value.
  1781. @item r
  1782. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1783. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1784. This means that the maximum local gain factor for each frame is defined
  1785. (only) by the frame's highest magnitude sample. This way, the samples can
  1786. be amplified as much as possible without exceeding the maximum signal
  1787. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1788. Normalizer can also take into account the frame's root mean square,
  1789. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1790. determine the power of a time-varying signal. It is therefore considered
  1791. that the RMS is a better approximation of the "perceived loudness" than
  1792. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1793. frames to a constant RMS value, a uniform "perceived loudness" can be
  1794. established. If a target RMS value has been specified, a frame's local gain
  1795. factor is defined as the factor that would result in exactly that RMS value.
  1796. Note, however, that the maximum local gain factor is still restricted by the
  1797. frame's highest magnitude sample, in order to prevent clipping.
  1798. @item n
  1799. Enable channels coupling. By default is enabled.
  1800. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1801. amount. This means the same gain factor will be applied to all channels, i.e.
  1802. the maximum possible gain factor is determined by the "loudest" channel.
  1803. However, in some recordings, it may happen that the volume of the different
  1804. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1805. In this case, this option can be used to disable the channel coupling. This way,
  1806. the gain factor will be determined independently for each channel, depending
  1807. only on the individual channel's highest magnitude sample. This allows for
  1808. harmonizing the volume of the different channels.
  1809. @item c
  1810. Enable DC bias correction. By default is disabled.
  1811. An audio signal (in the time domain) is a sequence of sample values.
  1812. In the Dynamic Audio Normalizer these sample values are represented in the
  1813. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1814. audio signal, or "waveform", should be centered around the zero point.
  1815. That means if we calculate the mean value of all samples in a file, or in a
  1816. single frame, then the result should be 0.0 or at least very close to that
  1817. value. If, however, there is a significant deviation of the mean value from
  1818. 0.0, in either positive or negative direction, this is referred to as a
  1819. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1820. Audio Normalizer provides optional DC bias correction.
  1821. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1822. the mean value, or "DC correction" offset, of each input frame and subtract
  1823. that value from all of the frame's sample values which ensures those samples
  1824. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1825. boundaries, the DC correction offset values will be interpolated smoothly
  1826. between neighbouring frames.
  1827. @item b
  1828. Enable alternative boundary mode. By default is disabled.
  1829. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1830. around each frame. This includes the preceding frames as well as the
  1831. subsequent frames. However, for the "boundary" frames, located at the very
  1832. beginning and at the very end of the audio file, not all neighbouring
  1833. frames are available. In particular, for the first few frames in the audio
  1834. file, the preceding frames are not known. And, similarly, for the last few
  1835. frames in the audio file, the subsequent frames are not known. Thus, the
  1836. question arises which gain factors should be assumed for the missing frames
  1837. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1838. to deal with this situation. The default boundary mode assumes a gain factor
  1839. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1840. "fade out" at the beginning and at the end of the input, respectively.
  1841. @item s
  1842. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1843. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1844. compression. This means that signal peaks will not be pruned and thus the
  1845. full dynamic range will be retained within each local neighbourhood. However,
  1846. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1847. normalization algorithm with a more "traditional" compression.
  1848. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1849. (thresholding) function. If (and only if) the compression feature is enabled,
  1850. all input frames will be processed by a soft knee thresholding function prior
  1851. to the actual normalization process. Put simply, the thresholding function is
  1852. going to prune all samples whose magnitude exceeds a certain threshold value.
  1853. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1854. value. Instead, the threshold value will be adjusted for each individual
  1855. frame.
  1856. In general, smaller parameters result in stronger compression, and vice versa.
  1857. Values below 3.0 are not recommended, because audible distortion may appear.
  1858. @end table
  1859. @section earwax
  1860. Make audio easier to listen to on headphones.
  1861. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1862. so that when listened to on headphones the stereo image is moved from
  1863. inside your head (standard for headphones) to outside and in front of
  1864. the listener (standard for speakers).
  1865. Ported from SoX.
  1866. @section equalizer
  1867. Apply a two-pole peaking equalisation (EQ) filter. With this
  1868. filter, the signal-level at and around a selected frequency can
  1869. be increased or decreased, whilst (unlike bandpass and bandreject
  1870. filters) that at all other frequencies is unchanged.
  1871. In order to produce complex equalisation curves, this filter can
  1872. be given several times, each with a different central frequency.
  1873. The filter accepts the following options:
  1874. @table @option
  1875. @item frequency, f
  1876. Set the filter's central frequency in Hz.
  1877. @item width_type
  1878. Set method to specify band-width of filter.
  1879. @table @option
  1880. @item h
  1881. Hz
  1882. @item q
  1883. Q-Factor
  1884. @item o
  1885. octave
  1886. @item s
  1887. slope
  1888. @end table
  1889. @item width, w
  1890. Specify the band-width of a filter in width_type units.
  1891. @item gain, g
  1892. Set the required gain or attenuation in dB.
  1893. Beware of clipping when using a positive gain.
  1894. @end table
  1895. @subsection Examples
  1896. @itemize
  1897. @item
  1898. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1899. @example
  1900. equalizer=f=1000:width_type=h:width=200:g=-10
  1901. @end example
  1902. @item
  1903. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1904. @example
  1905. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1906. @end example
  1907. @end itemize
  1908. @section extrastereo
  1909. Linearly increases the difference between left and right channels which
  1910. adds some sort of "live" effect to playback.
  1911. The filter accepts the following options:
  1912. @table @option
  1913. @item m
  1914. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1915. (average of both channels), with 1.0 sound will be unchanged, with
  1916. -1.0 left and right channels will be swapped.
  1917. @item c
  1918. Enable clipping. By default is enabled.
  1919. @end table
  1920. @section firequalizer
  1921. Apply FIR Equalization using arbitrary frequency response.
  1922. The filter accepts the following option:
  1923. @table @option
  1924. @item gain
  1925. Set gain curve equation (in dB). The expression can contain variables:
  1926. @table @option
  1927. @item f
  1928. the evaluated frequency
  1929. @item sr
  1930. sample rate
  1931. @item ch
  1932. channel number, set to 0 when multichannels evaluation is disabled
  1933. @item chid
  1934. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1935. multichannels evaluation is disabled
  1936. @item chs
  1937. number of channels
  1938. @item chlayout
  1939. channel_layout, see libavutil/channel_layout.h
  1940. @end table
  1941. and functions:
  1942. @table @option
  1943. @item gain_interpolate(f)
  1944. interpolate gain on frequency f based on gain_entry
  1945. @item cubic_interpolate(f)
  1946. same as gain_interpolate, but smoother
  1947. @end table
  1948. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1949. @item gain_entry
  1950. Set gain entry for gain_interpolate function. The expression can
  1951. contain functions:
  1952. @table @option
  1953. @item entry(f, g)
  1954. store gain entry at frequency f with value g
  1955. @end table
  1956. This option is also available as command.
  1957. @item delay
  1958. Set filter delay in seconds. Higher value means more accurate.
  1959. Default is @code{0.01}.
  1960. @item accuracy
  1961. Set filter accuracy in Hz. Lower value means more accurate.
  1962. Default is @code{5}.
  1963. @item wfunc
  1964. Set window function. Acceptable values are:
  1965. @table @option
  1966. @item rectangular
  1967. rectangular window, useful when gain curve is already smooth
  1968. @item hann
  1969. hann window (default)
  1970. @item hamming
  1971. hamming window
  1972. @item blackman
  1973. blackman window
  1974. @item nuttall3
  1975. 3-terms continuous 1st derivative nuttall window
  1976. @item mnuttall3
  1977. minimum 3-terms discontinuous nuttall window
  1978. @item nuttall
  1979. 4-terms continuous 1st derivative nuttall window
  1980. @item bnuttall
  1981. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1982. @item bharris
  1983. blackman-harris window
  1984. @item tukey
  1985. tukey window
  1986. @end table
  1987. @item fixed
  1988. If enabled, use fixed number of audio samples. This improves speed when
  1989. filtering with large delay. Default is disabled.
  1990. @item multi
  1991. Enable multichannels evaluation on gain. Default is disabled.
  1992. @item zero_phase
  1993. Enable zero phase mode by subtracting timestamp to compensate delay.
  1994. Default is disabled.
  1995. @item scale
  1996. Set scale used by gain. Acceptable values are:
  1997. @table @option
  1998. @item linlin
  1999. linear frequency, linear gain
  2000. @item linlog
  2001. linear frequency, logarithmic (in dB) gain (default)
  2002. @item loglin
  2003. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2004. @item loglog
  2005. logarithmic frequency, logarithmic gain
  2006. @end table
  2007. @item dumpfile
  2008. Set file for dumping, suitable for gnuplot.
  2009. @item dumpscale
  2010. Set scale for dumpfile. Acceptable values are same with scale option.
  2011. Default is linlog.
  2012. @item fft2
  2013. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2014. Default is disabled.
  2015. @end table
  2016. @subsection Examples
  2017. @itemize
  2018. @item
  2019. lowpass at 1000 Hz:
  2020. @example
  2021. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2022. @end example
  2023. @item
  2024. lowpass at 1000 Hz with gain_entry:
  2025. @example
  2026. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2027. @end example
  2028. @item
  2029. custom equalization:
  2030. @example
  2031. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2032. @end example
  2033. @item
  2034. higher delay with zero phase to compensate delay:
  2035. @example
  2036. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2037. @end example
  2038. @item
  2039. lowpass on left channel, highpass on right channel:
  2040. @example
  2041. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2042. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2043. @end example
  2044. @end itemize
  2045. @section flanger
  2046. Apply a flanging effect to the audio.
  2047. The filter accepts the following options:
  2048. @table @option
  2049. @item delay
  2050. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2051. @item depth
  2052. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2053. @item regen
  2054. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2055. Default value is 0.
  2056. @item width
  2057. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2058. Default value is 71.
  2059. @item speed
  2060. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2061. @item shape
  2062. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2063. Default value is @var{sinusoidal}.
  2064. @item phase
  2065. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2066. Default value is 25.
  2067. @item interp
  2068. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2069. Default is @var{linear}.
  2070. @end table
  2071. @section hdcd
  2072. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2073. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2074. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2075. of HDCD, and detects the Transient Filter flag.
  2076. @example
  2077. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2078. @end example
  2079. When using the filter with wav, note the default encoding for wav is 16-bit,
  2080. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2081. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2082. @example
  2083. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2084. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2085. @end example
  2086. The filter accepts the following options:
  2087. @table @option
  2088. @item disable_autoconvert
  2089. Disable any automatic format conversion or resampling in the filter graph.
  2090. @item process_stereo
  2091. Process the stereo channels together. If target_gain does not match between
  2092. channels, consider it invalid and use the last valid target_gain.
  2093. @item cdt_ms
  2094. Set the code detect timer period in ms.
  2095. @item force_pe
  2096. Always extend peaks above -3dBFS even if PE isn't signaled.
  2097. @item analyze_mode
  2098. Replace audio with a solid tone and adjust the amplitude to signal some
  2099. specific aspect of the decoding process. The output file can be loaded in
  2100. an audio editor alongside the original to aid analysis.
  2101. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2102. Modes are:
  2103. @table @samp
  2104. @item 0, off
  2105. Disabled
  2106. @item 1, lle
  2107. Gain adjustment level at each sample
  2108. @item 2, pe
  2109. Samples where peak extend occurs
  2110. @item 3, cdt
  2111. Samples where the code detect timer is active
  2112. @item 4, tgm
  2113. Samples where the target gain does not match between channels
  2114. @end table
  2115. @end table
  2116. @section highpass
  2117. Apply a high-pass filter with 3dB point frequency.
  2118. The filter can be either single-pole, or double-pole (the default).
  2119. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item frequency, f
  2123. Set frequency in Hz. Default is 3000.
  2124. @item poles, p
  2125. Set number of poles. Default is 2.
  2126. @item width_type
  2127. Set method to specify band-width of filter.
  2128. @table @option
  2129. @item h
  2130. Hz
  2131. @item q
  2132. Q-Factor
  2133. @item o
  2134. octave
  2135. @item s
  2136. slope
  2137. @end table
  2138. @item width, w
  2139. Specify the band-width of a filter in width_type units.
  2140. Applies only to double-pole filter.
  2141. The default is 0.707q and gives a Butterworth response.
  2142. @end table
  2143. @section join
  2144. Join multiple input streams into one multi-channel stream.
  2145. It accepts the following parameters:
  2146. @table @option
  2147. @item inputs
  2148. The number of input streams. It defaults to 2.
  2149. @item channel_layout
  2150. The desired output channel layout. It defaults to stereo.
  2151. @item map
  2152. Map channels from inputs to output. The argument is a '|'-separated list of
  2153. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2154. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2155. can be either the name of the input channel (e.g. FL for front left) or its
  2156. index in the specified input stream. @var{out_channel} is the name of the output
  2157. channel.
  2158. @end table
  2159. The filter will attempt to guess the mappings when they are not specified
  2160. explicitly. It does so by first trying to find an unused matching input channel
  2161. and if that fails it picks the first unused input channel.
  2162. Join 3 inputs (with properly set channel layouts):
  2163. @example
  2164. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2165. @end example
  2166. Build a 5.1 output from 6 single-channel streams:
  2167. @example
  2168. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2169. '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'
  2170. out
  2171. @end example
  2172. @section ladspa
  2173. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2174. To enable compilation of this filter you need to configure FFmpeg with
  2175. @code{--enable-ladspa}.
  2176. @table @option
  2177. @item file, f
  2178. Specifies the name of LADSPA plugin library to load. If the environment
  2179. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2180. each one of the directories specified by the colon separated list in
  2181. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2182. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2183. @file{/usr/lib/ladspa/}.
  2184. @item plugin, p
  2185. Specifies the plugin within the library. Some libraries contain only
  2186. one plugin, but others contain many of them. If this is not set filter
  2187. will list all available plugins within the specified library.
  2188. @item controls, c
  2189. Set the '|' separated list of controls which are zero or more floating point
  2190. values that determine the behavior of the loaded plugin (for example delay,
  2191. threshold or gain).
  2192. Controls need to be defined using the following syntax:
  2193. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2194. @var{valuei} is the value set on the @var{i}-th control.
  2195. Alternatively they can be also defined using the following syntax:
  2196. @var{value0}|@var{value1}|@var{value2}|..., where
  2197. @var{valuei} is the value set on the @var{i}-th control.
  2198. If @option{controls} is set to @code{help}, all available controls and
  2199. their valid ranges are printed.
  2200. @item sample_rate, s
  2201. Specify the sample rate, default to 44100. Only used if plugin have
  2202. zero inputs.
  2203. @item nb_samples, n
  2204. Set the number of samples per channel per each output frame, default
  2205. is 1024. Only used if plugin have zero inputs.
  2206. @item duration, d
  2207. Set the minimum duration of the sourced audio. See
  2208. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2209. for the accepted syntax.
  2210. Note that the resulting duration may be greater than the specified duration,
  2211. as the generated audio is always cut at the end of a complete frame.
  2212. If not specified, or the expressed duration is negative, the audio is
  2213. supposed to be generated forever.
  2214. Only used if plugin have zero inputs.
  2215. @end table
  2216. @subsection Examples
  2217. @itemize
  2218. @item
  2219. List all available plugins within amp (LADSPA example plugin) library:
  2220. @example
  2221. ladspa=file=amp
  2222. @end example
  2223. @item
  2224. List all available controls and their valid ranges for @code{vcf_notch}
  2225. plugin from @code{VCF} library:
  2226. @example
  2227. ladspa=f=vcf:p=vcf_notch:c=help
  2228. @end example
  2229. @item
  2230. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2231. plugin library:
  2232. @example
  2233. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2234. @end example
  2235. @item
  2236. Add reverberation to the audio using TAP-plugins
  2237. (Tom's Audio Processing plugins):
  2238. @example
  2239. ladspa=file=tap_reverb:tap_reverb
  2240. @end example
  2241. @item
  2242. Generate white noise, with 0.2 amplitude:
  2243. @example
  2244. ladspa=file=cmt:noise_source_white:c=c0=.2
  2245. @end example
  2246. @item
  2247. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2248. @code{C* Audio Plugin Suite} (CAPS) library:
  2249. @example
  2250. ladspa=file=caps:Click:c=c1=20'
  2251. @end example
  2252. @item
  2253. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2254. @example
  2255. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2256. @end example
  2257. @item
  2258. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2259. @code{SWH Plugins} collection:
  2260. @example
  2261. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2262. @end example
  2263. @item
  2264. Attenuate low frequencies using Multiband EQ from Steve Harris
  2265. @code{SWH Plugins} collection:
  2266. @example
  2267. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2268. @end example
  2269. @end itemize
  2270. @subsection Commands
  2271. This filter supports the following commands:
  2272. @table @option
  2273. @item cN
  2274. Modify the @var{N}-th control value.
  2275. If the specified value is not valid, it is ignored and prior one is kept.
  2276. @end table
  2277. @section loudnorm
  2278. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2279. Support for both single pass (livestreams, files) and double pass (files) modes.
  2280. This algorithm can target IL, LRA, and maximum true peak.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item I, i
  2284. Set integrated loudness target.
  2285. Range is -70.0 - -5.0. Default value is -24.0.
  2286. @item LRA, lra
  2287. Set loudness range target.
  2288. Range is 1.0 - 20.0. Default value is 7.0.
  2289. @item TP, tp
  2290. Set maximum true peak.
  2291. Range is -9.0 - +0.0. Default value is -2.0.
  2292. @item measured_I, measured_i
  2293. Measured IL of input file.
  2294. Range is -99.0 - +0.0.
  2295. @item measured_LRA, measured_lra
  2296. Measured LRA of input file.
  2297. Range is 0.0 - 99.0.
  2298. @item measured_TP, measured_tp
  2299. Measured true peak of input file.
  2300. Range is -99.0 - +99.0.
  2301. @item measured_thresh
  2302. Measured threshold of input file.
  2303. Range is -99.0 - +0.0.
  2304. @item offset
  2305. Set offset gain. Gain is applied before the true-peak limiter.
  2306. Range is -99.0 - +99.0. Default is +0.0.
  2307. @item linear
  2308. Normalize linearly if possible.
  2309. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2310. to be specified in order to use this mode.
  2311. Options are true or false. Default is true.
  2312. @item dual_mono
  2313. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2314. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2315. If set to @code{true}, this option will compensate for this effect.
  2316. Multi-channel input files are not affected by this option.
  2317. Options are true or false. Default is false.
  2318. @item print_format
  2319. Set print format for stats. Options are summary, json, or none.
  2320. Default value is none.
  2321. @end table
  2322. @section lowpass
  2323. Apply a low-pass filter with 3dB point frequency.
  2324. The filter can be either single-pole or double-pole (the default).
  2325. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2326. The filter accepts the following options:
  2327. @table @option
  2328. @item frequency, f
  2329. Set frequency in Hz. Default is 500.
  2330. @item poles, p
  2331. Set number of poles. Default is 2.
  2332. @item width_type
  2333. Set method to specify band-width of filter.
  2334. @table @option
  2335. @item h
  2336. Hz
  2337. @item q
  2338. Q-Factor
  2339. @item o
  2340. octave
  2341. @item s
  2342. slope
  2343. @end table
  2344. @item width, w
  2345. Specify the band-width of a filter in width_type units.
  2346. Applies only to double-pole filter.
  2347. The default is 0.707q and gives a Butterworth response.
  2348. @end table
  2349. @anchor{pan}
  2350. @section pan
  2351. Mix channels with specific gain levels. The filter accepts the output
  2352. channel layout followed by a set of channels definitions.
  2353. This filter is also designed to efficiently remap the channels of an audio
  2354. stream.
  2355. The filter accepts parameters of the form:
  2356. "@var{l}|@var{outdef}|@var{outdef}|..."
  2357. @table @option
  2358. @item l
  2359. output channel layout or number of channels
  2360. @item outdef
  2361. output channel specification, of the form:
  2362. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2363. @item out_name
  2364. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2365. number (c0, c1, etc.)
  2366. @item gain
  2367. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2368. @item in_name
  2369. input channel to use, see out_name for details; it is not possible to mix
  2370. named and numbered input channels
  2371. @end table
  2372. If the `=' in a channel specification is replaced by `<', then the gains for
  2373. that specification will be renormalized so that the total is 1, thus
  2374. avoiding clipping noise.
  2375. @subsection Mixing examples
  2376. For example, if you want to down-mix from stereo to mono, but with a bigger
  2377. factor for the left channel:
  2378. @example
  2379. pan=1c|c0=0.9*c0+0.1*c1
  2380. @end example
  2381. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2382. 7-channels surround:
  2383. @example
  2384. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2385. @end example
  2386. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2387. that should be preferred (see "-ac" option) unless you have very specific
  2388. needs.
  2389. @subsection Remapping examples
  2390. The channel remapping will be effective if, and only if:
  2391. @itemize
  2392. @item gain coefficients are zeroes or ones,
  2393. @item only one input per channel output,
  2394. @end itemize
  2395. If all these conditions are satisfied, the filter will notify the user ("Pure
  2396. channel mapping detected"), and use an optimized and lossless method to do the
  2397. remapping.
  2398. For example, if you have a 5.1 source and want a stereo audio stream by
  2399. dropping the extra channels:
  2400. @example
  2401. pan="stereo| c0=FL | c1=FR"
  2402. @end example
  2403. Given the same source, you can also switch front left and front right channels
  2404. and keep the input channel layout:
  2405. @example
  2406. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2407. @end example
  2408. If the input is a stereo audio stream, you can mute the front left channel (and
  2409. still keep the stereo channel layout) with:
  2410. @example
  2411. pan="stereo|c1=c1"
  2412. @end example
  2413. Still with a stereo audio stream input, you can copy the right channel in both
  2414. front left and right:
  2415. @example
  2416. pan="stereo| c0=FR | c1=FR"
  2417. @end example
  2418. @section replaygain
  2419. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2420. outputs it unchanged.
  2421. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2422. @section resample
  2423. Convert the audio sample format, sample rate and channel layout. It is
  2424. not meant to be used directly.
  2425. @section rubberband
  2426. Apply time-stretching and pitch-shifting with librubberband.
  2427. The filter accepts the following options:
  2428. @table @option
  2429. @item tempo
  2430. Set tempo scale factor.
  2431. @item pitch
  2432. Set pitch scale factor.
  2433. @item transients
  2434. Set transients detector.
  2435. Possible values are:
  2436. @table @var
  2437. @item crisp
  2438. @item mixed
  2439. @item smooth
  2440. @end table
  2441. @item detector
  2442. Set detector.
  2443. Possible values are:
  2444. @table @var
  2445. @item compound
  2446. @item percussive
  2447. @item soft
  2448. @end table
  2449. @item phase
  2450. Set phase.
  2451. Possible values are:
  2452. @table @var
  2453. @item laminar
  2454. @item independent
  2455. @end table
  2456. @item window
  2457. Set processing window size.
  2458. Possible values are:
  2459. @table @var
  2460. @item standard
  2461. @item short
  2462. @item long
  2463. @end table
  2464. @item smoothing
  2465. Set smoothing.
  2466. Possible values are:
  2467. @table @var
  2468. @item off
  2469. @item on
  2470. @end table
  2471. @item formant
  2472. Enable formant preservation when shift pitching.
  2473. Possible values are:
  2474. @table @var
  2475. @item shifted
  2476. @item preserved
  2477. @end table
  2478. @item pitchq
  2479. Set pitch quality.
  2480. Possible values are:
  2481. @table @var
  2482. @item quality
  2483. @item speed
  2484. @item consistency
  2485. @end table
  2486. @item channels
  2487. Set channels.
  2488. Possible values are:
  2489. @table @var
  2490. @item apart
  2491. @item together
  2492. @end table
  2493. @end table
  2494. @section sidechaincompress
  2495. This filter acts like normal compressor but has the ability to compress
  2496. detected signal using second input signal.
  2497. It needs two input streams and returns one output stream.
  2498. First input stream will be processed depending on second stream signal.
  2499. The filtered signal then can be filtered with other filters in later stages of
  2500. processing. See @ref{pan} and @ref{amerge} filter.
  2501. The filter accepts the following options:
  2502. @table @option
  2503. @item level_in
  2504. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2505. @item threshold
  2506. If a signal of second stream raises above this level it will affect the gain
  2507. reduction of first stream.
  2508. By default is 0.125. Range is between 0.00097563 and 1.
  2509. @item ratio
  2510. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2511. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2512. Default is 2. Range is between 1 and 20.
  2513. @item attack
  2514. Amount of milliseconds the signal has to rise above the threshold before gain
  2515. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2516. @item release
  2517. Amount of milliseconds the signal has to fall below the threshold before
  2518. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2519. @item makeup
  2520. Set the amount by how much signal will be amplified after processing.
  2521. Default is 2. Range is from 1 and 64.
  2522. @item knee
  2523. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2524. Default is 2.82843. Range is between 1 and 8.
  2525. @item link
  2526. Choose if the @code{average} level between all channels of side-chain stream
  2527. or the louder(@code{maximum}) channel of side-chain stream affects the
  2528. reduction. Default is @code{average}.
  2529. @item detection
  2530. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2531. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2532. @item level_sc
  2533. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2534. @item mix
  2535. How much to use compressed signal in output. Default is 1.
  2536. Range is between 0 and 1.
  2537. @end table
  2538. @subsection Examples
  2539. @itemize
  2540. @item
  2541. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2542. depending on the signal of 2nd input and later compressed signal to be
  2543. merged with 2nd input:
  2544. @example
  2545. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2546. @end example
  2547. @end itemize
  2548. @section sidechaingate
  2549. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2550. filter the detected signal before sending it to the gain reduction stage.
  2551. Normally a gate uses the full range signal to detect a level above the
  2552. threshold.
  2553. For example: If you cut all lower frequencies from your sidechain signal
  2554. the gate will decrease the volume of your track only if not enough highs
  2555. appear. With this technique you are able to reduce the resonation of a
  2556. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2557. guitar.
  2558. It needs two input streams and returns one output stream.
  2559. First input stream will be processed depending on second stream signal.
  2560. The filter accepts the following options:
  2561. @table @option
  2562. @item level_in
  2563. Set input level before filtering.
  2564. Default is 1. Allowed range is from 0.015625 to 64.
  2565. @item range
  2566. Set the level of gain reduction when the signal is below the threshold.
  2567. Default is 0.06125. Allowed range is from 0 to 1.
  2568. @item threshold
  2569. If a signal rises above this level the gain reduction is released.
  2570. Default is 0.125. Allowed range is from 0 to 1.
  2571. @item ratio
  2572. Set a ratio about which the signal is reduced.
  2573. Default is 2. Allowed range is from 1 to 9000.
  2574. @item attack
  2575. Amount of milliseconds the signal has to rise above the threshold before gain
  2576. reduction stops.
  2577. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2578. @item release
  2579. Amount of milliseconds the signal has to fall below the threshold before the
  2580. reduction is increased again. Default is 250 milliseconds.
  2581. Allowed range is from 0.01 to 9000.
  2582. @item makeup
  2583. Set amount of amplification of signal after processing.
  2584. Default is 1. Allowed range is from 1 to 64.
  2585. @item knee
  2586. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2587. Default is 2.828427125. Allowed range is from 1 to 8.
  2588. @item detection
  2589. Choose if exact signal should be taken for detection or an RMS like one.
  2590. Default is rms. Can be peak or rms.
  2591. @item link
  2592. Choose if the average level between all channels or the louder channel affects
  2593. the reduction.
  2594. Default is average. Can be average or maximum.
  2595. @item level_sc
  2596. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2597. @end table
  2598. @section silencedetect
  2599. Detect silence in an audio stream.
  2600. This filter logs a message when it detects that the input audio volume is less
  2601. or equal to a noise tolerance value for a duration greater or equal to the
  2602. minimum detected noise duration.
  2603. The printed times and duration are expressed in seconds.
  2604. The filter accepts the following options:
  2605. @table @option
  2606. @item duration, d
  2607. Set silence duration until notification (default is 2 seconds).
  2608. @item noise, n
  2609. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2610. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2611. @end table
  2612. @subsection Examples
  2613. @itemize
  2614. @item
  2615. Detect 5 seconds of silence with -50dB noise tolerance:
  2616. @example
  2617. silencedetect=n=-50dB:d=5
  2618. @end example
  2619. @item
  2620. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2621. tolerance in @file{silence.mp3}:
  2622. @example
  2623. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2624. @end example
  2625. @end itemize
  2626. @section silenceremove
  2627. Remove silence from the beginning, middle or end of the audio.
  2628. The filter accepts the following options:
  2629. @table @option
  2630. @item start_periods
  2631. This value is used to indicate if audio should be trimmed at beginning of
  2632. the audio. A value of zero indicates no silence should be trimmed from the
  2633. beginning. When specifying a non-zero value, it trims audio up until it
  2634. finds non-silence. Normally, when trimming silence from beginning of audio
  2635. the @var{start_periods} will be @code{1} but it can be increased to higher
  2636. values to trim all audio up to specific count of non-silence periods.
  2637. Default value is @code{0}.
  2638. @item start_duration
  2639. Specify the amount of time that non-silence must be detected before it stops
  2640. trimming audio. By increasing the duration, bursts of noises can be treated
  2641. as silence and trimmed off. Default value is @code{0}.
  2642. @item start_threshold
  2643. This indicates what sample value should be treated as silence. For digital
  2644. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2645. you may wish to increase the value to account for background noise.
  2646. Can be specified in dB (in case "dB" is appended to the specified value)
  2647. or amplitude ratio. Default value is @code{0}.
  2648. @item stop_periods
  2649. Set the count for trimming silence from the end of audio.
  2650. To remove silence from the middle of a file, specify a @var{stop_periods}
  2651. that is negative. This value is then treated as a positive value and is
  2652. used to indicate the effect should restart processing as specified by
  2653. @var{start_periods}, making it suitable for removing periods of silence
  2654. in the middle of the audio.
  2655. Default value is @code{0}.
  2656. @item stop_duration
  2657. Specify a duration of silence that must exist before audio is not copied any
  2658. more. By specifying a higher duration, silence that is wanted can be left in
  2659. the audio.
  2660. Default value is @code{0}.
  2661. @item stop_threshold
  2662. This is the same as @option{start_threshold} but for trimming silence from
  2663. the end of audio.
  2664. Can be specified in dB (in case "dB" is appended to the specified value)
  2665. or amplitude ratio. Default value is @code{0}.
  2666. @item leave_silence
  2667. This indicates that @var{stop_duration} length of audio should be left intact
  2668. at the beginning of each period of silence.
  2669. For example, if you want to remove long pauses between words but do not want
  2670. to remove the pauses completely. Default value is @code{0}.
  2671. @item detection
  2672. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2673. and works better with digital silence which is exactly 0.
  2674. Default value is @code{rms}.
  2675. @item window
  2676. Set ratio used to calculate size of window for detecting silence.
  2677. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2678. @end table
  2679. @subsection Examples
  2680. @itemize
  2681. @item
  2682. The following example shows how this filter can be used to start a recording
  2683. that does not contain the delay at the start which usually occurs between
  2684. pressing the record button and the start of the performance:
  2685. @example
  2686. silenceremove=1:5:0.02
  2687. @end example
  2688. @item
  2689. Trim all silence encountered from beginning to end where there is more than 1
  2690. second of silence in audio:
  2691. @example
  2692. silenceremove=0:0:0:-1:1:-90dB
  2693. @end example
  2694. @end itemize
  2695. @section sofalizer
  2696. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2697. loudspeakers around the user for binaural listening via headphones (audio
  2698. formats up to 9 channels supported).
  2699. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2700. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2701. Austrian Academy of Sciences.
  2702. To enable compilation of this filter you need to configure FFmpeg with
  2703. @code{--enable-netcdf}.
  2704. The filter accepts the following options:
  2705. @table @option
  2706. @item sofa
  2707. Set the SOFA file used for rendering.
  2708. @item gain
  2709. Set gain applied to audio. Value is in dB. Default is 0.
  2710. @item rotation
  2711. Set rotation of virtual loudspeakers in deg. Default is 0.
  2712. @item elevation
  2713. Set elevation of virtual speakers in deg. Default is 0.
  2714. @item radius
  2715. Set distance in meters between loudspeakers and the listener with near-field
  2716. HRTFs. Default is 1.
  2717. @item type
  2718. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2719. processing audio in time domain which is slow.
  2720. @var{freq} is processing audio in frequency domain which is fast.
  2721. Default is @var{freq}.
  2722. @item speakers
  2723. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2724. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2725. Each virtual loudspeaker is described with short channel name following with
  2726. azimuth and elevation in degreees.
  2727. Each virtual loudspeaker description is separated by '|'.
  2728. For example to override front left and front right channel positions use:
  2729. 'speakers=FL 45 15|FR 345 15'.
  2730. Descriptions with unrecognised channel names are ignored.
  2731. @end table
  2732. @subsection Examples
  2733. @itemize
  2734. @item
  2735. Using ClubFritz6 sofa file:
  2736. @example
  2737. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2738. @end example
  2739. @item
  2740. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2741. @example
  2742. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2743. @end example
  2744. @item
  2745. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2746. and also with custom gain:
  2747. @example
  2748. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2749. @end example
  2750. @end itemize
  2751. @section stereotools
  2752. This filter has some handy utilities to manage stereo signals, for converting
  2753. M/S stereo recordings to L/R signal while having control over the parameters
  2754. or spreading the stereo image of master track.
  2755. The filter accepts the following options:
  2756. @table @option
  2757. @item level_in
  2758. Set input level before filtering for both channels. Defaults is 1.
  2759. Allowed range is from 0.015625 to 64.
  2760. @item level_out
  2761. Set output level after filtering for both channels. Defaults is 1.
  2762. Allowed range is from 0.015625 to 64.
  2763. @item balance_in
  2764. Set input balance between both channels. Default is 0.
  2765. Allowed range is from -1 to 1.
  2766. @item balance_out
  2767. Set output balance between both channels. Default is 0.
  2768. Allowed range is from -1 to 1.
  2769. @item softclip
  2770. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2771. clipping. Disabled by default.
  2772. @item mutel
  2773. Mute the left channel. Disabled by default.
  2774. @item muter
  2775. Mute the right channel. Disabled by default.
  2776. @item phasel
  2777. Change the phase of the left channel. Disabled by default.
  2778. @item phaser
  2779. Change the phase of the right channel. Disabled by default.
  2780. @item mode
  2781. Set stereo mode. Available values are:
  2782. @table @samp
  2783. @item lr>lr
  2784. Left/Right to Left/Right, this is default.
  2785. @item lr>ms
  2786. Left/Right to Mid/Side.
  2787. @item ms>lr
  2788. Mid/Side to Left/Right.
  2789. @item lr>ll
  2790. Left/Right to Left/Left.
  2791. @item lr>rr
  2792. Left/Right to Right/Right.
  2793. @item lr>l+r
  2794. Left/Right to Left + Right.
  2795. @item lr>rl
  2796. Left/Right to Right/Left.
  2797. @end table
  2798. @item slev
  2799. Set level of side signal. Default is 1.
  2800. Allowed range is from 0.015625 to 64.
  2801. @item sbal
  2802. Set balance of side signal. Default is 0.
  2803. Allowed range is from -1 to 1.
  2804. @item mlev
  2805. Set level of the middle signal. Default is 1.
  2806. Allowed range is from 0.015625 to 64.
  2807. @item mpan
  2808. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2809. @item base
  2810. Set stereo base between mono and inversed channels. Default is 0.
  2811. Allowed range is from -1 to 1.
  2812. @item delay
  2813. Set delay in milliseconds how much to delay left from right channel and
  2814. vice versa. Default is 0. Allowed range is from -20 to 20.
  2815. @item sclevel
  2816. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2817. @item phase
  2818. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Apply karaoke like effect:
  2824. @example
  2825. stereotools=mlev=0.015625
  2826. @end example
  2827. @item
  2828. Convert M/S signal to L/R:
  2829. @example
  2830. "stereotools=mode=ms>lr"
  2831. @end example
  2832. @end itemize
  2833. @section stereowiden
  2834. This filter enhance the stereo effect by suppressing signal common to both
  2835. channels and by delaying the signal of left into right and vice versa,
  2836. thereby widening the stereo effect.
  2837. The filter accepts the following options:
  2838. @table @option
  2839. @item delay
  2840. Time in milliseconds of the delay of left signal into right and vice versa.
  2841. Default is 20 milliseconds.
  2842. @item feedback
  2843. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2844. effect of left signal in right output and vice versa which gives widening
  2845. effect. Default is 0.3.
  2846. @item crossfeed
  2847. Cross feed of left into right with inverted phase. This helps in suppressing
  2848. the mono. If the value is 1 it will cancel all the signal common to both
  2849. channels. Default is 0.3.
  2850. @item drymix
  2851. Set level of input signal of original channel. Default is 0.8.
  2852. @end table
  2853. @section treble
  2854. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2855. shelving filter with a response similar to that of a standard
  2856. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2857. The filter accepts the following options:
  2858. @table @option
  2859. @item gain, g
  2860. Give the gain at whichever is the lower of ~22 kHz and the
  2861. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2862. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2863. @item frequency, f
  2864. Set the filter's central frequency and so can be used
  2865. to extend or reduce the frequency range to be boosted or cut.
  2866. The default value is @code{3000} Hz.
  2867. @item width_type
  2868. Set method to specify band-width of filter.
  2869. @table @option
  2870. @item h
  2871. Hz
  2872. @item q
  2873. Q-Factor
  2874. @item o
  2875. octave
  2876. @item s
  2877. slope
  2878. @end table
  2879. @item width, w
  2880. Determine how steep is the filter's shelf transition.
  2881. @end table
  2882. @section tremolo
  2883. Sinusoidal amplitude modulation.
  2884. The filter accepts the following options:
  2885. @table @option
  2886. @item f
  2887. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2888. (20 Hz or lower) will result in a tremolo effect.
  2889. This filter may also be used as a ring modulator by specifying
  2890. a modulation frequency higher than 20 Hz.
  2891. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2892. @item d
  2893. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2894. Default value is 0.5.
  2895. @end table
  2896. @section vibrato
  2897. Sinusoidal phase modulation.
  2898. The filter accepts the following options:
  2899. @table @option
  2900. @item f
  2901. Modulation frequency in Hertz.
  2902. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2903. @item d
  2904. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2905. Default value is 0.5.
  2906. @end table
  2907. @section volume
  2908. Adjust the input audio volume.
  2909. It accepts the following parameters:
  2910. @table @option
  2911. @item volume
  2912. Set audio volume expression.
  2913. Output values are clipped to the maximum value.
  2914. The output audio volume is given by the relation:
  2915. @example
  2916. @var{output_volume} = @var{volume} * @var{input_volume}
  2917. @end example
  2918. The default value for @var{volume} is "1.0".
  2919. @item precision
  2920. This parameter represents the mathematical precision.
  2921. It determines which input sample formats will be allowed, which affects the
  2922. precision of the volume scaling.
  2923. @table @option
  2924. @item fixed
  2925. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2926. @item float
  2927. 32-bit floating-point; this limits input sample format to FLT. (default)
  2928. @item double
  2929. 64-bit floating-point; this limits input sample format to DBL.
  2930. @end table
  2931. @item replaygain
  2932. Choose the behaviour on encountering ReplayGain side data in input frames.
  2933. @table @option
  2934. @item drop
  2935. Remove ReplayGain side data, ignoring its contents (the default).
  2936. @item ignore
  2937. Ignore ReplayGain side data, but leave it in the frame.
  2938. @item track
  2939. Prefer the track gain, if present.
  2940. @item album
  2941. Prefer the album gain, if present.
  2942. @end table
  2943. @item replaygain_preamp
  2944. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2945. Default value for @var{replaygain_preamp} is 0.0.
  2946. @item eval
  2947. Set when the volume expression is evaluated.
  2948. It accepts the following values:
  2949. @table @samp
  2950. @item once
  2951. only evaluate expression once during the filter initialization, or
  2952. when the @samp{volume} command is sent
  2953. @item frame
  2954. evaluate expression for each incoming frame
  2955. @end table
  2956. Default value is @samp{once}.
  2957. @end table
  2958. The volume expression can contain the following parameters.
  2959. @table @option
  2960. @item n
  2961. frame number (starting at zero)
  2962. @item nb_channels
  2963. number of channels
  2964. @item nb_consumed_samples
  2965. number of samples consumed by the filter
  2966. @item nb_samples
  2967. number of samples in the current frame
  2968. @item pos
  2969. original frame position in the file
  2970. @item pts
  2971. frame PTS
  2972. @item sample_rate
  2973. sample rate
  2974. @item startpts
  2975. PTS at start of stream
  2976. @item startt
  2977. time at start of stream
  2978. @item t
  2979. frame time
  2980. @item tb
  2981. timestamp timebase
  2982. @item volume
  2983. last set volume value
  2984. @end table
  2985. Note that when @option{eval} is set to @samp{once} only the
  2986. @var{sample_rate} and @var{tb} variables are available, all other
  2987. variables will evaluate to NAN.
  2988. @subsection Commands
  2989. This filter supports the following commands:
  2990. @table @option
  2991. @item volume
  2992. Modify the volume expression.
  2993. The command accepts the same syntax of the corresponding option.
  2994. If the specified expression is not valid, it is kept at its current
  2995. value.
  2996. @item replaygain_noclip
  2997. Prevent clipping by limiting the gain applied.
  2998. Default value for @var{replaygain_noclip} is 1.
  2999. @end table
  3000. @subsection Examples
  3001. @itemize
  3002. @item
  3003. Halve the input audio volume:
  3004. @example
  3005. volume=volume=0.5
  3006. volume=volume=1/2
  3007. volume=volume=-6.0206dB
  3008. @end example
  3009. In all the above example the named key for @option{volume} can be
  3010. omitted, for example like in:
  3011. @example
  3012. volume=0.5
  3013. @end example
  3014. @item
  3015. Increase input audio power by 6 decibels using fixed-point precision:
  3016. @example
  3017. volume=volume=6dB:precision=fixed
  3018. @end example
  3019. @item
  3020. Fade volume after time 10 with an annihilation period of 5 seconds:
  3021. @example
  3022. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3023. @end example
  3024. @end itemize
  3025. @section volumedetect
  3026. Detect the volume of the input video.
  3027. The filter has no parameters. The input is not modified. Statistics about
  3028. the volume will be printed in the log when the input stream end is reached.
  3029. In particular it will show the mean volume (root mean square), maximum
  3030. volume (on a per-sample basis), and the beginning of a histogram of the
  3031. registered volume values (from the maximum value to a cumulated 1/1000 of
  3032. the samples).
  3033. All volumes are in decibels relative to the maximum PCM value.
  3034. @subsection Examples
  3035. Here is an excerpt of the output:
  3036. @example
  3037. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3038. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3039. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3040. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3041. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3042. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3043. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3044. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3045. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3046. @end example
  3047. It means that:
  3048. @itemize
  3049. @item
  3050. The mean square energy is approximately -27 dB, or 10^-2.7.
  3051. @item
  3052. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3053. @item
  3054. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3055. @end itemize
  3056. In other words, raising the volume by +4 dB does not cause any clipping,
  3057. raising it by +5 dB causes clipping for 6 samples, etc.
  3058. @c man end AUDIO FILTERS
  3059. @chapter Audio Sources
  3060. @c man begin AUDIO SOURCES
  3061. Below is a description of the currently available audio sources.
  3062. @section abuffer
  3063. Buffer audio frames, and make them available to the filter chain.
  3064. This source is mainly intended for a programmatic use, in particular
  3065. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3066. It accepts the following parameters:
  3067. @table @option
  3068. @item time_base
  3069. The timebase which will be used for timestamps of submitted frames. It must be
  3070. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3071. @item sample_rate
  3072. The sample rate of the incoming audio buffers.
  3073. @item sample_fmt
  3074. The sample format of the incoming audio buffers.
  3075. Either a sample format name or its corresponding integer representation from
  3076. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3077. @item channel_layout
  3078. The channel layout of the incoming audio buffers.
  3079. Either a channel layout name from channel_layout_map in
  3080. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3081. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3082. @item channels
  3083. The number of channels of the incoming audio buffers.
  3084. If both @var{channels} and @var{channel_layout} are specified, then they
  3085. must be consistent.
  3086. @end table
  3087. @subsection Examples
  3088. @example
  3089. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3090. @end example
  3091. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3092. Since the sample format with name "s16p" corresponds to the number
  3093. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3094. equivalent to:
  3095. @example
  3096. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3097. @end example
  3098. @section aevalsrc
  3099. Generate an audio signal specified by an expression.
  3100. This source accepts in input one or more expressions (one for each
  3101. channel), which are evaluated and used to generate a corresponding
  3102. audio signal.
  3103. This source accepts the following options:
  3104. @table @option
  3105. @item exprs
  3106. Set the '|'-separated expressions list for each separate channel. In case the
  3107. @option{channel_layout} option is not specified, the selected channel layout
  3108. depends on the number of provided expressions. Otherwise the last
  3109. specified expression is applied to the remaining output channels.
  3110. @item channel_layout, c
  3111. Set the channel layout. The number of channels in the specified layout
  3112. must be equal to the number of specified expressions.
  3113. @item duration, d
  3114. Set the minimum duration of the sourced audio. See
  3115. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3116. for the accepted syntax.
  3117. Note that the resulting duration may be greater than the specified
  3118. duration, as the generated audio is always cut at the end of a
  3119. complete frame.
  3120. If not specified, or the expressed duration is negative, the audio is
  3121. supposed to be generated forever.
  3122. @item nb_samples, n
  3123. Set the number of samples per channel per each output frame,
  3124. default to 1024.
  3125. @item sample_rate, s
  3126. Specify the sample rate, default to 44100.
  3127. @end table
  3128. Each expression in @var{exprs} can contain the following constants:
  3129. @table @option
  3130. @item n
  3131. number of the evaluated sample, starting from 0
  3132. @item t
  3133. time of the evaluated sample expressed in seconds, starting from 0
  3134. @item s
  3135. sample rate
  3136. @end table
  3137. @subsection Examples
  3138. @itemize
  3139. @item
  3140. Generate silence:
  3141. @example
  3142. aevalsrc=0
  3143. @end example
  3144. @item
  3145. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3146. 8000 Hz:
  3147. @example
  3148. aevalsrc="sin(440*2*PI*t):s=8000"
  3149. @end example
  3150. @item
  3151. Generate a two channels signal, specify the channel layout (Front
  3152. Center + Back Center) explicitly:
  3153. @example
  3154. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3155. @end example
  3156. @item
  3157. Generate white noise:
  3158. @example
  3159. aevalsrc="-2+random(0)"
  3160. @end example
  3161. @item
  3162. Generate an amplitude modulated signal:
  3163. @example
  3164. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3165. @end example
  3166. @item
  3167. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3168. @example
  3169. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3170. @end example
  3171. @end itemize
  3172. @section anullsrc
  3173. The null audio source, return unprocessed audio frames. It is mainly useful
  3174. as a template and to be employed in analysis / debugging tools, or as
  3175. the source for filters which ignore the input data (for example the sox
  3176. synth filter).
  3177. This source accepts the following options:
  3178. @table @option
  3179. @item channel_layout, cl
  3180. Specifies the channel layout, and can be either an integer or a string
  3181. representing a channel layout. The default value of @var{channel_layout}
  3182. is "stereo".
  3183. Check the channel_layout_map definition in
  3184. @file{libavutil/channel_layout.c} for the mapping between strings and
  3185. channel layout values.
  3186. @item sample_rate, r
  3187. Specifies the sample rate, and defaults to 44100.
  3188. @item nb_samples, n
  3189. Set the number of samples per requested frames.
  3190. @end table
  3191. @subsection Examples
  3192. @itemize
  3193. @item
  3194. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3195. @example
  3196. anullsrc=r=48000:cl=4
  3197. @end example
  3198. @item
  3199. Do the same operation with a more obvious syntax:
  3200. @example
  3201. anullsrc=r=48000:cl=mono
  3202. @end example
  3203. @end itemize
  3204. All the parameters need to be explicitly defined.
  3205. @section flite
  3206. Synthesize a voice utterance using the libflite library.
  3207. To enable compilation of this filter you need to configure FFmpeg with
  3208. @code{--enable-libflite}.
  3209. Note that the flite library is not thread-safe.
  3210. The filter accepts the following options:
  3211. @table @option
  3212. @item list_voices
  3213. If set to 1, list the names of the available voices and exit
  3214. immediately. Default value is 0.
  3215. @item nb_samples, n
  3216. Set the maximum number of samples per frame. Default value is 512.
  3217. @item textfile
  3218. Set the filename containing the text to speak.
  3219. @item text
  3220. Set the text to speak.
  3221. @item voice, v
  3222. Set the voice to use for the speech synthesis. Default value is
  3223. @code{kal}. See also the @var{list_voices} option.
  3224. @end table
  3225. @subsection Examples
  3226. @itemize
  3227. @item
  3228. Read from file @file{speech.txt}, and synthesize the text using the
  3229. standard flite voice:
  3230. @example
  3231. flite=textfile=speech.txt
  3232. @end example
  3233. @item
  3234. Read the specified text selecting the @code{slt} voice:
  3235. @example
  3236. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3237. @end example
  3238. @item
  3239. Input text to ffmpeg:
  3240. @example
  3241. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3242. @end example
  3243. @item
  3244. Make @file{ffplay} speak the specified text, using @code{flite} and
  3245. the @code{lavfi} device:
  3246. @example
  3247. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3248. @end example
  3249. @end itemize
  3250. For more information about libflite, check:
  3251. @url{http://www.speech.cs.cmu.edu/flite/}
  3252. @section anoisesrc
  3253. Generate a noise audio signal.
  3254. The filter accepts the following options:
  3255. @table @option
  3256. @item sample_rate, r
  3257. Specify the sample rate. Default value is 48000 Hz.
  3258. @item amplitude, a
  3259. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3260. is 1.0.
  3261. @item duration, d
  3262. Specify the duration of the generated audio stream. Not specifying this option
  3263. results in noise with an infinite length.
  3264. @item color, colour, c
  3265. Specify the color of noise. Available noise colors are white, pink, and brown.
  3266. Default color is white.
  3267. @item seed, s
  3268. Specify a value used to seed the PRNG.
  3269. @item nb_samples, n
  3270. Set the number of samples per each output frame, default is 1024.
  3271. @end table
  3272. @subsection Examples
  3273. @itemize
  3274. @item
  3275. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3276. @example
  3277. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3278. @end example
  3279. @end itemize
  3280. @section sine
  3281. Generate an audio signal made of a sine wave with amplitude 1/8.
  3282. The audio signal is bit-exact.
  3283. The filter accepts the following options:
  3284. @table @option
  3285. @item frequency, f
  3286. Set the carrier frequency. Default is 440 Hz.
  3287. @item beep_factor, b
  3288. Enable a periodic beep every second with frequency @var{beep_factor} times
  3289. the carrier frequency. Default is 0, meaning the beep is disabled.
  3290. @item sample_rate, r
  3291. Specify the sample rate, default is 44100.
  3292. @item duration, d
  3293. Specify the duration of the generated audio stream.
  3294. @item samples_per_frame
  3295. Set the number of samples per output frame.
  3296. The expression can contain the following constants:
  3297. @table @option
  3298. @item n
  3299. The (sequential) number of the output audio frame, starting from 0.
  3300. @item pts
  3301. The PTS (Presentation TimeStamp) of the output audio frame,
  3302. expressed in @var{TB} units.
  3303. @item t
  3304. The PTS of the output audio frame, expressed in seconds.
  3305. @item TB
  3306. The timebase of the output audio frames.
  3307. @end table
  3308. Default is @code{1024}.
  3309. @end table
  3310. @subsection Examples
  3311. @itemize
  3312. @item
  3313. Generate a simple 440 Hz sine wave:
  3314. @example
  3315. sine
  3316. @end example
  3317. @item
  3318. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3319. @example
  3320. sine=220:4:d=5
  3321. sine=f=220:b=4:d=5
  3322. sine=frequency=220:beep_factor=4:duration=5
  3323. @end example
  3324. @item
  3325. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3326. pattern:
  3327. @example
  3328. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3329. @end example
  3330. @end itemize
  3331. @c man end AUDIO SOURCES
  3332. @chapter Audio Sinks
  3333. @c man begin AUDIO SINKS
  3334. Below is a description of the currently available audio sinks.
  3335. @section abuffersink
  3336. Buffer audio frames, and make them available to the end of filter chain.
  3337. This sink is mainly intended for programmatic use, in particular
  3338. through the interface defined in @file{libavfilter/buffersink.h}
  3339. or the options system.
  3340. It accepts a pointer to an AVABufferSinkContext structure, which
  3341. defines the incoming buffers' formats, to be passed as the opaque
  3342. parameter to @code{avfilter_init_filter} for initialization.
  3343. @section anullsink
  3344. Null audio sink; do absolutely nothing with the input audio. It is
  3345. mainly useful as a template and for use in analysis / debugging
  3346. tools.
  3347. @c man end AUDIO SINKS
  3348. @chapter Video Filters
  3349. @c man begin VIDEO FILTERS
  3350. When you configure your FFmpeg build, you can disable any of the
  3351. existing filters using @code{--disable-filters}.
  3352. The configure output will show the video filters included in your
  3353. build.
  3354. Below is a description of the currently available video filters.
  3355. @section alphaextract
  3356. Extract the alpha component from the input as a grayscale video. This
  3357. is especially useful with the @var{alphamerge} filter.
  3358. @section alphamerge
  3359. Add or replace the alpha component of the primary input with the
  3360. grayscale value of a second input. This is intended for use with
  3361. @var{alphaextract} to allow the transmission or storage of frame
  3362. sequences that have alpha in a format that doesn't support an alpha
  3363. channel.
  3364. For example, to reconstruct full frames from a normal YUV-encoded video
  3365. and a separate video created with @var{alphaextract}, you might use:
  3366. @example
  3367. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3368. @end example
  3369. Since this filter is designed for reconstruction, it operates on frame
  3370. sequences without considering timestamps, and terminates when either
  3371. input reaches end of stream. This will cause problems if your encoding
  3372. pipeline drops frames. If you're trying to apply an image as an
  3373. overlay to a video stream, consider the @var{overlay} filter instead.
  3374. @section ass
  3375. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3376. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3377. Substation Alpha) subtitles files.
  3378. This filter accepts the following option in addition to the common options from
  3379. the @ref{subtitles} filter:
  3380. @table @option
  3381. @item shaping
  3382. Set the shaping engine
  3383. Available values are:
  3384. @table @samp
  3385. @item auto
  3386. The default libass shaping engine, which is the best available.
  3387. @item simple
  3388. Fast, font-agnostic shaper that can do only substitutions
  3389. @item complex
  3390. Slower shaper using OpenType for substitutions and positioning
  3391. @end table
  3392. The default is @code{auto}.
  3393. @end table
  3394. @section atadenoise
  3395. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3396. The filter accepts the following options:
  3397. @table @option
  3398. @item 0a
  3399. Set threshold A for 1st plane. Default is 0.02.
  3400. Valid range is 0 to 0.3.
  3401. @item 0b
  3402. Set threshold B for 1st plane. Default is 0.04.
  3403. Valid range is 0 to 5.
  3404. @item 1a
  3405. Set threshold A for 2nd plane. Default is 0.02.
  3406. Valid range is 0 to 0.3.
  3407. @item 1b
  3408. Set threshold B for 2nd plane. Default is 0.04.
  3409. Valid range is 0 to 5.
  3410. @item 2a
  3411. Set threshold A for 3rd plane. Default is 0.02.
  3412. Valid range is 0 to 0.3.
  3413. @item 2b
  3414. Set threshold B for 3rd plane. Default is 0.04.
  3415. Valid range is 0 to 5.
  3416. Threshold A is designed to react on abrupt changes in the input signal and
  3417. threshold B is designed to react on continuous changes in the input signal.
  3418. @item s
  3419. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3420. number in range [5, 129].
  3421. @item p
  3422. Set what planes of frame filter will use for averaging. Default is all.
  3423. @end table
  3424. @section avgblur
  3425. Apply average blur filter.
  3426. The filter accepts the following options:
  3427. @table @option
  3428. @item sizeX
  3429. Set horizontal kernel size.
  3430. @item planes
  3431. Set which planes to filter. By default all planes are filtered.
  3432. @item sizeY
  3433. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3434. Default is @code{0}.
  3435. @end table
  3436. @section bbox
  3437. Compute the bounding box for the non-black pixels in the input frame
  3438. luminance plane.
  3439. This filter computes the bounding box containing all the pixels with a
  3440. luminance value greater than the minimum allowed value.
  3441. The parameters describing the bounding box are printed on the filter
  3442. log.
  3443. The filter accepts the following option:
  3444. @table @option
  3445. @item min_val
  3446. Set the minimal luminance value. Default is @code{16}.
  3447. @end table
  3448. @section bitplanenoise
  3449. Show and measure bit plane noise.
  3450. The filter accepts the following options:
  3451. @table @option
  3452. @item bitplane
  3453. Set which plane to analyze. Default is @code{1}.
  3454. @item filter
  3455. Filter out noisy pixels from @code{bitplane} set above.
  3456. Default is disabled.
  3457. @end table
  3458. @section blackdetect
  3459. Detect video intervals that are (almost) completely black. Can be
  3460. useful to detect chapter transitions, commercials, or invalid
  3461. recordings. Output lines contains the time for the start, end and
  3462. duration of the detected black interval expressed in seconds.
  3463. In order to display the output lines, you need to set the loglevel at
  3464. least to the AV_LOG_INFO value.
  3465. The filter accepts the following options:
  3466. @table @option
  3467. @item black_min_duration, d
  3468. Set the minimum detected black duration expressed in seconds. It must
  3469. be a non-negative floating point number.
  3470. Default value is 2.0.
  3471. @item picture_black_ratio_th, pic_th
  3472. Set the threshold for considering a picture "black".
  3473. Express the minimum value for the ratio:
  3474. @example
  3475. @var{nb_black_pixels} / @var{nb_pixels}
  3476. @end example
  3477. for which a picture is considered black.
  3478. Default value is 0.98.
  3479. @item pixel_black_th, pix_th
  3480. Set the threshold for considering a pixel "black".
  3481. The threshold expresses the maximum pixel luminance value for which a
  3482. pixel is considered "black". The provided value is scaled according to
  3483. the following equation:
  3484. @example
  3485. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3486. @end example
  3487. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3488. the input video format, the range is [0-255] for YUV full-range
  3489. formats and [16-235] for YUV non full-range formats.
  3490. Default value is 0.10.
  3491. @end table
  3492. The following example sets the maximum pixel threshold to the minimum
  3493. value, and detects only black intervals of 2 or more seconds:
  3494. @example
  3495. blackdetect=d=2:pix_th=0.00
  3496. @end example
  3497. @section blackframe
  3498. Detect frames that are (almost) completely black. Can be useful to
  3499. detect chapter transitions or commercials. Output lines consist of
  3500. the frame number of the detected frame, the percentage of blackness,
  3501. the position in the file if known or -1 and the timestamp in seconds.
  3502. In order to display the output lines, you need to set the loglevel at
  3503. least to the AV_LOG_INFO value.
  3504. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3505. The value represents the percentage of pixels in the picture that
  3506. are below the threshold value.
  3507. It accepts the following parameters:
  3508. @table @option
  3509. @item amount
  3510. The percentage of the pixels that have to be below the threshold; it defaults to
  3511. @code{98}.
  3512. @item threshold, thresh
  3513. The threshold below which a pixel value is considered black; it defaults to
  3514. @code{32}.
  3515. @end table
  3516. @section blend, tblend
  3517. Blend two video frames into each other.
  3518. The @code{blend} filter takes two input streams and outputs one
  3519. stream, the first input is the "top" layer and second input is
  3520. "bottom" layer. By default, the output terminates when the longest input terminates.
  3521. The @code{tblend} (time blend) filter takes two consecutive frames
  3522. from one single stream, and outputs the result obtained by blending
  3523. the new frame on top of the old frame.
  3524. A description of the accepted options follows.
  3525. @table @option
  3526. @item c0_mode
  3527. @item c1_mode
  3528. @item c2_mode
  3529. @item c3_mode
  3530. @item all_mode
  3531. Set blend mode for specific pixel component or all pixel components in case
  3532. of @var{all_mode}. Default value is @code{normal}.
  3533. Available values for component modes are:
  3534. @table @samp
  3535. @item addition
  3536. @item addition128
  3537. @item and
  3538. @item average
  3539. @item burn
  3540. @item darken
  3541. @item difference
  3542. @item difference128
  3543. @item divide
  3544. @item dodge
  3545. @item freeze
  3546. @item exclusion
  3547. @item glow
  3548. @item hardlight
  3549. @item hardmix
  3550. @item heat
  3551. @item lighten
  3552. @item linearlight
  3553. @item multiply
  3554. @item multiply128
  3555. @item negation
  3556. @item normal
  3557. @item or
  3558. @item overlay
  3559. @item phoenix
  3560. @item pinlight
  3561. @item reflect
  3562. @item screen
  3563. @item softlight
  3564. @item subtract
  3565. @item vividlight
  3566. @item xor
  3567. @end table
  3568. @item c0_opacity
  3569. @item c1_opacity
  3570. @item c2_opacity
  3571. @item c3_opacity
  3572. @item all_opacity
  3573. Set blend opacity for specific pixel component or all pixel components in case
  3574. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3575. @item c0_expr
  3576. @item c1_expr
  3577. @item c2_expr
  3578. @item c3_expr
  3579. @item all_expr
  3580. Set blend expression for specific pixel component or all pixel components in case
  3581. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3582. The expressions can use the following variables:
  3583. @table @option
  3584. @item N
  3585. The sequential number of the filtered frame, starting from @code{0}.
  3586. @item X
  3587. @item Y
  3588. the coordinates of the current sample
  3589. @item W
  3590. @item H
  3591. the width and height of currently filtered plane
  3592. @item SW
  3593. @item SH
  3594. Width and height scale depending on the currently filtered plane. It is the
  3595. ratio between the corresponding luma plane number of pixels and the current
  3596. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3597. @code{0.5,0.5} for chroma planes.
  3598. @item T
  3599. Time of the current frame, expressed in seconds.
  3600. @item TOP, A
  3601. Value of pixel component at current location for first video frame (top layer).
  3602. @item BOTTOM, B
  3603. Value of pixel component at current location for second video frame (bottom layer).
  3604. @end table
  3605. @item shortest
  3606. Force termination when the shortest input terminates. Default is
  3607. @code{0}. This option is only defined for the @code{blend} filter.
  3608. @item repeatlast
  3609. Continue applying the last bottom frame after the end of the stream. A value of
  3610. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3611. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3612. @end table
  3613. @subsection Examples
  3614. @itemize
  3615. @item
  3616. Apply transition from bottom layer to top layer in first 10 seconds:
  3617. @example
  3618. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3619. @end example
  3620. @item
  3621. Apply 1x1 checkerboard effect:
  3622. @example
  3623. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3624. @end example
  3625. @item
  3626. Apply uncover left effect:
  3627. @example
  3628. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3629. @end example
  3630. @item
  3631. Apply uncover down effect:
  3632. @example
  3633. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3634. @end example
  3635. @item
  3636. Apply uncover up-left effect:
  3637. @example
  3638. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3639. @end example
  3640. @item
  3641. Split diagonally video and shows top and bottom layer on each side:
  3642. @example
  3643. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3644. @end example
  3645. @item
  3646. Display differences between the current and the previous frame:
  3647. @example
  3648. tblend=all_mode=difference128
  3649. @end example
  3650. @end itemize
  3651. @section boxblur
  3652. Apply a boxblur algorithm to the input video.
  3653. It accepts the following parameters:
  3654. @table @option
  3655. @item luma_radius, lr
  3656. @item luma_power, lp
  3657. @item chroma_radius, cr
  3658. @item chroma_power, cp
  3659. @item alpha_radius, ar
  3660. @item alpha_power, ap
  3661. @end table
  3662. A description of the accepted options follows.
  3663. @table @option
  3664. @item luma_radius, lr
  3665. @item chroma_radius, cr
  3666. @item alpha_radius, ar
  3667. Set an expression for the box radius in pixels used for blurring the
  3668. corresponding input plane.
  3669. The radius value must be a non-negative number, and must not be
  3670. greater than the value of the expression @code{min(w,h)/2} for the
  3671. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3672. planes.
  3673. Default value for @option{luma_radius} is "2". If not specified,
  3674. @option{chroma_radius} and @option{alpha_radius} default to the
  3675. corresponding value set for @option{luma_radius}.
  3676. The expressions can contain the following constants:
  3677. @table @option
  3678. @item w
  3679. @item h
  3680. The input width and height in pixels.
  3681. @item cw
  3682. @item ch
  3683. The input chroma image width and height in pixels.
  3684. @item hsub
  3685. @item vsub
  3686. The horizontal and vertical chroma subsample values. For example, for the
  3687. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3688. @end table
  3689. @item luma_power, lp
  3690. @item chroma_power, cp
  3691. @item alpha_power, ap
  3692. Specify how many times the boxblur filter is applied to the
  3693. corresponding plane.
  3694. Default value for @option{luma_power} is 2. If not specified,
  3695. @option{chroma_power} and @option{alpha_power} default to the
  3696. corresponding value set for @option{luma_power}.
  3697. A value of 0 will disable the effect.
  3698. @end table
  3699. @subsection Examples
  3700. @itemize
  3701. @item
  3702. Apply a boxblur filter with the luma, chroma, and alpha radii
  3703. set to 2:
  3704. @example
  3705. boxblur=luma_radius=2:luma_power=1
  3706. boxblur=2:1
  3707. @end example
  3708. @item
  3709. Set the luma radius to 2, and alpha and chroma radius to 0:
  3710. @example
  3711. boxblur=2:1:cr=0:ar=0
  3712. @end example
  3713. @item
  3714. Set the luma and chroma radii to a fraction of the video dimension:
  3715. @example
  3716. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3717. @end example
  3718. @end itemize
  3719. @section bwdif
  3720. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3721. Deinterlacing Filter").
  3722. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3723. interpolation algorithms.
  3724. It accepts the following parameters:
  3725. @table @option
  3726. @item mode
  3727. The interlacing mode to adopt. It accepts one of the following values:
  3728. @table @option
  3729. @item 0, send_frame
  3730. Output one frame for each frame.
  3731. @item 1, send_field
  3732. Output one frame for each field.
  3733. @end table
  3734. The default value is @code{send_field}.
  3735. @item parity
  3736. The picture field parity assumed for the input interlaced video. It accepts one
  3737. of the following values:
  3738. @table @option
  3739. @item 0, tff
  3740. Assume the top field is first.
  3741. @item 1, bff
  3742. Assume the bottom field is first.
  3743. @item -1, auto
  3744. Enable automatic detection of field parity.
  3745. @end table
  3746. The default value is @code{auto}.
  3747. If the interlacing is unknown or the decoder does not export this information,
  3748. top field first will be assumed.
  3749. @item deint
  3750. Specify which frames to deinterlace. Accept one of the following
  3751. values:
  3752. @table @option
  3753. @item 0, all
  3754. Deinterlace all frames.
  3755. @item 1, interlaced
  3756. Only deinterlace frames marked as interlaced.
  3757. @end table
  3758. The default value is @code{all}.
  3759. @end table
  3760. @section chromakey
  3761. YUV colorspace color/chroma keying.
  3762. The filter accepts the following options:
  3763. @table @option
  3764. @item color
  3765. The color which will be replaced with transparency.
  3766. @item similarity
  3767. Similarity percentage with the key color.
  3768. 0.01 matches only the exact key color, while 1.0 matches everything.
  3769. @item blend
  3770. Blend percentage.
  3771. 0.0 makes pixels either fully transparent, or not transparent at all.
  3772. Higher values result in semi-transparent pixels, with a higher transparency
  3773. the more similar the pixels color is to the key color.
  3774. @item yuv
  3775. Signals that the color passed is already in YUV instead of RGB.
  3776. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3777. This can be used to pass exact YUV values as hexadecimal numbers.
  3778. @end table
  3779. @subsection Examples
  3780. @itemize
  3781. @item
  3782. Make every green pixel in the input image transparent:
  3783. @example
  3784. ffmpeg -i input.png -vf chromakey=green out.png
  3785. @end example
  3786. @item
  3787. Overlay a greenscreen-video on top of a static black background.
  3788. @example
  3789. 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
  3790. @end example
  3791. @end itemize
  3792. @section ciescope
  3793. Display CIE color diagram with pixels overlaid onto it.
  3794. The filter accepts the following options:
  3795. @table @option
  3796. @item system
  3797. Set color system.
  3798. @table @samp
  3799. @item ntsc, 470m
  3800. @item ebu, 470bg
  3801. @item smpte
  3802. @item 240m
  3803. @item apple
  3804. @item widergb
  3805. @item cie1931
  3806. @item rec709, hdtv
  3807. @item uhdtv, rec2020
  3808. @end table
  3809. @item cie
  3810. Set CIE system.
  3811. @table @samp
  3812. @item xyy
  3813. @item ucs
  3814. @item luv
  3815. @end table
  3816. @item gamuts
  3817. Set what gamuts to draw.
  3818. See @code{system} option for available values.
  3819. @item size, s
  3820. Set ciescope size, by default set to 512.
  3821. @item intensity, i
  3822. Set intensity used to map input pixel values to CIE diagram.
  3823. @item contrast
  3824. Set contrast used to draw tongue colors that are out of active color system gamut.
  3825. @item corrgamma
  3826. Correct gamma displayed on scope, by default enabled.
  3827. @item showwhite
  3828. Show white point on CIE diagram, by default disabled.
  3829. @item gamma
  3830. Set input gamma. Used only with XYZ input color space.
  3831. @end table
  3832. @section codecview
  3833. Visualize information exported by some codecs.
  3834. Some codecs can export information through frames using side-data or other
  3835. means. For example, some MPEG based codecs export motion vectors through the
  3836. @var{export_mvs} flag in the codec @option{flags2} option.
  3837. The filter accepts the following option:
  3838. @table @option
  3839. @item mv
  3840. Set motion vectors to visualize.
  3841. Available flags for @var{mv} are:
  3842. @table @samp
  3843. @item pf
  3844. forward predicted MVs of P-frames
  3845. @item bf
  3846. forward predicted MVs of B-frames
  3847. @item bb
  3848. backward predicted MVs of B-frames
  3849. @end table
  3850. @item qp
  3851. Display quantization parameters using the chroma planes.
  3852. @item mv_type, mvt
  3853. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3854. Available flags for @var{mv_type} are:
  3855. @table @samp
  3856. @item fp
  3857. forward predicted MVs
  3858. @item bp
  3859. backward predicted MVs
  3860. @end table
  3861. @item frame_type, ft
  3862. Set frame type to visualize motion vectors of.
  3863. Available flags for @var{frame_type} are:
  3864. @table @samp
  3865. @item if
  3866. intra-coded frames (I-frames)
  3867. @item pf
  3868. predicted frames (P-frames)
  3869. @item bf
  3870. bi-directionally predicted frames (B-frames)
  3871. @end table
  3872. @end table
  3873. @subsection Examples
  3874. @itemize
  3875. @item
  3876. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3877. @example
  3878. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3879. @end example
  3880. @item
  3881. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3882. @example
  3883. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3884. @end example
  3885. @end itemize
  3886. @section colorbalance
  3887. Modify intensity of primary colors (red, green and blue) of input frames.
  3888. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3889. regions for the red-cyan, green-magenta or blue-yellow balance.
  3890. A positive adjustment value shifts the balance towards the primary color, a negative
  3891. value towards the complementary color.
  3892. The filter accepts the following options:
  3893. @table @option
  3894. @item rs
  3895. @item gs
  3896. @item bs
  3897. Adjust red, green and blue shadows (darkest pixels).
  3898. @item rm
  3899. @item gm
  3900. @item bm
  3901. Adjust red, green and blue midtones (medium pixels).
  3902. @item rh
  3903. @item gh
  3904. @item bh
  3905. Adjust red, green and blue highlights (brightest pixels).
  3906. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3907. @end table
  3908. @subsection Examples
  3909. @itemize
  3910. @item
  3911. Add red color cast to shadows:
  3912. @example
  3913. colorbalance=rs=.3
  3914. @end example
  3915. @end itemize
  3916. @section colorkey
  3917. RGB colorspace color keying.
  3918. The filter accepts the following options:
  3919. @table @option
  3920. @item color
  3921. The color which will be replaced with transparency.
  3922. @item similarity
  3923. Similarity percentage with the key color.
  3924. 0.01 matches only the exact key color, while 1.0 matches everything.
  3925. @item blend
  3926. Blend percentage.
  3927. 0.0 makes pixels either fully transparent, or not transparent at all.
  3928. Higher values result in semi-transparent pixels, with a higher transparency
  3929. the more similar the pixels color is to the key color.
  3930. @end table
  3931. @subsection Examples
  3932. @itemize
  3933. @item
  3934. Make every green pixel in the input image transparent:
  3935. @example
  3936. ffmpeg -i input.png -vf colorkey=green out.png
  3937. @end example
  3938. @item
  3939. Overlay a greenscreen-video on top of a static background image.
  3940. @example
  3941. 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
  3942. @end example
  3943. @end itemize
  3944. @section colorlevels
  3945. Adjust video input frames using levels.
  3946. The filter accepts the following options:
  3947. @table @option
  3948. @item rimin
  3949. @item gimin
  3950. @item bimin
  3951. @item aimin
  3952. Adjust red, green, blue and alpha input black point.
  3953. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3954. @item rimax
  3955. @item gimax
  3956. @item bimax
  3957. @item aimax
  3958. Adjust red, green, blue and alpha input white point.
  3959. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3960. Input levels are used to lighten highlights (bright tones), darken shadows
  3961. (dark tones), change the balance of bright and dark tones.
  3962. @item romin
  3963. @item gomin
  3964. @item bomin
  3965. @item aomin
  3966. Adjust red, green, blue and alpha output black point.
  3967. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3968. @item romax
  3969. @item gomax
  3970. @item bomax
  3971. @item aomax
  3972. Adjust red, green, blue and alpha output white point.
  3973. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3974. Output levels allows manual selection of a constrained output level range.
  3975. @end table
  3976. @subsection Examples
  3977. @itemize
  3978. @item
  3979. Make video output darker:
  3980. @example
  3981. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3982. @end example
  3983. @item
  3984. Increase contrast:
  3985. @example
  3986. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3987. @end example
  3988. @item
  3989. Make video output lighter:
  3990. @example
  3991. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3992. @end example
  3993. @item
  3994. Increase brightness:
  3995. @example
  3996. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3997. @end example
  3998. @end itemize
  3999. @section colorchannelmixer
  4000. Adjust video input frames by re-mixing color channels.
  4001. This filter modifies a color channel by adding the values associated to
  4002. the other channels of the same pixels. For example if the value to
  4003. modify is red, the output value will be:
  4004. @example
  4005. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4006. @end example
  4007. The filter accepts the following options:
  4008. @table @option
  4009. @item rr
  4010. @item rg
  4011. @item rb
  4012. @item ra
  4013. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4014. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4015. @item gr
  4016. @item gg
  4017. @item gb
  4018. @item ga
  4019. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4020. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4021. @item br
  4022. @item bg
  4023. @item bb
  4024. @item ba
  4025. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4026. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4027. @item ar
  4028. @item ag
  4029. @item ab
  4030. @item aa
  4031. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4032. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4033. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4034. @end table
  4035. @subsection Examples
  4036. @itemize
  4037. @item
  4038. Convert source to grayscale:
  4039. @example
  4040. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4041. @end example
  4042. @item
  4043. Simulate sepia tones:
  4044. @example
  4045. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4046. @end example
  4047. @end itemize
  4048. @section colormatrix
  4049. Convert color matrix.
  4050. The filter accepts the following options:
  4051. @table @option
  4052. @item src
  4053. @item dst
  4054. Specify the source and destination color matrix. Both values must be
  4055. specified.
  4056. The accepted values are:
  4057. @table @samp
  4058. @item bt709
  4059. BT.709
  4060. @item fcc
  4061. FCC
  4062. @item bt601
  4063. BT.601
  4064. @item bt470
  4065. BT.470
  4066. @item bt470bg
  4067. BT.470BG
  4068. @item smpte170m
  4069. SMPTE-170M
  4070. @item smpte240m
  4071. SMPTE-240M
  4072. @item bt2020
  4073. BT.2020
  4074. @end table
  4075. @end table
  4076. For example to convert from BT.601 to SMPTE-240M, use the command:
  4077. @example
  4078. colormatrix=bt601:smpte240m
  4079. @end example
  4080. @section colorspace
  4081. Convert colorspace, transfer characteristics or color primaries.
  4082. Input video needs to have an even size.
  4083. The filter accepts the following options:
  4084. @table @option
  4085. @anchor{all}
  4086. @item all
  4087. Specify all color properties at once.
  4088. The accepted values are:
  4089. @table @samp
  4090. @item bt470m
  4091. BT.470M
  4092. @item bt470bg
  4093. BT.470BG
  4094. @item bt601-6-525
  4095. BT.601-6 525
  4096. @item bt601-6-625
  4097. BT.601-6 625
  4098. @item bt709
  4099. BT.709
  4100. @item smpte170m
  4101. SMPTE-170M
  4102. @item smpte240m
  4103. SMPTE-240M
  4104. @item bt2020
  4105. BT.2020
  4106. @end table
  4107. @anchor{space}
  4108. @item space
  4109. Specify output colorspace.
  4110. The accepted values are:
  4111. @table @samp
  4112. @item bt709
  4113. BT.709
  4114. @item fcc
  4115. FCC
  4116. @item bt470bg
  4117. BT.470BG or BT.601-6 625
  4118. @item smpte170m
  4119. SMPTE-170M or BT.601-6 525
  4120. @item smpte240m
  4121. SMPTE-240M
  4122. @item ycgco
  4123. YCgCo
  4124. @item bt2020ncl
  4125. BT.2020 with non-constant luminance
  4126. @end table
  4127. @anchor{trc}
  4128. @item trc
  4129. Specify output transfer characteristics.
  4130. The accepted values are:
  4131. @table @samp
  4132. @item bt709
  4133. BT.709
  4134. @item bt470m
  4135. BT.470M
  4136. @item bt470bg
  4137. BT.470BG
  4138. @item gamma22
  4139. Constant gamma of 2.2
  4140. @item gamma28
  4141. Constant gamma of 2.8
  4142. @item smpte170m
  4143. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4144. @item smpte240m
  4145. SMPTE-240M
  4146. @item srgb
  4147. SRGB
  4148. @item iec61966-2-1
  4149. iec61966-2-1
  4150. @item iec61966-2-4
  4151. iec61966-2-4
  4152. @item xvycc
  4153. xvycc
  4154. @item bt2020-10
  4155. BT.2020 for 10-bits content
  4156. @item bt2020-12
  4157. BT.2020 for 12-bits content
  4158. @end table
  4159. @anchor{primaries}
  4160. @item primaries
  4161. Specify output color primaries.
  4162. The accepted values are:
  4163. @table @samp
  4164. @item bt709
  4165. BT.709
  4166. @item bt470m
  4167. BT.470M
  4168. @item bt470bg
  4169. BT.470BG or BT.601-6 625
  4170. @item smpte170m
  4171. SMPTE-170M or BT.601-6 525
  4172. @item smpte240m
  4173. SMPTE-240M
  4174. @item film
  4175. film
  4176. @item smpte431
  4177. SMPTE-431
  4178. @item smpte432
  4179. SMPTE-432
  4180. @item bt2020
  4181. BT.2020
  4182. @end table
  4183. @anchor{range}
  4184. @item range
  4185. Specify output color range.
  4186. The accepted values are:
  4187. @table @samp
  4188. @item tv
  4189. TV (restricted) range
  4190. @item mpeg
  4191. MPEG (restricted) range
  4192. @item pc
  4193. PC (full) range
  4194. @item jpeg
  4195. JPEG (full) range
  4196. @end table
  4197. @item format
  4198. Specify output color format.
  4199. The accepted values are:
  4200. @table @samp
  4201. @item yuv420p
  4202. YUV 4:2:0 planar 8-bits
  4203. @item yuv420p10
  4204. YUV 4:2:0 planar 10-bits
  4205. @item yuv420p12
  4206. YUV 4:2:0 planar 12-bits
  4207. @item yuv422p
  4208. YUV 4:2:2 planar 8-bits
  4209. @item yuv422p10
  4210. YUV 4:2:2 planar 10-bits
  4211. @item yuv422p12
  4212. YUV 4:2:2 planar 12-bits
  4213. @item yuv444p
  4214. YUV 4:4:4 planar 8-bits
  4215. @item yuv444p10
  4216. YUV 4:4:4 planar 10-bits
  4217. @item yuv444p12
  4218. YUV 4:4:4 planar 12-bits
  4219. @end table
  4220. @item fast
  4221. Do a fast conversion, which skips gamma/primary correction. This will take
  4222. significantly less CPU, but will be mathematically incorrect. To get output
  4223. compatible with that produced by the colormatrix filter, use fast=1.
  4224. @item dither
  4225. Specify dithering mode.
  4226. The accepted values are:
  4227. @table @samp
  4228. @item none
  4229. No dithering
  4230. @item fsb
  4231. Floyd-Steinberg dithering
  4232. @end table
  4233. @item wpadapt
  4234. Whitepoint adaptation mode.
  4235. The accepted values are:
  4236. @table @samp
  4237. @item bradford
  4238. Bradford whitepoint adaptation
  4239. @item vonkries
  4240. von Kries whitepoint adaptation
  4241. @item identity
  4242. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4243. @end table
  4244. @item iall
  4245. Override all input properties at once. Same accepted values as @ref{all}.
  4246. @item ispace
  4247. Override input colorspace. Same accepted values as @ref{space}.
  4248. @item iprimaries
  4249. Override input color primaries. Same accepted values as @ref{primaries}.
  4250. @item itrc
  4251. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4252. @item irange
  4253. Override input color range. Same accepted values as @ref{range}.
  4254. @end table
  4255. The filter converts the transfer characteristics, color space and color
  4256. primaries to the specified user values. The output value, if not specified,
  4257. is set to a default value based on the "all" property. If that property is
  4258. also not specified, the filter will log an error. The output color range and
  4259. format default to the same value as the input color range and format. The
  4260. input transfer characteristics, color space, color primaries and color range
  4261. should be set on the input data. If any of these are missing, the filter will
  4262. log an error and no conversion will take place.
  4263. For example to convert the input to SMPTE-240M, use the command:
  4264. @example
  4265. colorspace=smpte240m
  4266. @end example
  4267. @section convolution
  4268. Apply convolution 3x3 or 5x5 filter.
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item 0m
  4272. @item 1m
  4273. @item 2m
  4274. @item 3m
  4275. Set matrix for each plane.
  4276. Matrix is sequence of 9 or 25 signed integers.
  4277. @item 0rdiv
  4278. @item 1rdiv
  4279. @item 2rdiv
  4280. @item 3rdiv
  4281. Set multiplier for calculated value for each plane.
  4282. @item 0bias
  4283. @item 1bias
  4284. @item 2bias
  4285. @item 3bias
  4286. Set bias for each plane. This value is added to the result of the multiplication.
  4287. Useful for making the overall image brighter or darker. Default is 0.0.
  4288. @end table
  4289. @subsection Examples
  4290. @itemize
  4291. @item
  4292. Apply sharpen:
  4293. @example
  4294. 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"
  4295. @end example
  4296. @item
  4297. Apply blur:
  4298. @example
  4299. 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"
  4300. @end example
  4301. @item
  4302. Apply edge enhance:
  4303. @example
  4304. 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"
  4305. @end example
  4306. @item
  4307. Apply edge detect:
  4308. @example
  4309. 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"
  4310. @end example
  4311. @item
  4312. Apply emboss:
  4313. @example
  4314. 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"
  4315. @end example
  4316. @end itemize
  4317. @section copy
  4318. Copy the input source unchanged to the output. This is mainly useful for
  4319. testing purposes.
  4320. @anchor{coreimage}
  4321. @section coreimage
  4322. Video filtering on GPU using Apple's CoreImage API on OSX.
  4323. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4324. processed by video hardware. However, software-based OpenGL implementations
  4325. exist which means there is no guarantee for hardware processing. It depends on
  4326. the respective OSX.
  4327. There are many filters and image generators provided by Apple that come with a
  4328. large variety of options. The filter has to be referenced by its name along
  4329. with its options.
  4330. The coreimage filter accepts the following options:
  4331. @table @option
  4332. @item list_filters
  4333. List all available filters and generators along with all their respective
  4334. options as well as possible minimum and maximum values along with the default
  4335. values.
  4336. @example
  4337. list_filters=true
  4338. @end example
  4339. @item filter
  4340. Specify all filters by their respective name and options.
  4341. Use @var{list_filters} to determine all valid filter names and options.
  4342. Numerical options are specified by a float value and are automatically clamped
  4343. to their respective value range. Vector and color options have to be specified
  4344. by a list of space separated float values. Character escaping has to be done.
  4345. A special option name @code{default} is available to use default options for a
  4346. filter.
  4347. It is required to specify either @code{default} or at least one of the filter options.
  4348. All omitted options are used with their default values.
  4349. The syntax of the filter string is as follows:
  4350. @example
  4351. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4352. @end example
  4353. @item output_rect
  4354. Specify a rectangle where the output of the filter chain is copied into the
  4355. input image. It is given by a list of space separated float values:
  4356. @example
  4357. output_rect=x\ y\ width\ height
  4358. @end example
  4359. If not given, the output rectangle equals the dimensions of the input image.
  4360. The output rectangle is automatically cropped at the borders of the input
  4361. image. Negative values are valid for each component.
  4362. @example
  4363. output_rect=25\ 25\ 100\ 100
  4364. @end example
  4365. @end table
  4366. Several filters can be chained for successive processing without GPU-HOST
  4367. transfers allowing for fast processing of complex filter chains.
  4368. Currently, only filters with zero (generators) or exactly one (filters) input
  4369. image and one output image are supported. Also, transition filters are not yet
  4370. usable as intended.
  4371. Some filters generate output images with additional padding depending on the
  4372. respective filter kernel. The padding is automatically removed to ensure the
  4373. filter output has the same size as the input image.
  4374. For image generators, the size of the output image is determined by the
  4375. previous output image of the filter chain or the input image of the whole
  4376. filterchain, respectively. The generators do not use the pixel information of
  4377. this image to generate their output. However, the generated output is
  4378. blended onto this image, resulting in partial or complete coverage of the
  4379. output image.
  4380. The @ref{coreimagesrc} video source can be used for generating input images
  4381. which are directly fed into the filter chain. By using it, providing input
  4382. images by another video source or an input video is not required.
  4383. @subsection Examples
  4384. @itemize
  4385. @item
  4386. List all filters available:
  4387. @example
  4388. coreimage=list_filters=true
  4389. @end example
  4390. @item
  4391. Use the CIBoxBlur filter with default options to blur an image:
  4392. @example
  4393. coreimage=filter=CIBoxBlur@@default
  4394. @end example
  4395. @item
  4396. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4397. its center at 100x100 and a radius of 50 pixels:
  4398. @example
  4399. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4400. @end example
  4401. @item
  4402. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4403. given as complete and escaped command-line for Apple's standard bash shell:
  4404. @example
  4405. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4406. @end example
  4407. @end itemize
  4408. @section crop
  4409. Crop the input video to given dimensions.
  4410. It accepts the following parameters:
  4411. @table @option
  4412. @item w, out_w
  4413. The width of the output video. It defaults to @code{iw}.
  4414. This expression is evaluated only once during the filter
  4415. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4416. @item h, out_h
  4417. The height of the output video. It defaults to @code{ih}.
  4418. This expression is evaluated only once during the filter
  4419. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4420. @item x
  4421. The horizontal position, in the input video, of the left edge of the output
  4422. video. It defaults to @code{(in_w-out_w)/2}.
  4423. This expression is evaluated per-frame.
  4424. @item y
  4425. The vertical position, in the input video, of the top edge of the output video.
  4426. It defaults to @code{(in_h-out_h)/2}.
  4427. This expression is evaluated per-frame.
  4428. @item keep_aspect
  4429. If set to 1 will force the output display aspect ratio
  4430. to be the same of the input, by changing the output sample aspect
  4431. ratio. It defaults to 0.
  4432. @item exact
  4433. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4434. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4435. It defaults to 0.
  4436. @end table
  4437. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4438. expressions containing the following constants:
  4439. @table @option
  4440. @item x
  4441. @item y
  4442. The computed values for @var{x} and @var{y}. They are evaluated for
  4443. each new frame.
  4444. @item in_w
  4445. @item in_h
  4446. The input width and height.
  4447. @item iw
  4448. @item ih
  4449. These are the same as @var{in_w} and @var{in_h}.
  4450. @item out_w
  4451. @item out_h
  4452. The output (cropped) width and height.
  4453. @item ow
  4454. @item oh
  4455. These are the same as @var{out_w} and @var{out_h}.
  4456. @item a
  4457. same as @var{iw} / @var{ih}
  4458. @item sar
  4459. input sample aspect ratio
  4460. @item dar
  4461. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4462. @item hsub
  4463. @item vsub
  4464. horizontal and vertical chroma subsample values. For example for the
  4465. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4466. @item n
  4467. The number of the input frame, starting from 0.
  4468. @item pos
  4469. the position in the file of the input frame, NAN if unknown
  4470. @item t
  4471. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4472. @end table
  4473. The expression for @var{out_w} may depend on the value of @var{out_h},
  4474. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4475. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4476. evaluated after @var{out_w} and @var{out_h}.
  4477. The @var{x} and @var{y} parameters specify the expressions for the
  4478. position of the top-left corner of the output (non-cropped) area. They
  4479. are evaluated for each frame. If the evaluated value is not valid, it
  4480. is approximated to the nearest valid value.
  4481. The expression for @var{x} may depend on @var{y}, and the expression
  4482. for @var{y} may depend on @var{x}.
  4483. @subsection Examples
  4484. @itemize
  4485. @item
  4486. Crop area with size 100x100 at position (12,34).
  4487. @example
  4488. crop=100:100:12:34
  4489. @end example
  4490. Using named options, the example above becomes:
  4491. @example
  4492. crop=w=100:h=100:x=12:y=34
  4493. @end example
  4494. @item
  4495. Crop the central input area with size 100x100:
  4496. @example
  4497. crop=100:100
  4498. @end example
  4499. @item
  4500. Crop the central input area with size 2/3 of the input video:
  4501. @example
  4502. crop=2/3*in_w:2/3*in_h
  4503. @end example
  4504. @item
  4505. Crop the input video central square:
  4506. @example
  4507. crop=out_w=in_h
  4508. crop=in_h
  4509. @end example
  4510. @item
  4511. Delimit the rectangle with the top-left corner placed at position
  4512. 100:100 and the right-bottom corner corresponding to the right-bottom
  4513. corner of the input image.
  4514. @example
  4515. crop=in_w-100:in_h-100:100:100
  4516. @end example
  4517. @item
  4518. Crop 10 pixels from the left and right borders, and 20 pixels from
  4519. the top and bottom borders
  4520. @example
  4521. crop=in_w-2*10:in_h-2*20
  4522. @end example
  4523. @item
  4524. Keep only the bottom right quarter of the input image:
  4525. @example
  4526. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4527. @end example
  4528. @item
  4529. Crop height for getting Greek harmony:
  4530. @example
  4531. crop=in_w:1/PHI*in_w
  4532. @end example
  4533. @item
  4534. Apply trembling effect:
  4535. @example
  4536. 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)
  4537. @end example
  4538. @item
  4539. Apply erratic camera effect depending on timestamp:
  4540. @example
  4541. 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)"
  4542. @end example
  4543. @item
  4544. Set x depending on the value of y:
  4545. @example
  4546. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4547. @end example
  4548. @end itemize
  4549. @subsection Commands
  4550. This filter supports the following commands:
  4551. @table @option
  4552. @item w, out_w
  4553. @item h, out_h
  4554. @item x
  4555. @item y
  4556. Set width/height of the output video and the horizontal/vertical position
  4557. in the input video.
  4558. The command accepts the same syntax of the corresponding option.
  4559. If the specified expression is not valid, it is kept at its current
  4560. value.
  4561. @end table
  4562. @section cropdetect
  4563. Auto-detect the crop size.
  4564. It calculates the necessary cropping parameters and prints the
  4565. recommended parameters via the logging system. The detected dimensions
  4566. correspond to the non-black area of the input video.
  4567. It accepts the following parameters:
  4568. @table @option
  4569. @item limit
  4570. Set higher black value threshold, which can be optionally specified
  4571. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4572. value greater to the set value is considered non-black. It defaults to 24.
  4573. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4574. on the bitdepth of the pixel format.
  4575. @item round
  4576. The value which the width/height should be divisible by. It defaults to
  4577. 16. The offset is automatically adjusted to center the video. Use 2 to
  4578. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4579. encoding to most video codecs.
  4580. @item reset_count, reset
  4581. Set the counter that determines after how many frames cropdetect will
  4582. reset the previously detected largest video area and start over to
  4583. detect the current optimal crop area. Default value is 0.
  4584. This can be useful when channel logos distort the video area. 0
  4585. indicates 'never reset', and returns the largest area encountered during
  4586. playback.
  4587. @end table
  4588. @anchor{curves}
  4589. @section curves
  4590. Apply color adjustments using curves.
  4591. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4592. component (red, green and blue) has its values defined by @var{N} key points
  4593. tied from each other using a smooth curve. The x-axis represents the pixel
  4594. values from the input frame, and the y-axis the new pixel values to be set for
  4595. the output frame.
  4596. By default, a component curve is defined by the two points @var{(0;0)} and
  4597. @var{(1;1)}. This creates a straight line where each original pixel value is
  4598. "adjusted" to its own value, which means no change to the image.
  4599. The filter allows you to redefine these two points and add some more. A new
  4600. curve (using a natural cubic spline interpolation) will be define to pass
  4601. smoothly through all these new coordinates. The new defined points needs to be
  4602. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4603. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4604. the vector spaces, the values will be clipped accordingly.
  4605. The filter accepts the following options:
  4606. @table @option
  4607. @item preset
  4608. Select one of the available color presets. This option can be used in addition
  4609. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4610. options takes priority on the preset values.
  4611. Available presets are:
  4612. @table @samp
  4613. @item none
  4614. @item color_negative
  4615. @item cross_process
  4616. @item darker
  4617. @item increase_contrast
  4618. @item lighter
  4619. @item linear_contrast
  4620. @item medium_contrast
  4621. @item negative
  4622. @item strong_contrast
  4623. @item vintage
  4624. @end table
  4625. Default is @code{none}.
  4626. @item master, m
  4627. Set the master key points. These points will define a second pass mapping. It
  4628. is sometimes called a "luminance" or "value" mapping. It can be used with
  4629. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4630. post-processing LUT.
  4631. @item red, r
  4632. Set the key points for the red component.
  4633. @item green, g
  4634. Set the key points for the green component.
  4635. @item blue, b
  4636. Set the key points for the blue component.
  4637. @item all
  4638. Set the key points for all components (not including master).
  4639. Can be used in addition to the other key points component
  4640. options. In this case, the unset component(s) will fallback on this
  4641. @option{all} setting.
  4642. @item psfile
  4643. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4644. @item plot
  4645. Save Gnuplot script of the curves in specified file.
  4646. @end table
  4647. To avoid some filtergraph syntax conflicts, each key points list need to be
  4648. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4649. @subsection Examples
  4650. @itemize
  4651. @item
  4652. Increase slightly the middle level of blue:
  4653. @example
  4654. curves=blue='0/0 0.5/0.58 1/1'
  4655. @end example
  4656. @item
  4657. Vintage effect:
  4658. @example
  4659. 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'
  4660. @end example
  4661. Here we obtain the following coordinates for each components:
  4662. @table @var
  4663. @item red
  4664. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4665. @item green
  4666. @code{(0;0) (0.50;0.48) (1;1)}
  4667. @item blue
  4668. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4669. @end table
  4670. @item
  4671. The previous example can also be achieved with the associated built-in preset:
  4672. @example
  4673. curves=preset=vintage
  4674. @end example
  4675. @item
  4676. Or simply:
  4677. @example
  4678. curves=vintage
  4679. @end example
  4680. @item
  4681. Use a Photoshop preset and redefine the points of the green component:
  4682. @example
  4683. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4684. @end example
  4685. @item
  4686. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4687. and @command{gnuplot}:
  4688. @example
  4689. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4690. gnuplot -p /tmp/curves.plt
  4691. @end example
  4692. @end itemize
  4693. @section datascope
  4694. Video data analysis filter.
  4695. This filter shows hexadecimal pixel values of part of video.
  4696. The filter accepts the following options:
  4697. @table @option
  4698. @item size, s
  4699. Set output video size.
  4700. @item x
  4701. Set x offset from where to pick pixels.
  4702. @item y
  4703. Set y offset from where to pick pixels.
  4704. @item mode
  4705. Set scope mode, can be one of the following:
  4706. @table @samp
  4707. @item mono
  4708. Draw hexadecimal pixel values with white color on black background.
  4709. @item color
  4710. Draw hexadecimal pixel values with input video pixel color on black
  4711. background.
  4712. @item color2
  4713. Draw hexadecimal pixel values on color background picked from input video,
  4714. the text color is picked in such way so its always visible.
  4715. @end table
  4716. @item axis
  4717. Draw rows and columns numbers on left and top of video.
  4718. @item opacity
  4719. Set background opacity.
  4720. @end table
  4721. @section dctdnoiz
  4722. Denoise frames using 2D DCT (frequency domain filtering).
  4723. This filter is not designed for real time.
  4724. The filter accepts the following options:
  4725. @table @option
  4726. @item sigma, s
  4727. Set the noise sigma constant.
  4728. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4729. coefficient (absolute value) below this threshold with be dropped.
  4730. If you need a more advanced filtering, see @option{expr}.
  4731. Default is @code{0}.
  4732. @item overlap
  4733. Set number overlapping pixels for each block. Since the filter can be slow, you
  4734. may want to reduce this value, at the cost of a less effective filter and the
  4735. risk of various artefacts.
  4736. If the overlapping value doesn't permit processing the whole input width or
  4737. height, a warning will be displayed and according borders won't be denoised.
  4738. Default value is @var{blocksize}-1, which is the best possible setting.
  4739. @item expr, e
  4740. Set the coefficient factor expression.
  4741. For each coefficient of a DCT block, this expression will be evaluated as a
  4742. multiplier value for the coefficient.
  4743. If this is option is set, the @option{sigma} option will be ignored.
  4744. The absolute value of the coefficient can be accessed through the @var{c}
  4745. variable.
  4746. @item n
  4747. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4748. @var{blocksize}, which is the width and height of the processed blocks.
  4749. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4750. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4751. on the speed processing. Also, a larger block size does not necessarily means a
  4752. better de-noising.
  4753. @end table
  4754. @subsection Examples
  4755. Apply a denoise with a @option{sigma} of @code{4.5}:
  4756. @example
  4757. dctdnoiz=4.5
  4758. @end example
  4759. The same operation can be achieved using the expression system:
  4760. @example
  4761. dctdnoiz=e='gte(c, 4.5*3)'
  4762. @end example
  4763. Violent denoise using a block size of @code{16x16}:
  4764. @example
  4765. dctdnoiz=15:n=4
  4766. @end example
  4767. @section deband
  4768. Remove banding artifacts from input video.
  4769. It works by replacing banded pixels with average value of referenced pixels.
  4770. The filter accepts the following options:
  4771. @table @option
  4772. @item 1thr
  4773. @item 2thr
  4774. @item 3thr
  4775. @item 4thr
  4776. Set banding detection threshold for each plane. Default is 0.02.
  4777. Valid range is 0.00003 to 0.5.
  4778. If difference between current pixel and reference pixel is less than threshold,
  4779. it will be considered as banded.
  4780. @item range, r
  4781. Banding detection range in pixels. Default is 16. If positive, random number
  4782. in range 0 to set value will be used. If negative, exact absolute value
  4783. will be used.
  4784. The range defines square of four pixels around current pixel.
  4785. @item direction, d
  4786. Set direction in radians from which four pixel will be compared. If positive,
  4787. random direction from 0 to set direction will be picked. If negative, exact of
  4788. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4789. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4790. column.
  4791. @item blur, b
  4792. If enabled, current pixel is compared with average value of all four
  4793. surrounding pixels. The default is enabled. If disabled current pixel is
  4794. compared with all four surrounding pixels. The pixel is considered banded
  4795. if only all four differences with surrounding pixels are less than threshold.
  4796. @item coupling, c
  4797. If enabled, current pixel is changed if and only if all pixel components are banded,
  4798. e.g. banding detection threshold is triggered for all color components.
  4799. The default is disabled.
  4800. @end table
  4801. @anchor{decimate}
  4802. @section decimate
  4803. Drop duplicated frames at regular intervals.
  4804. The filter accepts the following options:
  4805. @table @option
  4806. @item cycle
  4807. Set the number of frames from which one will be dropped. Setting this to
  4808. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4809. Default is @code{5}.
  4810. @item dupthresh
  4811. Set the threshold for duplicate detection. If the difference metric for a frame
  4812. is less than or equal to this value, then it is declared as duplicate. Default
  4813. is @code{1.1}
  4814. @item scthresh
  4815. Set scene change threshold. Default is @code{15}.
  4816. @item blockx
  4817. @item blocky
  4818. Set the size of the x and y-axis blocks used during metric calculations.
  4819. Larger blocks give better noise suppression, but also give worse detection of
  4820. small movements. Must be a power of two. Default is @code{32}.
  4821. @item ppsrc
  4822. Mark main input as a pre-processed input and activate clean source input
  4823. stream. This allows the input to be pre-processed with various filters to help
  4824. the metrics calculation while keeping the frame selection lossless. When set to
  4825. @code{1}, the first stream is for the pre-processed input, and the second
  4826. stream is the clean source from where the kept frames are chosen. Default is
  4827. @code{0}.
  4828. @item chroma
  4829. Set whether or not chroma is considered in the metric calculations. Default is
  4830. @code{1}.
  4831. @end table
  4832. @section deflate
  4833. Apply deflate effect to the video.
  4834. This filter replaces the pixel by the local(3x3) average by taking into account
  4835. only values lower than the pixel.
  4836. It accepts the following options:
  4837. @table @option
  4838. @item threshold0
  4839. @item threshold1
  4840. @item threshold2
  4841. @item threshold3
  4842. Limit the maximum change for each plane, default is 65535.
  4843. If 0, plane will remain unchanged.
  4844. @end table
  4845. @section dejudder
  4846. Remove judder produced by partially interlaced telecined content.
  4847. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4848. source was partially telecined content then the output of @code{pullup,dejudder}
  4849. will have a variable frame rate. May change the recorded frame rate of the
  4850. container. Aside from that change, this filter will not affect constant frame
  4851. rate video.
  4852. The option available in this filter is:
  4853. @table @option
  4854. @item cycle
  4855. Specify the length of the window over which the judder repeats.
  4856. Accepts any integer greater than 1. Useful values are:
  4857. @table @samp
  4858. @item 4
  4859. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4860. @item 5
  4861. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4862. @item 20
  4863. If a mixture of the two.
  4864. @end table
  4865. The default is @samp{4}.
  4866. @end table
  4867. @section delogo
  4868. Suppress a TV station logo by a simple interpolation of the surrounding
  4869. pixels. Just set a rectangle covering the logo and watch it disappear
  4870. (and sometimes something even uglier appear - your mileage may vary).
  4871. It accepts the following parameters:
  4872. @table @option
  4873. @item x
  4874. @item y
  4875. Specify the top left corner coordinates of the logo. They must be
  4876. specified.
  4877. @item w
  4878. @item h
  4879. Specify the width and height of the logo to clear. They must be
  4880. specified.
  4881. @item band, t
  4882. Specify the thickness of the fuzzy edge of the rectangle (added to
  4883. @var{w} and @var{h}). The default value is 1. This option is
  4884. deprecated, setting higher values should no longer be necessary and
  4885. is not recommended.
  4886. @item show
  4887. When set to 1, a green rectangle is drawn on the screen to simplify
  4888. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4889. The default value is 0.
  4890. The rectangle is drawn on the outermost pixels which will be (partly)
  4891. replaced with interpolated values. The values of the next pixels
  4892. immediately outside this rectangle in each direction will be used to
  4893. compute the interpolated pixel values inside the rectangle.
  4894. @end table
  4895. @subsection Examples
  4896. @itemize
  4897. @item
  4898. Set a rectangle covering the area with top left corner coordinates 0,0
  4899. and size 100x77, and a band of size 10:
  4900. @example
  4901. delogo=x=0:y=0:w=100:h=77:band=10
  4902. @end example
  4903. @end itemize
  4904. @section deshake
  4905. Attempt to fix small changes in horizontal and/or vertical shift. This
  4906. filter helps remove camera shake from hand-holding a camera, bumping a
  4907. tripod, moving on a vehicle, etc.
  4908. The filter accepts the following options:
  4909. @table @option
  4910. @item x
  4911. @item y
  4912. @item w
  4913. @item h
  4914. Specify a rectangular area where to limit the search for motion
  4915. vectors.
  4916. If desired the search for motion vectors can be limited to a
  4917. rectangular area of the frame defined by its top left corner, width
  4918. and height. These parameters have the same meaning as the drawbox
  4919. filter which can be used to visualise the position of the bounding
  4920. box.
  4921. This is useful when simultaneous movement of subjects within the frame
  4922. might be confused for camera motion by the motion vector search.
  4923. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4924. then the full frame is used. This allows later options to be set
  4925. without specifying the bounding box for the motion vector search.
  4926. Default - search the whole frame.
  4927. @item rx
  4928. @item ry
  4929. Specify the maximum extent of movement in x and y directions in the
  4930. range 0-64 pixels. Default 16.
  4931. @item edge
  4932. Specify how to generate pixels to fill blanks at the edge of the
  4933. frame. Available values are:
  4934. @table @samp
  4935. @item blank, 0
  4936. Fill zeroes at blank locations
  4937. @item original, 1
  4938. Original image at blank locations
  4939. @item clamp, 2
  4940. Extruded edge value at blank locations
  4941. @item mirror, 3
  4942. Mirrored edge at blank locations
  4943. @end table
  4944. Default value is @samp{mirror}.
  4945. @item blocksize
  4946. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4947. default 8.
  4948. @item contrast
  4949. Specify the contrast threshold for blocks. Only blocks with more than
  4950. the specified contrast (difference between darkest and lightest
  4951. pixels) will be considered. Range 1-255, default 125.
  4952. @item search
  4953. Specify the search strategy. Available values are:
  4954. @table @samp
  4955. @item exhaustive, 0
  4956. Set exhaustive search
  4957. @item less, 1
  4958. Set less exhaustive search.
  4959. @end table
  4960. Default value is @samp{exhaustive}.
  4961. @item filename
  4962. If set then a detailed log of the motion search is written to the
  4963. specified file.
  4964. @item opencl
  4965. If set to 1, specify using OpenCL capabilities, only available if
  4966. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4967. @end table
  4968. @section detelecine
  4969. Apply an exact inverse of the telecine operation. It requires a predefined
  4970. pattern specified using the pattern option which must be the same as that passed
  4971. to the telecine filter.
  4972. This filter accepts the following options:
  4973. @table @option
  4974. @item first_field
  4975. @table @samp
  4976. @item top, t
  4977. top field first
  4978. @item bottom, b
  4979. bottom field first
  4980. The default value is @code{top}.
  4981. @end table
  4982. @item pattern
  4983. A string of numbers representing the pulldown pattern you wish to apply.
  4984. The default value is @code{23}.
  4985. @item start_frame
  4986. A number representing position of the first frame with respect to the telecine
  4987. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4988. @end table
  4989. @section dilation
  4990. Apply dilation effect to the video.
  4991. This filter replaces the pixel by the local(3x3) maximum.
  4992. It accepts the following options:
  4993. @table @option
  4994. @item threshold0
  4995. @item threshold1
  4996. @item threshold2
  4997. @item threshold3
  4998. Limit the maximum change for each plane, default is 65535.
  4999. If 0, plane will remain unchanged.
  5000. @item coordinates
  5001. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5002. pixels are used.
  5003. Flags to local 3x3 coordinates maps like this:
  5004. 1 2 3
  5005. 4 5
  5006. 6 7 8
  5007. @end table
  5008. @section displace
  5009. Displace pixels as indicated by second and third input stream.
  5010. It takes three input streams and outputs one stream, the first input is the
  5011. source, and second and third input are displacement maps.
  5012. The second input specifies how much to displace pixels along the
  5013. x-axis, while the third input specifies how much to displace pixels
  5014. along the y-axis.
  5015. If one of displacement map streams terminates, last frame from that
  5016. displacement map will be used.
  5017. Note that once generated, displacements maps can be reused over and over again.
  5018. A description of the accepted options follows.
  5019. @table @option
  5020. @item edge
  5021. Set displace behavior for pixels that are out of range.
  5022. Available values are:
  5023. @table @samp
  5024. @item blank
  5025. Missing pixels are replaced by black pixels.
  5026. @item smear
  5027. Adjacent pixels will spread out to replace missing pixels.
  5028. @item wrap
  5029. Out of range pixels are wrapped so they point to pixels of other side.
  5030. @end table
  5031. Default is @samp{smear}.
  5032. @end table
  5033. @subsection Examples
  5034. @itemize
  5035. @item
  5036. Add ripple effect to rgb input of video size hd720:
  5037. @example
  5038. 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
  5039. @end example
  5040. @item
  5041. Add wave effect to rgb input of video size hd720:
  5042. @example
  5043. 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
  5044. @end example
  5045. @end itemize
  5046. @section drawbox
  5047. Draw a colored box on the input image.
  5048. It accepts the following parameters:
  5049. @table @option
  5050. @item x
  5051. @item y
  5052. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5053. @item width, w
  5054. @item height, h
  5055. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5056. the input width and height. It defaults to 0.
  5057. @item color, c
  5058. Specify the color of the box to write. For the general syntax of this option,
  5059. check the "Color" section in the ffmpeg-utils manual. If the special
  5060. value @code{invert} is used, the box edge color is the same as the
  5061. video with inverted luma.
  5062. @item thickness, t
  5063. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5064. See below for the list of accepted constants.
  5065. @end table
  5066. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5067. following constants:
  5068. @table @option
  5069. @item dar
  5070. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5071. @item hsub
  5072. @item vsub
  5073. horizontal and vertical chroma subsample values. For example for the
  5074. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5075. @item in_h, ih
  5076. @item in_w, iw
  5077. The input width and height.
  5078. @item sar
  5079. The input sample aspect ratio.
  5080. @item x
  5081. @item y
  5082. The x and y offset coordinates where the box is drawn.
  5083. @item w
  5084. @item h
  5085. The width and height of the drawn box.
  5086. @item t
  5087. The thickness of the drawn box.
  5088. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5089. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5090. @end table
  5091. @subsection Examples
  5092. @itemize
  5093. @item
  5094. Draw a black box around the edge of the input image:
  5095. @example
  5096. drawbox
  5097. @end example
  5098. @item
  5099. Draw a box with color red and an opacity of 50%:
  5100. @example
  5101. drawbox=10:20:200:60:red@@0.5
  5102. @end example
  5103. The previous example can be specified as:
  5104. @example
  5105. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5106. @end example
  5107. @item
  5108. Fill the box with pink color:
  5109. @example
  5110. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5111. @end example
  5112. @item
  5113. Draw a 2-pixel red 2.40:1 mask:
  5114. @example
  5115. 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
  5116. @end example
  5117. @end itemize
  5118. @section drawgrid
  5119. Draw a grid on the input image.
  5120. It accepts the following parameters:
  5121. @table @option
  5122. @item x
  5123. @item y
  5124. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5125. @item width, w
  5126. @item height, h
  5127. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5128. input width and height, respectively, minus @code{thickness}, so image gets
  5129. framed. Default to 0.
  5130. @item color, c
  5131. Specify the color of the grid. For the general syntax of this option,
  5132. check the "Color" section in the ffmpeg-utils manual. If the special
  5133. value @code{invert} is used, the grid color is the same as the
  5134. video with inverted luma.
  5135. @item thickness, t
  5136. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5137. See below for the list of accepted constants.
  5138. @end table
  5139. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5140. following constants:
  5141. @table @option
  5142. @item dar
  5143. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5144. @item hsub
  5145. @item vsub
  5146. horizontal and vertical chroma subsample values. For example for the
  5147. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5148. @item in_h, ih
  5149. @item in_w, iw
  5150. The input grid cell width and height.
  5151. @item sar
  5152. The input sample aspect ratio.
  5153. @item x
  5154. @item y
  5155. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5156. @item w
  5157. @item h
  5158. The width and height of the drawn cell.
  5159. @item t
  5160. The thickness of the drawn cell.
  5161. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5162. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5163. @end table
  5164. @subsection Examples
  5165. @itemize
  5166. @item
  5167. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5168. @example
  5169. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5170. @end example
  5171. @item
  5172. Draw a white 3x3 grid with an opacity of 50%:
  5173. @example
  5174. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5175. @end example
  5176. @end itemize
  5177. @anchor{drawtext}
  5178. @section drawtext
  5179. Draw a text string or text from a specified file on top of a video, using the
  5180. libfreetype library.
  5181. To enable compilation of this filter, you need to configure FFmpeg with
  5182. @code{--enable-libfreetype}.
  5183. To enable default font fallback and the @var{font} option you need to
  5184. configure FFmpeg with @code{--enable-libfontconfig}.
  5185. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5186. @code{--enable-libfribidi}.
  5187. @subsection Syntax
  5188. It accepts the following parameters:
  5189. @table @option
  5190. @item box
  5191. Used to draw a box around text using the background color.
  5192. The value must be either 1 (enable) or 0 (disable).
  5193. The default value of @var{box} is 0.
  5194. @item boxborderw
  5195. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5196. The default value of @var{boxborderw} is 0.
  5197. @item boxcolor
  5198. The color to be used for drawing box around text. For the syntax of this
  5199. option, check the "Color" section in the ffmpeg-utils manual.
  5200. The default value of @var{boxcolor} is "white".
  5201. @item line_spacing
  5202. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5203. The default value of @var{line_spacing} is 0.
  5204. @item borderw
  5205. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5206. The default value of @var{borderw} is 0.
  5207. @item bordercolor
  5208. Set the color to be used for drawing border around text. For the syntax of this
  5209. option, check the "Color" section in the ffmpeg-utils manual.
  5210. The default value of @var{bordercolor} is "black".
  5211. @item expansion
  5212. Select how the @var{text} is expanded. Can be either @code{none},
  5213. @code{strftime} (deprecated) or
  5214. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5215. below for details.
  5216. @item basetime
  5217. Set a start time for the count. Value is in microseconds. Only applied
  5218. in the deprecated strftime expansion mode. To emulate in normal expansion
  5219. mode use the @code{pts} function, supplying the start time (in seconds)
  5220. as the second argument.
  5221. @item fix_bounds
  5222. If true, check and fix text coords to avoid clipping.
  5223. @item fontcolor
  5224. The color to be used for drawing fonts. For the syntax of this option, check
  5225. the "Color" section in the ffmpeg-utils manual.
  5226. The default value of @var{fontcolor} is "black".
  5227. @item fontcolor_expr
  5228. String which is expanded the same way as @var{text} to obtain dynamic
  5229. @var{fontcolor} value. By default this option has empty value and is not
  5230. processed. When this option is set, it overrides @var{fontcolor} option.
  5231. @item font
  5232. The font family to be used for drawing text. By default Sans.
  5233. @item fontfile
  5234. The font file to be used for drawing text. The path must be included.
  5235. This parameter is mandatory if the fontconfig support is disabled.
  5236. @item alpha
  5237. Draw the text applying alpha blending. The value can
  5238. be a number between 0.0 and 1.0.
  5239. The expression accepts the same variables @var{x, y} as well.
  5240. The default value is 1.
  5241. Please see @var{fontcolor_expr}.
  5242. @item fontsize
  5243. The font size to be used for drawing text.
  5244. The default value of @var{fontsize} is 16.
  5245. @item text_shaping
  5246. If set to 1, attempt to shape the text (for example, reverse the order of
  5247. right-to-left text and join Arabic characters) before drawing it.
  5248. Otherwise, just draw the text exactly as given.
  5249. By default 1 (if supported).
  5250. @item ft_load_flags
  5251. The flags to be used for loading the fonts.
  5252. The flags map the corresponding flags supported by libfreetype, and are
  5253. a combination of the following values:
  5254. @table @var
  5255. @item default
  5256. @item no_scale
  5257. @item no_hinting
  5258. @item render
  5259. @item no_bitmap
  5260. @item vertical_layout
  5261. @item force_autohint
  5262. @item crop_bitmap
  5263. @item pedantic
  5264. @item ignore_global_advance_width
  5265. @item no_recurse
  5266. @item ignore_transform
  5267. @item monochrome
  5268. @item linear_design
  5269. @item no_autohint
  5270. @end table
  5271. Default value is "default".
  5272. For more information consult the documentation for the FT_LOAD_*
  5273. libfreetype flags.
  5274. @item shadowcolor
  5275. The color to be used for drawing a shadow behind the drawn text. For the
  5276. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5277. The default value of @var{shadowcolor} is "black".
  5278. @item shadowx
  5279. @item shadowy
  5280. The x and y offsets for the text shadow position with respect to the
  5281. position of the text. They can be either positive or negative
  5282. values. The default value for both is "0".
  5283. @item start_number
  5284. The starting frame number for the n/frame_num variable. The default value
  5285. is "0".
  5286. @item tabsize
  5287. The size in number of spaces to use for rendering the tab.
  5288. Default value is 4.
  5289. @item timecode
  5290. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5291. format. It can be used with or without text parameter. @var{timecode_rate}
  5292. option must be specified.
  5293. @item timecode_rate, rate, r
  5294. Set the timecode frame rate (timecode only).
  5295. @item tc24hmax
  5296. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5297. Default is 0 (disabled).
  5298. @item text
  5299. The text string to be drawn. The text must be a sequence of UTF-8
  5300. encoded characters.
  5301. This parameter is mandatory if no file is specified with the parameter
  5302. @var{textfile}.
  5303. @item textfile
  5304. A text file containing text to be drawn. The text must be a sequence
  5305. of UTF-8 encoded characters.
  5306. This parameter is mandatory if no text string is specified with the
  5307. parameter @var{text}.
  5308. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5309. @item reload
  5310. If set to 1, the @var{textfile} will be reloaded before each frame.
  5311. Be sure to update it atomically, or it may be read partially, or even fail.
  5312. @item x
  5313. @item y
  5314. The expressions which specify the offsets where text will be drawn
  5315. within the video frame. They are relative to the top/left border of the
  5316. output image.
  5317. The default value of @var{x} and @var{y} is "0".
  5318. See below for the list of accepted constants and functions.
  5319. @end table
  5320. The parameters for @var{x} and @var{y} are expressions containing the
  5321. following constants and functions:
  5322. @table @option
  5323. @item dar
  5324. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5325. @item hsub
  5326. @item vsub
  5327. horizontal and vertical chroma subsample values. For example for the
  5328. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5329. @item line_h, lh
  5330. the height of each text line
  5331. @item main_h, h, H
  5332. the input height
  5333. @item main_w, w, W
  5334. the input width
  5335. @item max_glyph_a, ascent
  5336. the maximum distance from the baseline to the highest/upper grid
  5337. coordinate used to place a glyph outline point, for all the rendered
  5338. glyphs.
  5339. It is a positive value, due to the grid's orientation with the Y axis
  5340. upwards.
  5341. @item max_glyph_d, descent
  5342. the maximum distance from the baseline to the lowest grid coordinate
  5343. used to place a glyph outline point, for all the rendered glyphs.
  5344. This is a negative value, due to the grid's orientation, with the Y axis
  5345. upwards.
  5346. @item max_glyph_h
  5347. maximum glyph height, that is the maximum height for all the glyphs
  5348. contained in the rendered text, it is equivalent to @var{ascent} -
  5349. @var{descent}.
  5350. @item max_glyph_w
  5351. maximum glyph width, that is the maximum width for all the glyphs
  5352. contained in the rendered text
  5353. @item n
  5354. the number of input frame, starting from 0
  5355. @item rand(min, max)
  5356. return a random number included between @var{min} and @var{max}
  5357. @item sar
  5358. The input sample aspect ratio.
  5359. @item t
  5360. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5361. @item text_h, th
  5362. the height of the rendered text
  5363. @item text_w, tw
  5364. the width of the rendered text
  5365. @item x
  5366. @item y
  5367. the x and y offset coordinates where the text is drawn.
  5368. These parameters allow the @var{x} and @var{y} expressions to refer
  5369. each other, so you can for example specify @code{y=x/dar}.
  5370. @end table
  5371. @anchor{drawtext_expansion}
  5372. @subsection Text expansion
  5373. If @option{expansion} is set to @code{strftime},
  5374. the filter recognizes strftime() sequences in the provided text and
  5375. expands them accordingly. Check the documentation of strftime(). This
  5376. feature is deprecated.
  5377. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5378. If @option{expansion} is set to @code{normal} (which is the default),
  5379. the following expansion mechanism is used.
  5380. The backslash character @samp{\}, followed by any character, always expands to
  5381. the second character.
  5382. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5383. braces is a function name, possibly followed by arguments separated by ':'.
  5384. If the arguments contain special characters or delimiters (':' or '@}'),
  5385. they should be escaped.
  5386. Note that they probably must also be escaped as the value for the
  5387. @option{text} option in the filter argument string and as the filter
  5388. argument in the filtergraph description, and possibly also for the shell,
  5389. that makes up to four levels of escaping; using a text file avoids these
  5390. problems.
  5391. The following functions are available:
  5392. @table @command
  5393. @item expr, e
  5394. The expression evaluation result.
  5395. It must take one argument specifying the expression to be evaluated,
  5396. which accepts the same constants and functions as the @var{x} and
  5397. @var{y} values. Note that not all constants should be used, for
  5398. example the text size is not known when evaluating the expression, so
  5399. the constants @var{text_w} and @var{text_h} will have an undefined
  5400. value.
  5401. @item expr_int_format, eif
  5402. Evaluate the expression's value and output as formatted integer.
  5403. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5404. The second argument specifies the output format. Allowed values are @samp{x},
  5405. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5406. @code{printf} function.
  5407. The third parameter is optional and sets the number of positions taken by the output.
  5408. It can be used to add padding with zeros from the left.
  5409. @item gmtime
  5410. The time at which the filter is running, expressed in UTC.
  5411. It can accept an argument: a strftime() format string.
  5412. @item localtime
  5413. The time at which the filter is running, expressed in the local time zone.
  5414. It can accept an argument: a strftime() format string.
  5415. @item metadata
  5416. Frame metadata. Takes one or two arguments.
  5417. The first argument is mandatory and specifies the metadata key.
  5418. The second argument is optional and specifies a default value, used when the
  5419. metadata key is not found or empty.
  5420. @item n, frame_num
  5421. The frame number, starting from 0.
  5422. @item pict_type
  5423. A 1 character description of the current picture type.
  5424. @item pts
  5425. The timestamp of the current frame.
  5426. It can take up to three arguments.
  5427. The first argument is the format of the timestamp; it defaults to @code{flt}
  5428. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5429. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5430. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5431. @code{localtime} stands for the timestamp of the frame formatted as
  5432. local time zone time.
  5433. The second argument is an offset added to the timestamp.
  5434. If the format is set to @code{localtime} or @code{gmtime},
  5435. a third argument may be supplied: a strftime() format string.
  5436. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5437. @end table
  5438. @subsection Examples
  5439. @itemize
  5440. @item
  5441. Draw "Test Text" with font FreeSerif, using the default values for the
  5442. optional parameters.
  5443. @example
  5444. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5445. @end example
  5446. @item
  5447. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5448. and y=50 (counting from the top-left corner of the screen), text is
  5449. yellow with a red box around it. Both the text and the box have an
  5450. opacity of 20%.
  5451. @example
  5452. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5453. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5454. @end example
  5455. Note that the double quotes are not necessary if spaces are not used
  5456. within the parameter list.
  5457. @item
  5458. Show the text at the center of the video frame:
  5459. @example
  5460. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5461. @end example
  5462. @item
  5463. Show the text at a random position, switching to a new position every 30 seconds:
  5464. @example
  5465. 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)"
  5466. @end example
  5467. @item
  5468. Show a text line sliding from right to left in the last row of the video
  5469. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5470. with no newlines.
  5471. @example
  5472. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5473. @end example
  5474. @item
  5475. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5476. @example
  5477. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5478. @end example
  5479. @item
  5480. Draw a single green letter "g", at the center of the input video.
  5481. The glyph baseline is placed at half screen height.
  5482. @example
  5483. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5484. @end example
  5485. @item
  5486. Show text for 1 second every 3 seconds:
  5487. @example
  5488. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5489. @end example
  5490. @item
  5491. Use fontconfig to set the font. Note that the colons need to be escaped.
  5492. @example
  5493. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5494. @end example
  5495. @item
  5496. Print the date of a real-time encoding (see strftime(3)):
  5497. @example
  5498. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5499. @end example
  5500. @item
  5501. Show text fading in and out (appearing/disappearing):
  5502. @example
  5503. #!/bin/sh
  5504. DS=1.0 # display start
  5505. DE=10.0 # display end
  5506. FID=1.5 # fade in duration
  5507. FOD=5 # fade out duration
  5508. 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 @}"
  5509. @end example
  5510. @item
  5511. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5512. and the @option{fontsize} value are included in the @option{y} offset.
  5513. @example
  5514. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5515. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5516. @end example
  5517. @end itemize
  5518. For more information about libfreetype, check:
  5519. @url{http://www.freetype.org/}.
  5520. For more information about fontconfig, check:
  5521. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5522. For more information about libfribidi, check:
  5523. @url{http://fribidi.org/}.
  5524. @section edgedetect
  5525. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5526. The filter accepts the following options:
  5527. @table @option
  5528. @item low
  5529. @item high
  5530. Set low and high threshold values used by the Canny thresholding
  5531. algorithm.
  5532. The high threshold selects the "strong" edge pixels, which are then
  5533. connected through 8-connectivity with the "weak" edge pixels selected
  5534. by the low threshold.
  5535. @var{low} and @var{high} threshold values must be chosen in the range
  5536. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5537. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5538. is @code{50/255}.
  5539. @item mode
  5540. Define the drawing mode.
  5541. @table @samp
  5542. @item wires
  5543. Draw white/gray wires on black background.
  5544. @item colormix
  5545. Mix the colors to create a paint/cartoon effect.
  5546. @end table
  5547. Default value is @var{wires}.
  5548. @end table
  5549. @subsection Examples
  5550. @itemize
  5551. @item
  5552. Standard edge detection with custom values for the hysteresis thresholding:
  5553. @example
  5554. edgedetect=low=0.1:high=0.4
  5555. @end example
  5556. @item
  5557. Painting effect without thresholding:
  5558. @example
  5559. edgedetect=mode=colormix:high=0
  5560. @end example
  5561. @end itemize
  5562. @section eq
  5563. Set brightness, contrast, saturation and approximate gamma adjustment.
  5564. The filter accepts the following options:
  5565. @table @option
  5566. @item contrast
  5567. Set the contrast expression. The value must be a float value in range
  5568. @code{-2.0} to @code{2.0}. The default value is "1".
  5569. @item brightness
  5570. Set the brightness expression. The value must be a float value in
  5571. range @code{-1.0} to @code{1.0}. The default value is "0".
  5572. @item saturation
  5573. Set the saturation expression. The value must be a float in
  5574. range @code{0.0} to @code{3.0}. The default value is "1".
  5575. @item gamma
  5576. Set the gamma expression. The value must be a float in range
  5577. @code{0.1} to @code{10.0}. The default value is "1".
  5578. @item gamma_r
  5579. Set the gamma expression for red. The value must be a float in
  5580. range @code{0.1} to @code{10.0}. The default value is "1".
  5581. @item gamma_g
  5582. Set the gamma expression for green. The value must be a float in range
  5583. @code{0.1} to @code{10.0}. The default value is "1".
  5584. @item gamma_b
  5585. Set the gamma expression for blue. The value must be a float in range
  5586. @code{0.1} to @code{10.0}. The default value is "1".
  5587. @item gamma_weight
  5588. Set the gamma weight expression. It can be used to reduce the effect
  5589. of a high gamma value on bright image areas, e.g. keep them from
  5590. getting overamplified and just plain white. The value must be a float
  5591. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5592. gamma correction all the way down while @code{1.0} leaves it at its
  5593. full strength. Default is "1".
  5594. @item eval
  5595. Set when the expressions for brightness, contrast, saturation and
  5596. gamma expressions are evaluated.
  5597. It accepts the following values:
  5598. @table @samp
  5599. @item init
  5600. only evaluate expressions once during the filter initialization or
  5601. when a command is processed
  5602. @item frame
  5603. evaluate expressions for each incoming frame
  5604. @end table
  5605. Default value is @samp{init}.
  5606. @end table
  5607. The expressions accept the following parameters:
  5608. @table @option
  5609. @item n
  5610. frame count of the input frame starting from 0
  5611. @item pos
  5612. byte position of the corresponding packet in the input file, NAN if
  5613. unspecified
  5614. @item r
  5615. frame rate of the input video, NAN if the input frame rate is unknown
  5616. @item t
  5617. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5618. @end table
  5619. @subsection Commands
  5620. The filter supports the following commands:
  5621. @table @option
  5622. @item contrast
  5623. Set the contrast expression.
  5624. @item brightness
  5625. Set the brightness expression.
  5626. @item saturation
  5627. Set the saturation expression.
  5628. @item gamma
  5629. Set the gamma expression.
  5630. @item gamma_r
  5631. Set the gamma_r expression.
  5632. @item gamma_g
  5633. Set gamma_g expression.
  5634. @item gamma_b
  5635. Set gamma_b expression.
  5636. @item gamma_weight
  5637. Set gamma_weight expression.
  5638. The command accepts the same syntax of the corresponding option.
  5639. If the specified expression is not valid, it is kept at its current
  5640. value.
  5641. @end table
  5642. @section erosion
  5643. Apply erosion effect to the video.
  5644. This filter replaces the pixel by the local(3x3) minimum.
  5645. It accepts the following options:
  5646. @table @option
  5647. @item threshold0
  5648. @item threshold1
  5649. @item threshold2
  5650. @item threshold3
  5651. Limit the maximum change for each plane, default is 65535.
  5652. If 0, plane will remain unchanged.
  5653. @item coordinates
  5654. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5655. pixels are used.
  5656. Flags to local 3x3 coordinates maps like this:
  5657. 1 2 3
  5658. 4 5
  5659. 6 7 8
  5660. @end table
  5661. @section extractplanes
  5662. Extract color channel components from input video stream into
  5663. separate grayscale video streams.
  5664. The filter accepts the following option:
  5665. @table @option
  5666. @item planes
  5667. Set plane(s) to extract.
  5668. Available values for planes are:
  5669. @table @samp
  5670. @item y
  5671. @item u
  5672. @item v
  5673. @item a
  5674. @item r
  5675. @item g
  5676. @item b
  5677. @end table
  5678. Choosing planes not available in the input will result in an error.
  5679. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5680. with @code{y}, @code{u}, @code{v} planes at same time.
  5681. @end table
  5682. @subsection Examples
  5683. @itemize
  5684. @item
  5685. Extract luma, u and v color channel component from input video frame
  5686. into 3 grayscale outputs:
  5687. @example
  5688. 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
  5689. @end example
  5690. @end itemize
  5691. @section elbg
  5692. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5693. For each input image, the filter will compute the optimal mapping from
  5694. the input to the output given the codebook length, that is the number
  5695. of distinct output colors.
  5696. This filter accepts the following options.
  5697. @table @option
  5698. @item codebook_length, l
  5699. Set codebook length. The value must be a positive integer, and
  5700. represents the number of distinct output colors. Default value is 256.
  5701. @item nb_steps, n
  5702. Set the maximum number of iterations to apply for computing the optimal
  5703. mapping. The higher the value the better the result and the higher the
  5704. computation time. Default value is 1.
  5705. @item seed, s
  5706. Set a random seed, must be an integer included between 0 and
  5707. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5708. will try to use a good random seed on a best effort basis.
  5709. @item pal8
  5710. Set pal8 output pixel format. This option does not work with codebook
  5711. length greater than 256.
  5712. @end table
  5713. @section fade
  5714. Apply a fade-in/out effect to the input video.
  5715. It accepts the following parameters:
  5716. @table @option
  5717. @item type, t
  5718. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5719. effect.
  5720. Default is @code{in}.
  5721. @item start_frame, s
  5722. Specify the number of the frame to start applying the fade
  5723. effect at. Default is 0.
  5724. @item nb_frames, n
  5725. The number of frames that the fade effect lasts. At the end of the
  5726. fade-in effect, the output video will have the same intensity as the input video.
  5727. At the end of the fade-out transition, the output video will be filled with the
  5728. selected @option{color}.
  5729. Default is 25.
  5730. @item alpha
  5731. If set to 1, fade only alpha channel, if one exists on the input.
  5732. Default value is 0.
  5733. @item start_time, st
  5734. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5735. effect. If both start_frame and start_time are specified, the fade will start at
  5736. whichever comes last. Default is 0.
  5737. @item duration, d
  5738. The number of seconds for which the fade effect has to last. At the end of the
  5739. fade-in effect the output video will have the same intensity as the input video,
  5740. at the end of the fade-out transition the output video will be filled with the
  5741. selected @option{color}.
  5742. If both duration and nb_frames are specified, duration is used. Default is 0
  5743. (nb_frames is used by default).
  5744. @item color, c
  5745. Specify the color of the fade. Default is "black".
  5746. @end table
  5747. @subsection Examples
  5748. @itemize
  5749. @item
  5750. Fade in the first 30 frames of video:
  5751. @example
  5752. fade=in:0:30
  5753. @end example
  5754. The command above is equivalent to:
  5755. @example
  5756. fade=t=in:s=0:n=30
  5757. @end example
  5758. @item
  5759. Fade out the last 45 frames of a 200-frame video:
  5760. @example
  5761. fade=out:155:45
  5762. fade=type=out:start_frame=155:nb_frames=45
  5763. @end example
  5764. @item
  5765. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5766. @example
  5767. fade=in:0:25, fade=out:975:25
  5768. @end example
  5769. @item
  5770. Make the first 5 frames yellow, then fade in from frame 5-24:
  5771. @example
  5772. fade=in:5:20:color=yellow
  5773. @end example
  5774. @item
  5775. Fade in alpha over first 25 frames of video:
  5776. @example
  5777. fade=in:0:25:alpha=1
  5778. @end example
  5779. @item
  5780. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5781. @example
  5782. fade=t=in:st=5.5:d=0.5
  5783. @end example
  5784. @end itemize
  5785. @section fftfilt
  5786. Apply arbitrary expressions to samples in frequency domain
  5787. @table @option
  5788. @item dc_Y
  5789. Adjust the dc value (gain) of the luma plane of the image. The filter
  5790. accepts an integer value in range @code{0} to @code{1000}. The default
  5791. value is set to @code{0}.
  5792. @item dc_U
  5793. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5794. filter accepts an integer value in range @code{0} to @code{1000}. The
  5795. default value is set to @code{0}.
  5796. @item dc_V
  5797. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5798. filter accepts an integer value in range @code{0} to @code{1000}. The
  5799. default value is set to @code{0}.
  5800. @item weight_Y
  5801. Set the frequency domain weight expression for the luma plane.
  5802. @item weight_U
  5803. Set the frequency domain weight expression for the 1st chroma plane.
  5804. @item weight_V
  5805. Set the frequency domain weight expression for the 2nd chroma plane.
  5806. The filter accepts the following variables:
  5807. @item X
  5808. @item Y
  5809. The coordinates of the current sample.
  5810. @item W
  5811. @item H
  5812. The width and height of the image.
  5813. @end table
  5814. @subsection Examples
  5815. @itemize
  5816. @item
  5817. High-pass:
  5818. @example
  5819. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5820. @end example
  5821. @item
  5822. Low-pass:
  5823. @example
  5824. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5825. @end example
  5826. @item
  5827. Sharpen:
  5828. @example
  5829. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5830. @end example
  5831. @item
  5832. Blur:
  5833. @example
  5834. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5835. @end example
  5836. @end itemize
  5837. @section field
  5838. Extract a single field from an interlaced image using stride
  5839. arithmetic to avoid wasting CPU time. The output frames are marked as
  5840. non-interlaced.
  5841. The filter accepts the following options:
  5842. @table @option
  5843. @item type
  5844. Specify whether to extract the top (if the value is @code{0} or
  5845. @code{top}) or the bottom field (if the value is @code{1} or
  5846. @code{bottom}).
  5847. @end table
  5848. @section fieldhint
  5849. Create new frames by copying the top and bottom fields from surrounding frames
  5850. supplied as numbers by the hint file.
  5851. @table @option
  5852. @item hint
  5853. Set file containing hints: absolute/relative frame numbers.
  5854. There must be one line for each frame in a clip. Each line must contain two
  5855. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5856. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5857. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5858. for @code{relative} mode. First number tells from which frame to pick up top
  5859. field and second number tells from which frame to pick up bottom field.
  5860. If optionally followed by @code{+} output frame will be marked as interlaced,
  5861. else if followed by @code{-} output frame will be marked as progressive, else
  5862. it will be marked same as input frame.
  5863. If line starts with @code{#} or @code{;} that line is skipped.
  5864. @item mode
  5865. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5866. @end table
  5867. Example of first several lines of @code{hint} file for @code{relative} mode:
  5868. @example
  5869. 0,0 - # first frame
  5870. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5871. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5872. 1,0 -
  5873. 0,0 -
  5874. 0,0 -
  5875. 1,0 -
  5876. 1,0 -
  5877. 1,0 -
  5878. 0,0 -
  5879. 0,0 -
  5880. 1,0 -
  5881. 1,0 -
  5882. 1,0 -
  5883. 0,0 -
  5884. @end example
  5885. @section fieldmatch
  5886. Field matching filter for inverse telecine. It is meant to reconstruct the
  5887. progressive frames from a telecined stream. The filter does not drop duplicated
  5888. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5889. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5890. The separation of the field matching and the decimation is notably motivated by
  5891. the possibility of inserting a de-interlacing filter fallback between the two.
  5892. If the source has mixed telecined and real interlaced content,
  5893. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5894. But these remaining combed frames will be marked as interlaced, and thus can be
  5895. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5896. In addition to the various configuration options, @code{fieldmatch} can take an
  5897. optional second stream, activated through the @option{ppsrc} option. If
  5898. enabled, the frames reconstruction will be based on the fields and frames from
  5899. this second stream. This allows the first input to be pre-processed in order to
  5900. help the various algorithms of the filter, while keeping the output lossless
  5901. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5902. or brightness/contrast adjustments can help.
  5903. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5904. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5905. which @code{fieldmatch} is based on. While the semantic and usage are very
  5906. close, some behaviour and options names can differ.
  5907. The @ref{decimate} filter currently only works for constant frame rate input.
  5908. If your input has mixed telecined (30fps) and progressive content with a lower
  5909. framerate like 24fps use the following filterchain to produce the necessary cfr
  5910. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5911. The filter accepts the following options:
  5912. @table @option
  5913. @item order
  5914. Specify the assumed field order of the input stream. Available values are:
  5915. @table @samp
  5916. @item auto
  5917. Auto detect parity (use FFmpeg's internal parity value).
  5918. @item bff
  5919. Assume bottom field first.
  5920. @item tff
  5921. Assume top field first.
  5922. @end table
  5923. Note that it is sometimes recommended not to trust the parity announced by the
  5924. stream.
  5925. Default value is @var{auto}.
  5926. @item mode
  5927. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5928. sense that it won't risk creating jerkiness due to duplicate frames when
  5929. possible, but if there are bad edits or blended fields it will end up
  5930. outputting combed frames when a good match might actually exist. On the other
  5931. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5932. but will almost always find a good frame if there is one. The other values are
  5933. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5934. jerkiness and creating duplicate frames versus finding good matches in sections
  5935. with bad edits, orphaned fields, blended fields, etc.
  5936. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5937. Available values are:
  5938. @table @samp
  5939. @item pc
  5940. 2-way matching (p/c)
  5941. @item pc_n
  5942. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5943. @item pc_u
  5944. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5945. @item pc_n_ub
  5946. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5947. still combed (p/c + n + u/b)
  5948. @item pcn
  5949. 3-way matching (p/c/n)
  5950. @item pcn_ub
  5951. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5952. detected as combed (p/c/n + u/b)
  5953. @end table
  5954. The parenthesis at the end indicate the matches that would be used for that
  5955. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5956. @var{top}).
  5957. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5958. the slowest.
  5959. Default value is @var{pc_n}.
  5960. @item ppsrc
  5961. Mark the main input stream as a pre-processed input, and enable the secondary
  5962. input stream as the clean source to pick the fields from. See the filter
  5963. introduction for more details. It is similar to the @option{clip2} feature from
  5964. VFM/TFM.
  5965. Default value is @code{0} (disabled).
  5966. @item field
  5967. Set the field to match from. It is recommended to set this to the same value as
  5968. @option{order} unless you experience matching failures with that setting. In
  5969. certain circumstances changing the field that is used to match from can have a
  5970. large impact on matching performance. Available values are:
  5971. @table @samp
  5972. @item auto
  5973. Automatic (same value as @option{order}).
  5974. @item bottom
  5975. Match from the bottom field.
  5976. @item top
  5977. Match from the top field.
  5978. @end table
  5979. Default value is @var{auto}.
  5980. @item mchroma
  5981. Set whether or not chroma is included during the match comparisons. In most
  5982. cases it is recommended to leave this enabled. You should set this to @code{0}
  5983. only if your clip has bad chroma problems such as heavy rainbowing or other
  5984. artifacts. Setting this to @code{0} could also be used to speed things up at
  5985. the cost of some accuracy.
  5986. Default value is @code{1}.
  5987. @item y0
  5988. @item y1
  5989. These define an exclusion band which excludes the lines between @option{y0} and
  5990. @option{y1} from being included in the field matching decision. An exclusion
  5991. band can be used to ignore subtitles, a logo, or other things that may
  5992. interfere with the matching. @option{y0} sets the starting scan line and
  5993. @option{y1} sets the ending line; all lines in between @option{y0} and
  5994. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5995. @option{y0} and @option{y1} to the same value will disable the feature.
  5996. @option{y0} and @option{y1} defaults to @code{0}.
  5997. @item scthresh
  5998. Set the scene change detection threshold as a percentage of maximum change on
  5999. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6000. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6001. @option{scthresh} is @code{[0.0, 100.0]}.
  6002. Default value is @code{12.0}.
  6003. @item combmatch
  6004. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6005. account the combed scores of matches when deciding what match to use as the
  6006. final match. Available values are:
  6007. @table @samp
  6008. @item none
  6009. No final matching based on combed scores.
  6010. @item sc
  6011. Combed scores are only used when a scene change is detected.
  6012. @item full
  6013. Use combed scores all the time.
  6014. @end table
  6015. Default is @var{sc}.
  6016. @item combdbg
  6017. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6018. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6019. Available values are:
  6020. @table @samp
  6021. @item none
  6022. No forced calculation.
  6023. @item pcn
  6024. Force p/c/n calculations.
  6025. @item pcnub
  6026. Force p/c/n/u/b calculations.
  6027. @end table
  6028. Default value is @var{none}.
  6029. @item cthresh
  6030. This is the area combing threshold used for combed frame detection. This
  6031. essentially controls how "strong" or "visible" combing must be to be detected.
  6032. Larger values mean combing must be more visible and smaller values mean combing
  6033. can be less visible or strong and still be detected. Valid settings are from
  6034. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6035. be detected as combed). This is basically a pixel difference value. A good
  6036. range is @code{[8, 12]}.
  6037. Default value is @code{9}.
  6038. @item chroma
  6039. Sets whether or not chroma is considered in the combed frame decision. Only
  6040. disable this if your source has chroma problems (rainbowing, etc.) that are
  6041. causing problems for the combed frame detection with chroma enabled. Actually,
  6042. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6043. where there is chroma only combing in the source.
  6044. Default value is @code{0}.
  6045. @item blockx
  6046. @item blocky
  6047. Respectively set the x-axis and y-axis size of the window used during combed
  6048. frame detection. This has to do with the size of the area in which
  6049. @option{combpel} pixels are required to be detected as combed for a frame to be
  6050. declared combed. See the @option{combpel} parameter description for more info.
  6051. Possible values are any number that is a power of 2 starting at 4 and going up
  6052. to 512.
  6053. Default value is @code{16}.
  6054. @item combpel
  6055. The number of combed pixels inside any of the @option{blocky} by
  6056. @option{blockx} size blocks on the frame for the frame to be detected as
  6057. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6058. setting controls "how much" combing there must be in any localized area (a
  6059. window defined by the @option{blockx} and @option{blocky} settings) on the
  6060. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6061. which point no frames will ever be detected as combed). This setting is known
  6062. as @option{MI} in TFM/VFM vocabulary.
  6063. Default value is @code{80}.
  6064. @end table
  6065. @anchor{p/c/n/u/b meaning}
  6066. @subsection p/c/n/u/b meaning
  6067. @subsubsection p/c/n
  6068. We assume the following telecined stream:
  6069. @example
  6070. Top fields: 1 2 2 3 4
  6071. Bottom fields: 1 2 3 4 4
  6072. @end example
  6073. The numbers correspond to the progressive frame the fields relate to. Here, the
  6074. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6075. When @code{fieldmatch} is configured to run a matching from bottom
  6076. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6077. @example
  6078. Input stream:
  6079. T 1 2 2 3 4
  6080. B 1 2 3 4 4 <-- matching reference
  6081. Matches: c c n n c
  6082. Output stream:
  6083. T 1 2 3 4 4
  6084. B 1 2 3 4 4
  6085. @end example
  6086. As a result of the field matching, we can see that some frames get duplicated.
  6087. To perform a complete inverse telecine, you need to rely on a decimation filter
  6088. after this operation. See for instance the @ref{decimate} filter.
  6089. The same operation now matching from top fields (@option{field}=@var{top})
  6090. looks like this:
  6091. @example
  6092. Input stream:
  6093. T 1 2 2 3 4 <-- matching reference
  6094. B 1 2 3 4 4
  6095. Matches: c c p p c
  6096. Output stream:
  6097. T 1 2 2 3 4
  6098. B 1 2 2 3 4
  6099. @end example
  6100. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6101. basically, they refer to the frame and field of the opposite parity:
  6102. @itemize
  6103. @item @var{p} matches the field of the opposite parity in the previous frame
  6104. @item @var{c} matches the field of the opposite parity in the current frame
  6105. @item @var{n} matches the field of the opposite parity in the next frame
  6106. @end itemize
  6107. @subsubsection u/b
  6108. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6109. from the opposite parity flag. In the following examples, we assume that we are
  6110. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6111. 'x' is placed above and below each matched fields.
  6112. With bottom matching (@option{field}=@var{bottom}):
  6113. @example
  6114. Match: c p n b u
  6115. x x x x x
  6116. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6117. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6118. x x x x x
  6119. Output frames:
  6120. 2 1 2 2 2
  6121. 2 2 2 1 3
  6122. @end example
  6123. With top matching (@option{field}=@var{top}):
  6124. @example
  6125. Match: c p n b u
  6126. x x x x x
  6127. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6128. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6129. x x x x x
  6130. Output frames:
  6131. 2 2 2 1 2
  6132. 2 1 3 2 2
  6133. @end example
  6134. @subsection Examples
  6135. Simple IVTC of a top field first telecined stream:
  6136. @example
  6137. fieldmatch=order=tff:combmatch=none, decimate
  6138. @end example
  6139. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6140. @example
  6141. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6142. @end example
  6143. @section fieldorder
  6144. Transform the field order of the input video.
  6145. It accepts the following parameters:
  6146. @table @option
  6147. @item order
  6148. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6149. for bottom field first.
  6150. @end table
  6151. The default value is @samp{tff}.
  6152. The transformation is done by shifting the picture content up or down
  6153. by one line, and filling the remaining line with appropriate picture content.
  6154. This method is consistent with most broadcast field order converters.
  6155. If the input video is not flagged as being interlaced, or it is already
  6156. flagged as being of the required output field order, then this filter does
  6157. not alter the incoming video.
  6158. It is very useful when converting to or from PAL DV material,
  6159. which is bottom field first.
  6160. For example:
  6161. @example
  6162. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6163. @end example
  6164. @section fifo, afifo
  6165. Buffer input images and send them when they are requested.
  6166. It is mainly useful when auto-inserted by the libavfilter
  6167. framework.
  6168. It does not take parameters.
  6169. @section find_rect
  6170. Find a rectangular object
  6171. It accepts the following options:
  6172. @table @option
  6173. @item object
  6174. Filepath of the object image, needs to be in gray8.
  6175. @item threshold
  6176. Detection threshold, default is 0.5.
  6177. @item mipmaps
  6178. Number of mipmaps, default is 3.
  6179. @item xmin, ymin, xmax, ymax
  6180. Specifies the rectangle in which to search.
  6181. @end table
  6182. @subsection Examples
  6183. @itemize
  6184. @item
  6185. Generate a representative palette of a given video using @command{ffmpeg}:
  6186. @example
  6187. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6188. @end example
  6189. @end itemize
  6190. @section cover_rect
  6191. Cover a rectangular object
  6192. It accepts the following options:
  6193. @table @option
  6194. @item cover
  6195. Filepath of the optional cover image, needs to be in yuv420.
  6196. @item mode
  6197. Set covering mode.
  6198. It accepts the following values:
  6199. @table @samp
  6200. @item cover
  6201. cover it by the supplied image
  6202. @item blur
  6203. cover it by interpolating the surrounding pixels
  6204. @end table
  6205. Default value is @var{blur}.
  6206. @end table
  6207. @subsection Examples
  6208. @itemize
  6209. @item
  6210. Generate a representative palette of a given video using @command{ffmpeg}:
  6211. @example
  6212. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6213. @end example
  6214. @end itemize
  6215. @anchor{format}
  6216. @section format
  6217. Convert the input video to one of the specified pixel formats.
  6218. Libavfilter will try to pick one that is suitable as input to
  6219. the next filter.
  6220. It accepts the following parameters:
  6221. @table @option
  6222. @item pix_fmts
  6223. A '|'-separated list of pixel format names, such as
  6224. "pix_fmts=yuv420p|monow|rgb24".
  6225. @end table
  6226. @subsection Examples
  6227. @itemize
  6228. @item
  6229. Convert the input video to the @var{yuv420p} format
  6230. @example
  6231. format=pix_fmts=yuv420p
  6232. @end example
  6233. Convert the input video to any of the formats in the list
  6234. @example
  6235. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6236. @end example
  6237. @end itemize
  6238. @anchor{fps}
  6239. @section fps
  6240. Convert the video to specified constant frame rate by duplicating or dropping
  6241. frames as necessary.
  6242. It accepts the following parameters:
  6243. @table @option
  6244. @item fps
  6245. The desired output frame rate. The default is @code{25}.
  6246. @item round
  6247. Rounding method.
  6248. Possible values are:
  6249. @table @option
  6250. @item zero
  6251. zero round towards 0
  6252. @item inf
  6253. round away from 0
  6254. @item down
  6255. round towards -infinity
  6256. @item up
  6257. round towards +infinity
  6258. @item near
  6259. round to nearest
  6260. @end table
  6261. The default is @code{near}.
  6262. @item start_time
  6263. Assume the first PTS should be the given value, in seconds. This allows for
  6264. padding/trimming at the start of stream. By default, no assumption is made
  6265. about the first frame's expected PTS, so no padding or trimming is done.
  6266. For example, this could be set to 0 to pad the beginning with duplicates of
  6267. the first frame if a video stream starts after the audio stream or to trim any
  6268. frames with a negative PTS.
  6269. @end table
  6270. Alternatively, the options can be specified as a flat string:
  6271. @var{fps}[:@var{round}].
  6272. See also the @ref{setpts} filter.
  6273. @subsection Examples
  6274. @itemize
  6275. @item
  6276. A typical usage in order to set the fps to 25:
  6277. @example
  6278. fps=fps=25
  6279. @end example
  6280. @item
  6281. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6282. @example
  6283. fps=fps=film:round=near
  6284. @end example
  6285. @end itemize
  6286. @section framepack
  6287. Pack two different video streams into a stereoscopic video, setting proper
  6288. metadata on supported codecs. The two views should have the same size and
  6289. framerate and processing will stop when the shorter video ends. Please note
  6290. that you may conveniently adjust view properties with the @ref{scale} and
  6291. @ref{fps} filters.
  6292. It accepts the following parameters:
  6293. @table @option
  6294. @item format
  6295. The desired packing format. Supported values are:
  6296. @table @option
  6297. @item sbs
  6298. The views are next to each other (default).
  6299. @item tab
  6300. The views are on top of each other.
  6301. @item lines
  6302. The views are packed by line.
  6303. @item columns
  6304. The views are packed by column.
  6305. @item frameseq
  6306. The views are temporally interleaved.
  6307. @end table
  6308. @end table
  6309. Some examples:
  6310. @example
  6311. # Convert left and right views into a frame-sequential video
  6312. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6313. # Convert views into a side-by-side video with the same output resolution as the input
  6314. 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
  6315. @end example
  6316. @section framerate
  6317. Change the frame rate by interpolating new video output frames from the source
  6318. frames.
  6319. This filter is not designed to function correctly with interlaced media. If
  6320. you wish to change the frame rate of interlaced media then you are required
  6321. to deinterlace before this filter and re-interlace after this filter.
  6322. A description of the accepted options follows.
  6323. @table @option
  6324. @item fps
  6325. Specify the output frames per second. This option can also be specified
  6326. as a value alone. The default is @code{50}.
  6327. @item interp_start
  6328. Specify the start of a range where the output frame will be created as a
  6329. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6330. the default is @code{15}.
  6331. @item interp_end
  6332. Specify the end of a range where the output frame will be created as a
  6333. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6334. the default is @code{240}.
  6335. @item scene
  6336. Specify the level at which a scene change is detected as a value between
  6337. 0 and 100 to indicate a new scene; a low value reflects a low
  6338. probability for the current frame to introduce a new scene, while a higher
  6339. value means the current frame is more likely to be one.
  6340. The default is @code{7}.
  6341. @item flags
  6342. Specify flags influencing the filter process.
  6343. Available value for @var{flags} is:
  6344. @table @option
  6345. @item scene_change_detect, scd
  6346. Enable scene change detection using the value of the option @var{scene}.
  6347. This flag is enabled by default.
  6348. @end table
  6349. @end table
  6350. @section framestep
  6351. Select one frame every N-th frame.
  6352. This filter accepts the following option:
  6353. @table @option
  6354. @item step
  6355. Select frame after every @code{step} frames.
  6356. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6357. @end table
  6358. @anchor{frei0r}
  6359. @section frei0r
  6360. Apply a frei0r effect to the input video.
  6361. To enable the compilation of this filter, you need to install the frei0r
  6362. header and configure FFmpeg with @code{--enable-frei0r}.
  6363. It accepts the following parameters:
  6364. @table @option
  6365. @item filter_name
  6366. The name of the frei0r effect to load. If the environment variable
  6367. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6368. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6369. Otherwise, the standard frei0r paths are searched, in this order:
  6370. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6371. @file{/usr/lib/frei0r-1/}.
  6372. @item filter_params
  6373. A '|'-separated list of parameters to pass to the frei0r effect.
  6374. @end table
  6375. A frei0r effect parameter can be a boolean (its value is either
  6376. "y" or "n"), a double, a color (specified as
  6377. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6378. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6379. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6380. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6381. The number and types of parameters depend on the loaded effect. If an
  6382. effect parameter is not specified, the default value is set.
  6383. @subsection Examples
  6384. @itemize
  6385. @item
  6386. Apply the distort0r effect, setting the first two double parameters:
  6387. @example
  6388. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6389. @end example
  6390. @item
  6391. Apply the colordistance effect, taking a color as the first parameter:
  6392. @example
  6393. frei0r=colordistance:0.2/0.3/0.4
  6394. frei0r=colordistance:violet
  6395. frei0r=colordistance:0x112233
  6396. @end example
  6397. @item
  6398. Apply the perspective effect, specifying the top left and top right image
  6399. positions:
  6400. @example
  6401. frei0r=perspective:0.2/0.2|0.8/0.2
  6402. @end example
  6403. @end itemize
  6404. For more information, see
  6405. @url{http://frei0r.dyne.org}
  6406. @section fspp
  6407. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6408. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6409. processing filter, one of them is performed once per block, not per pixel.
  6410. This allows for much higher speed.
  6411. The filter accepts the following options:
  6412. @table @option
  6413. @item quality
  6414. Set quality. This option defines the number of levels for averaging. It accepts
  6415. an integer in the range 4-5. Default value is @code{4}.
  6416. @item qp
  6417. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6418. If not set, the filter will use the QP from the video stream (if available).
  6419. @item strength
  6420. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6421. more details but also more artifacts, while higher values make the image smoother
  6422. but also blurrier. Default value is @code{0} − PSNR optimal.
  6423. @item use_bframe_qp
  6424. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6425. option may cause flicker since the B-Frames have often larger QP. Default is
  6426. @code{0} (not enabled).
  6427. @end table
  6428. @section gblur
  6429. Apply Gaussian blur filter.
  6430. The filter accepts the following options:
  6431. @table @option
  6432. @item sigma
  6433. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6434. @item steps
  6435. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6436. @item planes
  6437. Set which planes to filter. By default all planes are filtered.
  6438. @item sigmaV
  6439. Set vertical sigma, if negative it will be same as @code{sigma}.
  6440. Default is @code{-1}.
  6441. @end table
  6442. @section geq
  6443. The filter accepts the following options:
  6444. @table @option
  6445. @item lum_expr, lum
  6446. Set the luminance expression.
  6447. @item cb_expr, cb
  6448. Set the chrominance blue expression.
  6449. @item cr_expr, cr
  6450. Set the chrominance red expression.
  6451. @item alpha_expr, a
  6452. Set the alpha expression.
  6453. @item red_expr, r
  6454. Set the red expression.
  6455. @item green_expr, g
  6456. Set the green expression.
  6457. @item blue_expr, b
  6458. Set the blue expression.
  6459. @end table
  6460. The colorspace is selected according to the specified options. If one
  6461. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6462. options is specified, the filter will automatically select a YCbCr
  6463. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6464. @option{blue_expr} options is specified, it will select an RGB
  6465. colorspace.
  6466. If one of the chrominance expression is not defined, it falls back on the other
  6467. one. If no alpha expression is specified it will evaluate to opaque value.
  6468. If none of chrominance expressions are specified, they will evaluate
  6469. to the luminance expression.
  6470. The expressions can use the following variables and functions:
  6471. @table @option
  6472. @item N
  6473. The sequential number of the filtered frame, starting from @code{0}.
  6474. @item X
  6475. @item Y
  6476. The coordinates of the current sample.
  6477. @item W
  6478. @item H
  6479. The width and height of the image.
  6480. @item SW
  6481. @item SH
  6482. Width and height scale depending on the currently filtered plane. It is the
  6483. ratio between the corresponding luma plane number of pixels and the current
  6484. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6485. @code{0.5,0.5} for chroma planes.
  6486. @item T
  6487. Time of the current frame, expressed in seconds.
  6488. @item p(x, y)
  6489. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6490. plane.
  6491. @item lum(x, y)
  6492. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6493. plane.
  6494. @item cb(x, y)
  6495. Return the value of the pixel at location (@var{x},@var{y}) of the
  6496. blue-difference chroma plane. Return 0 if there is no such plane.
  6497. @item cr(x, y)
  6498. Return the value of the pixel at location (@var{x},@var{y}) of the
  6499. red-difference chroma plane. Return 0 if there is no such plane.
  6500. @item r(x, y)
  6501. @item g(x, y)
  6502. @item b(x, y)
  6503. Return the value of the pixel at location (@var{x},@var{y}) of the
  6504. red/green/blue component. Return 0 if there is no such component.
  6505. @item alpha(x, y)
  6506. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6507. plane. Return 0 if there is no such plane.
  6508. @end table
  6509. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6510. automatically clipped to the closer edge.
  6511. @subsection Examples
  6512. @itemize
  6513. @item
  6514. Flip the image horizontally:
  6515. @example
  6516. geq=p(W-X\,Y)
  6517. @end example
  6518. @item
  6519. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6520. wavelength of 100 pixels:
  6521. @example
  6522. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6523. @end example
  6524. @item
  6525. Generate a fancy enigmatic moving light:
  6526. @example
  6527. 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
  6528. @end example
  6529. @item
  6530. Generate a quick emboss effect:
  6531. @example
  6532. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6533. @end example
  6534. @item
  6535. Modify RGB components depending on pixel position:
  6536. @example
  6537. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6538. @end example
  6539. @item
  6540. Create a radial gradient that is the same size as the input (also see
  6541. the @ref{vignette} filter):
  6542. @example
  6543. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6544. @end example
  6545. @end itemize
  6546. @section gradfun
  6547. Fix the banding artifacts that are sometimes introduced into nearly flat
  6548. regions by truncation to 8-bit color depth.
  6549. Interpolate the gradients that should go where the bands are, and
  6550. dither them.
  6551. It is designed for playback only. Do not use it prior to
  6552. lossy compression, because compression tends to lose the dither and
  6553. bring back the bands.
  6554. It accepts the following parameters:
  6555. @table @option
  6556. @item strength
  6557. The maximum amount by which the filter will change any one pixel. This is also
  6558. the threshold for detecting nearly flat regions. Acceptable values range from
  6559. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6560. valid range.
  6561. @item radius
  6562. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6563. gradients, but also prevents the filter from modifying the pixels near detailed
  6564. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6565. values will be clipped to the valid range.
  6566. @end table
  6567. Alternatively, the options can be specified as a flat string:
  6568. @var{strength}[:@var{radius}]
  6569. @subsection Examples
  6570. @itemize
  6571. @item
  6572. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6573. @example
  6574. gradfun=3.5:8
  6575. @end example
  6576. @item
  6577. Specify radius, omitting the strength (which will fall-back to the default
  6578. value):
  6579. @example
  6580. gradfun=radius=8
  6581. @end example
  6582. @end itemize
  6583. @anchor{haldclut}
  6584. @section haldclut
  6585. Apply a Hald CLUT to a video stream.
  6586. First input is the video stream to process, and second one is the Hald CLUT.
  6587. The Hald CLUT input can be a simple picture or a complete video stream.
  6588. The filter accepts the following options:
  6589. @table @option
  6590. @item shortest
  6591. Force termination when the shortest input terminates. Default is @code{0}.
  6592. @item repeatlast
  6593. Continue applying the last CLUT after the end of the stream. A value of
  6594. @code{0} disable the filter after the last frame of the CLUT is reached.
  6595. Default is @code{1}.
  6596. @end table
  6597. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6598. filters share the same internals).
  6599. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6600. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6601. @subsection Workflow examples
  6602. @subsubsection Hald CLUT video stream
  6603. Generate an identity Hald CLUT stream altered with various effects:
  6604. @example
  6605. 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
  6606. @end example
  6607. Note: make sure you use a lossless codec.
  6608. Then use it with @code{haldclut} to apply it on some random stream:
  6609. @example
  6610. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6611. @end example
  6612. The Hald CLUT will be applied to the 10 first seconds (duration of
  6613. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6614. to the remaining frames of the @code{mandelbrot} stream.
  6615. @subsubsection Hald CLUT with preview
  6616. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6617. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6618. biggest possible square starting at the top left of the picture. The remaining
  6619. padding pixels (bottom or right) will be ignored. This area can be used to add
  6620. a preview of the Hald CLUT.
  6621. Typically, the following generated Hald CLUT will be supported by the
  6622. @code{haldclut} filter:
  6623. @example
  6624. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6625. pad=iw+320 [padded_clut];
  6626. smptebars=s=320x256, split [a][b];
  6627. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6628. [main][b] overlay=W-320" -frames:v 1 clut.png
  6629. @end example
  6630. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6631. bars are displayed on the right-top, and below the same color bars processed by
  6632. the color changes.
  6633. Then, the effect of this Hald CLUT can be visualized with:
  6634. @example
  6635. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6636. @end example
  6637. @section hflip
  6638. Flip the input video horizontally.
  6639. For example, to horizontally flip the input video with @command{ffmpeg}:
  6640. @example
  6641. ffmpeg -i in.avi -vf "hflip" out.avi
  6642. @end example
  6643. @section histeq
  6644. This filter applies a global color histogram equalization on a
  6645. per-frame basis.
  6646. It can be used to correct video that has a compressed range of pixel
  6647. intensities. The filter redistributes the pixel intensities to
  6648. equalize their distribution across the intensity range. It may be
  6649. viewed as an "automatically adjusting contrast filter". This filter is
  6650. useful only for correcting degraded or poorly captured source
  6651. video.
  6652. The filter accepts the following options:
  6653. @table @option
  6654. @item strength
  6655. Determine the amount of equalization to be applied. As the strength
  6656. is reduced, the distribution of pixel intensities more-and-more
  6657. approaches that of the input frame. The value must be a float number
  6658. in the range [0,1] and defaults to 0.200.
  6659. @item intensity
  6660. Set the maximum intensity that can generated and scale the output
  6661. values appropriately. The strength should be set as desired and then
  6662. the intensity can be limited if needed to avoid washing-out. The value
  6663. must be a float number in the range [0,1] and defaults to 0.210.
  6664. @item antibanding
  6665. Set the antibanding level. If enabled the filter will randomly vary
  6666. the luminance of output pixels by a small amount to avoid banding of
  6667. the histogram. Possible values are @code{none}, @code{weak} or
  6668. @code{strong}. It defaults to @code{none}.
  6669. @end table
  6670. @section histogram
  6671. Compute and draw a color distribution histogram for the input video.
  6672. The computed histogram is a representation of the color component
  6673. distribution in an image.
  6674. Standard histogram displays the color components distribution in an image.
  6675. Displays color graph for each color component. Shows distribution of
  6676. the Y, U, V, A or R, G, B components, depending on input format, in the
  6677. current frame. Below each graph a color component scale meter is shown.
  6678. The filter accepts the following options:
  6679. @table @option
  6680. @item level_height
  6681. Set height of level. Default value is @code{200}.
  6682. Allowed range is [50, 2048].
  6683. @item scale_height
  6684. Set height of color scale. Default value is @code{12}.
  6685. Allowed range is [0, 40].
  6686. @item display_mode
  6687. Set display mode.
  6688. It accepts the following values:
  6689. @table @samp
  6690. @item parade
  6691. Per color component graphs are placed below each other.
  6692. @item overlay
  6693. Presents information identical to that in the @code{parade}, except
  6694. that the graphs representing color components are superimposed directly
  6695. over one another.
  6696. @end table
  6697. Default is @code{parade}.
  6698. @item levels_mode
  6699. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6700. Default is @code{linear}.
  6701. @item components
  6702. Set what color components to display.
  6703. Default is @code{7}.
  6704. @item fgopacity
  6705. Set foreground opacity. Default is @code{0.7}.
  6706. @item bgopacity
  6707. Set background opacity. Default is @code{0.5}.
  6708. @end table
  6709. @subsection Examples
  6710. @itemize
  6711. @item
  6712. Calculate and draw histogram:
  6713. @example
  6714. ffplay -i input -vf histogram
  6715. @end example
  6716. @end itemize
  6717. @anchor{hqdn3d}
  6718. @section hqdn3d
  6719. This is a high precision/quality 3d denoise filter. It aims to reduce
  6720. image noise, producing smooth images and making still images really
  6721. still. It should enhance compressibility.
  6722. It accepts the following optional parameters:
  6723. @table @option
  6724. @item luma_spatial
  6725. A non-negative floating point number which specifies spatial luma strength.
  6726. It defaults to 4.0.
  6727. @item chroma_spatial
  6728. A non-negative floating point number which specifies spatial chroma strength.
  6729. It defaults to 3.0*@var{luma_spatial}/4.0.
  6730. @item luma_tmp
  6731. A floating point number which specifies luma temporal strength. It defaults to
  6732. 6.0*@var{luma_spatial}/4.0.
  6733. @item chroma_tmp
  6734. A floating point number which specifies chroma temporal strength. It defaults to
  6735. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6736. @end table
  6737. @anchor{hwupload_cuda}
  6738. @section hwupload_cuda
  6739. Upload system memory frames to a CUDA device.
  6740. It accepts the following optional parameters:
  6741. @table @option
  6742. @item device
  6743. The number of the CUDA device to use
  6744. @end table
  6745. @section hqx
  6746. Apply a high-quality magnification filter designed for pixel art. This filter
  6747. was originally created by Maxim Stepin.
  6748. It accepts the following option:
  6749. @table @option
  6750. @item n
  6751. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6752. @code{hq3x} and @code{4} for @code{hq4x}.
  6753. Default is @code{3}.
  6754. @end table
  6755. @section hstack
  6756. Stack input videos horizontally.
  6757. All streams must be of same pixel format and of same height.
  6758. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6759. to create same output.
  6760. The filter accept the following option:
  6761. @table @option
  6762. @item inputs
  6763. Set number of input streams. Default is 2.
  6764. @item shortest
  6765. If set to 1, force the output to terminate when the shortest input
  6766. terminates. Default value is 0.
  6767. @end table
  6768. @section hue
  6769. Modify the hue and/or the saturation of the input.
  6770. It accepts the following parameters:
  6771. @table @option
  6772. @item h
  6773. Specify the hue angle as a number of degrees. It accepts an expression,
  6774. and defaults to "0".
  6775. @item s
  6776. Specify the saturation in the [-10,10] range. It accepts an expression and
  6777. defaults to "1".
  6778. @item H
  6779. Specify the hue angle as a number of radians. It accepts an
  6780. expression, and defaults to "0".
  6781. @item b
  6782. Specify the brightness in the [-10,10] range. It accepts an expression and
  6783. defaults to "0".
  6784. @end table
  6785. @option{h} and @option{H} are mutually exclusive, and can't be
  6786. specified at the same time.
  6787. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6788. expressions containing the following constants:
  6789. @table @option
  6790. @item n
  6791. frame count of the input frame starting from 0
  6792. @item pts
  6793. presentation timestamp of the input frame expressed in time base units
  6794. @item r
  6795. frame rate of the input video, NAN if the input frame rate is unknown
  6796. @item t
  6797. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6798. @item tb
  6799. time base of the input video
  6800. @end table
  6801. @subsection Examples
  6802. @itemize
  6803. @item
  6804. Set the hue to 90 degrees and the saturation to 1.0:
  6805. @example
  6806. hue=h=90:s=1
  6807. @end example
  6808. @item
  6809. Same command but expressing the hue in radians:
  6810. @example
  6811. hue=H=PI/2:s=1
  6812. @end example
  6813. @item
  6814. Rotate hue and make the saturation swing between 0
  6815. and 2 over a period of 1 second:
  6816. @example
  6817. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6818. @end example
  6819. @item
  6820. Apply a 3 seconds saturation fade-in effect starting at 0:
  6821. @example
  6822. hue="s=min(t/3\,1)"
  6823. @end example
  6824. The general fade-in expression can be written as:
  6825. @example
  6826. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6827. @end example
  6828. @item
  6829. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6830. @example
  6831. hue="s=max(0\, min(1\, (8-t)/3))"
  6832. @end example
  6833. The general fade-out expression can be written as:
  6834. @example
  6835. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6836. @end example
  6837. @end itemize
  6838. @subsection Commands
  6839. This filter supports the following commands:
  6840. @table @option
  6841. @item b
  6842. @item s
  6843. @item h
  6844. @item H
  6845. Modify the hue and/or the saturation and/or brightness of the input video.
  6846. The command accepts the same syntax of the corresponding option.
  6847. If the specified expression is not valid, it is kept at its current
  6848. value.
  6849. @end table
  6850. @section hysteresis
  6851. Grow first stream into second stream by connecting components.
  6852. This makes it possible to build more robust edge masks.
  6853. This filter accepts the following options:
  6854. @table @option
  6855. @item planes
  6856. Set which planes will be processed as bitmap, unprocessed planes will be
  6857. copied from first stream.
  6858. By default value 0xf, all planes will be processed.
  6859. @item threshold
  6860. Set threshold which is used in filtering. If pixel component value is higher than
  6861. this value filter algorithm for connecting components is activated.
  6862. By default value is 0.
  6863. @end table
  6864. @section idet
  6865. Detect video interlacing type.
  6866. This filter tries to detect if the input frames are interlaced, progressive,
  6867. top or bottom field first. It will also try to detect fields that are
  6868. repeated between adjacent frames (a sign of telecine).
  6869. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6870. Multiple frame detection incorporates the classification history of previous frames.
  6871. The filter will log these metadata values:
  6872. @table @option
  6873. @item single.current_frame
  6874. Detected type of current frame using single-frame detection. One of:
  6875. ``tff'' (top field first), ``bff'' (bottom field first),
  6876. ``progressive'', or ``undetermined''
  6877. @item single.tff
  6878. Cumulative number of frames detected as top field first using single-frame detection.
  6879. @item multiple.tff
  6880. Cumulative number of frames detected as top field first using multiple-frame detection.
  6881. @item single.bff
  6882. Cumulative number of frames detected as bottom field first using single-frame detection.
  6883. @item multiple.current_frame
  6884. Detected type of current frame using multiple-frame detection. One of:
  6885. ``tff'' (top field first), ``bff'' (bottom field first),
  6886. ``progressive'', or ``undetermined''
  6887. @item multiple.bff
  6888. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6889. @item single.progressive
  6890. Cumulative number of frames detected as progressive using single-frame detection.
  6891. @item multiple.progressive
  6892. Cumulative number of frames detected as progressive using multiple-frame detection.
  6893. @item single.undetermined
  6894. Cumulative number of frames that could not be classified using single-frame detection.
  6895. @item multiple.undetermined
  6896. Cumulative number of frames that could not be classified using multiple-frame detection.
  6897. @item repeated.current_frame
  6898. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6899. @item repeated.neither
  6900. Cumulative number of frames with no repeated field.
  6901. @item repeated.top
  6902. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6903. @item repeated.bottom
  6904. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6905. @end table
  6906. The filter accepts the following options:
  6907. @table @option
  6908. @item intl_thres
  6909. Set interlacing threshold.
  6910. @item prog_thres
  6911. Set progressive threshold.
  6912. @item rep_thres
  6913. Threshold for repeated field detection.
  6914. @item half_life
  6915. Number of frames after which a given frame's contribution to the
  6916. statistics is halved (i.e., it contributes only 0.5 to its
  6917. classification). The default of 0 means that all frames seen are given
  6918. full weight of 1.0 forever.
  6919. @item analyze_interlaced_flag
  6920. When this is not 0 then idet will use the specified number of frames to determine
  6921. if the interlaced flag is accurate, it will not count undetermined frames.
  6922. If the flag is found to be accurate it will be used without any further
  6923. computations, if it is found to be inaccurate it will be cleared without any
  6924. further computations. This allows inserting the idet filter as a low computational
  6925. method to clean up the interlaced flag
  6926. @end table
  6927. @section il
  6928. Deinterleave or interleave fields.
  6929. This filter allows one to process interlaced images fields without
  6930. deinterlacing them. Deinterleaving splits the input frame into 2
  6931. fields (so called half pictures). Odd lines are moved to the top
  6932. half of the output image, even lines to the bottom half.
  6933. You can process (filter) them independently and then re-interleave them.
  6934. The filter accepts the following options:
  6935. @table @option
  6936. @item luma_mode, l
  6937. @item chroma_mode, c
  6938. @item alpha_mode, a
  6939. Available values for @var{luma_mode}, @var{chroma_mode} and
  6940. @var{alpha_mode} are:
  6941. @table @samp
  6942. @item none
  6943. Do nothing.
  6944. @item deinterleave, d
  6945. Deinterleave fields, placing one above the other.
  6946. @item interleave, i
  6947. Interleave fields. Reverse the effect of deinterleaving.
  6948. @end table
  6949. Default value is @code{none}.
  6950. @item luma_swap, ls
  6951. @item chroma_swap, cs
  6952. @item alpha_swap, as
  6953. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6954. @end table
  6955. @section inflate
  6956. Apply inflate effect to the video.
  6957. This filter replaces the pixel by the local(3x3) average by taking into account
  6958. only values higher than the pixel.
  6959. It accepts the following options:
  6960. @table @option
  6961. @item threshold0
  6962. @item threshold1
  6963. @item threshold2
  6964. @item threshold3
  6965. Limit the maximum change for each plane, default is 65535.
  6966. If 0, plane will remain unchanged.
  6967. @end table
  6968. @section interlace
  6969. Simple interlacing filter from progressive contents. This interleaves upper (or
  6970. lower) lines from odd frames with lower (or upper) lines from even frames,
  6971. halving the frame rate and preserving image height.
  6972. @example
  6973. Original Original New Frame
  6974. Frame 'j' Frame 'j+1' (tff)
  6975. ========== =========== ==================
  6976. Line 0 --------------------> Frame 'j' Line 0
  6977. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6978. Line 2 ---------------------> Frame 'j' Line 2
  6979. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6980. ... ... ...
  6981. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6982. @end example
  6983. It accepts the following optional parameters:
  6984. @table @option
  6985. @item scan
  6986. This determines whether the interlaced frame is taken from the even
  6987. (tff - default) or odd (bff) lines of the progressive frame.
  6988. @item lowpass
  6989. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6990. interlacing and reduce moire patterns.
  6991. @end table
  6992. @section kerndeint
  6993. Deinterlace input video by applying Donald Graft's adaptive kernel
  6994. deinterling. Work on interlaced parts of a video to produce
  6995. progressive frames.
  6996. The description of the accepted parameters follows.
  6997. @table @option
  6998. @item thresh
  6999. Set the threshold which affects the filter's tolerance when
  7000. determining if a pixel line must be processed. It must be an integer
  7001. in the range [0,255] and defaults to 10. A value of 0 will result in
  7002. applying the process on every pixels.
  7003. @item map
  7004. Paint pixels exceeding the threshold value to white if set to 1.
  7005. Default is 0.
  7006. @item order
  7007. Set the fields order. Swap fields if set to 1, leave fields alone if
  7008. 0. Default is 0.
  7009. @item sharp
  7010. Enable additional sharpening if set to 1. Default is 0.
  7011. @item twoway
  7012. Enable twoway sharpening if set to 1. Default is 0.
  7013. @end table
  7014. @subsection Examples
  7015. @itemize
  7016. @item
  7017. Apply default values:
  7018. @example
  7019. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7020. @end example
  7021. @item
  7022. Enable additional sharpening:
  7023. @example
  7024. kerndeint=sharp=1
  7025. @end example
  7026. @item
  7027. Paint processed pixels in white:
  7028. @example
  7029. kerndeint=map=1
  7030. @end example
  7031. @end itemize
  7032. @section lenscorrection
  7033. Correct radial lens distortion
  7034. This filter can be used to correct for radial distortion as can result from the use
  7035. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7036. one can use tools available for example as part of opencv or simply trial-and-error.
  7037. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7038. and extract the k1 and k2 coefficients from the resulting matrix.
  7039. Note that effectively the same filter is available in the open-source tools Krita and
  7040. Digikam from the KDE project.
  7041. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7042. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7043. brightness distribution, so you may want to use both filters together in certain
  7044. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7045. be applied before or after lens correction.
  7046. @subsection Options
  7047. The filter accepts the following options:
  7048. @table @option
  7049. @item cx
  7050. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7051. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7052. width.
  7053. @item cy
  7054. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7055. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7056. height.
  7057. @item k1
  7058. Coefficient of the quadratic correction term. 0.5 means no correction.
  7059. @item k2
  7060. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7061. @end table
  7062. The formula that generates the correction is:
  7063. @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)
  7064. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7065. distances from the focal point in the source and target images, respectively.
  7066. @section loop
  7067. Loop video frames.
  7068. The filter accepts the following options:
  7069. @table @option
  7070. @item loop
  7071. Set the number of loops.
  7072. @item size
  7073. Set maximal size in number of frames.
  7074. @item start
  7075. Set first frame of loop.
  7076. @end table
  7077. @anchor{lut3d}
  7078. @section lut3d
  7079. Apply a 3D LUT to an input video.
  7080. The filter accepts the following options:
  7081. @table @option
  7082. @item file
  7083. Set the 3D LUT file name.
  7084. Currently supported formats:
  7085. @table @samp
  7086. @item 3dl
  7087. AfterEffects
  7088. @item cube
  7089. Iridas
  7090. @item dat
  7091. DaVinci
  7092. @item m3d
  7093. Pandora
  7094. @end table
  7095. @item interp
  7096. Select interpolation mode.
  7097. Available values are:
  7098. @table @samp
  7099. @item nearest
  7100. Use values from the nearest defined point.
  7101. @item trilinear
  7102. Interpolate values using the 8 points defining a cube.
  7103. @item tetrahedral
  7104. Interpolate values using a tetrahedron.
  7105. @end table
  7106. @end table
  7107. @section lut, lutrgb, lutyuv
  7108. Compute a look-up table for binding each pixel component input value
  7109. to an output value, and apply it to the input video.
  7110. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7111. to an RGB input video.
  7112. These filters accept the following parameters:
  7113. @table @option
  7114. @item c0
  7115. set first pixel component expression
  7116. @item c1
  7117. set second pixel component expression
  7118. @item c2
  7119. set third pixel component expression
  7120. @item c3
  7121. set fourth pixel component expression, corresponds to the alpha component
  7122. @item r
  7123. set red component expression
  7124. @item g
  7125. set green component expression
  7126. @item b
  7127. set blue component expression
  7128. @item a
  7129. alpha component expression
  7130. @item y
  7131. set Y/luminance component expression
  7132. @item u
  7133. set U/Cb component expression
  7134. @item v
  7135. set V/Cr component expression
  7136. @end table
  7137. Each of them specifies the expression to use for computing the lookup table for
  7138. the corresponding pixel component values.
  7139. The exact component associated to each of the @var{c*} options depends on the
  7140. format in input.
  7141. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7142. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7143. The expressions can contain the following constants and functions:
  7144. @table @option
  7145. @item w
  7146. @item h
  7147. The input width and height.
  7148. @item val
  7149. The input value for the pixel component.
  7150. @item clipval
  7151. The input value, clipped to the @var{minval}-@var{maxval} range.
  7152. @item maxval
  7153. The maximum value for the pixel component.
  7154. @item minval
  7155. The minimum value for the pixel component.
  7156. @item negval
  7157. The negated value for the pixel component value, clipped to the
  7158. @var{minval}-@var{maxval} range; it corresponds to the expression
  7159. "maxval-clipval+minval".
  7160. @item clip(val)
  7161. The computed value in @var{val}, clipped to the
  7162. @var{minval}-@var{maxval} range.
  7163. @item gammaval(gamma)
  7164. The computed gamma correction value of the pixel component value,
  7165. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7166. expression
  7167. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7168. @end table
  7169. All expressions default to "val".
  7170. @subsection Examples
  7171. @itemize
  7172. @item
  7173. Negate input video:
  7174. @example
  7175. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7176. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7177. @end example
  7178. The above is the same as:
  7179. @example
  7180. lutrgb="r=negval:g=negval:b=negval"
  7181. lutyuv="y=negval:u=negval:v=negval"
  7182. @end example
  7183. @item
  7184. Negate luminance:
  7185. @example
  7186. lutyuv=y=negval
  7187. @end example
  7188. @item
  7189. Remove chroma components, turning the video into a graytone image:
  7190. @example
  7191. lutyuv="u=128:v=128"
  7192. @end example
  7193. @item
  7194. Apply a luma burning effect:
  7195. @example
  7196. lutyuv="y=2*val"
  7197. @end example
  7198. @item
  7199. Remove green and blue components:
  7200. @example
  7201. lutrgb="g=0:b=0"
  7202. @end example
  7203. @item
  7204. Set a constant alpha channel value on input:
  7205. @example
  7206. format=rgba,lutrgb=a="maxval-minval/2"
  7207. @end example
  7208. @item
  7209. Correct luminance gamma by a factor of 0.5:
  7210. @example
  7211. lutyuv=y=gammaval(0.5)
  7212. @end example
  7213. @item
  7214. Discard least significant bits of luma:
  7215. @example
  7216. lutyuv=y='bitand(val, 128+64+32)'
  7217. @end example
  7218. @item
  7219. Technicolor like effect:
  7220. @example
  7221. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7222. @end example
  7223. @end itemize
  7224. @section lut2
  7225. Compute and apply a lookup table from two video inputs.
  7226. This filter accepts the following parameters:
  7227. @table @option
  7228. @item c0
  7229. set first pixel component expression
  7230. @item c1
  7231. set second pixel component expression
  7232. @item c2
  7233. set third pixel component expression
  7234. @item c3
  7235. set fourth pixel component expression, corresponds to the alpha component
  7236. @end table
  7237. Each of them specifies the expression to use for computing the lookup table for
  7238. the corresponding pixel component values.
  7239. The exact component associated to each of the @var{c*} options depends on the
  7240. format in inputs.
  7241. The expressions can contain the following constants:
  7242. @table @option
  7243. @item w
  7244. @item h
  7245. The input width and height.
  7246. @item x
  7247. The first input value for the pixel component.
  7248. @item y
  7249. The second input value for the pixel component.
  7250. @item bdx
  7251. The first input video bit depth.
  7252. @item bdy
  7253. The second input video bit depth.
  7254. @end table
  7255. All expressions default to "x".
  7256. @subsection Examples
  7257. @itemize
  7258. @item
  7259. Highlight differences between two RGB video streams:
  7260. @example
  7261. 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)'
  7262. @end example
  7263. @item
  7264. Highlight differences between two YUV video streams:
  7265. @example
  7266. 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)'
  7267. @end example
  7268. @end itemize
  7269. @section maskedclamp
  7270. Clamp the first input stream with the second input and third input stream.
  7271. Returns the value of first stream to be between second input
  7272. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7273. This filter accepts the following options:
  7274. @table @option
  7275. @item undershoot
  7276. Default value is @code{0}.
  7277. @item overshoot
  7278. Default value is @code{0}.
  7279. @item planes
  7280. Set which planes will be processed as bitmap, unprocessed planes will be
  7281. copied from first stream.
  7282. By default value 0xf, all planes will be processed.
  7283. @end table
  7284. @section maskedmerge
  7285. Merge the first input stream with the second input stream using per pixel
  7286. weights in the third input stream.
  7287. A value of 0 in the third stream pixel component means that pixel component
  7288. from first stream is returned unchanged, while maximum value (eg. 255 for
  7289. 8-bit videos) means that pixel component from second stream is returned
  7290. unchanged. Intermediate values define the amount of merging between both
  7291. input stream's pixel components.
  7292. This filter accepts the following options:
  7293. @table @option
  7294. @item planes
  7295. Set which planes will be processed as bitmap, unprocessed planes will be
  7296. copied from first stream.
  7297. By default value 0xf, all planes will be processed.
  7298. @end table
  7299. @section mcdeint
  7300. Apply motion-compensation deinterlacing.
  7301. It needs one field per frame as input and must thus be used together
  7302. with yadif=1/3 or equivalent.
  7303. This filter accepts the following options:
  7304. @table @option
  7305. @item mode
  7306. Set the deinterlacing mode.
  7307. It accepts one of the following values:
  7308. @table @samp
  7309. @item fast
  7310. @item medium
  7311. @item slow
  7312. use iterative motion estimation
  7313. @item extra_slow
  7314. like @samp{slow}, but use multiple reference frames.
  7315. @end table
  7316. Default value is @samp{fast}.
  7317. @item parity
  7318. Set the picture field parity assumed for the input video. It must be
  7319. one of the following values:
  7320. @table @samp
  7321. @item 0, tff
  7322. assume top field first
  7323. @item 1, bff
  7324. assume bottom field first
  7325. @end table
  7326. Default value is @samp{bff}.
  7327. @item qp
  7328. Set per-block quantization parameter (QP) used by the internal
  7329. encoder.
  7330. Higher values should result in a smoother motion vector field but less
  7331. optimal individual vectors. Default value is 1.
  7332. @end table
  7333. @section mergeplanes
  7334. Merge color channel components from several video streams.
  7335. The filter accepts up to 4 input streams, and merge selected input
  7336. planes to the output video.
  7337. This filter accepts the following options:
  7338. @table @option
  7339. @item mapping
  7340. Set input to output plane mapping. Default is @code{0}.
  7341. The mappings is specified as a bitmap. It should be specified as a
  7342. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7343. mapping for the first plane of the output stream. 'A' sets the number of
  7344. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7345. corresponding input to use (from 0 to 3). The rest of the mappings is
  7346. similar, 'Bb' describes the mapping for the output stream second
  7347. plane, 'Cc' describes the mapping for the output stream third plane and
  7348. 'Dd' describes the mapping for the output stream fourth plane.
  7349. @item format
  7350. Set output pixel format. Default is @code{yuva444p}.
  7351. @end table
  7352. @subsection Examples
  7353. @itemize
  7354. @item
  7355. Merge three gray video streams of same width and height into single video stream:
  7356. @example
  7357. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7358. @end example
  7359. @item
  7360. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7361. @example
  7362. [a0][a1]mergeplanes=0x00010210:yuva444p
  7363. @end example
  7364. @item
  7365. Swap Y and A plane in yuva444p stream:
  7366. @example
  7367. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7368. @end example
  7369. @item
  7370. Swap U and V plane in yuv420p stream:
  7371. @example
  7372. format=yuv420p,mergeplanes=0x000201:yuv420p
  7373. @end example
  7374. @item
  7375. Cast a rgb24 clip to yuv444p:
  7376. @example
  7377. format=rgb24,mergeplanes=0x000102:yuv444p
  7378. @end example
  7379. @end itemize
  7380. @section mestimate
  7381. Estimate and export motion vectors using block matching algorithms.
  7382. Motion vectors are stored in frame side data to be used by other filters.
  7383. This filter accepts the following options:
  7384. @table @option
  7385. @item method
  7386. Specify the motion estimation method. Accepts one of the following values:
  7387. @table @samp
  7388. @item esa
  7389. Exhaustive search algorithm.
  7390. @item tss
  7391. Three step search algorithm.
  7392. @item tdls
  7393. Two dimensional logarithmic search algorithm.
  7394. @item ntss
  7395. New three step search algorithm.
  7396. @item fss
  7397. Four step search algorithm.
  7398. @item ds
  7399. Diamond search algorithm.
  7400. @item hexbs
  7401. Hexagon-based search algorithm.
  7402. @item epzs
  7403. Enhanced predictive zonal search algorithm.
  7404. @item umh
  7405. Uneven multi-hexagon search algorithm.
  7406. @end table
  7407. Default value is @samp{esa}.
  7408. @item mb_size
  7409. Macroblock size. Default @code{16}.
  7410. @item search_param
  7411. Search parameter. Default @code{7}.
  7412. @end table
  7413. @section midequalizer
  7414. Apply Midway Image Equalization effect using two video streams.
  7415. Midway Image Equalization adjusts a pair of images to have the same
  7416. histogram, while maintaining their dynamics as much as possible. It's
  7417. useful for e.g. matching exposures from a pair of stereo cameras.
  7418. This filter has two inputs and one output, which must be of same pixel format, but
  7419. may be of different sizes. The output of filter is first input adjusted with
  7420. midway histogram of both inputs.
  7421. This filter accepts the following option:
  7422. @table @option
  7423. @item planes
  7424. Set which planes to process. Default is @code{15}, which is all available planes.
  7425. @end table
  7426. @section minterpolate
  7427. Convert the video to specified frame rate using motion interpolation.
  7428. This filter accepts the following options:
  7429. @table @option
  7430. @item fps
  7431. 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}.
  7432. @item mi_mode
  7433. Motion interpolation mode. Following values are accepted:
  7434. @table @samp
  7435. @item dup
  7436. Duplicate previous or next frame for interpolating new ones.
  7437. @item blend
  7438. Blend source frames. Interpolated frame is mean of previous and next frames.
  7439. @item mci
  7440. Motion compensated interpolation. Following options are effective when this mode is selected:
  7441. @table @samp
  7442. @item mc_mode
  7443. Motion compensation mode. Following values are accepted:
  7444. @table @samp
  7445. @item obmc
  7446. Overlapped block motion compensation.
  7447. @item aobmc
  7448. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7449. @end table
  7450. Default mode is @samp{obmc}.
  7451. @item me_mode
  7452. Motion estimation mode. Following values are accepted:
  7453. @table @samp
  7454. @item bidir
  7455. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7456. @item bilat
  7457. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7458. @end table
  7459. Default mode is @samp{bilat}.
  7460. @item me
  7461. The algorithm to be used for motion estimation. Following values are accepted:
  7462. @table @samp
  7463. @item esa
  7464. Exhaustive search algorithm.
  7465. @item tss
  7466. Three step search algorithm.
  7467. @item tdls
  7468. Two dimensional logarithmic search algorithm.
  7469. @item ntss
  7470. New three step search algorithm.
  7471. @item fss
  7472. Four step search algorithm.
  7473. @item ds
  7474. Diamond search algorithm.
  7475. @item hexbs
  7476. Hexagon-based search algorithm.
  7477. @item epzs
  7478. Enhanced predictive zonal search algorithm.
  7479. @item umh
  7480. Uneven multi-hexagon search algorithm.
  7481. @end table
  7482. Default algorithm is @samp{epzs}.
  7483. @item mb_size
  7484. Macroblock size. Default @code{16}.
  7485. @item search_param
  7486. Motion estimation search parameter. Default @code{32}.
  7487. @item vsbmc
  7488. 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).
  7489. @end table
  7490. @end table
  7491. @item scd
  7492. 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:
  7493. @table @samp
  7494. @item none
  7495. Disable scene change detection.
  7496. @item fdiff
  7497. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7498. @end table
  7499. Default method is @samp{fdiff}.
  7500. @item scd_threshold
  7501. Scene change detection threshold. Default is @code{5.0}.
  7502. @end table
  7503. @section mpdecimate
  7504. Drop frames that do not differ greatly from the previous frame in
  7505. order to reduce frame rate.
  7506. The main use of this filter is for very-low-bitrate encoding
  7507. (e.g. streaming over dialup modem), but it could in theory be used for
  7508. fixing movies that were inverse-telecined incorrectly.
  7509. A description of the accepted options follows.
  7510. @table @option
  7511. @item max
  7512. Set the maximum number of consecutive frames which can be dropped (if
  7513. positive), or the minimum interval between dropped frames (if
  7514. negative). If the value is 0, the frame is dropped unregarding the
  7515. number of previous sequentially dropped frames.
  7516. Default value is 0.
  7517. @item hi
  7518. @item lo
  7519. @item frac
  7520. Set the dropping threshold values.
  7521. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7522. represent actual pixel value differences, so a threshold of 64
  7523. corresponds to 1 unit of difference for each pixel, or the same spread
  7524. out differently over the block.
  7525. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7526. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7527. meaning the whole image) differ by more than a threshold of @option{lo}.
  7528. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7529. 64*5, and default value for @option{frac} is 0.33.
  7530. @end table
  7531. @section negate
  7532. Negate input video.
  7533. It accepts an integer in input; if non-zero it negates the
  7534. alpha component (if available). The default value in input is 0.
  7535. @section nlmeans
  7536. Denoise frames using Non-Local Means algorithm.
  7537. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7538. context similarity is defined by comparing their surrounding patches of size
  7539. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7540. around the pixel.
  7541. Note that the research area defines centers for patches, which means some
  7542. patches will be made of pixels outside that research area.
  7543. The filter accepts the following options.
  7544. @table @option
  7545. @item s
  7546. Set denoising strength.
  7547. @item p
  7548. Set patch size.
  7549. @item pc
  7550. Same as @option{p} but for chroma planes.
  7551. The default value is @var{0} and means automatic.
  7552. @item r
  7553. Set research size.
  7554. @item rc
  7555. Same as @option{r} but for chroma planes.
  7556. The default value is @var{0} and means automatic.
  7557. @end table
  7558. @section nnedi
  7559. Deinterlace video using neural network edge directed interpolation.
  7560. This filter accepts the following options:
  7561. @table @option
  7562. @item weights
  7563. Mandatory option, without binary file filter can not work.
  7564. Currently file can be found here:
  7565. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7566. @item deint
  7567. Set which frames to deinterlace, by default it is @code{all}.
  7568. Can be @code{all} or @code{interlaced}.
  7569. @item field
  7570. Set mode of operation.
  7571. Can be one of the following:
  7572. @table @samp
  7573. @item af
  7574. Use frame flags, both fields.
  7575. @item a
  7576. Use frame flags, single field.
  7577. @item t
  7578. Use top field only.
  7579. @item b
  7580. Use bottom field only.
  7581. @item tf
  7582. Use both fields, top first.
  7583. @item bf
  7584. Use both fields, bottom first.
  7585. @end table
  7586. @item planes
  7587. Set which planes to process, by default filter process all frames.
  7588. @item nsize
  7589. Set size of local neighborhood around each pixel, used by the predictor neural
  7590. network.
  7591. Can be one of the following:
  7592. @table @samp
  7593. @item s8x6
  7594. @item s16x6
  7595. @item s32x6
  7596. @item s48x6
  7597. @item s8x4
  7598. @item s16x4
  7599. @item s32x4
  7600. @end table
  7601. @item nns
  7602. Set the number of neurons in predicctor neural network.
  7603. Can be one of the following:
  7604. @table @samp
  7605. @item n16
  7606. @item n32
  7607. @item n64
  7608. @item n128
  7609. @item n256
  7610. @end table
  7611. @item qual
  7612. Controls the number of different neural network predictions that are blended
  7613. together to compute the final output value. Can be @code{fast}, default or
  7614. @code{slow}.
  7615. @item etype
  7616. Set which set of weights to use in the predictor.
  7617. Can be one of the following:
  7618. @table @samp
  7619. @item a
  7620. weights trained to minimize absolute error
  7621. @item s
  7622. weights trained to minimize squared error
  7623. @end table
  7624. @item pscrn
  7625. Controls whether or not the prescreener neural network is used to decide
  7626. which pixels should be processed by the predictor neural network and which
  7627. can be handled by simple cubic interpolation.
  7628. The prescreener is trained to know whether cubic interpolation will be
  7629. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7630. The computational complexity of the prescreener nn is much less than that of
  7631. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7632. using the prescreener generally results in much faster processing.
  7633. The prescreener is pretty accurate, so the difference between using it and not
  7634. using it is almost always unnoticeable.
  7635. Can be one of the following:
  7636. @table @samp
  7637. @item none
  7638. @item original
  7639. @item new
  7640. @end table
  7641. Default is @code{new}.
  7642. @item fapprox
  7643. Set various debugging flags.
  7644. @end table
  7645. @section noformat
  7646. Force libavfilter not to use any of the specified pixel formats for the
  7647. input to the next filter.
  7648. It accepts the following parameters:
  7649. @table @option
  7650. @item pix_fmts
  7651. A '|'-separated list of pixel format names, such as
  7652. apix_fmts=yuv420p|monow|rgb24".
  7653. @end table
  7654. @subsection Examples
  7655. @itemize
  7656. @item
  7657. Force libavfilter to use a format different from @var{yuv420p} for the
  7658. input to the vflip filter:
  7659. @example
  7660. noformat=pix_fmts=yuv420p,vflip
  7661. @end example
  7662. @item
  7663. Convert the input video to any of the formats not contained in the list:
  7664. @example
  7665. noformat=yuv420p|yuv444p|yuv410p
  7666. @end example
  7667. @end itemize
  7668. @section noise
  7669. Add noise on video input frame.
  7670. The filter accepts the following options:
  7671. @table @option
  7672. @item all_seed
  7673. @item c0_seed
  7674. @item c1_seed
  7675. @item c2_seed
  7676. @item c3_seed
  7677. Set noise seed for specific pixel component or all pixel components in case
  7678. of @var{all_seed}. Default value is @code{123457}.
  7679. @item all_strength, alls
  7680. @item c0_strength, c0s
  7681. @item c1_strength, c1s
  7682. @item c2_strength, c2s
  7683. @item c3_strength, c3s
  7684. Set noise strength for specific pixel component or all pixel components in case
  7685. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7686. @item all_flags, allf
  7687. @item c0_flags, c0f
  7688. @item c1_flags, c1f
  7689. @item c2_flags, c2f
  7690. @item c3_flags, c3f
  7691. Set pixel component flags or set flags for all components if @var{all_flags}.
  7692. Available values for component flags are:
  7693. @table @samp
  7694. @item a
  7695. averaged temporal noise (smoother)
  7696. @item p
  7697. mix random noise with a (semi)regular pattern
  7698. @item t
  7699. temporal noise (noise pattern changes between frames)
  7700. @item u
  7701. uniform noise (gaussian otherwise)
  7702. @end table
  7703. @end table
  7704. @subsection Examples
  7705. Add temporal and uniform noise to input video:
  7706. @example
  7707. noise=alls=20:allf=t+u
  7708. @end example
  7709. @section null
  7710. Pass the video source unchanged to the output.
  7711. @section ocr
  7712. Optical Character Recognition
  7713. This filter uses Tesseract for optical character recognition.
  7714. It accepts the following options:
  7715. @table @option
  7716. @item datapath
  7717. Set datapath to tesseract data. Default is to use whatever was
  7718. set at installation.
  7719. @item language
  7720. Set language, default is "eng".
  7721. @item whitelist
  7722. Set character whitelist.
  7723. @item blacklist
  7724. Set character blacklist.
  7725. @end table
  7726. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7727. @section ocv
  7728. Apply a video transform using libopencv.
  7729. To enable this filter, install the libopencv library and headers and
  7730. configure FFmpeg with @code{--enable-libopencv}.
  7731. It accepts the following parameters:
  7732. @table @option
  7733. @item filter_name
  7734. The name of the libopencv filter to apply.
  7735. @item filter_params
  7736. The parameters to pass to the libopencv filter. If not specified, the default
  7737. values are assumed.
  7738. @end table
  7739. Refer to the official libopencv documentation for more precise
  7740. information:
  7741. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7742. Several libopencv filters are supported; see the following subsections.
  7743. @anchor{dilate}
  7744. @subsection dilate
  7745. Dilate an image by using a specific structuring element.
  7746. It corresponds to the libopencv function @code{cvDilate}.
  7747. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7748. @var{struct_el} represents a structuring element, and has the syntax:
  7749. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7750. @var{cols} and @var{rows} represent the number of columns and rows of
  7751. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7752. point, and @var{shape} the shape for the structuring element. @var{shape}
  7753. must be "rect", "cross", "ellipse", or "custom".
  7754. If the value for @var{shape} is "custom", it must be followed by a
  7755. string of the form "=@var{filename}". The file with name
  7756. @var{filename} is assumed to represent a binary image, with each
  7757. printable character corresponding to a bright pixel. When a custom
  7758. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7759. or columns and rows of the read file are assumed instead.
  7760. The default value for @var{struct_el} is "3x3+0x0/rect".
  7761. @var{nb_iterations} specifies the number of times the transform is
  7762. applied to the image, and defaults to 1.
  7763. Some examples:
  7764. @example
  7765. # Use the default values
  7766. ocv=dilate
  7767. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7768. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7769. # Read the shape from the file diamond.shape, iterating two times.
  7770. # The file diamond.shape may contain a pattern of characters like this
  7771. # *
  7772. # ***
  7773. # *****
  7774. # ***
  7775. # *
  7776. # The specified columns and rows are ignored
  7777. # but the anchor point coordinates are not
  7778. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7779. @end example
  7780. @subsection erode
  7781. Erode an image by using a specific structuring element.
  7782. It corresponds to the libopencv function @code{cvErode}.
  7783. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7784. with the same syntax and semantics as the @ref{dilate} filter.
  7785. @subsection smooth
  7786. Smooth the input video.
  7787. The filter takes the following parameters:
  7788. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7789. @var{type} is the type of smooth filter to apply, and must be one of
  7790. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7791. or "bilateral". The default value is "gaussian".
  7792. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7793. depend on the smooth type. @var{param1} and
  7794. @var{param2} accept integer positive values or 0. @var{param3} and
  7795. @var{param4} accept floating point values.
  7796. The default value for @var{param1} is 3. The default value for the
  7797. other parameters is 0.
  7798. These parameters correspond to the parameters assigned to the
  7799. libopencv function @code{cvSmooth}.
  7800. @anchor{overlay}
  7801. @section overlay
  7802. Overlay one video on top of another.
  7803. It takes two inputs and has one output. The first input is the "main"
  7804. video on which the second input is overlaid.
  7805. It accepts the following parameters:
  7806. A description of the accepted options follows.
  7807. @table @option
  7808. @item x
  7809. @item y
  7810. Set the expression for the x and y coordinates of the overlaid video
  7811. on the main video. Default value is "0" for both expressions. In case
  7812. the expression is invalid, it is set to a huge value (meaning that the
  7813. overlay will not be displayed within the output visible area).
  7814. @item eof_action
  7815. The action to take when EOF is encountered on the secondary input; it accepts
  7816. one of the following values:
  7817. @table @option
  7818. @item repeat
  7819. Repeat the last frame (the default).
  7820. @item endall
  7821. End both streams.
  7822. @item pass
  7823. Pass the main input through.
  7824. @end table
  7825. @item eval
  7826. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7827. It accepts the following values:
  7828. @table @samp
  7829. @item init
  7830. only evaluate expressions once during the filter initialization or
  7831. when a command is processed
  7832. @item frame
  7833. evaluate expressions for each incoming frame
  7834. @end table
  7835. Default value is @samp{frame}.
  7836. @item shortest
  7837. If set to 1, force the output to terminate when the shortest input
  7838. terminates. Default value is 0.
  7839. @item format
  7840. Set the format for the output video.
  7841. It accepts the following values:
  7842. @table @samp
  7843. @item yuv420
  7844. force YUV420 output
  7845. @item yuv422
  7846. force YUV422 output
  7847. @item yuv444
  7848. force YUV444 output
  7849. @item rgb
  7850. force packed RGB output
  7851. @item gbrp
  7852. force planar RGB output
  7853. @end table
  7854. Default value is @samp{yuv420}.
  7855. @item rgb @emph{(deprecated)}
  7856. If set to 1, force the filter to accept inputs in the RGB
  7857. color space. Default value is 0. This option is deprecated, use
  7858. @option{format} instead.
  7859. @item repeatlast
  7860. If set to 1, force the filter to draw the last overlay frame over the
  7861. main input until the end of the stream. A value of 0 disables this
  7862. behavior. Default value is 1.
  7863. @end table
  7864. The @option{x}, and @option{y} expressions can contain the following
  7865. parameters.
  7866. @table @option
  7867. @item main_w, W
  7868. @item main_h, H
  7869. The main input width and height.
  7870. @item overlay_w, w
  7871. @item overlay_h, h
  7872. The overlay input width and height.
  7873. @item x
  7874. @item y
  7875. The computed values for @var{x} and @var{y}. They are evaluated for
  7876. each new frame.
  7877. @item hsub
  7878. @item vsub
  7879. horizontal and vertical chroma subsample values of the output
  7880. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7881. @var{vsub} is 1.
  7882. @item n
  7883. the number of input frame, starting from 0
  7884. @item pos
  7885. the position in the file of the input frame, NAN if unknown
  7886. @item t
  7887. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7888. @end table
  7889. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7890. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7891. when @option{eval} is set to @samp{init}.
  7892. Be aware that frames are taken from each input video in timestamp
  7893. order, hence, if their initial timestamps differ, it is a good idea
  7894. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7895. have them begin in the same zero timestamp, as the example for
  7896. the @var{movie} filter does.
  7897. You can chain together more overlays but you should test the
  7898. efficiency of such approach.
  7899. @subsection Commands
  7900. This filter supports the following commands:
  7901. @table @option
  7902. @item x
  7903. @item y
  7904. Modify the x and y of the overlay input.
  7905. The command accepts the same syntax of the corresponding option.
  7906. If the specified expression is not valid, it is kept at its current
  7907. value.
  7908. @end table
  7909. @subsection Examples
  7910. @itemize
  7911. @item
  7912. Draw the overlay at 10 pixels from the bottom right corner of the main
  7913. video:
  7914. @example
  7915. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7916. @end example
  7917. Using named options the example above becomes:
  7918. @example
  7919. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7920. @end example
  7921. @item
  7922. Insert a transparent PNG logo in the bottom left corner of the input,
  7923. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7924. @example
  7925. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7926. @end example
  7927. @item
  7928. Insert 2 different transparent PNG logos (second logo on bottom
  7929. right corner) using the @command{ffmpeg} tool:
  7930. @example
  7931. 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
  7932. @end example
  7933. @item
  7934. Add a transparent color layer on top of the main video; @code{WxH}
  7935. must specify the size of the main input to the overlay filter:
  7936. @example
  7937. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7938. @end example
  7939. @item
  7940. Play an original video and a filtered version (here with the deshake
  7941. filter) side by side using the @command{ffplay} tool:
  7942. @example
  7943. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7944. @end example
  7945. The above command is the same as:
  7946. @example
  7947. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7948. @end example
  7949. @item
  7950. Make a sliding overlay appearing from the left to the right top part of the
  7951. screen starting since time 2:
  7952. @example
  7953. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7954. @end example
  7955. @item
  7956. Compose output by putting two input videos side to side:
  7957. @example
  7958. ffmpeg -i left.avi -i right.avi -filter_complex "
  7959. nullsrc=size=200x100 [background];
  7960. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7961. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7962. [background][left] overlay=shortest=1 [background+left];
  7963. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7964. "
  7965. @end example
  7966. @item
  7967. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7968. @example
  7969. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7970. -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]'
  7971. masked.avi
  7972. @end example
  7973. @item
  7974. Chain several overlays in cascade:
  7975. @example
  7976. nullsrc=s=200x200 [bg];
  7977. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7978. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7979. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7980. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7981. [in3] null, [mid2] overlay=100:100 [out0]
  7982. @end example
  7983. @end itemize
  7984. @section owdenoise
  7985. Apply Overcomplete Wavelet denoiser.
  7986. The filter accepts the following options:
  7987. @table @option
  7988. @item depth
  7989. Set depth.
  7990. Larger depth values will denoise lower frequency components more, but
  7991. slow down filtering.
  7992. Must be an int in the range 8-16, default is @code{8}.
  7993. @item luma_strength, ls
  7994. Set luma strength.
  7995. Must be a double value in the range 0-1000, default is @code{1.0}.
  7996. @item chroma_strength, cs
  7997. Set chroma strength.
  7998. Must be a double value in the range 0-1000, default is @code{1.0}.
  7999. @end table
  8000. @anchor{pad}
  8001. @section pad
  8002. Add paddings to the input image, and place the original input at the
  8003. provided @var{x}, @var{y} coordinates.
  8004. It accepts the following parameters:
  8005. @table @option
  8006. @item width, w
  8007. @item height, h
  8008. Specify an expression for the size of the output image with the
  8009. paddings added. If the value for @var{width} or @var{height} is 0, the
  8010. corresponding input size is used for the output.
  8011. The @var{width} expression can reference the value set by the
  8012. @var{height} expression, and vice versa.
  8013. The default value of @var{width} and @var{height} is 0.
  8014. @item x
  8015. @item y
  8016. Specify the offsets to place the input image at within the padded area,
  8017. with respect to the top/left border of the output image.
  8018. The @var{x} expression can reference the value set by the @var{y}
  8019. expression, and vice versa.
  8020. The default value of @var{x} and @var{y} is 0.
  8021. @item color
  8022. Specify the color of the padded area. For the syntax of this option,
  8023. check the "Color" section in the ffmpeg-utils manual.
  8024. The default value of @var{color} is "black".
  8025. @item eval
  8026. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8027. It accepts the following values:
  8028. @table @samp
  8029. @item init
  8030. Only evaluate expressions once during the filter initialization or when
  8031. a command is processed.
  8032. @item frame
  8033. Evaluate expressions for each incoming frame.
  8034. @end table
  8035. Default value is @samp{init}.
  8036. @end table
  8037. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8038. options are expressions containing the following constants:
  8039. @table @option
  8040. @item in_w
  8041. @item in_h
  8042. The input video width and height.
  8043. @item iw
  8044. @item ih
  8045. These are the same as @var{in_w} and @var{in_h}.
  8046. @item out_w
  8047. @item out_h
  8048. The output width and height (the size of the padded area), as
  8049. specified by the @var{width} and @var{height} expressions.
  8050. @item ow
  8051. @item oh
  8052. These are the same as @var{out_w} and @var{out_h}.
  8053. @item x
  8054. @item y
  8055. The x and y offsets as specified by the @var{x} and @var{y}
  8056. expressions, or NAN if not yet specified.
  8057. @item a
  8058. same as @var{iw} / @var{ih}
  8059. @item sar
  8060. input sample aspect ratio
  8061. @item dar
  8062. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8063. @item hsub
  8064. @item vsub
  8065. The horizontal and vertical chroma subsample values. For example for the
  8066. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8067. @end table
  8068. @subsection Examples
  8069. @itemize
  8070. @item
  8071. Add paddings with the color "violet" to the input video. The output video
  8072. size is 640x480, and the top-left corner of the input video is placed at
  8073. column 0, row 40
  8074. @example
  8075. pad=640:480:0:40:violet
  8076. @end example
  8077. The example above is equivalent to the following command:
  8078. @example
  8079. pad=width=640:height=480:x=0:y=40:color=violet
  8080. @end example
  8081. @item
  8082. Pad the input to get an output with dimensions increased by 3/2,
  8083. and put the input video at the center of the padded area:
  8084. @example
  8085. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8086. @end example
  8087. @item
  8088. Pad the input to get a squared output with size equal to the maximum
  8089. value between the input width and height, and put the input video at
  8090. the center of the padded area:
  8091. @example
  8092. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8093. @end example
  8094. @item
  8095. Pad the input to get a final w/h ratio of 16:9:
  8096. @example
  8097. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8098. @end example
  8099. @item
  8100. In case of anamorphic video, in order to set the output display aspect
  8101. correctly, it is necessary to use @var{sar} in the expression,
  8102. according to the relation:
  8103. @example
  8104. (ih * X / ih) * sar = output_dar
  8105. X = output_dar / sar
  8106. @end example
  8107. Thus the previous example needs to be modified to:
  8108. @example
  8109. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8110. @end example
  8111. @item
  8112. Double the output size and put the input video in the bottom-right
  8113. corner of the output padded area:
  8114. @example
  8115. pad="2*iw:2*ih:ow-iw:oh-ih"
  8116. @end example
  8117. @end itemize
  8118. @anchor{palettegen}
  8119. @section palettegen
  8120. Generate one palette for a whole video stream.
  8121. It accepts the following options:
  8122. @table @option
  8123. @item max_colors
  8124. Set the maximum number of colors to quantize in the palette.
  8125. Note: the palette will still contain 256 colors; the unused palette entries
  8126. will be black.
  8127. @item reserve_transparent
  8128. Create a palette of 255 colors maximum and reserve the last one for
  8129. transparency. Reserving the transparency color is useful for GIF optimization.
  8130. If not set, the maximum of colors in the palette will be 256. You probably want
  8131. to disable this option for a standalone image.
  8132. Set by default.
  8133. @item stats_mode
  8134. Set statistics mode.
  8135. It accepts the following values:
  8136. @table @samp
  8137. @item full
  8138. Compute full frame histograms.
  8139. @item diff
  8140. Compute histograms only for the part that differs from previous frame. This
  8141. might be relevant to give more importance to the moving part of your input if
  8142. the background is static.
  8143. @item single
  8144. Compute new histogram for each frame.
  8145. @end table
  8146. Default value is @var{full}.
  8147. @end table
  8148. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8149. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8150. color quantization of the palette. This information is also visible at
  8151. @var{info} logging level.
  8152. @subsection Examples
  8153. @itemize
  8154. @item
  8155. Generate a representative palette of a given video using @command{ffmpeg}:
  8156. @example
  8157. ffmpeg -i input.mkv -vf palettegen palette.png
  8158. @end example
  8159. @end itemize
  8160. @section paletteuse
  8161. Use a palette to downsample an input video stream.
  8162. The filter takes two inputs: one video stream and a palette. The palette must
  8163. be a 256 pixels image.
  8164. It accepts the following options:
  8165. @table @option
  8166. @item dither
  8167. Select dithering mode. Available algorithms are:
  8168. @table @samp
  8169. @item bayer
  8170. Ordered 8x8 bayer dithering (deterministic)
  8171. @item heckbert
  8172. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8173. Note: this dithering is sometimes considered "wrong" and is included as a
  8174. reference.
  8175. @item floyd_steinberg
  8176. Floyd and Steingberg dithering (error diffusion)
  8177. @item sierra2
  8178. Frankie Sierra dithering v2 (error diffusion)
  8179. @item sierra2_4a
  8180. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8181. @end table
  8182. Default is @var{sierra2_4a}.
  8183. @item bayer_scale
  8184. When @var{bayer} dithering is selected, this option defines the scale of the
  8185. pattern (how much the crosshatch pattern is visible). A low value means more
  8186. visible pattern for less banding, and higher value means less visible pattern
  8187. at the cost of more banding.
  8188. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8189. @item diff_mode
  8190. If set, define the zone to process
  8191. @table @samp
  8192. @item rectangle
  8193. Only the changing rectangle will be reprocessed. This is similar to GIF
  8194. cropping/offsetting compression mechanism. This option can be useful for speed
  8195. if only a part of the image is changing, and has use cases such as limiting the
  8196. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8197. moving scene (it leads to more deterministic output if the scene doesn't change
  8198. much, and as a result less moving noise and better GIF compression).
  8199. @end table
  8200. Default is @var{none}.
  8201. @item new
  8202. Take new palette for each output frame.
  8203. @end table
  8204. @subsection Examples
  8205. @itemize
  8206. @item
  8207. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8208. using @command{ffmpeg}:
  8209. @example
  8210. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8211. @end example
  8212. @end itemize
  8213. @section perspective
  8214. Correct perspective of video not recorded perpendicular to the screen.
  8215. A description of the accepted parameters follows.
  8216. @table @option
  8217. @item x0
  8218. @item y0
  8219. @item x1
  8220. @item y1
  8221. @item x2
  8222. @item y2
  8223. @item x3
  8224. @item y3
  8225. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8226. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8227. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8228. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8229. then the corners of the source will be sent to the specified coordinates.
  8230. The expressions can use the following variables:
  8231. @table @option
  8232. @item W
  8233. @item H
  8234. the width and height of video frame.
  8235. @item in
  8236. Input frame count.
  8237. @item on
  8238. Output frame count.
  8239. @end table
  8240. @item interpolation
  8241. Set interpolation for perspective correction.
  8242. It accepts the following values:
  8243. @table @samp
  8244. @item linear
  8245. @item cubic
  8246. @end table
  8247. Default value is @samp{linear}.
  8248. @item sense
  8249. Set interpretation of coordinate options.
  8250. It accepts the following values:
  8251. @table @samp
  8252. @item 0, source
  8253. Send point in the source specified by the given coordinates to
  8254. the corners of the destination.
  8255. @item 1, destination
  8256. Send the corners of the source to the point in the destination specified
  8257. by the given coordinates.
  8258. Default value is @samp{source}.
  8259. @end table
  8260. @item eval
  8261. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8262. It accepts the following values:
  8263. @table @samp
  8264. @item init
  8265. only evaluate expressions once during the filter initialization or
  8266. when a command is processed
  8267. @item frame
  8268. evaluate expressions for each incoming frame
  8269. @end table
  8270. Default value is @samp{init}.
  8271. @end table
  8272. @section phase
  8273. Delay interlaced video by one field time so that the field order changes.
  8274. The intended use is to fix PAL movies that have been captured with the
  8275. opposite field order to the film-to-video transfer.
  8276. A description of the accepted parameters follows.
  8277. @table @option
  8278. @item mode
  8279. Set phase mode.
  8280. It accepts the following values:
  8281. @table @samp
  8282. @item t
  8283. Capture field order top-first, transfer bottom-first.
  8284. Filter will delay the bottom field.
  8285. @item b
  8286. Capture field order bottom-first, transfer top-first.
  8287. Filter will delay the top field.
  8288. @item p
  8289. Capture and transfer with the same field order. This mode only exists
  8290. for the documentation of the other options to refer to, but if you
  8291. actually select it, the filter will faithfully do nothing.
  8292. @item a
  8293. Capture field order determined automatically by field flags, transfer
  8294. opposite.
  8295. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8296. basis using field flags. If no field information is available,
  8297. then this works just like @samp{u}.
  8298. @item u
  8299. Capture unknown or varying, transfer opposite.
  8300. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8301. analyzing the images and selecting the alternative that produces best
  8302. match between the fields.
  8303. @item T
  8304. Capture top-first, transfer unknown or varying.
  8305. Filter selects among @samp{t} and @samp{p} using image analysis.
  8306. @item B
  8307. Capture bottom-first, transfer unknown or varying.
  8308. Filter selects among @samp{b} and @samp{p} using image analysis.
  8309. @item A
  8310. Capture determined by field flags, transfer unknown or varying.
  8311. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8312. image analysis. If no field information is available, then this works just
  8313. like @samp{U}. This is the default mode.
  8314. @item U
  8315. Both capture and transfer unknown or varying.
  8316. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8317. @end table
  8318. @end table
  8319. @section pixdesctest
  8320. Pixel format descriptor test filter, mainly useful for internal
  8321. testing. The output video should be equal to the input video.
  8322. For example:
  8323. @example
  8324. format=monow, pixdesctest
  8325. @end example
  8326. can be used to test the monowhite pixel format descriptor definition.
  8327. @section pp
  8328. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8329. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8330. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8331. Each subfilter and some options have a short and a long name that can be used
  8332. interchangeably, i.e. dr/dering are the same.
  8333. The filters accept the following options:
  8334. @table @option
  8335. @item subfilters
  8336. Set postprocessing subfilters string.
  8337. @end table
  8338. All subfilters share common options to determine their scope:
  8339. @table @option
  8340. @item a/autoq
  8341. Honor the quality commands for this subfilter.
  8342. @item c/chrom
  8343. Do chrominance filtering, too (default).
  8344. @item y/nochrom
  8345. Do luminance filtering only (no chrominance).
  8346. @item n/noluma
  8347. Do chrominance filtering only (no luminance).
  8348. @end table
  8349. These options can be appended after the subfilter name, separated by a '|'.
  8350. Available subfilters are:
  8351. @table @option
  8352. @item hb/hdeblock[|difference[|flatness]]
  8353. Horizontal deblocking filter
  8354. @table @option
  8355. @item difference
  8356. Difference factor where higher values mean more deblocking (default: @code{32}).
  8357. @item flatness
  8358. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8359. @end table
  8360. @item vb/vdeblock[|difference[|flatness]]
  8361. Vertical deblocking filter
  8362. @table @option
  8363. @item difference
  8364. Difference factor where higher values mean more deblocking (default: @code{32}).
  8365. @item flatness
  8366. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8367. @end table
  8368. @item ha/hadeblock[|difference[|flatness]]
  8369. Accurate horizontal deblocking filter
  8370. @table @option
  8371. @item difference
  8372. Difference factor where higher values mean more deblocking (default: @code{32}).
  8373. @item flatness
  8374. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8375. @end table
  8376. @item va/vadeblock[|difference[|flatness]]
  8377. Accurate vertical deblocking filter
  8378. @table @option
  8379. @item difference
  8380. Difference factor where higher values mean more deblocking (default: @code{32}).
  8381. @item flatness
  8382. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8383. @end table
  8384. @end table
  8385. The horizontal and vertical deblocking filters share the difference and
  8386. flatness values so you cannot set different horizontal and vertical
  8387. thresholds.
  8388. @table @option
  8389. @item h1/x1hdeblock
  8390. Experimental horizontal deblocking filter
  8391. @item v1/x1vdeblock
  8392. Experimental vertical deblocking filter
  8393. @item dr/dering
  8394. Deringing filter
  8395. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8396. @table @option
  8397. @item threshold1
  8398. larger -> stronger filtering
  8399. @item threshold2
  8400. larger -> stronger filtering
  8401. @item threshold3
  8402. larger -> stronger filtering
  8403. @end table
  8404. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8405. @table @option
  8406. @item f/fullyrange
  8407. Stretch luminance to @code{0-255}.
  8408. @end table
  8409. @item lb/linblenddeint
  8410. Linear blend deinterlacing filter that deinterlaces the given block by
  8411. filtering all lines with a @code{(1 2 1)} filter.
  8412. @item li/linipoldeint
  8413. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8414. linearly interpolating every second line.
  8415. @item ci/cubicipoldeint
  8416. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8417. cubically interpolating every second line.
  8418. @item md/mediandeint
  8419. Median deinterlacing filter that deinterlaces the given block by applying a
  8420. median filter to every second line.
  8421. @item fd/ffmpegdeint
  8422. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8423. second line with a @code{(-1 4 2 4 -1)} filter.
  8424. @item l5/lowpass5
  8425. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8426. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8427. @item fq/forceQuant[|quantizer]
  8428. Overrides the quantizer table from the input with the constant quantizer you
  8429. specify.
  8430. @table @option
  8431. @item quantizer
  8432. Quantizer to use
  8433. @end table
  8434. @item de/default
  8435. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8436. @item fa/fast
  8437. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8438. @item ac
  8439. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8440. @end table
  8441. @subsection Examples
  8442. @itemize
  8443. @item
  8444. Apply horizontal and vertical deblocking, deringing and automatic
  8445. brightness/contrast:
  8446. @example
  8447. pp=hb/vb/dr/al
  8448. @end example
  8449. @item
  8450. Apply default filters without brightness/contrast correction:
  8451. @example
  8452. pp=de/-al
  8453. @end example
  8454. @item
  8455. Apply default filters and temporal denoiser:
  8456. @example
  8457. pp=default/tmpnoise|1|2|3
  8458. @end example
  8459. @item
  8460. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8461. automatically depending on available CPU time:
  8462. @example
  8463. pp=hb|y/vb|a
  8464. @end example
  8465. @end itemize
  8466. @section pp7
  8467. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8468. similar to spp = 6 with 7 point DCT, where only the center sample is
  8469. used after IDCT.
  8470. The filter accepts the following options:
  8471. @table @option
  8472. @item qp
  8473. Force a constant quantization parameter. It accepts an integer in range
  8474. 0 to 63. If not set, the filter will use the QP from the video stream
  8475. (if available).
  8476. @item mode
  8477. Set thresholding mode. Available modes are:
  8478. @table @samp
  8479. @item hard
  8480. Set hard thresholding.
  8481. @item soft
  8482. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8483. @item medium
  8484. Set medium thresholding (good results, default).
  8485. @end table
  8486. @end table
  8487. @section premultiply
  8488. Apply alpha premultiply effect to input video stream using first plane
  8489. of second stream as alpha.
  8490. Both streams must have same dimensions and same pixel format.
  8491. @section prewitt
  8492. Apply prewitt operator to input video stream.
  8493. The filter accepts the following option:
  8494. @table @option
  8495. @item planes
  8496. Set which planes will be processed, unprocessed planes will be copied.
  8497. By default value 0xf, all planes will be processed.
  8498. @item scale
  8499. Set value which will be multiplied with filtered result.
  8500. @item delta
  8501. Set value which will be added to filtered result.
  8502. @end table
  8503. @section psnr
  8504. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8505. Ratio) between two input videos.
  8506. This filter takes in input two input videos, the first input is
  8507. considered the "main" source and is passed unchanged to the
  8508. output. The second input is used as a "reference" video for computing
  8509. the PSNR.
  8510. Both video inputs must have the same resolution and pixel format for
  8511. this filter to work correctly. Also it assumes that both inputs
  8512. have the same number of frames, which are compared one by one.
  8513. The obtained average PSNR is printed through the logging system.
  8514. The filter stores the accumulated MSE (mean squared error) of each
  8515. frame, and at the end of the processing it is averaged across all frames
  8516. equally, and the following formula is applied to obtain the PSNR:
  8517. @example
  8518. PSNR = 10*log10(MAX^2/MSE)
  8519. @end example
  8520. Where MAX is the average of the maximum values of each component of the
  8521. image.
  8522. The description of the accepted parameters follows.
  8523. @table @option
  8524. @item stats_file, f
  8525. If specified the filter will use the named file to save the PSNR of
  8526. each individual frame. When filename equals "-" the data is sent to
  8527. standard output.
  8528. @item stats_version
  8529. Specifies which version of the stats file format to use. Details of
  8530. each format are written below.
  8531. Default value is 1.
  8532. @item stats_add_max
  8533. Determines whether the max value is output to the stats log.
  8534. Default value is 0.
  8535. Requires stats_version >= 2. If this is set and stats_version < 2,
  8536. the filter will return an error.
  8537. @end table
  8538. The file printed if @var{stats_file} is selected, contains a sequence of
  8539. key/value pairs of the form @var{key}:@var{value} for each compared
  8540. couple of frames.
  8541. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8542. the list of per-frame-pair stats, with key value pairs following the frame
  8543. format with the following parameters:
  8544. @table @option
  8545. @item psnr_log_version
  8546. The version of the log file format. Will match @var{stats_version}.
  8547. @item fields
  8548. A comma separated list of the per-frame-pair parameters included in
  8549. the log.
  8550. @end table
  8551. A description of each shown per-frame-pair parameter follows:
  8552. @table @option
  8553. @item n
  8554. sequential number of the input frame, starting from 1
  8555. @item mse_avg
  8556. Mean Square Error pixel-by-pixel average difference of the compared
  8557. frames, averaged over all the image components.
  8558. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8559. Mean Square Error pixel-by-pixel average difference of the compared
  8560. frames for the component specified by the suffix.
  8561. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8562. Peak Signal to Noise ratio of the compared frames for the component
  8563. specified by the suffix.
  8564. @item max_avg, max_y, max_u, max_v
  8565. Maximum allowed value for each channel, and average over all
  8566. channels.
  8567. @end table
  8568. For example:
  8569. @example
  8570. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8571. [main][ref] psnr="stats_file=stats.log" [out]
  8572. @end example
  8573. On this example the input file being processed is compared with the
  8574. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8575. is stored in @file{stats.log}.
  8576. @anchor{pullup}
  8577. @section pullup
  8578. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8579. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8580. content.
  8581. The pullup filter is designed to take advantage of future context in making
  8582. its decisions. This filter is stateless in the sense that it does not lock
  8583. onto a pattern to follow, but it instead looks forward to the following
  8584. fields in order to identify matches and rebuild progressive frames.
  8585. To produce content with an even framerate, insert the fps filter after
  8586. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8587. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8588. The filter accepts the following options:
  8589. @table @option
  8590. @item jl
  8591. @item jr
  8592. @item jt
  8593. @item jb
  8594. These options set the amount of "junk" to ignore at the left, right, top, and
  8595. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8596. while top and bottom are in units of 2 lines.
  8597. The default is 8 pixels on each side.
  8598. @item sb
  8599. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8600. filter generating an occasional mismatched frame, but it may also cause an
  8601. excessive number of frames to be dropped during high motion sequences.
  8602. Conversely, setting it to -1 will make filter match fields more easily.
  8603. This may help processing of video where there is slight blurring between
  8604. the fields, but may also cause there to be interlaced frames in the output.
  8605. Default value is @code{0}.
  8606. @item mp
  8607. Set the metric plane to use. It accepts the following values:
  8608. @table @samp
  8609. @item l
  8610. Use luma plane.
  8611. @item u
  8612. Use chroma blue plane.
  8613. @item v
  8614. Use chroma red plane.
  8615. @end table
  8616. This option may be set to use chroma plane instead of the default luma plane
  8617. for doing filter's computations. This may improve accuracy on very clean
  8618. source material, but more likely will decrease accuracy, especially if there
  8619. is chroma noise (rainbow effect) or any grayscale video.
  8620. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8621. load and make pullup usable in realtime on slow machines.
  8622. @end table
  8623. For best results (without duplicated frames in the output file) it is
  8624. necessary to change the output frame rate. For example, to inverse
  8625. telecine NTSC input:
  8626. @example
  8627. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8628. @end example
  8629. @section qp
  8630. Change video quantization parameters (QP).
  8631. The filter accepts the following option:
  8632. @table @option
  8633. @item qp
  8634. Set expression for quantization parameter.
  8635. @end table
  8636. The expression is evaluated through the eval API and can contain, among others,
  8637. the following constants:
  8638. @table @var
  8639. @item known
  8640. 1 if index is not 129, 0 otherwise.
  8641. @item qp
  8642. Sequentional index starting from -129 to 128.
  8643. @end table
  8644. @subsection Examples
  8645. @itemize
  8646. @item
  8647. Some equation like:
  8648. @example
  8649. qp=2+2*sin(PI*qp)
  8650. @end example
  8651. @end itemize
  8652. @section random
  8653. Flush video frames from internal cache of frames into a random order.
  8654. No frame is discarded.
  8655. Inspired by @ref{frei0r} nervous filter.
  8656. @table @option
  8657. @item frames
  8658. Set size in number of frames of internal cache, in range from @code{2} to
  8659. @code{512}. Default is @code{30}.
  8660. @item seed
  8661. Set seed for random number generator, must be an integer included between
  8662. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8663. less than @code{0}, the filter will try to use a good random seed on a
  8664. best effort basis.
  8665. @end table
  8666. @section readeia608
  8667. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8668. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8669. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8670. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8671. @table @option
  8672. @item lavfi.readeia608.X.cc
  8673. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8674. @item lavfi.readeia608.X.line
  8675. The number of the line on which the EIA-608 data was identified and read.
  8676. @end table
  8677. This filter accepts the following options:
  8678. @table @option
  8679. @item scan_min
  8680. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8681. @item scan_max
  8682. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8683. @item mac
  8684. Set minimal acceptable amplitude change for sync codes detection.
  8685. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8686. @item spw
  8687. Set the ratio of width reserved for sync code detection.
  8688. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8689. @item mhd
  8690. Set the max peaks height difference for sync code detection.
  8691. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8692. @item mpd
  8693. Set max peaks period difference for sync code detection.
  8694. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8695. @item msd
  8696. Set the first two max start code bits differences.
  8697. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8698. @item bhd
  8699. Set the minimum ratio of bits height compared to 3rd start code bit.
  8700. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8701. @item th_w
  8702. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8703. @item th_b
  8704. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8705. @item chp
  8706. Enable checking the parity bit. In the event of a parity error, the filter will output
  8707. @code{0x00} for that character. Default is false.
  8708. @end table
  8709. @subsection Examples
  8710. @itemize
  8711. @item
  8712. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8713. @example
  8714. 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
  8715. @end example
  8716. @end itemize
  8717. @section readvitc
  8718. Read vertical interval timecode (VITC) information from the top lines of a
  8719. video frame.
  8720. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8721. timecode value, if a valid timecode has been detected. Further metadata key
  8722. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8723. timecode data has been found or not.
  8724. This filter accepts the following options:
  8725. @table @option
  8726. @item scan_max
  8727. Set the maximum number of lines to scan for VITC data. If the value is set to
  8728. @code{-1} the full video frame is scanned. Default is @code{45}.
  8729. @item thr_b
  8730. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8731. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8732. @item thr_w
  8733. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8734. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8735. @end table
  8736. @subsection Examples
  8737. @itemize
  8738. @item
  8739. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8740. draw @code{--:--:--:--} as a placeholder:
  8741. @example
  8742. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8743. @end example
  8744. @end itemize
  8745. @section remap
  8746. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8747. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8748. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8749. value for pixel will be used for destination pixel.
  8750. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8751. will have Xmap/Ymap video stream dimensions.
  8752. Xmap and Ymap input video streams are 16bit depth, single channel.
  8753. @section removegrain
  8754. The removegrain filter is a spatial denoiser for progressive video.
  8755. @table @option
  8756. @item m0
  8757. Set mode for the first plane.
  8758. @item m1
  8759. Set mode for the second plane.
  8760. @item m2
  8761. Set mode for the third plane.
  8762. @item m3
  8763. Set mode for the fourth plane.
  8764. @end table
  8765. Range of mode is from 0 to 24. Description of each mode follows:
  8766. @table @var
  8767. @item 0
  8768. Leave input plane unchanged. Default.
  8769. @item 1
  8770. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8771. @item 2
  8772. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8773. @item 3
  8774. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8775. @item 4
  8776. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8777. This is equivalent to a median filter.
  8778. @item 5
  8779. Line-sensitive clipping giving the minimal change.
  8780. @item 6
  8781. Line-sensitive clipping, intermediate.
  8782. @item 7
  8783. Line-sensitive clipping, intermediate.
  8784. @item 8
  8785. Line-sensitive clipping, intermediate.
  8786. @item 9
  8787. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8788. @item 10
  8789. Replaces the target pixel with the closest neighbour.
  8790. @item 11
  8791. [1 2 1] horizontal and vertical kernel blur.
  8792. @item 12
  8793. Same as mode 11.
  8794. @item 13
  8795. Bob mode, interpolates top field from the line where the neighbours
  8796. pixels are the closest.
  8797. @item 14
  8798. Bob mode, interpolates bottom field from the line where the neighbours
  8799. pixels are the closest.
  8800. @item 15
  8801. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8802. interpolation formula.
  8803. @item 16
  8804. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8805. interpolation formula.
  8806. @item 17
  8807. Clips the pixel with the minimum and maximum of respectively the maximum and
  8808. minimum of each pair of opposite neighbour pixels.
  8809. @item 18
  8810. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8811. the current pixel is minimal.
  8812. @item 19
  8813. Replaces the pixel with the average of its 8 neighbours.
  8814. @item 20
  8815. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8816. @item 21
  8817. Clips pixels using the averages of opposite neighbour.
  8818. @item 22
  8819. Same as mode 21 but simpler and faster.
  8820. @item 23
  8821. Small edge and halo removal, but reputed useless.
  8822. @item 24
  8823. Similar as 23.
  8824. @end table
  8825. @section removelogo
  8826. Suppress a TV station logo, using an image file to determine which
  8827. pixels comprise the logo. It works by filling in the pixels that
  8828. comprise the logo with neighboring pixels.
  8829. The filter accepts the following options:
  8830. @table @option
  8831. @item filename, f
  8832. Set the filter bitmap file, which can be any image format supported by
  8833. libavformat. The width and height of the image file must match those of the
  8834. video stream being processed.
  8835. @end table
  8836. Pixels in the provided bitmap image with a value of zero are not
  8837. considered part of the logo, non-zero pixels are considered part of
  8838. the logo. If you use white (255) for the logo and black (0) for the
  8839. rest, you will be safe. For making the filter bitmap, it is
  8840. recommended to take a screen capture of a black frame with the logo
  8841. visible, and then using a threshold filter followed by the erode
  8842. filter once or twice.
  8843. If needed, little splotches can be fixed manually. Remember that if
  8844. logo pixels are not covered, the filter quality will be much
  8845. reduced. Marking too many pixels as part of the logo does not hurt as
  8846. much, but it will increase the amount of blurring needed to cover over
  8847. the image and will destroy more information than necessary, and extra
  8848. pixels will slow things down on a large logo.
  8849. @section repeatfields
  8850. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8851. fields based on its value.
  8852. @section reverse
  8853. Reverse a video clip.
  8854. Warning: This filter requires memory to buffer the entire clip, so trimming
  8855. is suggested.
  8856. @subsection Examples
  8857. @itemize
  8858. @item
  8859. Take the first 5 seconds of a clip, and reverse it.
  8860. @example
  8861. trim=end=5,reverse
  8862. @end example
  8863. @end itemize
  8864. @section rotate
  8865. Rotate video by an arbitrary angle expressed in radians.
  8866. The filter accepts the following options:
  8867. A description of the optional parameters follows.
  8868. @table @option
  8869. @item angle, a
  8870. Set an expression for the angle by which to rotate the input video
  8871. clockwise, expressed as a number of radians. A negative value will
  8872. result in a counter-clockwise rotation. By default it is set to "0".
  8873. This expression is evaluated for each frame.
  8874. @item out_w, ow
  8875. Set the output width expression, default value is "iw".
  8876. This expression is evaluated just once during configuration.
  8877. @item out_h, oh
  8878. Set the output height expression, default value is "ih".
  8879. This expression is evaluated just once during configuration.
  8880. @item bilinear
  8881. Enable bilinear interpolation if set to 1, a value of 0 disables
  8882. it. Default value is 1.
  8883. @item fillcolor, c
  8884. Set the color used to fill the output area not covered by the rotated
  8885. image. For the general syntax of this option, check the "Color" section in the
  8886. ffmpeg-utils manual. If the special value "none" is selected then no
  8887. background is printed (useful for example if the background is never shown).
  8888. Default value is "black".
  8889. @end table
  8890. The expressions for the angle and the output size can contain the
  8891. following constants and functions:
  8892. @table @option
  8893. @item n
  8894. sequential number of the input frame, starting from 0. It is always NAN
  8895. before the first frame is filtered.
  8896. @item t
  8897. time in seconds of the input frame, it is set to 0 when the filter is
  8898. configured. It is always NAN before the first frame is filtered.
  8899. @item hsub
  8900. @item vsub
  8901. horizontal and vertical chroma subsample values. For example for the
  8902. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8903. @item in_w, iw
  8904. @item in_h, ih
  8905. the input video width and height
  8906. @item out_w, ow
  8907. @item out_h, oh
  8908. the output width and height, that is the size of the padded area as
  8909. specified by the @var{width} and @var{height} expressions
  8910. @item rotw(a)
  8911. @item roth(a)
  8912. the minimal width/height required for completely containing the input
  8913. video rotated by @var{a} radians.
  8914. These are only available when computing the @option{out_w} and
  8915. @option{out_h} expressions.
  8916. @end table
  8917. @subsection Examples
  8918. @itemize
  8919. @item
  8920. Rotate the input by PI/6 radians clockwise:
  8921. @example
  8922. rotate=PI/6
  8923. @end example
  8924. @item
  8925. Rotate the input by PI/6 radians counter-clockwise:
  8926. @example
  8927. rotate=-PI/6
  8928. @end example
  8929. @item
  8930. Rotate the input by 45 degrees clockwise:
  8931. @example
  8932. rotate=45*PI/180
  8933. @end example
  8934. @item
  8935. Apply a constant rotation with period T, starting from an angle of PI/3:
  8936. @example
  8937. rotate=PI/3+2*PI*t/T
  8938. @end example
  8939. @item
  8940. Make the input video rotation oscillating with a period of T
  8941. seconds and an amplitude of A radians:
  8942. @example
  8943. rotate=A*sin(2*PI/T*t)
  8944. @end example
  8945. @item
  8946. Rotate the video, output size is chosen so that the whole rotating
  8947. input video is always completely contained in the output:
  8948. @example
  8949. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8950. @end example
  8951. @item
  8952. Rotate the video, reduce the output size so that no background is ever
  8953. shown:
  8954. @example
  8955. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8956. @end example
  8957. @end itemize
  8958. @subsection Commands
  8959. The filter supports the following commands:
  8960. @table @option
  8961. @item a, angle
  8962. Set the angle expression.
  8963. The command accepts the same syntax of the corresponding option.
  8964. If the specified expression is not valid, it is kept at its current
  8965. value.
  8966. @end table
  8967. @section sab
  8968. Apply Shape Adaptive Blur.
  8969. The filter accepts the following options:
  8970. @table @option
  8971. @item luma_radius, lr
  8972. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8973. value is 1.0. A greater value will result in a more blurred image, and
  8974. in slower processing.
  8975. @item luma_pre_filter_radius, lpfr
  8976. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8977. value is 1.0.
  8978. @item luma_strength, ls
  8979. Set luma maximum difference between pixels to still be considered, must
  8980. be a value in the 0.1-100.0 range, default value is 1.0.
  8981. @item chroma_radius, cr
  8982. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8983. greater value will result in a more blurred image, and in slower
  8984. processing.
  8985. @item chroma_pre_filter_radius, cpfr
  8986. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8987. @item chroma_strength, cs
  8988. Set chroma maximum difference between pixels to still be considered,
  8989. must be a value in the -0.9-100.0 range.
  8990. @end table
  8991. Each chroma option value, if not explicitly specified, is set to the
  8992. corresponding luma option value.
  8993. @anchor{scale}
  8994. @section scale
  8995. Scale (resize) the input video, using the libswscale library.
  8996. The scale filter forces the output display aspect ratio to be the same
  8997. of the input, by changing the output sample aspect ratio.
  8998. If the input image format is different from the format requested by
  8999. the next filter, the scale filter will convert the input to the
  9000. requested format.
  9001. @subsection Options
  9002. The filter accepts the following options, or any of the options
  9003. supported by the libswscale scaler.
  9004. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9005. the complete list of scaler options.
  9006. @table @option
  9007. @item width, w
  9008. @item height, h
  9009. Set the output video dimension expression. Default value is the input
  9010. dimension.
  9011. If the value is 0, the input width is used for the output.
  9012. If one of the values is -1, the scale filter will use a value that
  9013. maintains the aspect ratio of the input image, calculated from the
  9014. other specified dimension. If both of them are -1, the input size is
  9015. used
  9016. If one of the values is -n with n > 1, the scale filter will also use a value
  9017. that maintains the aspect ratio of the input image, calculated from the other
  9018. specified dimension. After that it will, however, make sure that the calculated
  9019. dimension is divisible by n and adjust the value if necessary.
  9020. See below for the list of accepted constants for use in the dimension
  9021. expression.
  9022. @item eval
  9023. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9024. @table @samp
  9025. @item init
  9026. Only evaluate expressions once during the filter initialization or when a command is processed.
  9027. @item frame
  9028. Evaluate expressions for each incoming frame.
  9029. @end table
  9030. Default value is @samp{init}.
  9031. @item interl
  9032. Set the interlacing mode. It accepts the following values:
  9033. @table @samp
  9034. @item 1
  9035. Force interlaced aware scaling.
  9036. @item 0
  9037. Do not apply interlaced scaling.
  9038. @item -1
  9039. Select interlaced aware scaling depending on whether the source frames
  9040. are flagged as interlaced or not.
  9041. @end table
  9042. Default value is @samp{0}.
  9043. @item flags
  9044. Set libswscale scaling flags. See
  9045. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9046. complete list of values. If not explicitly specified the filter applies
  9047. the default flags.
  9048. @item param0, param1
  9049. Set libswscale input parameters for scaling algorithms that need them. See
  9050. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9051. complete documentation. If not explicitly specified the filter applies
  9052. empty parameters.
  9053. @item size, s
  9054. Set the video size. For the syntax of this option, check the
  9055. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9056. @item in_color_matrix
  9057. @item out_color_matrix
  9058. Set in/output YCbCr color space type.
  9059. This allows the autodetected value to be overridden as well as allows forcing
  9060. a specific value used for the output and encoder.
  9061. If not specified, the color space type depends on the pixel format.
  9062. Possible values:
  9063. @table @samp
  9064. @item auto
  9065. Choose automatically.
  9066. @item bt709
  9067. Format conforming to International Telecommunication Union (ITU)
  9068. Recommendation BT.709.
  9069. @item fcc
  9070. Set color space conforming to the United States Federal Communications
  9071. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9072. @item bt601
  9073. Set color space conforming to:
  9074. @itemize
  9075. @item
  9076. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9077. @item
  9078. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9079. @item
  9080. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9081. @end itemize
  9082. @item smpte240m
  9083. Set color space conforming to SMPTE ST 240:1999.
  9084. @end table
  9085. @item in_range
  9086. @item out_range
  9087. Set in/output YCbCr sample range.
  9088. This allows the autodetected value to be overridden as well as allows forcing
  9089. a specific value used for the output and encoder. If not specified, the
  9090. range depends on the pixel format. Possible values:
  9091. @table @samp
  9092. @item auto
  9093. Choose automatically.
  9094. @item jpeg/full/pc
  9095. Set full range (0-255 in case of 8-bit luma).
  9096. @item mpeg/tv
  9097. Set "MPEG" range (16-235 in case of 8-bit luma).
  9098. @end table
  9099. @item force_original_aspect_ratio
  9100. Enable decreasing or increasing output video width or height if necessary to
  9101. keep the original aspect ratio. Possible values:
  9102. @table @samp
  9103. @item disable
  9104. Scale the video as specified and disable this feature.
  9105. @item decrease
  9106. The output video dimensions will automatically be decreased if needed.
  9107. @item increase
  9108. The output video dimensions will automatically be increased if needed.
  9109. @end table
  9110. One useful instance of this option is that when you know a specific device's
  9111. maximum allowed resolution, you can use this to limit the output video to
  9112. that, while retaining the aspect ratio. For example, device A allows
  9113. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9114. decrease) and specifying 1280x720 to the command line makes the output
  9115. 1280x533.
  9116. Please note that this is a different thing than specifying -1 for @option{w}
  9117. or @option{h}, you still need to specify the output resolution for this option
  9118. to work.
  9119. @end table
  9120. The values of the @option{w} and @option{h} options are expressions
  9121. containing the following constants:
  9122. @table @var
  9123. @item in_w
  9124. @item in_h
  9125. The input width and height
  9126. @item iw
  9127. @item ih
  9128. These are the same as @var{in_w} and @var{in_h}.
  9129. @item out_w
  9130. @item out_h
  9131. The output (scaled) width and height
  9132. @item ow
  9133. @item oh
  9134. These are the same as @var{out_w} and @var{out_h}
  9135. @item a
  9136. The same as @var{iw} / @var{ih}
  9137. @item sar
  9138. input sample aspect ratio
  9139. @item dar
  9140. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9141. @item hsub
  9142. @item vsub
  9143. horizontal and vertical input chroma subsample values. For example for the
  9144. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9145. @item ohsub
  9146. @item ovsub
  9147. horizontal and vertical output chroma subsample values. For example for the
  9148. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9149. @end table
  9150. @subsection Examples
  9151. @itemize
  9152. @item
  9153. Scale the input video to a size of 200x100
  9154. @example
  9155. scale=w=200:h=100
  9156. @end example
  9157. This is equivalent to:
  9158. @example
  9159. scale=200:100
  9160. @end example
  9161. or:
  9162. @example
  9163. scale=200x100
  9164. @end example
  9165. @item
  9166. Specify a size abbreviation for the output size:
  9167. @example
  9168. scale=qcif
  9169. @end example
  9170. which can also be written as:
  9171. @example
  9172. scale=size=qcif
  9173. @end example
  9174. @item
  9175. Scale the input to 2x:
  9176. @example
  9177. scale=w=2*iw:h=2*ih
  9178. @end example
  9179. @item
  9180. The above is the same as:
  9181. @example
  9182. scale=2*in_w:2*in_h
  9183. @end example
  9184. @item
  9185. Scale the input to 2x with forced interlaced scaling:
  9186. @example
  9187. scale=2*iw:2*ih:interl=1
  9188. @end example
  9189. @item
  9190. Scale the input to half size:
  9191. @example
  9192. scale=w=iw/2:h=ih/2
  9193. @end example
  9194. @item
  9195. Increase the width, and set the height to the same size:
  9196. @example
  9197. scale=3/2*iw:ow
  9198. @end example
  9199. @item
  9200. Seek Greek harmony:
  9201. @example
  9202. scale=iw:1/PHI*iw
  9203. scale=ih*PHI:ih
  9204. @end example
  9205. @item
  9206. Increase the height, and set the width to 3/2 of the height:
  9207. @example
  9208. scale=w=3/2*oh:h=3/5*ih
  9209. @end example
  9210. @item
  9211. Increase the size, making the size a multiple of the chroma
  9212. subsample values:
  9213. @example
  9214. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9215. @end example
  9216. @item
  9217. Increase the width to a maximum of 500 pixels,
  9218. keeping the same aspect ratio as the input:
  9219. @example
  9220. scale=w='min(500\, iw*3/2):h=-1'
  9221. @end example
  9222. @end itemize
  9223. @subsection Commands
  9224. This filter supports the following commands:
  9225. @table @option
  9226. @item width, w
  9227. @item height, h
  9228. Set the output video dimension expression.
  9229. The command accepts the same syntax of the corresponding option.
  9230. If the specified expression is not valid, it is kept at its current
  9231. value.
  9232. @end table
  9233. @section scale_npp
  9234. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9235. format conversion on CUDA video frames. Setting the output width and height
  9236. works in the same way as for the @var{scale} filter.
  9237. The following additional options are accepted:
  9238. @table @option
  9239. @item format
  9240. The pixel format of the output CUDA frames. If set to the string "same" (the
  9241. default), the input format will be kept. Note that automatic format negotiation
  9242. and conversion is not yet supported for hardware frames
  9243. @item interp_algo
  9244. The interpolation algorithm used for resizing. One of the following:
  9245. @table @option
  9246. @item nn
  9247. Nearest neighbour.
  9248. @item linear
  9249. @item cubic
  9250. @item cubic2p_bspline
  9251. 2-parameter cubic (B=1, C=0)
  9252. @item cubic2p_catmullrom
  9253. 2-parameter cubic (B=0, C=1/2)
  9254. @item cubic2p_b05c03
  9255. 2-parameter cubic (B=1/2, C=3/10)
  9256. @item super
  9257. Supersampling
  9258. @item lanczos
  9259. @end table
  9260. @end table
  9261. @section scale2ref
  9262. Scale (resize) the input video, based on a reference video.
  9263. See the scale filter for available options, scale2ref supports the same but
  9264. uses the reference video instead of the main input as basis.
  9265. @subsection Examples
  9266. @itemize
  9267. @item
  9268. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9269. @example
  9270. 'scale2ref[b][a];[a][b]overlay'
  9271. @end example
  9272. @end itemize
  9273. @anchor{selectivecolor}
  9274. @section selectivecolor
  9275. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9276. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9277. by the "purity" of the color (that is, how saturated it already is).
  9278. This filter is similar to the Adobe Photoshop Selective Color tool.
  9279. The filter accepts the following options:
  9280. @table @option
  9281. @item correction_method
  9282. Select color correction method.
  9283. Available values are:
  9284. @table @samp
  9285. @item absolute
  9286. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9287. component value).
  9288. @item relative
  9289. Specified adjustments are relative to the original component value.
  9290. @end table
  9291. Default is @code{absolute}.
  9292. @item reds
  9293. Adjustments for red pixels (pixels where the red component is the maximum)
  9294. @item yellows
  9295. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9296. @item greens
  9297. Adjustments for green pixels (pixels where the green component is the maximum)
  9298. @item cyans
  9299. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9300. @item blues
  9301. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9302. @item magentas
  9303. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9304. @item whites
  9305. Adjustments for white pixels (pixels where all components are greater than 128)
  9306. @item neutrals
  9307. Adjustments for all pixels except pure black and pure white
  9308. @item blacks
  9309. Adjustments for black pixels (pixels where all components are lesser than 128)
  9310. @item psfile
  9311. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9312. @end table
  9313. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9314. 4 space separated floating point adjustment values in the [-1,1] range,
  9315. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9316. pixels of its range.
  9317. @subsection Examples
  9318. @itemize
  9319. @item
  9320. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9321. increase magenta by 27% in blue areas:
  9322. @example
  9323. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9324. @end example
  9325. @item
  9326. Use a Photoshop selective color preset:
  9327. @example
  9328. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9329. @end example
  9330. @end itemize
  9331. @anchor{separatefields}
  9332. @section separatefields
  9333. The @code{separatefields} takes a frame-based video input and splits
  9334. each frame into its components fields, producing a new half height clip
  9335. with twice the frame rate and twice the frame count.
  9336. This filter use field-dominance information in frame to decide which
  9337. of each pair of fields to place first in the output.
  9338. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9339. @section setdar, setsar
  9340. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9341. output video.
  9342. This is done by changing the specified Sample (aka Pixel) Aspect
  9343. Ratio, according to the following equation:
  9344. @example
  9345. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9346. @end example
  9347. Keep in mind that the @code{setdar} filter does not modify the pixel
  9348. dimensions of the video frame. Also, the display aspect ratio set by
  9349. this filter may be changed by later filters in the filterchain,
  9350. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9351. applied.
  9352. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9353. the filter output video.
  9354. Note that as a consequence of the application of this filter, the
  9355. output display aspect ratio will change according to the equation
  9356. above.
  9357. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9358. filter may be changed by later filters in the filterchain, e.g. if
  9359. another "setsar" or a "setdar" filter is applied.
  9360. It accepts the following parameters:
  9361. @table @option
  9362. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9363. Set the aspect ratio used by the filter.
  9364. The parameter can be a floating point number string, an expression, or
  9365. a string of the form @var{num}:@var{den}, where @var{num} and
  9366. @var{den} are the numerator and denominator of the aspect ratio. If
  9367. the parameter is not specified, it is assumed the value "0".
  9368. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9369. should be escaped.
  9370. @item max
  9371. Set the maximum integer value to use for expressing numerator and
  9372. denominator when reducing the expressed aspect ratio to a rational.
  9373. Default value is @code{100}.
  9374. @end table
  9375. The parameter @var{sar} is an expression containing
  9376. the following constants:
  9377. @table @option
  9378. @item E, PI, PHI
  9379. These are approximated values for the mathematical constants e
  9380. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9381. @item w, h
  9382. The input width and height.
  9383. @item a
  9384. These are the same as @var{w} / @var{h}.
  9385. @item sar
  9386. The input sample aspect ratio.
  9387. @item dar
  9388. The input display aspect ratio. It is the same as
  9389. (@var{w} / @var{h}) * @var{sar}.
  9390. @item hsub, vsub
  9391. Horizontal and vertical chroma subsample values. For example, for the
  9392. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9393. @end table
  9394. @subsection Examples
  9395. @itemize
  9396. @item
  9397. To change the display aspect ratio to 16:9, specify one of the following:
  9398. @example
  9399. setdar=dar=1.77777
  9400. setdar=dar=16/9
  9401. @end example
  9402. @item
  9403. To change the sample aspect ratio to 10:11, specify:
  9404. @example
  9405. setsar=sar=10/11
  9406. @end example
  9407. @item
  9408. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9409. 1000 in the aspect ratio reduction, use the command:
  9410. @example
  9411. setdar=ratio=16/9:max=1000
  9412. @end example
  9413. @end itemize
  9414. @anchor{setfield}
  9415. @section setfield
  9416. Force field for the output video frame.
  9417. The @code{setfield} filter marks the interlace type field for the
  9418. output frames. It does not change the input frame, but only sets the
  9419. corresponding property, which affects how the frame is treated by
  9420. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9421. The filter accepts the following options:
  9422. @table @option
  9423. @item mode
  9424. Available values are:
  9425. @table @samp
  9426. @item auto
  9427. Keep the same field property.
  9428. @item bff
  9429. Mark the frame as bottom-field-first.
  9430. @item tff
  9431. Mark the frame as top-field-first.
  9432. @item prog
  9433. Mark the frame as progressive.
  9434. @end table
  9435. @end table
  9436. @section showinfo
  9437. Show a line containing various information for each input video frame.
  9438. The input video is not modified.
  9439. The shown line contains a sequence of key/value pairs of the form
  9440. @var{key}:@var{value}.
  9441. The following values are shown in the output:
  9442. @table @option
  9443. @item n
  9444. The (sequential) number of the input frame, starting from 0.
  9445. @item pts
  9446. The Presentation TimeStamp of the input frame, expressed as a number of
  9447. time base units. The time base unit depends on the filter input pad.
  9448. @item pts_time
  9449. The Presentation TimeStamp of the input frame, expressed as a number of
  9450. seconds.
  9451. @item pos
  9452. The position of the frame in the input stream, or -1 if this information is
  9453. unavailable and/or meaningless (for example in case of synthetic video).
  9454. @item fmt
  9455. The pixel format name.
  9456. @item sar
  9457. The sample aspect ratio of the input frame, expressed in the form
  9458. @var{num}/@var{den}.
  9459. @item s
  9460. The size of the input frame. For the syntax of this option, check the
  9461. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9462. @item i
  9463. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9464. for bottom field first).
  9465. @item iskey
  9466. This is 1 if the frame is a key frame, 0 otherwise.
  9467. @item type
  9468. The picture type of the input frame ("I" for an I-frame, "P" for a
  9469. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9470. Also refer to the documentation of the @code{AVPictureType} enum and of
  9471. the @code{av_get_picture_type_char} function defined in
  9472. @file{libavutil/avutil.h}.
  9473. @item checksum
  9474. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9475. @item plane_checksum
  9476. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9477. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9478. @end table
  9479. @section showpalette
  9480. Displays the 256 colors palette of each frame. This filter is only relevant for
  9481. @var{pal8} pixel format frames.
  9482. It accepts the following option:
  9483. @table @option
  9484. @item s
  9485. Set the size of the box used to represent one palette color entry. Default is
  9486. @code{30} (for a @code{30x30} pixel box).
  9487. @end table
  9488. @section shuffleframes
  9489. Reorder and/or duplicate and/or drop video frames.
  9490. It accepts the following parameters:
  9491. @table @option
  9492. @item mapping
  9493. Set the destination indexes of input frames.
  9494. This is space or '|' separated list of indexes that maps input frames to output
  9495. frames. Number of indexes also sets maximal value that each index may have.
  9496. '-1' index have special meaning and that is to drop frame.
  9497. @end table
  9498. The first frame has the index 0. The default is to keep the input unchanged.
  9499. @subsection Examples
  9500. @itemize
  9501. @item
  9502. Swap second and third frame of every three frames of the input:
  9503. @example
  9504. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9505. @end example
  9506. @item
  9507. Swap 10th and 1st frame of every ten frames of the input:
  9508. @example
  9509. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9510. @end example
  9511. @end itemize
  9512. @section shuffleplanes
  9513. Reorder and/or duplicate video planes.
  9514. It accepts the following parameters:
  9515. @table @option
  9516. @item map0
  9517. The index of the input plane to be used as the first output plane.
  9518. @item map1
  9519. The index of the input plane to be used as the second output plane.
  9520. @item map2
  9521. The index of the input plane to be used as the third output plane.
  9522. @item map3
  9523. The index of the input plane to be used as the fourth output plane.
  9524. @end table
  9525. The first plane has the index 0. The default is to keep the input unchanged.
  9526. @subsection Examples
  9527. @itemize
  9528. @item
  9529. Swap the second and third planes of the input:
  9530. @example
  9531. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9532. @end example
  9533. @end itemize
  9534. @anchor{signalstats}
  9535. @section signalstats
  9536. Evaluate various visual metrics that assist in determining issues associated
  9537. with the digitization of analog video media.
  9538. By default the filter will log these metadata values:
  9539. @table @option
  9540. @item YMIN
  9541. Display the minimal Y value contained within the input frame. Expressed in
  9542. range of [0-255].
  9543. @item YLOW
  9544. Display the Y value at the 10% percentile within the input frame. Expressed in
  9545. range of [0-255].
  9546. @item YAVG
  9547. Display the average Y value within the input frame. Expressed in range of
  9548. [0-255].
  9549. @item YHIGH
  9550. Display the Y value at the 90% percentile within the input frame. Expressed in
  9551. range of [0-255].
  9552. @item YMAX
  9553. Display the maximum Y value contained within the input frame. Expressed in
  9554. range of [0-255].
  9555. @item UMIN
  9556. Display the minimal U value contained within the input frame. Expressed in
  9557. range of [0-255].
  9558. @item ULOW
  9559. Display the U value at the 10% percentile within the input frame. Expressed in
  9560. range of [0-255].
  9561. @item UAVG
  9562. Display the average U value within the input frame. Expressed in range of
  9563. [0-255].
  9564. @item UHIGH
  9565. Display the U value at the 90% percentile within the input frame. Expressed in
  9566. range of [0-255].
  9567. @item UMAX
  9568. Display the maximum U value contained within the input frame. Expressed in
  9569. range of [0-255].
  9570. @item VMIN
  9571. Display the minimal V value contained within the input frame. Expressed in
  9572. range of [0-255].
  9573. @item VLOW
  9574. Display the V value at the 10% percentile within the input frame. Expressed in
  9575. range of [0-255].
  9576. @item VAVG
  9577. Display the average V value within the input frame. Expressed in range of
  9578. [0-255].
  9579. @item VHIGH
  9580. Display the V value at the 90% percentile within the input frame. Expressed in
  9581. range of [0-255].
  9582. @item VMAX
  9583. Display the maximum V value contained within the input frame. Expressed in
  9584. range of [0-255].
  9585. @item SATMIN
  9586. Display the minimal saturation value contained within the input frame.
  9587. Expressed in range of [0-~181.02].
  9588. @item SATLOW
  9589. Display the saturation value at the 10% percentile within the input frame.
  9590. Expressed in range of [0-~181.02].
  9591. @item SATAVG
  9592. Display the average saturation value within the input frame. Expressed in range
  9593. of [0-~181.02].
  9594. @item SATHIGH
  9595. Display the saturation value at the 90% percentile within the input frame.
  9596. Expressed in range of [0-~181.02].
  9597. @item SATMAX
  9598. Display the maximum saturation value contained within the input frame.
  9599. Expressed in range of [0-~181.02].
  9600. @item HUEMED
  9601. Display the median value for hue within the input frame. Expressed in range of
  9602. [0-360].
  9603. @item HUEAVG
  9604. Display the average value for hue within the input frame. Expressed in range of
  9605. [0-360].
  9606. @item YDIF
  9607. Display the average of sample value difference between all values of the Y
  9608. plane in the current frame and corresponding values of the previous input frame.
  9609. Expressed in range of [0-255].
  9610. @item UDIF
  9611. Display the average of sample value difference between all values of the U
  9612. plane in the current frame and corresponding values of the previous input frame.
  9613. Expressed in range of [0-255].
  9614. @item VDIF
  9615. Display the average of sample value difference between all values of the V
  9616. plane in the current frame and corresponding values of the previous input frame.
  9617. Expressed in range of [0-255].
  9618. @item YBITDEPTH
  9619. Display bit depth of Y plane in current frame.
  9620. Expressed in range of [0-16].
  9621. @item UBITDEPTH
  9622. Display bit depth of U plane in current frame.
  9623. Expressed in range of [0-16].
  9624. @item VBITDEPTH
  9625. Display bit depth of V plane in current frame.
  9626. Expressed in range of [0-16].
  9627. @end table
  9628. The filter accepts the following options:
  9629. @table @option
  9630. @item stat
  9631. @item out
  9632. @option{stat} specify an additional form of image analysis.
  9633. @option{out} output video with the specified type of pixel highlighted.
  9634. Both options accept the following values:
  9635. @table @samp
  9636. @item tout
  9637. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9638. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9639. include the results of video dropouts, head clogs, or tape tracking issues.
  9640. @item vrep
  9641. Identify @var{vertical line repetition}. Vertical line repetition includes
  9642. similar rows of pixels within a frame. In born-digital video vertical line
  9643. repetition is common, but this pattern is uncommon in video digitized from an
  9644. analog source. When it occurs in video that results from the digitization of an
  9645. analog source it can indicate concealment from a dropout compensator.
  9646. @item brng
  9647. Identify pixels that fall outside of legal broadcast range.
  9648. @end table
  9649. @item color, c
  9650. Set the highlight color for the @option{out} option. The default color is
  9651. yellow.
  9652. @end table
  9653. @subsection Examples
  9654. @itemize
  9655. @item
  9656. Output data of various video metrics:
  9657. @example
  9658. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9659. @end example
  9660. @item
  9661. Output specific data about the minimum and maximum values of the Y plane per frame:
  9662. @example
  9663. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9664. @end example
  9665. @item
  9666. Playback video while highlighting pixels that are outside of broadcast range in red.
  9667. @example
  9668. ffplay example.mov -vf signalstats="out=brng:color=red"
  9669. @end example
  9670. @item
  9671. Playback video with signalstats metadata drawn over the frame.
  9672. @example
  9673. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9674. @end example
  9675. The contents of signalstat_drawtext.txt used in the command are:
  9676. @example
  9677. time %@{pts:hms@}
  9678. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9679. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9680. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9681. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9682. @end example
  9683. @end itemize
  9684. @anchor{signature}
  9685. @section signature
  9686. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  9687. input. In this case the matching between the inputs can be calculated additionally.
  9688. The filter always passes through the first input. The signature of each stream can
  9689. be written into a file.
  9690. It accepts the following options:
  9691. @table @option
  9692. @item detectmode
  9693. Enable or disable the matching process.
  9694. Available values are:
  9695. @table @samp
  9696. @item off
  9697. Disable the calculation of a matching (default).
  9698. @item full
  9699. Calculate the matching for the whole video and output whether the whole video
  9700. matches or only parts.
  9701. @item fast
  9702. Calculate only until a matching is found or the video ends. Should be faster in
  9703. some cases.
  9704. @end table
  9705. @item nb_inputs
  9706. Set the number of inputs. The option value must be a non negative integer.
  9707. Default value is 1.
  9708. @item filename
  9709. Set the path to which the output is written. If there is more than one input,
  9710. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  9711. integer), that will be replaced with the input number. If no filename is
  9712. specified, no output will be written. This is the default.
  9713. @item format
  9714. Choose the output format.
  9715. Available values are:
  9716. @table @samp
  9717. @item binary
  9718. Use the specified binary representation (default).
  9719. @item xml
  9720. Use the specified xml representation.
  9721. @end table
  9722. @item th_d
  9723. Set threshold to detect one word as similar. The option value must be an integer
  9724. greater than zero. The default value is 9000.
  9725. @item th_dc
  9726. Set threshold to detect all words as similar. The option value must be an integer
  9727. greater than zero. The default value is 60000.
  9728. @item th_xh
  9729. Set threshold to detect frames as similar. The option value must be an integer
  9730. greater than zero. The default value is 116.
  9731. @item th_di
  9732. Set the minimum length of a sequence in frames to recognize it as matching
  9733. sequence. The option value must be a non negative integer value.
  9734. The default value is 0.
  9735. @item th_it
  9736. Set the minimum relation, that matching frames to all frames must have.
  9737. The option value must be a double value between 0 and 1. The default value is 0.5.
  9738. @end table
  9739. @subsection Examples
  9740. @itemize
  9741. @item
  9742. To calculate the signature of an input video and store it in signature.bin:
  9743. @example
  9744. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  9745. @end example
  9746. @item
  9747. To detect whether two videos match and store the signatures in XML format in
  9748. signature0.xml and signature1.xml:
  9749. @example
  9750. 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 -
  9751. @end example
  9752. @end itemize
  9753. @anchor{smartblur}
  9754. @section smartblur
  9755. Blur the input video without impacting the outlines.
  9756. It accepts the following options:
  9757. @table @option
  9758. @item luma_radius, lr
  9759. Set the luma radius. The option value must be a float number in
  9760. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9761. used to blur the image (slower if larger). Default value is 1.0.
  9762. @item luma_strength, ls
  9763. Set the luma strength. The option value must be a float number
  9764. in the range [-1.0,1.0] that configures the blurring. A value included
  9765. in [0.0,1.0] will blur the image whereas a value included in
  9766. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9767. @item luma_threshold, lt
  9768. Set the luma threshold used as a coefficient to determine
  9769. whether a pixel should be blurred or not. The option value must be an
  9770. integer in the range [-30,30]. A value of 0 will filter all the image,
  9771. a value included in [0,30] will filter flat areas and a value included
  9772. in [-30,0] will filter edges. Default value is 0.
  9773. @item chroma_radius, cr
  9774. Set the chroma radius. The option value must be a float number in
  9775. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9776. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  9777. @item chroma_strength, cs
  9778. Set the chroma strength. The option value must be a float number
  9779. in the range [-1.0,1.0] that configures the blurring. A value included
  9780. in [0.0,1.0] will blur the image whereas a value included in
  9781. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  9782. @item chroma_threshold, ct
  9783. Set the chroma threshold used as a coefficient to determine
  9784. whether a pixel should be blurred or not. The option value must be an
  9785. integer in the range [-30,30]. A value of 0 will filter all the image,
  9786. a value included in [0,30] will filter flat areas and a value included
  9787. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  9788. @end table
  9789. If a chroma option is not explicitly set, the corresponding luma value
  9790. is set.
  9791. @section ssim
  9792. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9793. This filter takes in input two input videos, the first input is
  9794. considered the "main" source and is passed unchanged to the
  9795. output. The second input is used as a "reference" video for computing
  9796. the SSIM.
  9797. Both video inputs must have the same resolution and pixel format for
  9798. this filter to work correctly. Also it assumes that both inputs
  9799. have the same number of frames, which are compared one by one.
  9800. The filter stores the calculated SSIM of each frame.
  9801. The description of the accepted parameters follows.
  9802. @table @option
  9803. @item stats_file, f
  9804. If specified the filter will use the named file to save the SSIM of
  9805. each individual frame. When filename equals "-" the data is sent to
  9806. standard output.
  9807. @end table
  9808. The file printed if @var{stats_file} is selected, contains a sequence of
  9809. key/value pairs of the form @var{key}:@var{value} for each compared
  9810. couple of frames.
  9811. A description of each shown parameter follows:
  9812. @table @option
  9813. @item n
  9814. sequential number of the input frame, starting from 1
  9815. @item Y, U, V, R, G, B
  9816. SSIM of the compared frames for the component specified by the suffix.
  9817. @item All
  9818. SSIM of the compared frames for the whole frame.
  9819. @item dB
  9820. Same as above but in dB representation.
  9821. @end table
  9822. For example:
  9823. @example
  9824. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9825. [main][ref] ssim="stats_file=stats.log" [out]
  9826. @end example
  9827. On this example the input file being processed is compared with the
  9828. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9829. is stored in @file{stats.log}.
  9830. Another example with both psnr and ssim at same time:
  9831. @example
  9832. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9833. @end example
  9834. @section stereo3d
  9835. Convert between different stereoscopic image formats.
  9836. The filters accept the following options:
  9837. @table @option
  9838. @item in
  9839. Set stereoscopic image format of input.
  9840. Available values for input image formats are:
  9841. @table @samp
  9842. @item sbsl
  9843. side by side parallel (left eye left, right eye right)
  9844. @item sbsr
  9845. side by side crosseye (right eye left, left eye right)
  9846. @item sbs2l
  9847. side by side parallel with half width resolution
  9848. (left eye left, right eye right)
  9849. @item sbs2r
  9850. side by side crosseye with half width resolution
  9851. (right eye left, left eye right)
  9852. @item abl
  9853. above-below (left eye above, right eye below)
  9854. @item abr
  9855. above-below (right eye above, left eye below)
  9856. @item ab2l
  9857. above-below with half height resolution
  9858. (left eye above, right eye below)
  9859. @item ab2r
  9860. above-below with half height resolution
  9861. (right eye above, left eye below)
  9862. @item al
  9863. alternating frames (left eye first, right eye second)
  9864. @item ar
  9865. alternating frames (right eye first, left eye second)
  9866. @item irl
  9867. interleaved rows (left eye has top row, right eye starts on next row)
  9868. @item irr
  9869. interleaved rows (right eye has top row, left eye starts on next row)
  9870. @item icl
  9871. interleaved columns, left eye first
  9872. @item icr
  9873. interleaved columns, right eye first
  9874. Default value is @samp{sbsl}.
  9875. @end table
  9876. @item out
  9877. Set stereoscopic image format of output.
  9878. @table @samp
  9879. @item sbsl
  9880. side by side parallel (left eye left, right eye right)
  9881. @item sbsr
  9882. side by side crosseye (right eye left, left eye right)
  9883. @item sbs2l
  9884. side by side parallel with half width resolution
  9885. (left eye left, right eye right)
  9886. @item sbs2r
  9887. side by side crosseye with half width resolution
  9888. (right eye left, left eye right)
  9889. @item abl
  9890. above-below (left eye above, right eye below)
  9891. @item abr
  9892. above-below (right eye above, left eye below)
  9893. @item ab2l
  9894. above-below with half height resolution
  9895. (left eye above, right eye below)
  9896. @item ab2r
  9897. above-below with half height resolution
  9898. (right eye above, left eye below)
  9899. @item al
  9900. alternating frames (left eye first, right eye second)
  9901. @item ar
  9902. alternating frames (right eye first, left eye second)
  9903. @item irl
  9904. interleaved rows (left eye has top row, right eye starts on next row)
  9905. @item irr
  9906. interleaved rows (right eye has top row, left eye starts on next row)
  9907. @item arbg
  9908. anaglyph red/blue gray
  9909. (red filter on left eye, blue filter on right eye)
  9910. @item argg
  9911. anaglyph red/green gray
  9912. (red filter on left eye, green filter on right eye)
  9913. @item arcg
  9914. anaglyph red/cyan gray
  9915. (red filter on left eye, cyan filter on right eye)
  9916. @item arch
  9917. anaglyph red/cyan half colored
  9918. (red filter on left eye, cyan filter on right eye)
  9919. @item arcc
  9920. anaglyph red/cyan color
  9921. (red filter on left eye, cyan filter on right eye)
  9922. @item arcd
  9923. anaglyph red/cyan color optimized with the least squares projection of dubois
  9924. (red filter on left eye, cyan filter on right eye)
  9925. @item agmg
  9926. anaglyph green/magenta gray
  9927. (green filter on left eye, magenta filter on right eye)
  9928. @item agmh
  9929. anaglyph green/magenta half colored
  9930. (green filter on left eye, magenta filter on right eye)
  9931. @item agmc
  9932. anaglyph green/magenta colored
  9933. (green filter on left eye, magenta filter on right eye)
  9934. @item agmd
  9935. anaglyph green/magenta color optimized with the least squares projection of dubois
  9936. (green filter on left eye, magenta filter on right eye)
  9937. @item aybg
  9938. anaglyph yellow/blue gray
  9939. (yellow filter on left eye, blue filter on right eye)
  9940. @item aybh
  9941. anaglyph yellow/blue half colored
  9942. (yellow filter on left eye, blue filter on right eye)
  9943. @item aybc
  9944. anaglyph yellow/blue colored
  9945. (yellow filter on left eye, blue filter on right eye)
  9946. @item aybd
  9947. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9948. (yellow filter on left eye, blue filter on right eye)
  9949. @item ml
  9950. mono output (left eye only)
  9951. @item mr
  9952. mono output (right eye only)
  9953. @item chl
  9954. checkerboard, left eye first
  9955. @item chr
  9956. checkerboard, right eye first
  9957. @item icl
  9958. interleaved columns, left eye first
  9959. @item icr
  9960. interleaved columns, right eye first
  9961. @item hdmi
  9962. HDMI frame pack
  9963. @end table
  9964. Default value is @samp{arcd}.
  9965. @end table
  9966. @subsection Examples
  9967. @itemize
  9968. @item
  9969. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9970. @example
  9971. stereo3d=sbsl:aybd
  9972. @end example
  9973. @item
  9974. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9975. @example
  9976. stereo3d=abl:sbsr
  9977. @end example
  9978. @end itemize
  9979. @section streamselect, astreamselect
  9980. Select video or audio streams.
  9981. The filter accepts the following options:
  9982. @table @option
  9983. @item inputs
  9984. Set number of inputs. Default is 2.
  9985. @item map
  9986. Set input indexes to remap to outputs.
  9987. @end table
  9988. @subsection Commands
  9989. The @code{streamselect} and @code{astreamselect} filter supports the following
  9990. commands:
  9991. @table @option
  9992. @item map
  9993. Set input indexes to remap to outputs.
  9994. @end table
  9995. @subsection Examples
  9996. @itemize
  9997. @item
  9998. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9999. @example
  10000. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10001. @end example
  10002. @item
  10003. Same as above, but for audio:
  10004. @example
  10005. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10006. @end example
  10007. @end itemize
  10008. @section sobel
  10009. Apply sobel operator to input video stream.
  10010. The filter accepts the following option:
  10011. @table @option
  10012. @item planes
  10013. Set which planes will be processed, unprocessed planes will be copied.
  10014. By default value 0xf, all planes will be processed.
  10015. @item scale
  10016. Set value which will be multiplied with filtered result.
  10017. @item delta
  10018. Set value which will be added to filtered result.
  10019. @end table
  10020. @anchor{spp}
  10021. @section spp
  10022. Apply a simple postprocessing filter that compresses and decompresses the image
  10023. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10024. and average the results.
  10025. The filter accepts the following options:
  10026. @table @option
  10027. @item quality
  10028. Set quality. This option defines the number of levels for averaging. It accepts
  10029. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10030. effect. A value of @code{6} means the higher quality. For each increment of
  10031. that value the speed drops by a factor of approximately 2. Default value is
  10032. @code{3}.
  10033. @item qp
  10034. Force a constant quantization parameter. If not set, the filter will use the QP
  10035. from the video stream (if available).
  10036. @item mode
  10037. Set thresholding mode. Available modes are:
  10038. @table @samp
  10039. @item hard
  10040. Set hard thresholding (default).
  10041. @item soft
  10042. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10043. @end table
  10044. @item use_bframe_qp
  10045. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10046. option may cause flicker since the B-Frames have often larger QP. Default is
  10047. @code{0} (not enabled).
  10048. @end table
  10049. @anchor{subtitles}
  10050. @section subtitles
  10051. Draw subtitles on top of input video using the libass library.
  10052. To enable compilation of this filter you need to configure FFmpeg with
  10053. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10054. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10055. Alpha) subtitles format.
  10056. The filter accepts the following options:
  10057. @table @option
  10058. @item filename, f
  10059. Set the filename of the subtitle file to read. It must be specified.
  10060. @item original_size
  10061. Specify the size of the original video, the video for which the ASS file
  10062. was composed. For the syntax of this option, check the
  10063. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10064. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10065. correctly scale the fonts if the aspect ratio has been changed.
  10066. @item fontsdir
  10067. Set a directory path containing fonts that can be used by the filter.
  10068. These fonts will be used in addition to whatever the font provider uses.
  10069. @item charenc
  10070. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10071. useful if not UTF-8.
  10072. @item stream_index, si
  10073. Set subtitles stream index. @code{subtitles} filter only.
  10074. @item force_style
  10075. Override default style or script info parameters of the subtitles. It accepts a
  10076. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10077. @end table
  10078. If the first key is not specified, it is assumed that the first value
  10079. specifies the @option{filename}.
  10080. For example, to render the file @file{sub.srt} on top of the input
  10081. video, use the command:
  10082. @example
  10083. subtitles=sub.srt
  10084. @end example
  10085. which is equivalent to:
  10086. @example
  10087. subtitles=filename=sub.srt
  10088. @end example
  10089. To render the default subtitles stream from file @file{video.mkv}, use:
  10090. @example
  10091. subtitles=video.mkv
  10092. @end example
  10093. To render the second subtitles stream from that file, use:
  10094. @example
  10095. subtitles=video.mkv:si=1
  10096. @end example
  10097. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10098. @code{DejaVu Serif}, use:
  10099. @example
  10100. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10101. @end example
  10102. @section super2xsai
  10103. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10104. Interpolate) pixel art scaling algorithm.
  10105. Useful for enlarging pixel art images without reducing sharpness.
  10106. @section swaprect
  10107. Swap two rectangular objects in video.
  10108. This filter accepts the following options:
  10109. @table @option
  10110. @item w
  10111. Set object width.
  10112. @item h
  10113. Set object height.
  10114. @item x1
  10115. Set 1st rect x coordinate.
  10116. @item y1
  10117. Set 1st rect y coordinate.
  10118. @item x2
  10119. Set 2nd rect x coordinate.
  10120. @item y2
  10121. Set 2nd rect y coordinate.
  10122. All expressions are evaluated once for each frame.
  10123. @end table
  10124. The all options are expressions containing the following constants:
  10125. @table @option
  10126. @item w
  10127. @item h
  10128. The input width and height.
  10129. @item a
  10130. same as @var{w} / @var{h}
  10131. @item sar
  10132. input sample aspect ratio
  10133. @item dar
  10134. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10135. @item n
  10136. The number of the input frame, starting from 0.
  10137. @item t
  10138. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10139. @item pos
  10140. the position in the file of the input frame, NAN if unknown
  10141. @end table
  10142. @section swapuv
  10143. Swap U & V plane.
  10144. @section telecine
  10145. Apply telecine process to the video.
  10146. This filter accepts the following options:
  10147. @table @option
  10148. @item first_field
  10149. @table @samp
  10150. @item top, t
  10151. top field first
  10152. @item bottom, b
  10153. bottom field first
  10154. The default value is @code{top}.
  10155. @end table
  10156. @item pattern
  10157. A string of numbers representing the pulldown pattern you wish to apply.
  10158. The default value is @code{23}.
  10159. @end table
  10160. @example
  10161. Some typical patterns:
  10162. NTSC output (30i):
  10163. 27.5p: 32222
  10164. 24p: 23 (classic)
  10165. 24p: 2332 (preferred)
  10166. 20p: 33
  10167. 18p: 334
  10168. 16p: 3444
  10169. PAL output (25i):
  10170. 27.5p: 12222
  10171. 24p: 222222222223 ("Euro pulldown")
  10172. 16.67p: 33
  10173. 16p: 33333334
  10174. @end example
  10175. @section threshold
  10176. Apply threshold effect to video stream.
  10177. This filter needs four video streams to perform thresholding.
  10178. First stream is stream we are filtering.
  10179. Second stream is holding threshold values, third stream is holding min values,
  10180. and last, fourth stream is holding max values.
  10181. The filter accepts the following option:
  10182. @table @option
  10183. @item planes
  10184. Set which planes will be processed, unprocessed planes will be copied.
  10185. By default value 0xf, all planes will be processed.
  10186. @end table
  10187. For example if first stream pixel's component value is less then threshold value
  10188. of pixel component from 2nd threshold stream, third stream value will picked,
  10189. otherwise fourth stream pixel component value will be picked.
  10190. Using color source filter one can perform various types of thresholding:
  10191. @subsection Examples
  10192. @itemize
  10193. @item
  10194. Binary threshold, using gray color as threshold:
  10195. @example
  10196. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10197. @end example
  10198. @item
  10199. Inverted binary threshold, using gray color as threshold:
  10200. @example
  10201. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10202. @end example
  10203. @item
  10204. Truncate binary threshold, using gray color as threshold:
  10205. @example
  10206. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10207. @end example
  10208. @item
  10209. Threshold to zero, using gray color as threshold:
  10210. @example
  10211. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10212. @end example
  10213. @item
  10214. Inverted threshold to zero, using gray color as threshold:
  10215. @example
  10216. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10217. @end example
  10218. @end itemize
  10219. @section thumbnail
  10220. Select the most representative frame in a given sequence of consecutive frames.
  10221. The filter accepts the following options:
  10222. @table @option
  10223. @item n
  10224. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10225. will pick one of them, and then handle the next batch of @var{n} frames until
  10226. the end. Default is @code{100}.
  10227. @end table
  10228. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10229. value will result in a higher memory usage, so a high value is not recommended.
  10230. @subsection Examples
  10231. @itemize
  10232. @item
  10233. Extract one picture each 50 frames:
  10234. @example
  10235. thumbnail=50
  10236. @end example
  10237. @item
  10238. Complete example of a thumbnail creation with @command{ffmpeg}:
  10239. @example
  10240. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10241. @end example
  10242. @end itemize
  10243. @section tile
  10244. Tile several successive frames together.
  10245. The filter accepts the following options:
  10246. @table @option
  10247. @item layout
  10248. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10249. this option, check the
  10250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10251. @item nb_frames
  10252. Set the maximum number of frames to render in the given area. It must be less
  10253. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10254. the area will be used.
  10255. @item margin
  10256. Set the outer border margin in pixels.
  10257. @item padding
  10258. Set the inner border thickness (i.e. the number of pixels between frames). For
  10259. more advanced padding options (such as having different values for the edges),
  10260. refer to the pad video filter.
  10261. @item color
  10262. Specify the color of the unused area. For the syntax of this option, check the
  10263. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10264. is "black".
  10265. @end table
  10266. @subsection Examples
  10267. @itemize
  10268. @item
  10269. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10270. @example
  10271. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10272. @end example
  10273. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10274. duplicating each output frame to accommodate the originally detected frame
  10275. rate.
  10276. @item
  10277. Display @code{5} pictures in an area of @code{3x2} frames,
  10278. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10279. mixed flat and named options:
  10280. @example
  10281. tile=3x2:nb_frames=5:padding=7:margin=2
  10282. @end example
  10283. @end itemize
  10284. @section tinterlace
  10285. Perform various types of temporal field interlacing.
  10286. Frames are counted starting from 1, so the first input frame is
  10287. considered odd.
  10288. The filter accepts the following options:
  10289. @table @option
  10290. @item mode
  10291. Specify the mode of the interlacing. This option can also be specified
  10292. as a value alone. See below for a list of values for this option.
  10293. Available values are:
  10294. @table @samp
  10295. @item merge, 0
  10296. Move odd frames into the upper field, even into the lower field,
  10297. generating a double height frame at half frame rate.
  10298. @example
  10299. ------> time
  10300. Input:
  10301. Frame 1 Frame 2 Frame 3 Frame 4
  10302. 11111 22222 33333 44444
  10303. 11111 22222 33333 44444
  10304. 11111 22222 33333 44444
  10305. 11111 22222 33333 44444
  10306. Output:
  10307. 11111 33333
  10308. 22222 44444
  10309. 11111 33333
  10310. 22222 44444
  10311. 11111 33333
  10312. 22222 44444
  10313. 11111 33333
  10314. 22222 44444
  10315. @end example
  10316. @item drop_even, 1
  10317. Only output odd frames, even frames are dropped, generating a frame with
  10318. unchanged height at half frame rate.
  10319. @example
  10320. ------> time
  10321. Input:
  10322. Frame 1 Frame 2 Frame 3 Frame 4
  10323. 11111 22222 33333 44444
  10324. 11111 22222 33333 44444
  10325. 11111 22222 33333 44444
  10326. 11111 22222 33333 44444
  10327. Output:
  10328. 11111 33333
  10329. 11111 33333
  10330. 11111 33333
  10331. 11111 33333
  10332. @end example
  10333. @item drop_odd, 2
  10334. Only output even frames, odd frames are dropped, generating a frame with
  10335. unchanged height at half frame rate.
  10336. @example
  10337. ------> time
  10338. Input:
  10339. Frame 1 Frame 2 Frame 3 Frame 4
  10340. 11111 22222 33333 44444
  10341. 11111 22222 33333 44444
  10342. 11111 22222 33333 44444
  10343. 11111 22222 33333 44444
  10344. Output:
  10345. 22222 44444
  10346. 22222 44444
  10347. 22222 44444
  10348. 22222 44444
  10349. @end example
  10350. @item pad, 3
  10351. Expand each frame to full height, but pad alternate lines with black,
  10352. generating a frame with double height at the same input frame rate.
  10353. @example
  10354. ------> time
  10355. Input:
  10356. Frame 1 Frame 2 Frame 3 Frame 4
  10357. 11111 22222 33333 44444
  10358. 11111 22222 33333 44444
  10359. 11111 22222 33333 44444
  10360. 11111 22222 33333 44444
  10361. Output:
  10362. 11111 ..... 33333 .....
  10363. ..... 22222 ..... 44444
  10364. 11111 ..... 33333 .....
  10365. ..... 22222 ..... 44444
  10366. 11111 ..... 33333 .....
  10367. ..... 22222 ..... 44444
  10368. 11111 ..... 33333 .....
  10369. ..... 22222 ..... 44444
  10370. @end example
  10371. @item interleave_top, 4
  10372. Interleave the upper field from odd frames with the lower field from
  10373. even frames, generating a frame with unchanged height at half frame rate.
  10374. @example
  10375. ------> time
  10376. Input:
  10377. Frame 1 Frame 2 Frame 3 Frame 4
  10378. 11111<- 22222 33333<- 44444
  10379. 11111 22222<- 33333 44444<-
  10380. 11111<- 22222 33333<- 44444
  10381. 11111 22222<- 33333 44444<-
  10382. Output:
  10383. 11111 33333
  10384. 22222 44444
  10385. 11111 33333
  10386. 22222 44444
  10387. @end example
  10388. @item interleave_bottom, 5
  10389. Interleave the lower field from odd frames with the upper field from
  10390. even frames, generating a frame with unchanged height at half frame rate.
  10391. @example
  10392. ------> time
  10393. Input:
  10394. Frame 1 Frame 2 Frame 3 Frame 4
  10395. 11111 22222<- 33333 44444<-
  10396. 11111<- 22222 33333<- 44444
  10397. 11111 22222<- 33333 44444<-
  10398. 11111<- 22222 33333<- 44444
  10399. Output:
  10400. 22222 44444
  10401. 11111 33333
  10402. 22222 44444
  10403. 11111 33333
  10404. @end example
  10405. @item interlacex2, 6
  10406. Double frame rate with unchanged height. Frames are inserted each
  10407. containing the second temporal field from the previous input frame and
  10408. the first temporal field from the next input frame. This mode relies on
  10409. the top_field_first flag. Useful for interlaced video displays with no
  10410. field synchronisation.
  10411. @example
  10412. ------> time
  10413. Input:
  10414. Frame 1 Frame 2 Frame 3 Frame 4
  10415. 11111 22222 33333 44444
  10416. 11111 22222 33333 44444
  10417. 11111 22222 33333 44444
  10418. 11111 22222 33333 44444
  10419. Output:
  10420. 11111 22222 22222 33333 33333 44444 44444
  10421. 11111 11111 22222 22222 33333 33333 44444
  10422. 11111 22222 22222 33333 33333 44444 44444
  10423. 11111 11111 22222 22222 33333 33333 44444
  10424. @end example
  10425. @item mergex2, 7
  10426. Move odd frames into the upper field, even into the lower field,
  10427. generating a double height frame at same frame rate.
  10428. @example
  10429. ------> time
  10430. Input:
  10431. Frame 1 Frame 2 Frame 3 Frame 4
  10432. 11111 22222 33333 44444
  10433. 11111 22222 33333 44444
  10434. 11111 22222 33333 44444
  10435. 11111 22222 33333 44444
  10436. Output:
  10437. 11111 33333 33333 55555
  10438. 22222 22222 44444 44444
  10439. 11111 33333 33333 55555
  10440. 22222 22222 44444 44444
  10441. 11111 33333 33333 55555
  10442. 22222 22222 44444 44444
  10443. 11111 33333 33333 55555
  10444. 22222 22222 44444 44444
  10445. @end example
  10446. @end table
  10447. Numeric values are deprecated but are accepted for backward
  10448. compatibility reasons.
  10449. Default mode is @code{merge}.
  10450. @item flags
  10451. Specify flags influencing the filter process.
  10452. Available value for @var{flags} is:
  10453. @table @option
  10454. @item low_pass_filter, vlfp
  10455. Enable vertical low-pass filtering in the filter.
  10456. Vertical low-pass filtering is required when creating an interlaced
  10457. destination from a progressive source which contains high-frequency
  10458. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10459. patterning.
  10460. Vertical low-pass filtering can only be enabled for @option{mode}
  10461. @var{interleave_top} and @var{interleave_bottom}.
  10462. @end table
  10463. @end table
  10464. @section transpose
  10465. Transpose rows with columns in the input video and optionally flip it.
  10466. It accepts the following parameters:
  10467. @table @option
  10468. @item dir
  10469. Specify the transposition direction.
  10470. Can assume the following values:
  10471. @table @samp
  10472. @item 0, 4, cclock_flip
  10473. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10474. @example
  10475. L.R L.l
  10476. . . -> . .
  10477. l.r R.r
  10478. @end example
  10479. @item 1, 5, clock
  10480. Rotate by 90 degrees clockwise, that is:
  10481. @example
  10482. L.R l.L
  10483. . . -> . .
  10484. l.r r.R
  10485. @end example
  10486. @item 2, 6, cclock
  10487. Rotate by 90 degrees counterclockwise, that is:
  10488. @example
  10489. L.R R.r
  10490. . . -> . .
  10491. l.r L.l
  10492. @end example
  10493. @item 3, 7, clock_flip
  10494. Rotate by 90 degrees clockwise and vertically flip, that is:
  10495. @example
  10496. L.R r.R
  10497. . . -> . .
  10498. l.r l.L
  10499. @end example
  10500. @end table
  10501. For values between 4-7, the transposition is only done if the input
  10502. video geometry is portrait and not landscape. These values are
  10503. deprecated, the @code{passthrough} option should be used instead.
  10504. Numerical values are deprecated, and should be dropped in favor of
  10505. symbolic constants.
  10506. @item passthrough
  10507. Do not apply the transposition if the input geometry matches the one
  10508. specified by the specified value. It accepts the following values:
  10509. @table @samp
  10510. @item none
  10511. Always apply transposition.
  10512. @item portrait
  10513. Preserve portrait geometry (when @var{height} >= @var{width}).
  10514. @item landscape
  10515. Preserve landscape geometry (when @var{width} >= @var{height}).
  10516. @end table
  10517. Default value is @code{none}.
  10518. @end table
  10519. For example to rotate by 90 degrees clockwise and preserve portrait
  10520. layout:
  10521. @example
  10522. transpose=dir=1:passthrough=portrait
  10523. @end example
  10524. The command above can also be specified as:
  10525. @example
  10526. transpose=1:portrait
  10527. @end example
  10528. @section trim
  10529. Trim the input so that the output contains one continuous subpart of the input.
  10530. It accepts the following parameters:
  10531. @table @option
  10532. @item start
  10533. Specify the time of the start of the kept section, i.e. the frame with the
  10534. timestamp @var{start} will be the first frame in the output.
  10535. @item end
  10536. Specify the time of the first frame that will be dropped, i.e. the frame
  10537. immediately preceding the one with the timestamp @var{end} will be the last
  10538. frame in the output.
  10539. @item start_pts
  10540. This is the same as @var{start}, except this option sets the start timestamp
  10541. in timebase units instead of seconds.
  10542. @item end_pts
  10543. This is the same as @var{end}, except this option sets the end timestamp
  10544. in timebase units instead of seconds.
  10545. @item duration
  10546. The maximum duration of the output in seconds.
  10547. @item start_frame
  10548. The number of the first frame that should be passed to the output.
  10549. @item end_frame
  10550. The number of the first frame that should be dropped.
  10551. @end table
  10552. @option{start}, @option{end}, and @option{duration} are expressed as time
  10553. duration specifications; see
  10554. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10555. for the accepted syntax.
  10556. Note that the first two sets of the start/end options and the @option{duration}
  10557. option look at the frame timestamp, while the _frame variants simply count the
  10558. frames that pass through the filter. Also note that this filter does not modify
  10559. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10560. setpts filter after the trim filter.
  10561. If multiple start or end options are set, this filter tries to be greedy and
  10562. keep all the frames that match at least one of the specified constraints. To keep
  10563. only the part that matches all the constraints at once, chain multiple trim
  10564. filters.
  10565. The defaults are such that all the input is kept. So it is possible to set e.g.
  10566. just the end values to keep everything before the specified time.
  10567. Examples:
  10568. @itemize
  10569. @item
  10570. Drop everything except the second minute of input:
  10571. @example
  10572. ffmpeg -i INPUT -vf trim=60:120
  10573. @end example
  10574. @item
  10575. Keep only the first second:
  10576. @example
  10577. ffmpeg -i INPUT -vf trim=duration=1
  10578. @end example
  10579. @end itemize
  10580. @anchor{unsharp}
  10581. @section unsharp
  10582. Sharpen or blur the input video.
  10583. It accepts the following parameters:
  10584. @table @option
  10585. @item luma_msize_x, lx
  10586. Set the luma matrix horizontal size. It must be an odd integer between
  10587. 3 and 23. The default value is 5.
  10588. @item luma_msize_y, ly
  10589. Set the luma matrix vertical size. It must be an odd integer between 3
  10590. and 23. The default value is 5.
  10591. @item luma_amount, la
  10592. Set the luma effect strength. It must be a floating point number, reasonable
  10593. values lay between -1.5 and 1.5.
  10594. Negative values will blur the input video, while positive values will
  10595. sharpen it, a value of zero will disable the effect.
  10596. Default value is 1.0.
  10597. @item chroma_msize_x, cx
  10598. Set the chroma matrix horizontal size. It must be an odd integer
  10599. between 3 and 23. The default value is 5.
  10600. @item chroma_msize_y, cy
  10601. Set the chroma matrix vertical size. It must be an odd integer
  10602. between 3 and 23. The default value is 5.
  10603. @item chroma_amount, ca
  10604. Set the chroma effect strength. It must be a floating point number, reasonable
  10605. values lay between -1.5 and 1.5.
  10606. Negative values will blur the input video, while positive values will
  10607. sharpen it, a value of zero will disable the effect.
  10608. Default value is 0.0.
  10609. @item opencl
  10610. If set to 1, specify using OpenCL capabilities, only available if
  10611. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10612. @end table
  10613. All parameters are optional and default to the equivalent of the
  10614. string '5:5:1.0:5:5:0.0'.
  10615. @subsection Examples
  10616. @itemize
  10617. @item
  10618. Apply strong luma sharpen effect:
  10619. @example
  10620. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10621. @end example
  10622. @item
  10623. Apply a strong blur of both luma and chroma parameters:
  10624. @example
  10625. unsharp=7:7:-2:7:7:-2
  10626. @end example
  10627. @end itemize
  10628. @section uspp
  10629. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10630. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10631. shifts and average the results.
  10632. The way this differs from the behavior of spp is that uspp actually encodes &
  10633. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10634. DCT similar to MJPEG.
  10635. The filter accepts the following options:
  10636. @table @option
  10637. @item quality
  10638. Set quality. This option defines the number of levels for averaging. It accepts
  10639. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10640. effect. A value of @code{8} means the higher quality. For each increment of
  10641. that value the speed drops by a factor of approximately 2. Default value is
  10642. @code{3}.
  10643. @item qp
  10644. Force a constant quantization parameter. If not set, the filter will use the QP
  10645. from the video stream (if available).
  10646. @end table
  10647. @section vaguedenoiser
  10648. Apply a wavelet based denoiser.
  10649. It transforms each frame from the video input into the wavelet domain,
  10650. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10651. the obtained coefficients. It does an inverse wavelet transform after.
  10652. Due to wavelet properties, it should give a nice smoothed result, and
  10653. reduced noise, without blurring picture features.
  10654. This filter accepts the following options:
  10655. @table @option
  10656. @item threshold
  10657. The filtering strength. The higher, the more filtered the video will be.
  10658. Hard thresholding can use a higher threshold than soft thresholding
  10659. before the video looks overfiltered.
  10660. @item method
  10661. The filtering method the filter will use.
  10662. It accepts the following values:
  10663. @table @samp
  10664. @item hard
  10665. All values under the threshold will be zeroed.
  10666. @item soft
  10667. All values under the threshold will be zeroed. All values above will be
  10668. reduced by the threshold.
  10669. @item garrote
  10670. Scales or nullifies coefficients - intermediary between (more) soft and
  10671. (less) hard thresholding.
  10672. @end table
  10673. @item nsteps
  10674. Number of times, the wavelet will decompose the picture. Picture can't
  10675. be decomposed beyond a particular point (typically, 8 for a 640x480
  10676. frame - as 2^9 = 512 > 480)
  10677. @item percent
  10678. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10679. @item planes
  10680. A list of the planes to process. By default all planes are processed.
  10681. @end table
  10682. @section vectorscope
  10683. Display 2 color component values in the two dimensional graph (which is called
  10684. a vectorscope).
  10685. This filter accepts the following options:
  10686. @table @option
  10687. @item mode, m
  10688. Set vectorscope mode.
  10689. It accepts the following values:
  10690. @table @samp
  10691. @item gray
  10692. Gray values are displayed on graph, higher brightness means more pixels have
  10693. same component color value on location in graph. This is the default mode.
  10694. @item color
  10695. Gray values are displayed on graph. Surrounding pixels values which are not
  10696. present in video frame are drawn in gradient of 2 color components which are
  10697. set by option @code{x} and @code{y}. The 3rd color component is static.
  10698. @item color2
  10699. Actual color components values present in video frame are displayed on graph.
  10700. @item color3
  10701. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10702. on graph increases value of another color component, which is luminance by
  10703. default values of @code{x} and @code{y}.
  10704. @item color4
  10705. Actual colors present in video frame are displayed on graph. If two different
  10706. colors map to same position on graph then color with higher value of component
  10707. not present in graph is picked.
  10708. @item color5
  10709. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10710. component picked from radial gradient.
  10711. @end table
  10712. @item x
  10713. Set which color component will be represented on X-axis. Default is @code{1}.
  10714. @item y
  10715. Set which color component will be represented on Y-axis. Default is @code{2}.
  10716. @item intensity, i
  10717. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10718. of color component which represents frequency of (X, Y) location in graph.
  10719. @item envelope, e
  10720. @table @samp
  10721. @item none
  10722. No envelope, this is default.
  10723. @item instant
  10724. Instant envelope, even darkest single pixel will be clearly highlighted.
  10725. @item peak
  10726. Hold maximum and minimum values presented in graph over time. This way you
  10727. can still spot out of range values without constantly looking at vectorscope.
  10728. @item peak+instant
  10729. Peak and instant envelope combined together.
  10730. @end table
  10731. @item graticule, g
  10732. Set what kind of graticule to draw.
  10733. @table @samp
  10734. @item none
  10735. @item green
  10736. @item color
  10737. @end table
  10738. @item opacity, o
  10739. Set graticule opacity.
  10740. @item flags, f
  10741. Set graticule flags.
  10742. @table @samp
  10743. @item white
  10744. Draw graticule for white point.
  10745. @item black
  10746. Draw graticule for black point.
  10747. @item name
  10748. Draw color points short names.
  10749. @end table
  10750. @item bgopacity, b
  10751. Set background opacity.
  10752. @item lthreshold, l
  10753. Set low threshold for color component not represented on X or Y axis.
  10754. Values lower than this value will be ignored. Default is 0.
  10755. Note this value is multiplied with actual max possible value one pixel component
  10756. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10757. is 0.1 * 255 = 25.
  10758. @item hthreshold, h
  10759. Set high threshold for color component not represented on X or Y axis.
  10760. Values higher than this value will be ignored. Default is 1.
  10761. Note this value is multiplied with actual max possible value one pixel component
  10762. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10763. is 0.9 * 255 = 230.
  10764. @item colorspace, c
  10765. Set what kind of colorspace to use when drawing graticule.
  10766. @table @samp
  10767. @item auto
  10768. @item 601
  10769. @item 709
  10770. @end table
  10771. Default is auto.
  10772. @end table
  10773. @anchor{vidstabdetect}
  10774. @section vidstabdetect
  10775. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10776. @ref{vidstabtransform} for pass 2.
  10777. This filter generates a file with relative translation and rotation
  10778. transform information about subsequent frames, which is then used by
  10779. the @ref{vidstabtransform} filter.
  10780. To enable compilation of this filter you need to configure FFmpeg with
  10781. @code{--enable-libvidstab}.
  10782. This filter accepts the following options:
  10783. @table @option
  10784. @item result
  10785. Set the path to the file used to write the transforms information.
  10786. Default value is @file{transforms.trf}.
  10787. @item shakiness
  10788. Set how shaky the video is and how quick the camera is. It accepts an
  10789. integer in the range 1-10, a value of 1 means little shakiness, a
  10790. value of 10 means strong shakiness. Default value is 5.
  10791. @item accuracy
  10792. Set the accuracy of the detection process. It must be a value in the
  10793. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10794. accuracy. Default value is 15.
  10795. @item stepsize
  10796. Set stepsize of the search process. The region around minimum is
  10797. scanned with 1 pixel resolution. Default value is 6.
  10798. @item mincontrast
  10799. Set minimum contrast. Below this value a local measurement field is
  10800. discarded. Must be a floating point value in the range 0-1. Default
  10801. value is 0.3.
  10802. @item tripod
  10803. Set reference frame number for tripod mode.
  10804. If enabled, the motion of the frames is compared to a reference frame
  10805. in the filtered stream, identified by the specified number. The idea
  10806. is to compensate all movements in a more-or-less static scene and keep
  10807. the camera view absolutely still.
  10808. If set to 0, it is disabled. The frames are counted starting from 1.
  10809. @item show
  10810. Show fields and transforms in the resulting frames. It accepts an
  10811. integer in the range 0-2. Default value is 0, which disables any
  10812. visualization.
  10813. @end table
  10814. @subsection Examples
  10815. @itemize
  10816. @item
  10817. Use default values:
  10818. @example
  10819. vidstabdetect
  10820. @end example
  10821. @item
  10822. Analyze strongly shaky movie and put the results in file
  10823. @file{mytransforms.trf}:
  10824. @example
  10825. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10826. @end example
  10827. @item
  10828. Visualize the result of internal transformations in the resulting
  10829. video:
  10830. @example
  10831. vidstabdetect=show=1
  10832. @end example
  10833. @item
  10834. Analyze a video with medium shakiness using @command{ffmpeg}:
  10835. @example
  10836. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10837. @end example
  10838. @end itemize
  10839. @anchor{vidstabtransform}
  10840. @section vidstabtransform
  10841. Video stabilization/deshaking: pass 2 of 2,
  10842. see @ref{vidstabdetect} for pass 1.
  10843. Read a file with transform information for each frame and
  10844. apply/compensate them. Together with the @ref{vidstabdetect}
  10845. filter this can be used to deshake videos. See also
  10846. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10847. the @ref{unsharp} filter, see below.
  10848. To enable compilation of this filter you need to configure FFmpeg with
  10849. @code{--enable-libvidstab}.
  10850. @subsection Options
  10851. @table @option
  10852. @item input
  10853. Set path to the file used to read the transforms. Default value is
  10854. @file{transforms.trf}.
  10855. @item smoothing
  10856. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10857. camera movements. Default value is 10.
  10858. For example a number of 10 means that 21 frames are used (10 in the
  10859. past and 10 in the future) to smoothen the motion in the video. A
  10860. larger value leads to a smoother video, but limits the acceleration of
  10861. the camera (pan/tilt movements). 0 is a special case where a static
  10862. camera is simulated.
  10863. @item optalgo
  10864. Set the camera path optimization algorithm.
  10865. Accepted values are:
  10866. @table @samp
  10867. @item gauss
  10868. gaussian kernel low-pass filter on camera motion (default)
  10869. @item avg
  10870. averaging on transformations
  10871. @end table
  10872. @item maxshift
  10873. Set maximal number of pixels to translate frames. Default value is -1,
  10874. meaning no limit.
  10875. @item maxangle
  10876. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10877. value is -1, meaning no limit.
  10878. @item crop
  10879. Specify how to deal with borders that may be visible due to movement
  10880. compensation.
  10881. Available values are:
  10882. @table @samp
  10883. @item keep
  10884. keep image information from previous frame (default)
  10885. @item black
  10886. fill the border black
  10887. @end table
  10888. @item invert
  10889. Invert transforms if set to 1. Default value is 0.
  10890. @item relative
  10891. Consider transforms as relative to previous frame if set to 1,
  10892. absolute if set to 0. Default value is 0.
  10893. @item zoom
  10894. Set percentage to zoom. A positive value will result in a zoom-in
  10895. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10896. zoom).
  10897. @item optzoom
  10898. Set optimal zooming to avoid borders.
  10899. Accepted values are:
  10900. @table @samp
  10901. @item 0
  10902. disabled
  10903. @item 1
  10904. optimal static zoom value is determined (only very strong movements
  10905. will lead to visible borders) (default)
  10906. @item 2
  10907. optimal adaptive zoom value is determined (no borders will be
  10908. visible), see @option{zoomspeed}
  10909. @end table
  10910. Note that the value given at zoom is added to the one calculated here.
  10911. @item zoomspeed
  10912. Set percent to zoom maximally each frame (enabled when
  10913. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10914. 0.25.
  10915. @item interpol
  10916. Specify type of interpolation.
  10917. Available values are:
  10918. @table @samp
  10919. @item no
  10920. no interpolation
  10921. @item linear
  10922. linear only horizontal
  10923. @item bilinear
  10924. linear in both directions (default)
  10925. @item bicubic
  10926. cubic in both directions (slow)
  10927. @end table
  10928. @item tripod
  10929. Enable virtual tripod mode if set to 1, which is equivalent to
  10930. @code{relative=0:smoothing=0}. Default value is 0.
  10931. Use also @code{tripod} option of @ref{vidstabdetect}.
  10932. @item debug
  10933. Increase log verbosity if set to 1. Also the detected global motions
  10934. are written to the temporary file @file{global_motions.trf}. Default
  10935. value is 0.
  10936. @end table
  10937. @subsection Examples
  10938. @itemize
  10939. @item
  10940. Use @command{ffmpeg} for a typical stabilization with default values:
  10941. @example
  10942. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10943. @end example
  10944. Note the use of the @ref{unsharp} filter which is always recommended.
  10945. @item
  10946. Zoom in a bit more and load transform data from a given file:
  10947. @example
  10948. vidstabtransform=zoom=5:input="mytransforms.trf"
  10949. @end example
  10950. @item
  10951. Smoothen the video even more:
  10952. @example
  10953. vidstabtransform=smoothing=30
  10954. @end example
  10955. @end itemize
  10956. @section vflip
  10957. Flip the input video vertically.
  10958. For example, to vertically flip a video with @command{ffmpeg}:
  10959. @example
  10960. ffmpeg -i in.avi -vf "vflip" out.avi
  10961. @end example
  10962. @anchor{vignette}
  10963. @section vignette
  10964. Make or reverse a natural vignetting effect.
  10965. The filter accepts the following options:
  10966. @table @option
  10967. @item angle, a
  10968. Set lens angle expression as a number of radians.
  10969. The value is clipped in the @code{[0,PI/2]} range.
  10970. Default value: @code{"PI/5"}
  10971. @item x0
  10972. @item y0
  10973. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10974. by default.
  10975. @item mode
  10976. Set forward/backward mode.
  10977. Available modes are:
  10978. @table @samp
  10979. @item forward
  10980. The larger the distance from the central point, the darker the image becomes.
  10981. @item backward
  10982. The larger the distance from the central point, the brighter the image becomes.
  10983. This can be used to reverse a vignette effect, though there is no automatic
  10984. detection to extract the lens @option{angle} and other settings (yet). It can
  10985. also be used to create a burning effect.
  10986. @end table
  10987. Default value is @samp{forward}.
  10988. @item eval
  10989. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10990. It accepts the following values:
  10991. @table @samp
  10992. @item init
  10993. Evaluate expressions only once during the filter initialization.
  10994. @item frame
  10995. Evaluate expressions for each incoming frame. This is way slower than the
  10996. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10997. allows advanced dynamic expressions.
  10998. @end table
  10999. Default value is @samp{init}.
  11000. @item dither
  11001. Set dithering to reduce the circular banding effects. Default is @code{1}
  11002. (enabled).
  11003. @item aspect
  11004. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11005. Setting this value to the SAR of the input will make a rectangular vignetting
  11006. following the dimensions of the video.
  11007. Default is @code{1/1}.
  11008. @end table
  11009. @subsection Expressions
  11010. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11011. following parameters.
  11012. @table @option
  11013. @item w
  11014. @item h
  11015. input width and height
  11016. @item n
  11017. the number of input frame, starting from 0
  11018. @item pts
  11019. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11020. @var{TB} units, NAN if undefined
  11021. @item r
  11022. frame rate of the input video, NAN if the input frame rate is unknown
  11023. @item t
  11024. the PTS (Presentation TimeStamp) of the filtered video frame,
  11025. expressed in seconds, NAN if undefined
  11026. @item tb
  11027. time base of the input video
  11028. @end table
  11029. @subsection Examples
  11030. @itemize
  11031. @item
  11032. Apply simple strong vignetting effect:
  11033. @example
  11034. vignette=PI/4
  11035. @end example
  11036. @item
  11037. Make a flickering vignetting:
  11038. @example
  11039. vignette='PI/4+random(1)*PI/50':eval=frame
  11040. @end example
  11041. @end itemize
  11042. @section vstack
  11043. Stack input videos vertically.
  11044. All streams must be of same pixel format and of same width.
  11045. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11046. to create same output.
  11047. The filter accept the following option:
  11048. @table @option
  11049. @item inputs
  11050. Set number of input streams. Default is 2.
  11051. @item shortest
  11052. If set to 1, force the output to terminate when the shortest input
  11053. terminates. Default value is 0.
  11054. @end table
  11055. @section w3fdif
  11056. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11057. Deinterlacing Filter").
  11058. Based on the process described by Martin Weston for BBC R&D, and
  11059. implemented based on the de-interlace algorithm written by Jim
  11060. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11061. uses filter coefficients calculated by BBC R&D.
  11062. There are two sets of filter coefficients, so called "simple":
  11063. and "complex". Which set of filter coefficients is used can
  11064. be set by passing an optional parameter:
  11065. @table @option
  11066. @item filter
  11067. Set the interlacing filter coefficients. Accepts one of the following values:
  11068. @table @samp
  11069. @item simple
  11070. Simple filter coefficient set.
  11071. @item complex
  11072. More-complex filter coefficient set.
  11073. @end table
  11074. Default value is @samp{complex}.
  11075. @item deint
  11076. Specify which frames to deinterlace. Accept one of the following values:
  11077. @table @samp
  11078. @item all
  11079. Deinterlace all frames,
  11080. @item interlaced
  11081. Only deinterlace frames marked as interlaced.
  11082. @end table
  11083. Default value is @samp{all}.
  11084. @end table
  11085. @section waveform
  11086. Video waveform monitor.
  11087. The waveform monitor plots color component intensity. By default luminance
  11088. only. Each column of the waveform corresponds to a column of pixels in the
  11089. source video.
  11090. It accepts the following options:
  11091. @table @option
  11092. @item mode, m
  11093. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11094. In row mode, the graph on the left side represents color component value 0 and
  11095. the right side represents value = 255. In column mode, the top side represents
  11096. color component value = 0 and bottom side represents value = 255.
  11097. @item intensity, i
  11098. Set intensity. Smaller values are useful to find out how many values of the same
  11099. luminance are distributed across input rows/columns.
  11100. Default value is @code{0.04}. Allowed range is [0, 1].
  11101. @item mirror, r
  11102. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11103. In mirrored mode, higher values will be represented on the left
  11104. side for @code{row} mode and at the top for @code{column} mode. Default is
  11105. @code{1} (mirrored).
  11106. @item display, d
  11107. Set display mode.
  11108. It accepts the following values:
  11109. @table @samp
  11110. @item overlay
  11111. Presents information identical to that in the @code{parade}, except
  11112. that the graphs representing color components are superimposed directly
  11113. over one another.
  11114. This display mode makes it easier to spot relative differences or similarities
  11115. in overlapping areas of the color components that are supposed to be identical,
  11116. such as neutral whites, grays, or blacks.
  11117. @item stack
  11118. Display separate graph for the color components side by side in
  11119. @code{row} mode or one below the other in @code{column} mode.
  11120. @item parade
  11121. Display separate graph for the color components side by side in
  11122. @code{column} mode or one below the other in @code{row} mode.
  11123. Using this display mode makes it easy to spot color casts in the highlights
  11124. and shadows of an image, by comparing the contours of the top and the bottom
  11125. graphs of each waveform. Since whites, grays, and blacks are characterized
  11126. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11127. should display three waveforms of roughly equal width/height. If not, the
  11128. correction is easy to perform by making level adjustments the three waveforms.
  11129. @end table
  11130. Default is @code{stack}.
  11131. @item components, c
  11132. Set which color components to display. Default is 1, which means only luminance
  11133. or red color component if input is in RGB colorspace. If is set for example to
  11134. 7 it will display all 3 (if) available color components.
  11135. @item envelope, e
  11136. @table @samp
  11137. @item none
  11138. No envelope, this is default.
  11139. @item instant
  11140. Instant envelope, minimum and maximum values presented in graph will be easily
  11141. visible even with small @code{step} value.
  11142. @item peak
  11143. Hold minimum and maximum values presented in graph across time. This way you
  11144. can still spot out of range values without constantly looking at waveforms.
  11145. @item peak+instant
  11146. Peak and instant envelope combined together.
  11147. @end table
  11148. @item filter, f
  11149. @table @samp
  11150. @item lowpass
  11151. No filtering, this is default.
  11152. @item flat
  11153. Luma and chroma combined together.
  11154. @item aflat
  11155. Similar as above, but shows difference between blue and red chroma.
  11156. @item chroma
  11157. Displays only chroma.
  11158. @item color
  11159. Displays actual color value on waveform.
  11160. @item acolor
  11161. Similar as above, but with luma showing frequency of chroma values.
  11162. @end table
  11163. @item graticule, g
  11164. Set which graticule to display.
  11165. @table @samp
  11166. @item none
  11167. Do not display graticule.
  11168. @item green
  11169. Display green graticule showing legal broadcast ranges.
  11170. @end table
  11171. @item opacity, o
  11172. Set graticule opacity.
  11173. @item flags, fl
  11174. Set graticule flags.
  11175. @table @samp
  11176. @item numbers
  11177. Draw numbers above lines. By default enabled.
  11178. @item dots
  11179. Draw dots instead of lines.
  11180. @end table
  11181. @item scale, s
  11182. Set scale used for displaying graticule.
  11183. @table @samp
  11184. @item digital
  11185. @item millivolts
  11186. @item ire
  11187. @end table
  11188. Default is digital.
  11189. @item bgopacity, b
  11190. Set background opacity.
  11191. @end table
  11192. @section weave
  11193. The @code{weave} takes a field-based video input and join
  11194. each two sequential fields into single frame, producing a new double
  11195. height clip with half the frame rate and half the frame count.
  11196. It accepts the following option:
  11197. @table @option
  11198. @item first_field
  11199. Set first field. Available values are:
  11200. @table @samp
  11201. @item top, t
  11202. Set the frame as top-field-first.
  11203. @item bottom, b
  11204. Set the frame as bottom-field-first.
  11205. @end table
  11206. @end table
  11207. @subsection Examples
  11208. @itemize
  11209. @item
  11210. Interlace video using @ref{select} and @ref{separatefields} filter:
  11211. @example
  11212. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11213. @end example
  11214. @end itemize
  11215. @section xbr
  11216. Apply the xBR high-quality magnification filter which is designed for pixel
  11217. art. It follows a set of edge-detection rules, see
  11218. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11219. It accepts the following option:
  11220. @table @option
  11221. @item n
  11222. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11223. @code{3xBR} and @code{4} for @code{4xBR}.
  11224. Default is @code{3}.
  11225. @end table
  11226. @anchor{yadif}
  11227. @section yadif
  11228. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11229. filter").
  11230. It accepts the following parameters:
  11231. @table @option
  11232. @item mode
  11233. The interlacing mode to adopt. It accepts one of the following values:
  11234. @table @option
  11235. @item 0, send_frame
  11236. Output one frame for each frame.
  11237. @item 1, send_field
  11238. Output one frame for each field.
  11239. @item 2, send_frame_nospatial
  11240. Like @code{send_frame}, but it skips the spatial interlacing check.
  11241. @item 3, send_field_nospatial
  11242. Like @code{send_field}, but it skips the spatial interlacing check.
  11243. @end table
  11244. The default value is @code{send_frame}.
  11245. @item parity
  11246. The picture field parity assumed for the input interlaced video. It accepts one
  11247. of the following values:
  11248. @table @option
  11249. @item 0, tff
  11250. Assume the top field is first.
  11251. @item 1, bff
  11252. Assume the bottom field is first.
  11253. @item -1, auto
  11254. Enable automatic detection of field parity.
  11255. @end table
  11256. The default value is @code{auto}.
  11257. If the interlacing is unknown or the decoder does not export this information,
  11258. top field first will be assumed.
  11259. @item deint
  11260. Specify which frames to deinterlace. Accept one of the following
  11261. values:
  11262. @table @option
  11263. @item 0, all
  11264. Deinterlace all frames.
  11265. @item 1, interlaced
  11266. Only deinterlace frames marked as interlaced.
  11267. @end table
  11268. The default value is @code{all}.
  11269. @end table
  11270. @section zoompan
  11271. Apply Zoom & Pan effect.
  11272. This filter accepts the following options:
  11273. @table @option
  11274. @item zoom, z
  11275. Set the zoom expression. Default is 1.
  11276. @item x
  11277. @item y
  11278. Set the x and y expression. Default is 0.
  11279. @item d
  11280. Set the duration expression in number of frames.
  11281. This sets for how many number of frames effect will last for
  11282. single input image.
  11283. @item s
  11284. Set the output image size, default is 'hd720'.
  11285. @item fps
  11286. Set the output frame rate, default is '25'.
  11287. @end table
  11288. Each expression can contain the following constants:
  11289. @table @option
  11290. @item in_w, iw
  11291. Input width.
  11292. @item in_h, ih
  11293. Input height.
  11294. @item out_w, ow
  11295. Output width.
  11296. @item out_h, oh
  11297. Output height.
  11298. @item in
  11299. Input frame count.
  11300. @item on
  11301. Output frame count.
  11302. @item x
  11303. @item y
  11304. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11305. for current input frame.
  11306. @item px
  11307. @item py
  11308. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11309. not yet such frame (first input frame).
  11310. @item zoom
  11311. Last calculated zoom from 'z' expression for current input frame.
  11312. @item pzoom
  11313. Last calculated zoom of last output frame of previous input frame.
  11314. @item duration
  11315. Number of output frames for current input frame. Calculated from 'd' expression
  11316. for each input frame.
  11317. @item pduration
  11318. number of output frames created for previous input frame
  11319. @item a
  11320. Rational number: input width / input height
  11321. @item sar
  11322. sample aspect ratio
  11323. @item dar
  11324. display aspect ratio
  11325. @end table
  11326. @subsection Examples
  11327. @itemize
  11328. @item
  11329. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11330. @example
  11331. 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
  11332. @end example
  11333. @item
  11334. Zoom-in up to 1.5 and pan always at center of picture:
  11335. @example
  11336. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11337. @end example
  11338. @item
  11339. Same as above but without pausing:
  11340. @example
  11341. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11342. @end example
  11343. @end itemize
  11344. @section zscale
  11345. Scale (resize) the input video, using the z.lib library:
  11346. https://github.com/sekrit-twc/zimg.
  11347. The zscale filter forces the output display aspect ratio to be the same
  11348. as the input, by changing the output sample aspect ratio.
  11349. If the input image format is different from the format requested by
  11350. the next filter, the zscale filter will convert the input to the
  11351. requested format.
  11352. @subsection Options
  11353. The filter accepts the following options.
  11354. @table @option
  11355. @item width, w
  11356. @item height, h
  11357. Set the output video dimension expression. Default value is the input
  11358. dimension.
  11359. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11360. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11361. If one of the values is -1, the zscale filter will use a value that
  11362. maintains the aspect ratio of the input image, calculated from the
  11363. other specified dimension. If both of them are -1, the input size is
  11364. used
  11365. If one of the values is -n with n > 1, the zscale filter will also use a value
  11366. that maintains the aspect ratio of the input image, calculated from the other
  11367. specified dimension. After that it will, however, make sure that the calculated
  11368. dimension is divisible by n and adjust the value if necessary.
  11369. See below for the list of accepted constants for use in the dimension
  11370. expression.
  11371. @item size, s
  11372. Set the video size. For the syntax of this option, check the
  11373. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11374. @item dither, d
  11375. Set the dither type.
  11376. Possible values are:
  11377. @table @var
  11378. @item none
  11379. @item ordered
  11380. @item random
  11381. @item error_diffusion
  11382. @end table
  11383. Default is none.
  11384. @item filter, f
  11385. Set the resize filter type.
  11386. Possible values are:
  11387. @table @var
  11388. @item point
  11389. @item bilinear
  11390. @item bicubic
  11391. @item spline16
  11392. @item spline36
  11393. @item lanczos
  11394. @end table
  11395. Default is bilinear.
  11396. @item range, r
  11397. Set the color range.
  11398. Possible values are:
  11399. @table @var
  11400. @item input
  11401. @item limited
  11402. @item full
  11403. @end table
  11404. Default is same as input.
  11405. @item primaries, p
  11406. Set the color primaries.
  11407. Possible values are:
  11408. @table @var
  11409. @item input
  11410. @item 709
  11411. @item unspecified
  11412. @item 170m
  11413. @item 240m
  11414. @item 2020
  11415. @end table
  11416. Default is same as input.
  11417. @item transfer, t
  11418. Set the transfer characteristics.
  11419. Possible values are:
  11420. @table @var
  11421. @item input
  11422. @item 709
  11423. @item unspecified
  11424. @item 601
  11425. @item linear
  11426. @item 2020_10
  11427. @item 2020_12
  11428. @item smpte2084
  11429. @item iec61966-2-1
  11430. @item arib-std-b67
  11431. @end table
  11432. Default is same as input.
  11433. @item matrix, m
  11434. Set the colorspace matrix.
  11435. Possible value are:
  11436. @table @var
  11437. @item input
  11438. @item 709
  11439. @item unspecified
  11440. @item 470bg
  11441. @item 170m
  11442. @item 2020_ncl
  11443. @item 2020_cl
  11444. @end table
  11445. Default is same as input.
  11446. @item rangein, rin
  11447. Set the input color range.
  11448. Possible values are:
  11449. @table @var
  11450. @item input
  11451. @item limited
  11452. @item full
  11453. @end table
  11454. Default is same as input.
  11455. @item primariesin, pin
  11456. Set the input color primaries.
  11457. Possible values are:
  11458. @table @var
  11459. @item input
  11460. @item 709
  11461. @item unspecified
  11462. @item 170m
  11463. @item 240m
  11464. @item 2020
  11465. @end table
  11466. Default is same as input.
  11467. @item transferin, tin
  11468. Set the input transfer characteristics.
  11469. Possible values are:
  11470. @table @var
  11471. @item input
  11472. @item 709
  11473. @item unspecified
  11474. @item 601
  11475. @item linear
  11476. @item 2020_10
  11477. @item 2020_12
  11478. @end table
  11479. Default is same as input.
  11480. @item matrixin, min
  11481. Set the input colorspace matrix.
  11482. Possible value are:
  11483. @table @var
  11484. @item input
  11485. @item 709
  11486. @item unspecified
  11487. @item 470bg
  11488. @item 170m
  11489. @item 2020_ncl
  11490. @item 2020_cl
  11491. @end table
  11492. @item chromal, c
  11493. Set the output chroma location.
  11494. Possible values are:
  11495. @table @var
  11496. @item input
  11497. @item left
  11498. @item center
  11499. @item topleft
  11500. @item top
  11501. @item bottomleft
  11502. @item bottom
  11503. @end table
  11504. @item chromalin, cin
  11505. Set the input chroma location.
  11506. Possible values are:
  11507. @table @var
  11508. @item input
  11509. @item left
  11510. @item center
  11511. @item topleft
  11512. @item top
  11513. @item bottomleft
  11514. @item bottom
  11515. @end table
  11516. @item npl
  11517. Set the nominal peak luminance.
  11518. @end table
  11519. The values of the @option{w} and @option{h} options are expressions
  11520. containing the following constants:
  11521. @table @var
  11522. @item in_w
  11523. @item in_h
  11524. The input width and height
  11525. @item iw
  11526. @item ih
  11527. These are the same as @var{in_w} and @var{in_h}.
  11528. @item out_w
  11529. @item out_h
  11530. The output (scaled) width and height
  11531. @item ow
  11532. @item oh
  11533. These are the same as @var{out_w} and @var{out_h}
  11534. @item a
  11535. The same as @var{iw} / @var{ih}
  11536. @item sar
  11537. input sample aspect ratio
  11538. @item dar
  11539. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11540. @item hsub
  11541. @item vsub
  11542. horizontal and vertical input chroma subsample values. For example for the
  11543. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11544. @item ohsub
  11545. @item ovsub
  11546. horizontal and vertical output chroma subsample values. For example for the
  11547. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11548. @end table
  11549. @table @option
  11550. @end table
  11551. @c man end VIDEO FILTERS
  11552. @chapter Video Sources
  11553. @c man begin VIDEO SOURCES
  11554. Below is a description of the currently available video sources.
  11555. @section buffer
  11556. Buffer video frames, and make them available to the filter chain.
  11557. This source is mainly intended for a programmatic use, in particular
  11558. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11559. It accepts the following parameters:
  11560. @table @option
  11561. @item video_size
  11562. Specify the size (width and height) of the buffered video frames. For the
  11563. syntax of this option, check the
  11564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11565. @item width
  11566. The input video width.
  11567. @item height
  11568. The input video height.
  11569. @item pix_fmt
  11570. A string representing the pixel format of the buffered video frames.
  11571. It may be a number corresponding to a pixel format, or a pixel format
  11572. name.
  11573. @item time_base
  11574. Specify the timebase assumed by the timestamps of the buffered frames.
  11575. @item frame_rate
  11576. Specify the frame rate expected for the video stream.
  11577. @item pixel_aspect, sar
  11578. The sample (pixel) aspect ratio of the input video.
  11579. @item sws_param
  11580. Specify the optional parameters to be used for the scale filter which
  11581. is automatically inserted when an input change is detected in the
  11582. input size or format.
  11583. @item hw_frames_ctx
  11584. When using a hardware pixel format, this should be a reference to an
  11585. AVHWFramesContext describing input frames.
  11586. @end table
  11587. For example:
  11588. @example
  11589. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11590. @end example
  11591. will instruct the source to accept video frames with size 320x240 and
  11592. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11593. square pixels (1:1 sample aspect ratio).
  11594. Since the pixel format with name "yuv410p" corresponds to the number 6
  11595. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11596. this example corresponds to:
  11597. @example
  11598. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11599. @end example
  11600. Alternatively, the options can be specified as a flat string, but this
  11601. syntax is deprecated:
  11602. @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}]
  11603. @section cellauto
  11604. Create a pattern generated by an elementary cellular automaton.
  11605. The initial state of the cellular automaton can be defined through the
  11606. @option{filename} and @option{pattern} options. If such options are
  11607. not specified an initial state is created randomly.
  11608. At each new frame a new row in the video is filled with the result of
  11609. the cellular automaton next generation. The behavior when the whole
  11610. frame is filled is defined by the @option{scroll} option.
  11611. This source accepts the following options:
  11612. @table @option
  11613. @item filename, f
  11614. Read the initial cellular automaton state, i.e. the starting row, from
  11615. the specified file.
  11616. In the file, each non-whitespace character is considered an alive
  11617. cell, a newline will terminate the row, and further characters in the
  11618. file will be ignored.
  11619. @item pattern, p
  11620. Read the initial cellular automaton state, i.e. the starting row, from
  11621. the specified string.
  11622. Each non-whitespace character in the string is considered an alive
  11623. cell, a newline will terminate the row, and further characters in the
  11624. string will be ignored.
  11625. @item rate, r
  11626. Set the video rate, that is the number of frames generated per second.
  11627. Default is 25.
  11628. @item random_fill_ratio, ratio
  11629. Set the random fill ratio for the initial cellular automaton row. It
  11630. is a floating point number value ranging from 0 to 1, defaults to
  11631. 1/PHI.
  11632. This option is ignored when a file or a pattern is specified.
  11633. @item random_seed, seed
  11634. Set the seed for filling randomly the initial row, must be an integer
  11635. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11636. set to -1, the filter will try to use a good random seed on a best
  11637. effort basis.
  11638. @item rule
  11639. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11640. Default value is 110.
  11641. @item size, s
  11642. Set the size of the output video. For the syntax of this option, check the
  11643. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11644. If @option{filename} or @option{pattern} is specified, the size is set
  11645. by default to the width of the specified initial state row, and the
  11646. height is set to @var{width} * PHI.
  11647. If @option{size} is set, it must contain the width of the specified
  11648. pattern string, and the specified pattern will be centered in the
  11649. larger row.
  11650. If a filename or a pattern string is not specified, the size value
  11651. defaults to "320x518" (used for a randomly generated initial state).
  11652. @item scroll
  11653. If set to 1, scroll the output upward when all the rows in the output
  11654. have been already filled. If set to 0, the new generated row will be
  11655. written over the top row just after the bottom row is filled.
  11656. Defaults to 1.
  11657. @item start_full, full
  11658. If set to 1, completely fill the output with generated rows before
  11659. outputting the first frame.
  11660. This is the default behavior, for disabling set the value to 0.
  11661. @item stitch
  11662. If set to 1, stitch the left and right row edges together.
  11663. This is the default behavior, for disabling set the value to 0.
  11664. @end table
  11665. @subsection Examples
  11666. @itemize
  11667. @item
  11668. Read the initial state from @file{pattern}, and specify an output of
  11669. size 200x400.
  11670. @example
  11671. cellauto=f=pattern:s=200x400
  11672. @end example
  11673. @item
  11674. Generate a random initial row with a width of 200 cells, with a fill
  11675. ratio of 2/3:
  11676. @example
  11677. cellauto=ratio=2/3:s=200x200
  11678. @end example
  11679. @item
  11680. Create a pattern generated by rule 18 starting by a single alive cell
  11681. centered on an initial row with width 100:
  11682. @example
  11683. cellauto=p=@@:s=100x400:full=0:rule=18
  11684. @end example
  11685. @item
  11686. Specify a more elaborated initial pattern:
  11687. @example
  11688. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11689. @end example
  11690. @end itemize
  11691. @anchor{coreimagesrc}
  11692. @section coreimagesrc
  11693. Video source generated on GPU using Apple's CoreImage API on OSX.
  11694. This video source is a specialized version of the @ref{coreimage} video filter.
  11695. Use a core image generator at the beginning of the applied filterchain to
  11696. generate the content.
  11697. The coreimagesrc video source accepts the following options:
  11698. @table @option
  11699. @item list_generators
  11700. List all available generators along with all their respective options as well as
  11701. possible minimum and maximum values along with the default values.
  11702. @example
  11703. list_generators=true
  11704. @end example
  11705. @item size, s
  11706. Specify the size of the sourced video. For the syntax of this option, check the
  11707. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11708. The default value is @code{320x240}.
  11709. @item rate, r
  11710. Specify the frame rate of the sourced video, as the number of frames
  11711. generated per second. It has to be a string in the format
  11712. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11713. number or a valid video frame rate abbreviation. The default value is
  11714. "25".
  11715. @item sar
  11716. Set the sample aspect ratio of the sourced video.
  11717. @item duration, d
  11718. Set the duration of the sourced video. See
  11719. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11720. for the accepted syntax.
  11721. If not specified, or the expressed duration is negative, the video is
  11722. supposed to be generated forever.
  11723. @end table
  11724. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11725. A complete filterchain can be used for further processing of the
  11726. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11727. and examples for details.
  11728. @subsection Examples
  11729. @itemize
  11730. @item
  11731. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11732. given as complete and escaped command-line for Apple's standard bash shell:
  11733. @example
  11734. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11735. @end example
  11736. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11737. need for a nullsrc video source.
  11738. @end itemize
  11739. @section mandelbrot
  11740. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11741. point specified with @var{start_x} and @var{start_y}.
  11742. This source accepts the following options:
  11743. @table @option
  11744. @item end_pts
  11745. Set the terminal pts value. Default value is 400.
  11746. @item end_scale
  11747. Set the terminal scale value.
  11748. Must be a floating point value. Default value is 0.3.
  11749. @item inner
  11750. Set the inner coloring mode, that is the algorithm used to draw the
  11751. Mandelbrot fractal internal region.
  11752. It shall assume one of the following values:
  11753. @table @option
  11754. @item black
  11755. Set black mode.
  11756. @item convergence
  11757. Show time until convergence.
  11758. @item mincol
  11759. Set color based on point closest to the origin of the iterations.
  11760. @item period
  11761. Set period mode.
  11762. @end table
  11763. Default value is @var{mincol}.
  11764. @item bailout
  11765. Set the bailout value. Default value is 10.0.
  11766. @item maxiter
  11767. Set the maximum of iterations performed by the rendering
  11768. algorithm. Default value is 7189.
  11769. @item outer
  11770. Set outer coloring mode.
  11771. It shall assume one of following values:
  11772. @table @option
  11773. @item iteration_count
  11774. Set iteration cound mode.
  11775. @item normalized_iteration_count
  11776. set normalized iteration count mode.
  11777. @end table
  11778. Default value is @var{normalized_iteration_count}.
  11779. @item rate, r
  11780. Set frame rate, expressed as number of frames per second. Default
  11781. value is "25".
  11782. @item size, s
  11783. Set frame size. For the syntax of this option, check the "Video
  11784. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11785. @item start_scale
  11786. Set the initial scale value. Default value is 3.0.
  11787. @item start_x
  11788. Set the initial x position. Must be a floating point value between
  11789. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11790. @item start_y
  11791. Set the initial y position. Must be a floating point value between
  11792. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11793. @end table
  11794. @section mptestsrc
  11795. Generate various test patterns, as generated by the MPlayer test filter.
  11796. The size of the generated video is fixed, and is 256x256.
  11797. This source is useful in particular for testing encoding features.
  11798. This source accepts the following options:
  11799. @table @option
  11800. @item rate, r
  11801. Specify the frame rate of the sourced video, as the number of frames
  11802. generated per second. It has to be a string in the format
  11803. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11804. number or a valid video frame rate abbreviation. The default value is
  11805. "25".
  11806. @item duration, d
  11807. Set the duration of the sourced video. See
  11808. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11809. for the accepted syntax.
  11810. If not specified, or the expressed duration is negative, the video is
  11811. supposed to be generated forever.
  11812. @item test, t
  11813. Set the number or the name of the test to perform. Supported tests are:
  11814. @table @option
  11815. @item dc_luma
  11816. @item dc_chroma
  11817. @item freq_luma
  11818. @item freq_chroma
  11819. @item amp_luma
  11820. @item amp_chroma
  11821. @item cbp
  11822. @item mv
  11823. @item ring1
  11824. @item ring2
  11825. @item all
  11826. @end table
  11827. Default value is "all", which will cycle through the list of all tests.
  11828. @end table
  11829. Some examples:
  11830. @example
  11831. mptestsrc=t=dc_luma
  11832. @end example
  11833. will generate a "dc_luma" test pattern.
  11834. @section frei0r_src
  11835. Provide a frei0r source.
  11836. To enable compilation of this filter you need to install the frei0r
  11837. header and configure FFmpeg with @code{--enable-frei0r}.
  11838. This source accepts the following parameters:
  11839. @table @option
  11840. @item size
  11841. The size of the video to generate. For the syntax of this option, check the
  11842. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11843. @item framerate
  11844. The framerate of the generated video. It may be a string of the form
  11845. @var{num}/@var{den} or a frame rate abbreviation.
  11846. @item filter_name
  11847. The name to the frei0r source to load. For more information regarding frei0r and
  11848. how to set the parameters, read the @ref{frei0r} section in the video filters
  11849. documentation.
  11850. @item filter_params
  11851. A '|'-separated list of parameters to pass to the frei0r source.
  11852. @end table
  11853. For example, to generate a frei0r partik0l source with size 200x200
  11854. and frame rate 10 which is overlaid on the overlay filter main input:
  11855. @example
  11856. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11857. @end example
  11858. @section life
  11859. Generate a life pattern.
  11860. This source is based on a generalization of John Conway's life game.
  11861. The sourced input represents a life grid, each pixel represents a cell
  11862. which can be in one of two possible states, alive or dead. Every cell
  11863. interacts with its eight neighbours, which are the cells that are
  11864. horizontally, vertically, or diagonally adjacent.
  11865. At each interaction the grid evolves according to the adopted rule,
  11866. which specifies the number of neighbor alive cells which will make a
  11867. cell stay alive or born. The @option{rule} option allows one to specify
  11868. the rule to adopt.
  11869. This source accepts the following options:
  11870. @table @option
  11871. @item filename, f
  11872. Set the file from which to read the initial grid state. In the file,
  11873. each non-whitespace character is considered an alive cell, and newline
  11874. is used to delimit the end of each row.
  11875. If this option is not specified, the initial grid is generated
  11876. randomly.
  11877. @item rate, r
  11878. Set the video rate, that is the number of frames generated per second.
  11879. Default is 25.
  11880. @item random_fill_ratio, ratio
  11881. Set the random fill ratio for the initial random grid. It is a
  11882. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11883. It is ignored when a file is specified.
  11884. @item random_seed, seed
  11885. Set the seed for filling the initial random grid, must be an integer
  11886. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11887. set to -1, the filter will try to use a good random seed on a best
  11888. effort basis.
  11889. @item rule
  11890. Set the life rule.
  11891. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11892. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11893. @var{NS} specifies the number of alive neighbor cells which make a
  11894. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11895. which make a dead cell to become alive (i.e. to "born").
  11896. "s" and "b" can be used in place of "S" and "B", respectively.
  11897. Alternatively a rule can be specified by an 18-bits integer. The 9
  11898. high order bits are used to encode the next cell state if it is alive
  11899. for each number of neighbor alive cells, the low order bits specify
  11900. the rule for "borning" new cells. Higher order bits encode for an
  11901. higher number of neighbor cells.
  11902. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11903. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11904. Default value is "S23/B3", which is the original Conway's game of life
  11905. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11906. cells, and will born a new cell if there are three alive cells around
  11907. a dead cell.
  11908. @item size, s
  11909. Set the size of the output video. For the syntax of this option, check the
  11910. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11911. If @option{filename} is specified, the size is set by default to the
  11912. same size of the input file. If @option{size} is set, it must contain
  11913. the size specified in the input file, and the initial grid defined in
  11914. that file is centered in the larger resulting area.
  11915. If a filename is not specified, the size value defaults to "320x240"
  11916. (used for a randomly generated initial grid).
  11917. @item stitch
  11918. If set to 1, stitch the left and right grid edges together, and the
  11919. top and bottom edges also. Defaults to 1.
  11920. @item mold
  11921. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11922. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11923. value from 0 to 255.
  11924. @item life_color
  11925. Set the color of living (or new born) cells.
  11926. @item death_color
  11927. Set the color of dead cells. If @option{mold} is set, this is the first color
  11928. used to represent a dead cell.
  11929. @item mold_color
  11930. Set mold color, for definitely dead and moldy cells.
  11931. For the syntax of these 3 color options, check the "Color" section in the
  11932. ffmpeg-utils manual.
  11933. @end table
  11934. @subsection Examples
  11935. @itemize
  11936. @item
  11937. Read a grid from @file{pattern}, and center it on a grid of size
  11938. 300x300 pixels:
  11939. @example
  11940. life=f=pattern:s=300x300
  11941. @end example
  11942. @item
  11943. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11944. @example
  11945. life=ratio=2/3:s=200x200
  11946. @end example
  11947. @item
  11948. Specify a custom rule for evolving a randomly generated grid:
  11949. @example
  11950. life=rule=S14/B34
  11951. @end example
  11952. @item
  11953. Full example with slow death effect (mold) using @command{ffplay}:
  11954. @example
  11955. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11956. @end example
  11957. @end itemize
  11958. @anchor{allrgb}
  11959. @anchor{allyuv}
  11960. @anchor{color}
  11961. @anchor{haldclutsrc}
  11962. @anchor{nullsrc}
  11963. @anchor{rgbtestsrc}
  11964. @anchor{smptebars}
  11965. @anchor{smptehdbars}
  11966. @anchor{testsrc}
  11967. @anchor{testsrc2}
  11968. @anchor{yuvtestsrc}
  11969. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11970. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11971. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11972. The @code{color} source provides an uniformly colored input.
  11973. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11974. @ref{haldclut} filter.
  11975. The @code{nullsrc} source returns unprocessed video frames. It is
  11976. mainly useful to be employed in analysis / debugging tools, or as the
  11977. source for filters which ignore the input data.
  11978. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11979. detecting RGB vs BGR issues. You should see a red, green and blue
  11980. stripe from top to bottom.
  11981. The @code{smptebars} source generates a color bars pattern, based on
  11982. the SMPTE Engineering Guideline EG 1-1990.
  11983. The @code{smptehdbars} source generates a color bars pattern, based on
  11984. the SMPTE RP 219-2002.
  11985. The @code{testsrc} source generates a test video pattern, showing a
  11986. color pattern, a scrolling gradient and a timestamp. This is mainly
  11987. intended for testing purposes.
  11988. The @code{testsrc2} source is similar to testsrc, but supports more
  11989. pixel formats instead of just @code{rgb24}. This allows using it as an
  11990. input for other tests without requiring a format conversion.
  11991. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11992. see a y, cb and cr stripe from top to bottom.
  11993. The sources accept the following parameters:
  11994. @table @option
  11995. @item color, c
  11996. Specify the color of the source, only available in the @code{color}
  11997. source. For the syntax of this option, check the "Color" section in the
  11998. ffmpeg-utils manual.
  11999. @item level
  12000. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12001. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12002. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12003. coded on a @code{1/(N*N)} scale.
  12004. @item size, s
  12005. Specify the size of the sourced video. For the syntax of this option, check the
  12006. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12007. The default value is @code{320x240}.
  12008. This option is not available with the @code{haldclutsrc} filter.
  12009. @item rate, r
  12010. Specify the frame rate of the sourced video, as the number of frames
  12011. generated per second. It has to be a string in the format
  12012. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12013. number or a valid video frame rate abbreviation. The default value is
  12014. "25".
  12015. @item sar
  12016. Set the sample aspect ratio of the sourced video.
  12017. @item duration, d
  12018. Set the duration of the sourced video. See
  12019. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12020. for the accepted syntax.
  12021. If not specified, or the expressed duration is negative, the video is
  12022. supposed to be generated forever.
  12023. @item decimals, n
  12024. Set the number of decimals to show in the timestamp, only available in the
  12025. @code{testsrc} source.
  12026. The displayed timestamp value will correspond to the original
  12027. timestamp value multiplied by the power of 10 of the specified
  12028. value. Default value is 0.
  12029. @end table
  12030. For example the following:
  12031. @example
  12032. testsrc=duration=5.3:size=qcif:rate=10
  12033. @end example
  12034. will generate a video with a duration of 5.3 seconds, with size
  12035. 176x144 and a frame rate of 10 frames per second.
  12036. The following graph description will generate a red source
  12037. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12038. frames per second.
  12039. @example
  12040. color=c=red@@0.2:s=qcif:r=10
  12041. @end example
  12042. If the input content is to be ignored, @code{nullsrc} can be used. The
  12043. following command generates noise in the luminance plane by employing
  12044. the @code{geq} filter:
  12045. @example
  12046. nullsrc=s=256x256, geq=random(1)*255:128:128
  12047. @end example
  12048. @subsection Commands
  12049. The @code{color} source supports the following commands:
  12050. @table @option
  12051. @item c, color
  12052. Set the color of the created image. Accepts the same syntax of the
  12053. corresponding @option{color} option.
  12054. @end table
  12055. @c man end VIDEO SOURCES
  12056. @chapter Video Sinks
  12057. @c man begin VIDEO SINKS
  12058. Below is a description of the currently available video sinks.
  12059. @section buffersink
  12060. Buffer video frames, and make them available to the end of the filter
  12061. graph.
  12062. This sink is mainly intended for programmatic use, in particular
  12063. through the interface defined in @file{libavfilter/buffersink.h}
  12064. or the options system.
  12065. It accepts a pointer to an AVBufferSinkContext structure, which
  12066. defines the incoming buffers' formats, to be passed as the opaque
  12067. parameter to @code{avfilter_init_filter} for initialization.
  12068. @section nullsink
  12069. Null video sink: do absolutely nothing with the input video. It is
  12070. mainly useful as a template and for use in analysis / debugging
  12071. tools.
  12072. @c man end VIDEO SINKS
  12073. @chapter Multimedia Filters
  12074. @c man begin MULTIMEDIA FILTERS
  12075. Below is a description of the currently available multimedia filters.
  12076. @section abitscope
  12077. Convert input audio to a video output, displaying the audio bit scope.
  12078. The filter accepts the following options:
  12079. @table @option
  12080. @item rate, r
  12081. Set frame rate, expressed as number of frames per second. Default
  12082. value is "25".
  12083. @item size, s
  12084. Specify the video size for the output. For the syntax of this option, check the
  12085. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12086. Default value is @code{1024x256}.
  12087. @item colors
  12088. Specify list of colors separated by space or by '|' which will be used to
  12089. draw channels. Unrecognized or missing colors will be replaced
  12090. by white color.
  12091. @end table
  12092. @section ahistogram
  12093. Convert input audio to a video output, displaying the volume histogram.
  12094. The filter accepts the following options:
  12095. @table @option
  12096. @item dmode
  12097. Specify how histogram is calculated.
  12098. It accepts the following values:
  12099. @table @samp
  12100. @item single
  12101. Use single histogram for all channels.
  12102. @item separate
  12103. Use separate histogram for each channel.
  12104. @end table
  12105. Default is @code{single}.
  12106. @item rate, r
  12107. Set frame rate, expressed as number of frames per second. Default
  12108. value is "25".
  12109. @item size, s
  12110. Specify the video size for the output. For the syntax of this option, check the
  12111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12112. Default value is @code{hd720}.
  12113. @item scale
  12114. Set display scale.
  12115. It accepts the following values:
  12116. @table @samp
  12117. @item log
  12118. logarithmic
  12119. @item sqrt
  12120. square root
  12121. @item cbrt
  12122. cubic root
  12123. @item lin
  12124. linear
  12125. @item rlog
  12126. reverse logarithmic
  12127. @end table
  12128. Default is @code{log}.
  12129. @item ascale
  12130. Set amplitude scale.
  12131. It accepts the following values:
  12132. @table @samp
  12133. @item log
  12134. logarithmic
  12135. @item lin
  12136. linear
  12137. @end table
  12138. Default is @code{log}.
  12139. @item acount
  12140. Set how much frames to accumulate in histogram.
  12141. Defauls is 1. Setting this to -1 accumulates all frames.
  12142. @item rheight
  12143. Set histogram ratio of window height.
  12144. @item slide
  12145. Set sonogram sliding.
  12146. It accepts the following values:
  12147. @table @samp
  12148. @item replace
  12149. replace old rows with new ones.
  12150. @item scroll
  12151. scroll from top to bottom.
  12152. @end table
  12153. Default is @code{replace}.
  12154. @end table
  12155. @section aphasemeter
  12156. Convert input audio to a video output, displaying the audio phase.
  12157. The filter accepts the following options:
  12158. @table @option
  12159. @item rate, r
  12160. Set the output frame rate. Default value is @code{25}.
  12161. @item size, s
  12162. Set the video size for the output. For the syntax of this option, check the
  12163. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12164. Default value is @code{800x400}.
  12165. @item rc
  12166. @item gc
  12167. @item bc
  12168. Specify the red, green, blue contrast. Default values are @code{2},
  12169. @code{7} and @code{1}.
  12170. Allowed range is @code{[0, 255]}.
  12171. @item mpc
  12172. Set color which will be used for drawing median phase. If color is
  12173. @code{none} which is default, no median phase value will be drawn.
  12174. @item video
  12175. Enable video output. Default is enabled.
  12176. @end table
  12177. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12178. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12179. The @code{-1} means left and right channels are completely out of phase and
  12180. @code{1} means channels are in phase.
  12181. @section avectorscope
  12182. Convert input audio to a video output, representing the audio vector
  12183. scope.
  12184. The filter is used to measure the difference between channels of stereo
  12185. audio stream. A monoaural signal, consisting of identical left and right
  12186. signal, results in straight vertical line. Any stereo separation is visible
  12187. as a deviation from this line, creating a Lissajous figure.
  12188. If the straight (or deviation from it) but horizontal line appears this
  12189. indicates that the left and right channels are out of phase.
  12190. The filter accepts the following options:
  12191. @table @option
  12192. @item mode, m
  12193. Set the vectorscope mode.
  12194. Available values are:
  12195. @table @samp
  12196. @item lissajous
  12197. Lissajous rotated by 45 degrees.
  12198. @item lissajous_xy
  12199. Same as above but not rotated.
  12200. @item polar
  12201. Shape resembling half of circle.
  12202. @end table
  12203. Default value is @samp{lissajous}.
  12204. @item size, s
  12205. Set the video size for the output. For the syntax of this option, check the
  12206. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12207. Default value is @code{400x400}.
  12208. @item rate, r
  12209. Set the output frame rate. Default value is @code{25}.
  12210. @item rc
  12211. @item gc
  12212. @item bc
  12213. @item ac
  12214. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12215. @code{160}, @code{80} and @code{255}.
  12216. Allowed range is @code{[0, 255]}.
  12217. @item rf
  12218. @item gf
  12219. @item bf
  12220. @item af
  12221. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12222. @code{10}, @code{5} and @code{5}.
  12223. Allowed range is @code{[0, 255]}.
  12224. @item zoom
  12225. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12226. @item draw
  12227. Set the vectorscope drawing mode.
  12228. Available values are:
  12229. @table @samp
  12230. @item dot
  12231. Draw dot for each sample.
  12232. @item line
  12233. Draw line between previous and current sample.
  12234. @end table
  12235. Default value is @samp{dot}.
  12236. @item scale
  12237. Specify amplitude scale of audio samples.
  12238. Available values are:
  12239. @table @samp
  12240. @item lin
  12241. Linear.
  12242. @item sqrt
  12243. Square root.
  12244. @item cbrt
  12245. Cubic root.
  12246. @item log
  12247. Logarithmic.
  12248. @end table
  12249. @end table
  12250. @subsection Examples
  12251. @itemize
  12252. @item
  12253. Complete example using @command{ffplay}:
  12254. @example
  12255. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12256. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12257. @end example
  12258. @end itemize
  12259. @section bench, abench
  12260. Benchmark part of a filtergraph.
  12261. The filter accepts the following options:
  12262. @table @option
  12263. @item action
  12264. Start or stop a timer.
  12265. Available values are:
  12266. @table @samp
  12267. @item start
  12268. Get the current time, set it as frame metadata (using the key
  12269. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12270. @item stop
  12271. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12272. the input frame metadata to get the time difference. Time difference, average,
  12273. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12274. @code{min}) are then printed. The timestamps are expressed in seconds.
  12275. @end table
  12276. @end table
  12277. @subsection Examples
  12278. @itemize
  12279. @item
  12280. Benchmark @ref{selectivecolor} filter:
  12281. @example
  12282. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12283. @end example
  12284. @end itemize
  12285. @section concat
  12286. Concatenate audio and video streams, joining them together one after the
  12287. other.
  12288. The filter works on segments of synchronized video and audio streams. All
  12289. segments must have the same number of streams of each type, and that will
  12290. also be the number of streams at output.
  12291. The filter accepts the following options:
  12292. @table @option
  12293. @item n
  12294. Set the number of segments. Default is 2.
  12295. @item v
  12296. Set the number of output video streams, that is also the number of video
  12297. streams in each segment. Default is 1.
  12298. @item a
  12299. Set the number of output audio streams, that is also the number of audio
  12300. streams in each segment. Default is 0.
  12301. @item unsafe
  12302. Activate unsafe mode: do not fail if segments have a different format.
  12303. @end table
  12304. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12305. @var{a} audio outputs.
  12306. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12307. segment, in the same order as the outputs, then the inputs for the second
  12308. segment, etc.
  12309. Related streams do not always have exactly the same duration, for various
  12310. reasons including codec frame size or sloppy authoring. For that reason,
  12311. related synchronized streams (e.g. a video and its audio track) should be
  12312. concatenated at once. The concat filter will use the duration of the longest
  12313. stream in each segment (except the last one), and if necessary pad shorter
  12314. audio streams with silence.
  12315. For this filter to work correctly, all segments must start at timestamp 0.
  12316. All corresponding streams must have the same parameters in all segments; the
  12317. filtering system will automatically select a common pixel format for video
  12318. streams, and a common sample format, sample rate and channel layout for
  12319. audio streams, but other settings, such as resolution, must be converted
  12320. explicitly by the user.
  12321. Different frame rates are acceptable but will result in variable frame rate
  12322. at output; be sure to configure the output file to handle it.
  12323. @subsection Examples
  12324. @itemize
  12325. @item
  12326. Concatenate an opening, an episode and an ending, all in bilingual version
  12327. (video in stream 0, audio in streams 1 and 2):
  12328. @example
  12329. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12330. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12331. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12332. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12333. @end example
  12334. @item
  12335. Concatenate two parts, handling audio and video separately, using the
  12336. (a)movie sources, and adjusting the resolution:
  12337. @example
  12338. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12339. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12340. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12341. @end example
  12342. Note that a desync will happen at the stitch if the audio and video streams
  12343. do not have exactly the same duration in the first file.
  12344. @end itemize
  12345. @section drawgraph, adrawgraph
  12346. Draw a graph using input video or audio metadata.
  12347. It accepts the following parameters:
  12348. @table @option
  12349. @item m1
  12350. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12351. @item fg1
  12352. Set 1st foreground color expression.
  12353. @item m2
  12354. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12355. @item fg2
  12356. Set 2nd foreground color expression.
  12357. @item m3
  12358. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12359. @item fg3
  12360. Set 3rd foreground color expression.
  12361. @item m4
  12362. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12363. @item fg4
  12364. Set 4th foreground color expression.
  12365. @item min
  12366. Set minimal value of metadata value.
  12367. @item max
  12368. Set maximal value of metadata value.
  12369. @item bg
  12370. Set graph background color. Default is white.
  12371. @item mode
  12372. Set graph mode.
  12373. Available values for mode is:
  12374. @table @samp
  12375. @item bar
  12376. @item dot
  12377. @item line
  12378. @end table
  12379. Default is @code{line}.
  12380. @item slide
  12381. Set slide mode.
  12382. Available values for slide is:
  12383. @table @samp
  12384. @item frame
  12385. Draw new frame when right border is reached.
  12386. @item replace
  12387. Replace old columns with new ones.
  12388. @item scroll
  12389. Scroll from right to left.
  12390. @item rscroll
  12391. Scroll from left to right.
  12392. @item picture
  12393. Draw single picture.
  12394. @end table
  12395. Default is @code{frame}.
  12396. @item size
  12397. Set size of graph video. For the syntax of this option, check the
  12398. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12399. The default value is @code{900x256}.
  12400. The foreground color expressions can use the following variables:
  12401. @table @option
  12402. @item MIN
  12403. Minimal value of metadata value.
  12404. @item MAX
  12405. Maximal value of metadata value.
  12406. @item VAL
  12407. Current metadata key value.
  12408. @end table
  12409. The color is defined as 0xAABBGGRR.
  12410. @end table
  12411. Example using metadata from @ref{signalstats} filter:
  12412. @example
  12413. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12414. @end example
  12415. Example using metadata from @ref{ebur128} filter:
  12416. @example
  12417. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12418. @end example
  12419. @anchor{ebur128}
  12420. @section ebur128
  12421. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12422. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12423. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12424. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12425. The filter also has a video output (see the @var{video} option) with a real
  12426. time graph to observe the loudness evolution. The graphic contains the logged
  12427. message mentioned above, so it is not printed anymore when this option is set,
  12428. unless the verbose logging is set. The main graphing area contains the
  12429. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12430. the momentary loudness (400 milliseconds).
  12431. More information about the Loudness Recommendation EBU R128 on
  12432. @url{http://tech.ebu.ch/loudness}.
  12433. The filter accepts the following options:
  12434. @table @option
  12435. @item video
  12436. Activate the video output. The audio stream is passed unchanged whether this
  12437. option is set or no. The video stream will be the first output stream if
  12438. activated. Default is @code{0}.
  12439. @item size
  12440. Set the video size. This option is for video only. For the syntax of this
  12441. option, check the
  12442. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12443. Default and minimum resolution is @code{640x480}.
  12444. @item meter
  12445. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12446. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12447. other integer value between this range is allowed.
  12448. @item metadata
  12449. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12450. into 100ms output frames, each of them containing various loudness information
  12451. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12452. Default is @code{0}.
  12453. @item framelog
  12454. Force the frame logging level.
  12455. Available values are:
  12456. @table @samp
  12457. @item info
  12458. information logging level
  12459. @item verbose
  12460. verbose logging level
  12461. @end table
  12462. By default, the logging level is set to @var{info}. If the @option{video} or
  12463. the @option{metadata} options are set, it switches to @var{verbose}.
  12464. @item peak
  12465. Set peak mode(s).
  12466. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12467. values are:
  12468. @table @samp
  12469. @item none
  12470. Disable any peak mode (default).
  12471. @item sample
  12472. Enable sample-peak mode.
  12473. Simple peak mode looking for the higher sample value. It logs a message
  12474. for sample-peak (identified by @code{SPK}).
  12475. @item true
  12476. Enable true-peak mode.
  12477. If enabled, the peak lookup is done on an over-sampled version of the input
  12478. stream for better peak accuracy. It logs a message for true-peak.
  12479. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12480. This mode requires a build with @code{libswresample}.
  12481. @end table
  12482. @item dualmono
  12483. Treat mono input files as "dual mono". If a mono file is intended for playback
  12484. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12485. If set to @code{true}, this option will compensate for this effect.
  12486. Multi-channel input files are not affected by this option.
  12487. @item panlaw
  12488. Set a specific pan law to be used for the measurement of dual mono files.
  12489. This parameter is optional, and has a default value of -3.01dB.
  12490. @end table
  12491. @subsection Examples
  12492. @itemize
  12493. @item
  12494. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12495. @example
  12496. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12497. @end example
  12498. @item
  12499. Run an analysis with @command{ffmpeg}:
  12500. @example
  12501. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12502. @end example
  12503. @end itemize
  12504. @section interleave, ainterleave
  12505. Temporally interleave frames from several inputs.
  12506. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12507. These filters read frames from several inputs and send the oldest
  12508. queued frame to the output.
  12509. Input streams must have well defined, monotonically increasing frame
  12510. timestamp values.
  12511. In order to submit one frame to output, these filters need to enqueue
  12512. at least one frame for each input, so they cannot work in case one
  12513. input is not yet terminated and will not receive incoming frames.
  12514. For example consider the case when one input is a @code{select} filter
  12515. which always drops input frames. The @code{interleave} filter will keep
  12516. reading from that input, but it will never be able to send new frames
  12517. to output until the input sends an end-of-stream signal.
  12518. Also, depending on inputs synchronization, the filters will drop
  12519. frames in case one input receives more frames than the other ones, and
  12520. the queue is already filled.
  12521. These filters accept the following options:
  12522. @table @option
  12523. @item nb_inputs, n
  12524. Set the number of different inputs, it is 2 by default.
  12525. @end table
  12526. @subsection Examples
  12527. @itemize
  12528. @item
  12529. Interleave frames belonging to different streams using @command{ffmpeg}:
  12530. @example
  12531. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12532. @end example
  12533. @item
  12534. Add flickering blur effect:
  12535. @example
  12536. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12537. @end example
  12538. @end itemize
  12539. @section metadata, ametadata
  12540. Manipulate frame metadata.
  12541. This filter accepts the following options:
  12542. @table @option
  12543. @item mode
  12544. Set mode of operation of the filter.
  12545. Can be one of the following:
  12546. @table @samp
  12547. @item select
  12548. If both @code{value} and @code{key} is set, select frames
  12549. which have such metadata. If only @code{key} is set, select
  12550. every frame that has such key in metadata.
  12551. @item add
  12552. Add new metadata @code{key} and @code{value}. If key is already available
  12553. do nothing.
  12554. @item modify
  12555. Modify value of already present key.
  12556. @item delete
  12557. If @code{value} is set, delete only keys that have such value.
  12558. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12559. the frame.
  12560. @item print
  12561. Print key and its value if metadata was found. If @code{key} is not set print all
  12562. metadata values available in frame.
  12563. @end table
  12564. @item key
  12565. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12566. @item value
  12567. Set metadata value which will be used. This option is mandatory for
  12568. @code{modify} and @code{add} mode.
  12569. @item function
  12570. Which function to use when comparing metadata value and @code{value}.
  12571. Can be one of following:
  12572. @table @samp
  12573. @item same_str
  12574. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12575. @item starts_with
  12576. Values are interpreted as strings, returns true if metadata value starts with
  12577. the @code{value} option string.
  12578. @item less
  12579. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12580. @item equal
  12581. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12582. @item greater
  12583. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12584. @item expr
  12585. Values are interpreted as floats, returns true if expression from option @code{expr}
  12586. evaluates to true.
  12587. @end table
  12588. @item expr
  12589. Set expression which is used when @code{function} is set to @code{expr}.
  12590. The expression is evaluated through the eval API and can contain the following
  12591. constants:
  12592. @table @option
  12593. @item VALUE1
  12594. Float representation of @code{value} from metadata key.
  12595. @item VALUE2
  12596. Float representation of @code{value} as supplied by user in @code{value} option.
  12597. @end table
  12598. @item file
  12599. If specified in @code{print} mode, output is written to the named file. Instead of
  12600. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12601. for standard output. If @code{file} option is not set, output is written to the log
  12602. with AV_LOG_INFO loglevel.
  12603. @end table
  12604. @subsection Examples
  12605. @itemize
  12606. @item
  12607. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12608. between 0 and 1.
  12609. @example
  12610. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12611. @end example
  12612. @item
  12613. Print silencedetect output to file @file{metadata.txt}.
  12614. @example
  12615. silencedetect,ametadata=mode=print:file=metadata.txt
  12616. @end example
  12617. @item
  12618. Direct all metadata to a pipe with file descriptor 4.
  12619. @example
  12620. metadata=mode=print:file='pipe\:4'
  12621. @end example
  12622. @end itemize
  12623. @section perms, aperms
  12624. Set read/write permissions for the output frames.
  12625. These filters are mainly aimed at developers to test direct path in the
  12626. following filter in the filtergraph.
  12627. The filters accept the following options:
  12628. @table @option
  12629. @item mode
  12630. Select the permissions mode.
  12631. It accepts the following values:
  12632. @table @samp
  12633. @item none
  12634. Do nothing. This is the default.
  12635. @item ro
  12636. Set all the output frames read-only.
  12637. @item rw
  12638. Set all the output frames directly writable.
  12639. @item toggle
  12640. Make the frame read-only if writable, and writable if read-only.
  12641. @item random
  12642. Set each output frame read-only or writable randomly.
  12643. @end table
  12644. @item seed
  12645. Set the seed for the @var{random} mode, must be an integer included between
  12646. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12647. @code{-1}, the filter will try to use a good random seed on a best effort
  12648. basis.
  12649. @end table
  12650. Note: in case of auto-inserted filter between the permission filter and the
  12651. following one, the permission might not be received as expected in that
  12652. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12653. perms/aperms filter can avoid this problem.
  12654. @section realtime, arealtime
  12655. Slow down filtering to match real time approximatively.
  12656. These filters will pause the filtering for a variable amount of time to
  12657. match the output rate with the input timestamps.
  12658. They are similar to the @option{re} option to @code{ffmpeg}.
  12659. They accept the following options:
  12660. @table @option
  12661. @item limit
  12662. Time limit for the pauses. Any pause longer than that will be considered
  12663. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12664. @end table
  12665. @anchor{select}
  12666. @section select, aselect
  12667. Select frames to pass in output.
  12668. This filter accepts the following options:
  12669. @table @option
  12670. @item expr, e
  12671. Set expression, which is evaluated for each input frame.
  12672. If the expression is evaluated to zero, the frame is discarded.
  12673. If the evaluation result is negative or NaN, the frame is sent to the
  12674. first output; otherwise it is sent to the output with index
  12675. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12676. For example a value of @code{1.2} corresponds to the output with index
  12677. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12678. @item outputs, n
  12679. Set the number of outputs. The output to which to send the selected
  12680. frame is based on the result of the evaluation. Default value is 1.
  12681. @end table
  12682. The expression can contain the following constants:
  12683. @table @option
  12684. @item n
  12685. The (sequential) number of the filtered frame, starting from 0.
  12686. @item selected_n
  12687. The (sequential) number of the selected frame, starting from 0.
  12688. @item prev_selected_n
  12689. The sequential number of the last selected frame. It's NAN if undefined.
  12690. @item TB
  12691. The timebase of the input timestamps.
  12692. @item pts
  12693. The PTS (Presentation TimeStamp) of the filtered video frame,
  12694. expressed in @var{TB} units. It's NAN if undefined.
  12695. @item t
  12696. The PTS of the filtered video frame,
  12697. expressed in seconds. It's NAN if undefined.
  12698. @item prev_pts
  12699. The PTS of the previously filtered video frame. It's NAN if undefined.
  12700. @item prev_selected_pts
  12701. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12702. @item prev_selected_t
  12703. The PTS of the last previously selected video frame. It's NAN if undefined.
  12704. @item start_pts
  12705. The PTS of the first video frame in the video. It's NAN if undefined.
  12706. @item start_t
  12707. The time of the first video frame in the video. It's NAN if undefined.
  12708. @item pict_type @emph{(video only)}
  12709. The type of the filtered frame. It can assume one of the following
  12710. values:
  12711. @table @option
  12712. @item I
  12713. @item P
  12714. @item B
  12715. @item S
  12716. @item SI
  12717. @item SP
  12718. @item BI
  12719. @end table
  12720. @item interlace_type @emph{(video only)}
  12721. The frame interlace type. It can assume one of the following values:
  12722. @table @option
  12723. @item PROGRESSIVE
  12724. The frame is progressive (not interlaced).
  12725. @item TOPFIRST
  12726. The frame is top-field-first.
  12727. @item BOTTOMFIRST
  12728. The frame is bottom-field-first.
  12729. @end table
  12730. @item consumed_sample_n @emph{(audio only)}
  12731. the number of selected samples before the current frame
  12732. @item samples_n @emph{(audio only)}
  12733. the number of samples in the current frame
  12734. @item sample_rate @emph{(audio only)}
  12735. the input sample rate
  12736. @item key
  12737. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12738. @item pos
  12739. the position in the file of the filtered frame, -1 if the information
  12740. is not available (e.g. for synthetic video)
  12741. @item scene @emph{(video only)}
  12742. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12743. probability for the current frame to introduce a new scene, while a higher
  12744. value means the current frame is more likely to be one (see the example below)
  12745. @item concatdec_select
  12746. The concat demuxer can select only part of a concat input file by setting an
  12747. inpoint and an outpoint, but the output packets may not be entirely contained
  12748. in the selected interval. By using this variable, it is possible to skip frames
  12749. generated by the concat demuxer which are not exactly contained in the selected
  12750. interval.
  12751. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12752. and the @var{lavf.concat.duration} packet metadata values which are also
  12753. present in the decoded frames.
  12754. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12755. start_time and either the duration metadata is missing or the frame pts is less
  12756. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12757. missing.
  12758. That basically means that an input frame is selected if its pts is within the
  12759. interval set by the concat demuxer.
  12760. @end table
  12761. The default value of the select expression is "1".
  12762. @subsection Examples
  12763. @itemize
  12764. @item
  12765. Select all frames in input:
  12766. @example
  12767. select
  12768. @end example
  12769. The example above is the same as:
  12770. @example
  12771. select=1
  12772. @end example
  12773. @item
  12774. Skip all frames:
  12775. @example
  12776. select=0
  12777. @end example
  12778. @item
  12779. Select only I-frames:
  12780. @example
  12781. select='eq(pict_type\,I)'
  12782. @end example
  12783. @item
  12784. Select one frame every 100:
  12785. @example
  12786. select='not(mod(n\,100))'
  12787. @end example
  12788. @item
  12789. Select only frames contained in the 10-20 time interval:
  12790. @example
  12791. select=between(t\,10\,20)
  12792. @end example
  12793. @item
  12794. Select only I-frames contained in the 10-20 time interval:
  12795. @example
  12796. select=between(t\,10\,20)*eq(pict_type\,I)
  12797. @end example
  12798. @item
  12799. Select frames with a minimum distance of 10 seconds:
  12800. @example
  12801. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12802. @end example
  12803. @item
  12804. Use aselect to select only audio frames with samples number > 100:
  12805. @example
  12806. aselect='gt(samples_n\,100)'
  12807. @end example
  12808. @item
  12809. Create a mosaic of the first scenes:
  12810. @example
  12811. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12812. @end example
  12813. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12814. choice.
  12815. @item
  12816. Send even and odd frames to separate outputs, and compose them:
  12817. @example
  12818. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12819. @end example
  12820. @item
  12821. Select useful frames from an ffconcat file which is using inpoints and
  12822. outpoints but where the source files are not intra frame only.
  12823. @example
  12824. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12825. @end example
  12826. @end itemize
  12827. @section sendcmd, asendcmd
  12828. Send commands to filters in the filtergraph.
  12829. These filters read commands to be sent to other filters in the
  12830. filtergraph.
  12831. @code{sendcmd} must be inserted between two video filters,
  12832. @code{asendcmd} must be inserted between two audio filters, but apart
  12833. from that they act the same way.
  12834. The specification of commands can be provided in the filter arguments
  12835. with the @var{commands} option, or in a file specified by the
  12836. @var{filename} option.
  12837. These filters accept the following options:
  12838. @table @option
  12839. @item commands, c
  12840. Set the commands to be read and sent to the other filters.
  12841. @item filename, f
  12842. Set the filename of the commands to be read and sent to the other
  12843. filters.
  12844. @end table
  12845. @subsection Commands syntax
  12846. A commands description consists of a sequence of interval
  12847. specifications, comprising a list of commands to be executed when a
  12848. particular event related to that interval occurs. The occurring event
  12849. is typically the current frame time entering or leaving a given time
  12850. interval.
  12851. An interval is specified by the following syntax:
  12852. @example
  12853. @var{START}[-@var{END}] @var{COMMANDS};
  12854. @end example
  12855. The time interval is specified by the @var{START} and @var{END} times.
  12856. @var{END} is optional and defaults to the maximum time.
  12857. The current frame time is considered within the specified interval if
  12858. it is included in the interval [@var{START}, @var{END}), that is when
  12859. the time is greater or equal to @var{START} and is lesser than
  12860. @var{END}.
  12861. @var{COMMANDS} consists of a sequence of one or more command
  12862. specifications, separated by ",", relating to that interval. The
  12863. syntax of a command specification is given by:
  12864. @example
  12865. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12866. @end example
  12867. @var{FLAGS} is optional and specifies the type of events relating to
  12868. the time interval which enable sending the specified command, and must
  12869. be a non-null sequence of identifier flags separated by "+" or "|" and
  12870. enclosed between "[" and "]".
  12871. The following flags are recognized:
  12872. @table @option
  12873. @item enter
  12874. The command is sent when the current frame timestamp enters the
  12875. specified interval. In other words, the command is sent when the
  12876. previous frame timestamp was not in the given interval, and the
  12877. current is.
  12878. @item leave
  12879. The command is sent when the current frame timestamp leaves the
  12880. specified interval. In other words, the command is sent when the
  12881. previous frame timestamp was in the given interval, and the
  12882. current is not.
  12883. @end table
  12884. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12885. assumed.
  12886. @var{TARGET} specifies the target of the command, usually the name of
  12887. the filter class or a specific filter instance name.
  12888. @var{COMMAND} specifies the name of the command for the target filter.
  12889. @var{ARG} is optional and specifies the optional list of argument for
  12890. the given @var{COMMAND}.
  12891. Between one interval specification and another, whitespaces, or
  12892. sequences of characters starting with @code{#} until the end of line,
  12893. are ignored and can be used to annotate comments.
  12894. A simplified BNF description of the commands specification syntax
  12895. follows:
  12896. @example
  12897. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12898. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12899. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12900. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12901. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12902. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12903. @end example
  12904. @subsection Examples
  12905. @itemize
  12906. @item
  12907. Specify audio tempo change at second 4:
  12908. @example
  12909. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12910. @end example
  12911. @item
  12912. Specify a list of drawtext and hue commands in a file.
  12913. @example
  12914. # show text in the interval 5-10
  12915. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12916. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12917. # desaturate the image in the interval 15-20
  12918. 15.0-20.0 [enter] hue s 0,
  12919. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12920. [leave] hue s 1,
  12921. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12922. # apply an exponential saturation fade-out effect, starting from time 25
  12923. 25 [enter] hue s exp(25-t)
  12924. @end example
  12925. A filtergraph allowing to read and process the above command list
  12926. stored in a file @file{test.cmd}, can be specified with:
  12927. @example
  12928. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12929. @end example
  12930. @end itemize
  12931. @anchor{setpts}
  12932. @section setpts, asetpts
  12933. Change the PTS (presentation timestamp) of the input frames.
  12934. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12935. This filter accepts the following options:
  12936. @table @option
  12937. @item expr
  12938. The expression which is evaluated for each frame to construct its timestamp.
  12939. @end table
  12940. The expression is evaluated through the eval API and can contain the following
  12941. constants:
  12942. @table @option
  12943. @item FRAME_RATE
  12944. frame rate, only defined for constant frame-rate video
  12945. @item PTS
  12946. The presentation timestamp in input
  12947. @item N
  12948. The count of the input frame for video or the number of consumed samples,
  12949. not including the current frame for audio, starting from 0.
  12950. @item NB_CONSUMED_SAMPLES
  12951. The number of consumed samples, not including the current frame (only
  12952. audio)
  12953. @item NB_SAMPLES, S
  12954. The number of samples in the current frame (only audio)
  12955. @item SAMPLE_RATE, SR
  12956. The audio sample rate.
  12957. @item STARTPTS
  12958. The PTS of the first frame.
  12959. @item STARTT
  12960. the time in seconds of the first frame
  12961. @item INTERLACED
  12962. State whether the current frame is interlaced.
  12963. @item T
  12964. the time in seconds of the current frame
  12965. @item POS
  12966. original position in the file of the frame, or undefined if undefined
  12967. for the current frame
  12968. @item PREV_INPTS
  12969. The previous input PTS.
  12970. @item PREV_INT
  12971. previous input time in seconds
  12972. @item PREV_OUTPTS
  12973. The previous output PTS.
  12974. @item PREV_OUTT
  12975. previous output time in seconds
  12976. @item RTCTIME
  12977. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12978. instead.
  12979. @item RTCSTART
  12980. The wallclock (RTC) time at the start of the movie in microseconds.
  12981. @item TB
  12982. The timebase of the input timestamps.
  12983. @end table
  12984. @subsection Examples
  12985. @itemize
  12986. @item
  12987. Start counting PTS from zero
  12988. @example
  12989. setpts=PTS-STARTPTS
  12990. @end example
  12991. @item
  12992. Apply fast motion effect:
  12993. @example
  12994. setpts=0.5*PTS
  12995. @end example
  12996. @item
  12997. Apply slow motion effect:
  12998. @example
  12999. setpts=2.0*PTS
  13000. @end example
  13001. @item
  13002. Set fixed rate of 25 frames per second:
  13003. @example
  13004. setpts=N/(25*TB)
  13005. @end example
  13006. @item
  13007. Set fixed rate 25 fps with some jitter:
  13008. @example
  13009. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13010. @end example
  13011. @item
  13012. Apply an offset of 10 seconds to the input PTS:
  13013. @example
  13014. setpts=PTS+10/TB
  13015. @end example
  13016. @item
  13017. Generate timestamps from a "live source" and rebase onto the current timebase:
  13018. @example
  13019. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13020. @end example
  13021. @item
  13022. Generate timestamps by counting samples:
  13023. @example
  13024. asetpts=N/SR/TB
  13025. @end example
  13026. @end itemize
  13027. @section settb, asettb
  13028. Set the timebase to use for the output frames timestamps.
  13029. It is mainly useful for testing timebase configuration.
  13030. It accepts the following parameters:
  13031. @table @option
  13032. @item expr, tb
  13033. The expression which is evaluated into the output timebase.
  13034. @end table
  13035. The value for @option{tb} is an arithmetic expression representing a
  13036. rational. The expression can contain the constants "AVTB" (the default
  13037. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13038. audio only). Default value is "intb".
  13039. @subsection Examples
  13040. @itemize
  13041. @item
  13042. Set the timebase to 1/25:
  13043. @example
  13044. settb=expr=1/25
  13045. @end example
  13046. @item
  13047. Set the timebase to 1/10:
  13048. @example
  13049. settb=expr=0.1
  13050. @end example
  13051. @item
  13052. Set the timebase to 1001/1000:
  13053. @example
  13054. settb=1+0.001
  13055. @end example
  13056. @item
  13057. Set the timebase to 2*intb:
  13058. @example
  13059. settb=2*intb
  13060. @end example
  13061. @item
  13062. Set the default timebase value:
  13063. @example
  13064. settb=AVTB
  13065. @end example
  13066. @end itemize
  13067. @section showcqt
  13068. Convert input audio to a video output representing frequency spectrum
  13069. logarithmically using Brown-Puckette constant Q transform algorithm with
  13070. direct frequency domain coefficient calculation (but the transform itself
  13071. is not really constant Q, instead the Q factor is actually variable/clamped),
  13072. with musical tone scale, from E0 to D#10.
  13073. The filter accepts the following options:
  13074. @table @option
  13075. @item size, s
  13076. Specify the video size for the output. It must be even. For the syntax of this option,
  13077. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13078. Default value is @code{1920x1080}.
  13079. @item fps, rate, r
  13080. Set the output frame rate. Default value is @code{25}.
  13081. @item bar_h
  13082. Set the bargraph height. It must be even. Default value is @code{-1} which
  13083. computes the bargraph height automatically.
  13084. @item axis_h
  13085. Set the axis height. It must be even. Default value is @code{-1} which computes
  13086. the axis height automatically.
  13087. @item sono_h
  13088. Set the sonogram height. It must be even. Default value is @code{-1} which
  13089. computes the sonogram height automatically.
  13090. @item fullhd
  13091. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13092. instead. Default value is @code{1}.
  13093. @item sono_v, volume
  13094. Specify the sonogram volume expression. It can contain variables:
  13095. @table @option
  13096. @item bar_v
  13097. the @var{bar_v} evaluated expression
  13098. @item frequency, freq, f
  13099. the frequency where it is evaluated
  13100. @item timeclamp, tc
  13101. the value of @var{timeclamp} option
  13102. @end table
  13103. and functions:
  13104. @table @option
  13105. @item a_weighting(f)
  13106. A-weighting of equal loudness
  13107. @item b_weighting(f)
  13108. B-weighting of equal loudness
  13109. @item c_weighting(f)
  13110. C-weighting of equal loudness.
  13111. @end table
  13112. Default value is @code{16}.
  13113. @item bar_v, volume2
  13114. Specify the bargraph volume expression. It can contain variables:
  13115. @table @option
  13116. @item sono_v
  13117. the @var{sono_v} evaluated expression
  13118. @item frequency, freq, f
  13119. the frequency where it is evaluated
  13120. @item timeclamp, tc
  13121. the value of @var{timeclamp} option
  13122. @end table
  13123. and functions:
  13124. @table @option
  13125. @item a_weighting(f)
  13126. A-weighting of equal loudness
  13127. @item b_weighting(f)
  13128. B-weighting of equal loudness
  13129. @item c_weighting(f)
  13130. C-weighting of equal loudness.
  13131. @end table
  13132. Default value is @code{sono_v}.
  13133. @item sono_g, gamma
  13134. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13135. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13136. Acceptable range is @code{[1, 7]}.
  13137. @item bar_g, gamma2
  13138. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13139. @code{[1, 7]}.
  13140. @item bar_t
  13141. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13142. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13143. @item timeclamp, tc
  13144. Specify the transform timeclamp. At low frequency, there is trade-off between
  13145. accuracy in time domain and frequency domain. If timeclamp is lower,
  13146. event in time domain is represented more accurately (such as fast bass drum),
  13147. otherwise event in frequency domain is represented more accurately
  13148. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13149. @item basefreq
  13150. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13151. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13152. @item endfreq
  13153. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13154. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13155. @item coeffclamp
  13156. This option is deprecated and ignored.
  13157. @item tlength
  13158. Specify the transform length in time domain. Use this option to control accuracy
  13159. trade-off between time domain and frequency domain at every frequency sample.
  13160. It can contain variables:
  13161. @table @option
  13162. @item frequency, freq, f
  13163. the frequency where it is evaluated
  13164. @item timeclamp, tc
  13165. the value of @var{timeclamp} option.
  13166. @end table
  13167. Default value is @code{384*tc/(384+tc*f)}.
  13168. @item count
  13169. Specify the transform count for every video frame. Default value is @code{6}.
  13170. Acceptable range is @code{[1, 30]}.
  13171. @item fcount
  13172. Specify the transform count for every single pixel. Default value is @code{0},
  13173. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13174. @item fontfile
  13175. Specify font file for use with freetype to draw the axis. If not specified,
  13176. use embedded font. Note that drawing with font file or embedded font is not
  13177. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13178. option instead.
  13179. @item font
  13180. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13181. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13182. @item fontcolor
  13183. Specify font color expression. This is arithmetic expression that should return
  13184. integer value 0xRRGGBB. It can contain variables:
  13185. @table @option
  13186. @item frequency, freq, f
  13187. the frequency where it is evaluated
  13188. @item timeclamp, tc
  13189. the value of @var{timeclamp} option
  13190. @end table
  13191. and functions:
  13192. @table @option
  13193. @item midi(f)
  13194. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13195. @item r(x), g(x), b(x)
  13196. red, green, and blue value of intensity x.
  13197. @end table
  13198. Default value is @code{st(0, (midi(f)-59.5)/12);
  13199. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13200. r(1-ld(1)) + b(ld(1))}.
  13201. @item axisfile
  13202. Specify image file to draw the axis. This option override @var{fontfile} and
  13203. @var{fontcolor} option.
  13204. @item axis, text
  13205. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13206. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13207. Default value is @code{1}.
  13208. @item csp
  13209. Set colorspace. The accepted values are:
  13210. @table @samp
  13211. @item unspecified
  13212. Unspecified (default)
  13213. @item bt709
  13214. BT.709
  13215. @item fcc
  13216. FCC
  13217. @item bt470bg
  13218. BT.470BG or BT.601-6 625
  13219. @item smpte170m
  13220. SMPTE-170M or BT.601-6 525
  13221. @item smpte240m
  13222. SMPTE-240M
  13223. @item bt2020ncl
  13224. BT.2020 with non-constant luminance
  13225. @end table
  13226. @item cscheme
  13227. Set spectrogram color scheme. This is list of floating point values with format
  13228. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13229. The default is @code{1|0.5|0|0|0.5|1}.
  13230. @end table
  13231. @subsection Examples
  13232. @itemize
  13233. @item
  13234. Playing audio while showing the spectrum:
  13235. @example
  13236. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13237. @end example
  13238. @item
  13239. Same as above, but with frame rate 30 fps:
  13240. @example
  13241. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13242. @end example
  13243. @item
  13244. Playing at 1280x720:
  13245. @example
  13246. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13247. @end example
  13248. @item
  13249. Disable sonogram display:
  13250. @example
  13251. sono_h=0
  13252. @end example
  13253. @item
  13254. A1 and its harmonics: A1, A2, (near)E3, A3:
  13255. @example
  13256. 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),
  13257. asplit[a][out1]; [a] showcqt [out0]'
  13258. @end example
  13259. @item
  13260. Same as above, but with more accuracy in frequency domain:
  13261. @example
  13262. 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),
  13263. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13264. @end example
  13265. @item
  13266. Custom volume:
  13267. @example
  13268. bar_v=10:sono_v=bar_v*a_weighting(f)
  13269. @end example
  13270. @item
  13271. Custom gamma, now spectrum is linear to the amplitude.
  13272. @example
  13273. bar_g=2:sono_g=2
  13274. @end example
  13275. @item
  13276. Custom tlength equation:
  13277. @example
  13278. 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)))'
  13279. @end example
  13280. @item
  13281. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13282. @example
  13283. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13284. @end example
  13285. @item
  13286. Custom font using fontconfig:
  13287. @example
  13288. font='Courier New,Monospace,mono|bold'
  13289. @end example
  13290. @item
  13291. Custom frequency range with custom axis using image file:
  13292. @example
  13293. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13294. @end example
  13295. @end itemize
  13296. @section showfreqs
  13297. Convert input audio to video output representing the audio power spectrum.
  13298. Audio amplitude is on Y-axis while frequency is on X-axis.
  13299. The filter accepts the following options:
  13300. @table @option
  13301. @item size, s
  13302. Specify size of video. For the syntax of this option, check the
  13303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13304. Default is @code{1024x512}.
  13305. @item mode
  13306. Set display mode.
  13307. This set how each frequency bin will be represented.
  13308. It accepts the following values:
  13309. @table @samp
  13310. @item line
  13311. @item bar
  13312. @item dot
  13313. @end table
  13314. Default is @code{bar}.
  13315. @item ascale
  13316. Set amplitude scale.
  13317. It accepts the following values:
  13318. @table @samp
  13319. @item lin
  13320. Linear scale.
  13321. @item sqrt
  13322. Square root scale.
  13323. @item cbrt
  13324. Cubic root scale.
  13325. @item log
  13326. Logarithmic scale.
  13327. @end table
  13328. Default is @code{log}.
  13329. @item fscale
  13330. Set frequency scale.
  13331. It accepts the following values:
  13332. @table @samp
  13333. @item lin
  13334. Linear scale.
  13335. @item log
  13336. Logarithmic scale.
  13337. @item rlog
  13338. Reverse logarithmic scale.
  13339. @end table
  13340. Default is @code{lin}.
  13341. @item win_size
  13342. Set window size.
  13343. It accepts the following values:
  13344. @table @samp
  13345. @item w16
  13346. @item w32
  13347. @item w64
  13348. @item w128
  13349. @item w256
  13350. @item w512
  13351. @item w1024
  13352. @item w2048
  13353. @item w4096
  13354. @item w8192
  13355. @item w16384
  13356. @item w32768
  13357. @item w65536
  13358. @end table
  13359. Default is @code{w2048}
  13360. @item win_func
  13361. Set windowing function.
  13362. It accepts the following values:
  13363. @table @samp
  13364. @item rect
  13365. @item bartlett
  13366. @item hanning
  13367. @item hamming
  13368. @item blackman
  13369. @item welch
  13370. @item flattop
  13371. @item bharris
  13372. @item bnuttall
  13373. @item bhann
  13374. @item sine
  13375. @item nuttall
  13376. @item lanczos
  13377. @item gauss
  13378. @item tukey
  13379. @item dolph
  13380. @item cauchy
  13381. @item parzen
  13382. @item poisson
  13383. @end table
  13384. Default is @code{hanning}.
  13385. @item overlap
  13386. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13387. which means optimal overlap for selected window function will be picked.
  13388. @item averaging
  13389. Set time averaging. Setting this to 0 will display current maximal peaks.
  13390. Default is @code{1}, which means time averaging is disabled.
  13391. @item colors
  13392. Specify list of colors separated by space or by '|' which will be used to
  13393. draw channel frequencies. Unrecognized or missing colors will be replaced
  13394. by white color.
  13395. @item cmode
  13396. Set channel display mode.
  13397. It accepts the following values:
  13398. @table @samp
  13399. @item combined
  13400. @item separate
  13401. @end table
  13402. Default is @code{combined}.
  13403. @item minamp
  13404. Set minimum amplitude used in @code{log} amplitude scaler.
  13405. @end table
  13406. @anchor{showspectrum}
  13407. @section showspectrum
  13408. Convert input audio to a video output, representing the audio frequency
  13409. spectrum.
  13410. The filter accepts the following options:
  13411. @table @option
  13412. @item size, s
  13413. Specify 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{640x512}.
  13416. @item slide
  13417. Specify how the spectrum should slide along the window.
  13418. It accepts the following values:
  13419. @table @samp
  13420. @item replace
  13421. the samples start again on the left when they reach the right
  13422. @item scroll
  13423. the samples scroll from right to left
  13424. @item fullframe
  13425. frames are only produced when the samples reach the right
  13426. @item rscroll
  13427. the samples scroll from left to right
  13428. @end table
  13429. Default value is @code{replace}.
  13430. @item mode
  13431. Specify display mode.
  13432. It accepts the following values:
  13433. @table @samp
  13434. @item combined
  13435. all channels are displayed in the same row
  13436. @item separate
  13437. all channels are displayed in separate rows
  13438. @end table
  13439. Default value is @samp{combined}.
  13440. @item color
  13441. Specify display color mode.
  13442. It accepts the following values:
  13443. @table @samp
  13444. @item channel
  13445. each channel is displayed in a separate color
  13446. @item intensity
  13447. each channel is displayed using the same color scheme
  13448. @item rainbow
  13449. each channel is displayed using the rainbow color scheme
  13450. @item moreland
  13451. each channel is displayed using the moreland color scheme
  13452. @item nebulae
  13453. each channel is displayed using the nebulae color scheme
  13454. @item fire
  13455. each channel is displayed using the fire color scheme
  13456. @item fiery
  13457. each channel is displayed using the fiery color scheme
  13458. @item fruit
  13459. each channel is displayed using the fruit color scheme
  13460. @item cool
  13461. each channel is displayed using the cool color scheme
  13462. @end table
  13463. Default value is @samp{channel}.
  13464. @item scale
  13465. Specify scale used for calculating intensity color values.
  13466. It accepts the following values:
  13467. @table @samp
  13468. @item lin
  13469. linear
  13470. @item sqrt
  13471. square root, default
  13472. @item cbrt
  13473. cubic root
  13474. @item log
  13475. logarithmic
  13476. @item 4thrt
  13477. 4th root
  13478. @item 5thrt
  13479. 5th root
  13480. @end table
  13481. Default value is @samp{sqrt}.
  13482. @item saturation
  13483. Set saturation modifier for displayed colors. Negative values provide
  13484. alternative color scheme. @code{0} is no saturation at all.
  13485. Saturation must be in [-10.0, 10.0] range.
  13486. Default value is @code{1}.
  13487. @item win_func
  13488. Set window function.
  13489. It accepts the following values:
  13490. @table @samp
  13491. @item rect
  13492. @item bartlett
  13493. @item hann
  13494. @item hanning
  13495. @item hamming
  13496. @item blackman
  13497. @item welch
  13498. @item flattop
  13499. @item bharris
  13500. @item bnuttall
  13501. @item bhann
  13502. @item sine
  13503. @item nuttall
  13504. @item lanczos
  13505. @item gauss
  13506. @item tukey
  13507. @item dolph
  13508. @item cauchy
  13509. @item parzen
  13510. @item poisson
  13511. @end table
  13512. Default value is @code{hann}.
  13513. @item orientation
  13514. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13515. @code{horizontal}. Default is @code{vertical}.
  13516. @item overlap
  13517. Set ratio of overlap window. Default value is @code{0}.
  13518. When value is @code{1} overlap is set to recommended size for specific
  13519. window function currently used.
  13520. @item gain
  13521. Set scale gain for calculating intensity color values.
  13522. Default value is @code{1}.
  13523. @item data
  13524. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13525. @item rotation
  13526. Set color rotation, must be in [-1.0, 1.0] range.
  13527. Default value is @code{0}.
  13528. @end table
  13529. The usage is very similar to the showwaves filter; see the examples in that
  13530. section.
  13531. @subsection Examples
  13532. @itemize
  13533. @item
  13534. Large window with logarithmic color scaling:
  13535. @example
  13536. showspectrum=s=1280x480:scale=log
  13537. @end example
  13538. @item
  13539. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13540. @example
  13541. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13542. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13543. @end example
  13544. @end itemize
  13545. @section showspectrumpic
  13546. Convert input audio to a single video frame, representing the audio frequency
  13547. spectrum.
  13548. The filter accepts the following options:
  13549. @table @option
  13550. @item size, s
  13551. Specify the video size for the output. For the syntax of this option, check the
  13552. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13553. Default value is @code{4096x2048}.
  13554. @item mode
  13555. Specify display mode.
  13556. It accepts the following values:
  13557. @table @samp
  13558. @item combined
  13559. all channels are displayed in the same row
  13560. @item separate
  13561. all channels are displayed in separate rows
  13562. @end table
  13563. Default value is @samp{combined}.
  13564. @item color
  13565. Specify display color mode.
  13566. It accepts the following values:
  13567. @table @samp
  13568. @item channel
  13569. each channel is displayed in a separate color
  13570. @item intensity
  13571. each channel is displayed using the same color scheme
  13572. @item rainbow
  13573. each channel is displayed using the rainbow color scheme
  13574. @item moreland
  13575. each channel is displayed using the moreland color scheme
  13576. @item nebulae
  13577. each channel is displayed using the nebulae color scheme
  13578. @item fire
  13579. each channel is displayed using the fire color scheme
  13580. @item fiery
  13581. each channel is displayed using the fiery color scheme
  13582. @item fruit
  13583. each channel is displayed using the fruit color scheme
  13584. @item cool
  13585. each channel is displayed using the cool color scheme
  13586. @end table
  13587. Default value is @samp{intensity}.
  13588. @item scale
  13589. Specify scale used for calculating intensity color values.
  13590. It accepts the following values:
  13591. @table @samp
  13592. @item lin
  13593. linear
  13594. @item sqrt
  13595. square root, default
  13596. @item cbrt
  13597. cubic root
  13598. @item log
  13599. logarithmic
  13600. @item 4thrt
  13601. 4th root
  13602. @item 5thrt
  13603. 5th root
  13604. @end table
  13605. Default value is @samp{log}.
  13606. @item saturation
  13607. Set saturation modifier for displayed colors. Negative values provide
  13608. alternative color scheme. @code{0} is no saturation at all.
  13609. Saturation must be in [-10.0, 10.0] range.
  13610. Default value is @code{1}.
  13611. @item win_func
  13612. Set window function.
  13613. It accepts the following values:
  13614. @table @samp
  13615. @item rect
  13616. @item bartlett
  13617. @item hann
  13618. @item hanning
  13619. @item hamming
  13620. @item blackman
  13621. @item welch
  13622. @item flattop
  13623. @item bharris
  13624. @item bnuttall
  13625. @item bhann
  13626. @item sine
  13627. @item nuttall
  13628. @item lanczos
  13629. @item gauss
  13630. @item tukey
  13631. @item dolph
  13632. @item cauchy
  13633. @item parzen
  13634. @item poisson
  13635. @end table
  13636. Default value is @code{hann}.
  13637. @item orientation
  13638. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13639. @code{horizontal}. Default is @code{vertical}.
  13640. @item gain
  13641. Set scale gain for calculating intensity color values.
  13642. Default value is @code{1}.
  13643. @item legend
  13644. Draw time and frequency axes and legends. Default is enabled.
  13645. @item rotation
  13646. Set color rotation, must be in [-1.0, 1.0] range.
  13647. Default value is @code{0}.
  13648. @end table
  13649. @subsection Examples
  13650. @itemize
  13651. @item
  13652. Extract an audio spectrogram of a whole audio track
  13653. in a 1024x1024 picture using @command{ffmpeg}:
  13654. @example
  13655. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13656. @end example
  13657. @end itemize
  13658. @section showvolume
  13659. Convert input audio volume to a video output.
  13660. The filter accepts the following options:
  13661. @table @option
  13662. @item rate, r
  13663. Set video rate.
  13664. @item b
  13665. Set border width, allowed range is [0, 5]. Default is 1.
  13666. @item w
  13667. Set channel width, allowed range is [80, 8192]. Default is 400.
  13668. @item h
  13669. Set channel height, allowed range is [1, 900]. Default is 20.
  13670. @item f
  13671. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13672. @item c
  13673. Set volume color expression.
  13674. The expression can use the following variables:
  13675. @table @option
  13676. @item VOLUME
  13677. Current max volume of channel in dB.
  13678. @item PEAK
  13679. Current peak.
  13680. @item CHANNEL
  13681. Current channel number, starting from 0.
  13682. @end table
  13683. @item t
  13684. If set, displays channel names. Default is enabled.
  13685. @item v
  13686. If set, displays volume values. Default is enabled.
  13687. @item o
  13688. Set orientation, can be @code{horizontal} or @code{vertical},
  13689. default is @code{horizontal}.
  13690. @item s
  13691. Set step size, allowed range s [0, 5]. Default is 0, which means
  13692. step is disabled.
  13693. @end table
  13694. @section showwaves
  13695. Convert input audio to a video output, representing the samples waves.
  13696. The filter accepts the following options:
  13697. @table @option
  13698. @item size, s
  13699. Specify the video size for the output. For the syntax of this option, check the
  13700. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13701. Default value is @code{600x240}.
  13702. @item mode
  13703. Set display mode.
  13704. Available values are:
  13705. @table @samp
  13706. @item point
  13707. Draw a point for each sample.
  13708. @item line
  13709. Draw a vertical line for each sample.
  13710. @item p2p
  13711. Draw a point for each sample and a line between them.
  13712. @item cline
  13713. Draw a centered vertical line for each sample.
  13714. @end table
  13715. Default value is @code{point}.
  13716. @item n
  13717. Set the number of samples which are printed on the same column. A
  13718. larger value will decrease the frame rate. Must be a positive
  13719. integer. This option can be set only if the value for @var{rate}
  13720. is not explicitly specified.
  13721. @item rate, r
  13722. Set the (approximate) output frame rate. This is done by setting the
  13723. option @var{n}. Default value is "25".
  13724. @item split_channels
  13725. Set if channels should be drawn separately or overlap. Default value is 0.
  13726. @item colors
  13727. Set colors separated by '|' which are going to be used for drawing of each channel.
  13728. @item scale
  13729. Set amplitude scale.
  13730. Available values are:
  13731. @table @samp
  13732. @item lin
  13733. Linear.
  13734. @item log
  13735. Logarithmic.
  13736. @item sqrt
  13737. Square root.
  13738. @item cbrt
  13739. Cubic root.
  13740. @end table
  13741. Default is linear.
  13742. @end table
  13743. @subsection Examples
  13744. @itemize
  13745. @item
  13746. Output the input file audio and the corresponding video representation
  13747. at the same time:
  13748. @example
  13749. amovie=a.mp3,asplit[out0],showwaves[out1]
  13750. @end example
  13751. @item
  13752. Create a synthetic signal and show it with showwaves, forcing a
  13753. frame rate of 30 frames per second:
  13754. @example
  13755. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13756. @end example
  13757. @end itemize
  13758. @section showwavespic
  13759. Convert input audio to a single video frame, representing the samples waves.
  13760. The filter accepts the following options:
  13761. @table @option
  13762. @item size, s
  13763. Specify the video size for the output. For the syntax of this option, check the
  13764. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13765. Default value is @code{600x240}.
  13766. @item split_channels
  13767. Set if channels should be drawn separately or overlap. Default value is 0.
  13768. @item colors
  13769. Set colors separated by '|' which are going to be used for drawing of each channel.
  13770. @item scale
  13771. Set amplitude scale.
  13772. Available values are:
  13773. @table @samp
  13774. @item lin
  13775. Linear.
  13776. @item log
  13777. Logarithmic.
  13778. @item sqrt
  13779. Square root.
  13780. @item cbrt
  13781. Cubic root.
  13782. @end table
  13783. Default is linear.
  13784. @end table
  13785. @subsection Examples
  13786. @itemize
  13787. @item
  13788. Extract a channel split representation of the wave form of a whole audio track
  13789. in a 1024x800 picture using @command{ffmpeg}:
  13790. @example
  13791. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13792. @end example
  13793. @end itemize
  13794. @section sidedata, asidedata
  13795. Delete frame side data, or select frames based on it.
  13796. This filter accepts the following options:
  13797. @table @option
  13798. @item mode
  13799. Set mode of operation of the filter.
  13800. Can be one of the following:
  13801. @table @samp
  13802. @item select
  13803. Select every frame with side data of @code{type}.
  13804. @item delete
  13805. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13806. data in the frame.
  13807. @end table
  13808. @item type
  13809. Set side data type used with all modes. Must be set for @code{select} mode. For
  13810. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13811. in @file{libavutil/frame.h}. For example, to choose
  13812. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13813. @end table
  13814. @section spectrumsynth
  13815. Sythesize audio from 2 input video spectrums, first input stream represents
  13816. magnitude across time and second represents phase across time.
  13817. The filter will transform from frequency domain as displayed in videos back
  13818. to time domain as presented in audio output.
  13819. This filter is primarily created for reversing processed @ref{showspectrum}
  13820. filter outputs, but can synthesize sound from other spectrograms too.
  13821. But in such case results are going to be poor if the phase data is not
  13822. available, because in such cases phase data need to be recreated, usually
  13823. its just recreated from random noise.
  13824. For best results use gray only output (@code{channel} color mode in
  13825. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13826. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13827. @code{data} option. Inputs videos should generally use @code{fullframe}
  13828. slide mode as that saves resources needed for decoding video.
  13829. The filter accepts the following options:
  13830. @table @option
  13831. @item sample_rate
  13832. Specify sample rate of output audio, the sample rate of audio from which
  13833. spectrum was generated may differ.
  13834. @item channels
  13835. Set number of channels represented in input video spectrums.
  13836. @item scale
  13837. Set scale which was used when generating magnitude input spectrum.
  13838. Can be @code{lin} or @code{log}. Default is @code{log}.
  13839. @item slide
  13840. Set slide which was used when generating inputs spectrums.
  13841. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13842. Default is @code{fullframe}.
  13843. @item win_func
  13844. Set window function used for resynthesis.
  13845. @item overlap
  13846. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13847. which means optimal overlap for selected window function will be picked.
  13848. @item orientation
  13849. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13850. Default is @code{vertical}.
  13851. @end table
  13852. @subsection Examples
  13853. @itemize
  13854. @item
  13855. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13856. then resynthesize videos back to audio with spectrumsynth:
  13857. @example
  13858. 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
  13859. 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
  13860. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13861. @end example
  13862. @end itemize
  13863. @section split, asplit
  13864. Split input into several identical outputs.
  13865. @code{asplit} works with audio input, @code{split} with video.
  13866. The filter accepts a single parameter which specifies the number of outputs. If
  13867. unspecified, it defaults to 2.
  13868. @subsection Examples
  13869. @itemize
  13870. @item
  13871. Create two separate outputs from the same input:
  13872. @example
  13873. [in] split [out0][out1]
  13874. @end example
  13875. @item
  13876. To create 3 or more outputs, you need to specify the number of
  13877. outputs, like in:
  13878. @example
  13879. [in] asplit=3 [out0][out1][out2]
  13880. @end example
  13881. @item
  13882. Create two separate outputs from the same input, one cropped and
  13883. one padded:
  13884. @example
  13885. [in] split [splitout1][splitout2];
  13886. [splitout1] crop=100:100:0:0 [cropout];
  13887. [splitout2] pad=200:200:100:100 [padout];
  13888. @end example
  13889. @item
  13890. Create 5 copies of the input audio with @command{ffmpeg}:
  13891. @example
  13892. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13893. @end example
  13894. @end itemize
  13895. @section zmq, azmq
  13896. Receive commands sent through a libzmq client, and forward them to
  13897. filters in the filtergraph.
  13898. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13899. must be inserted between two video filters, @code{azmq} between two
  13900. audio filters.
  13901. To enable these filters you need to install the libzmq library and
  13902. headers and configure FFmpeg with @code{--enable-libzmq}.
  13903. For more information about libzmq see:
  13904. @url{http://www.zeromq.org/}
  13905. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13906. receives messages sent through a network interface defined by the
  13907. @option{bind_address} option.
  13908. The received message must be in the form:
  13909. @example
  13910. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13911. @end example
  13912. @var{TARGET} specifies the target of the command, usually the name of
  13913. the filter class or a specific filter instance name.
  13914. @var{COMMAND} specifies the name of the command for the target filter.
  13915. @var{ARG} is optional and specifies the optional argument list for the
  13916. given @var{COMMAND}.
  13917. Upon reception, the message is processed and the corresponding command
  13918. is injected into the filtergraph. Depending on the result, the filter
  13919. will send a reply to the client, adopting the format:
  13920. @example
  13921. @var{ERROR_CODE} @var{ERROR_REASON}
  13922. @var{MESSAGE}
  13923. @end example
  13924. @var{MESSAGE} is optional.
  13925. @subsection Examples
  13926. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13927. be used to send commands processed by these filters.
  13928. Consider the following filtergraph generated by @command{ffplay}
  13929. @example
  13930. ffplay -dumpgraph 1 -f lavfi "
  13931. color=s=100x100:c=red [l];
  13932. color=s=100x100:c=blue [r];
  13933. nullsrc=s=200x100, zmq [bg];
  13934. [bg][l] overlay [bg+l];
  13935. [bg+l][r] overlay=x=100 "
  13936. @end example
  13937. To change the color of the left side of the video, the following
  13938. command can be used:
  13939. @example
  13940. echo Parsed_color_0 c yellow | tools/zmqsend
  13941. @end example
  13942. To change the right side:
  13943. @example
  13944. echo Parsed_color_1 c pink | tools/zmqsend
  13945. @end example
  13946. @c man end MULTIMEDIA FILTERS
  13947. @chapter Multimedia Sources
  13948. @c man begin MULTIMEDIA SOURCES
  13949. Below is a description of the currently available multimedia sources.
  13950. @section amovie
  13951. This is the same as @ref{movie} source, except it selects an audio
  13952. stream by default.
  13953. @anchor{movie}
  13954. @section movie
  13955. Read audio and/or video stream(s) from a movie container.
  13956. It accepts the following parameters:
  13957. @table @option
  13958. @item filename
  13959. The name of the resource to read (not necessarily a file; it can also be a
  13960. device or a stream accessed through some protocol).
  13961. @item format_name, f
  13962. Specifies the format assumed for the movie to read, and can be either
  13963. the name of a container or an input device. If not specified, the
  13964. format is guessed from @var{movie_name} or by probing.
  13965. @item seek_point, sp
  13966. Specifies the seek point in seconds. The frames will be output
  13967. starting from this seek point. The parameter is evaluated with
  13968. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13969. postfix. The default value is "0".
  13970. @item streams, s
  13971. Specifies the streams to read. Several streams can be specified,
  13972. separated by "+". The source will then have as many outputs, in the
  13973. same order. The syntax is explained in the ``Stream specifiers''
  13974. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13975. respectively the default (best suited) video and audio stream. Default
  13976. is "dv", or "da" if the filter is called as "amovie".
  13977. @item stream_index, si
  13978. Specifies the index of the video stream to read. If the value is -1,
  13979. the most suitable video stream will be automatically selected. The default
  13980. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13981. audio instead of video.
  13982. @item loop
  13983. Specifies how many times to read the stream in sequence.
  13984. If the value is 0, the stream will be looped infinitely.
  13985. Default value is "1".
  13986. Note that when the movie is looped the source timestamps are not
  13987. changed, so it will generate non monotonically increasing timestamps.
  13988. @item discontinuity
  13989. Specifies the time difference between frames above which the point is
  13990. considered a timestamp discontinuity which is removed by adjusting the later
  13991. timestamps.
  13992. @end table
  13993. It allows overlaying a second video on top of the main input of
  13994. a filtergraph, as shown in this graph:
  13995. @example
  13996. input -----------> deltapts0 --> overlay --> output
  13997. ^
  13998. |
  13999. movie --> scale--> deltapts1 -------+
  14000. @end example
  14001. @subsection Examples
  14002. @itemize
  14003. @item
  14004. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14005. on top of the input labelled "in":
  14006. @example
  14007. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14008. [in] setpts=PTS-STARTPTS [main];
  14009. [main][over] overlay=16:16 [out]
  14010. @end example
  14011. @item
  14012. Read from a video4linux2 device, and overlay it on top of the input
  14013. labelled "in":
  14014. @example
  14015. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14016. [in] setpts=PTS-STARTPTS [main];
  14017. [main][over] overlay=16:16 [out]
  14018. @end example
  14019. @item
  14020. Read the first video stream and the audio stream with id 0x81 from
  14021. dvd.vob; the video is connected to the pad named "video" and the audio is
  14022. connected to the pad named "audio":
  14023. @example
  14024. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14025. @end example
  14026. @end itemize
  14027. @subsection Commands
  14028. Both movie and amovie support the following commands:
  14029. @table @option
  14030. @item seek
  14031. Perform seek using "av_seek_frame".
  14032. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14033. @itemize
  14034. @item
  14035. @var{stream_index}: If stream_index is -1, a default
  14036. stream is selected, and @var{timestamp} is automatically converted
  14037. from AV_TIME_BASE units to the stream specific time_base.
  14038. @item
  14039. @var{timestamp}: Timestamp in AVStream.time_base units
  14040. or, if no stream is specified, in AV_TIME_BASE units.
  14041. @item
  14042. @var{flags}: Flags which select direction and seeking mode.
  14043. @end itemize
  14044. @item get_duration
  14045. Get movie duration in AV_TIME_BASE units.
  14046. @end table
  14047. @c man end MULTIMEDIA SOURCES