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.

18240 lines
486KB

  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. ffmpeg-resampler manual for the complete list of supported options.
  1096. @subsection Examples
  1097. @itemize
  1098. @item
  1099. Resample the input audio to 44100Hz:
  1100. @example
  1101. aresample=44100
  1102. @end example
  1103. @item
  1104. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1105. samples per second compensation:
  1106. @example
  1107. aresample=async=1000
  1108. @end example
  1109. @end itemize
  1110. @section areverse
  1111. Reverse an audio clip.
  1112. Warning: This filter requires memory to buffer the entire clip, so trimming
  1113. is suggested.
  1114. @subsection Examples
  1115. @itemize
  1116. @item
  1117. Take the first 5 seconds of a clip, and reverse it.
  1118. @example
  1119. atrim=end=5,areverse
  1120. @end example
  1121. @end itemize
  1122. @section asetnsamples
  1123. Set the number of samples per each output audio frame.
  1124. The last output packet may contain a different number of samples, as
  1125. the filter will flush all the remaining samples when the input audio
  1126. signals its end.
  1127. The filter accepts the following options:
  1128. @table @option
  1129. @item nb_out_samples, n
  1130. Set the number of frames per each output audio frame. The number is
  1131. intended as the number of samples @emph{per each channel}.
  1132. Default value is 1024.
  1133. @item pad, p
  1134. If set to 1, the filter will pad the last audio frame with zeroes, so
  1135. that the last frame will contain the same number of samples as the
  1136. previous ones. Default value is 1.
  1137. @end table
  1138. For example, to set the number of per-frame samples to 1234 and
  1139. disable padding for the last frame, use:
  1140. @example
  1141. asetnsamples=n=1234:p=0
  1142. @end example
  1143. @section asetrate
  1144. Set the sample rate without altering the PCM data.
  1145. This will result in a change of speed and pitch.
  1146. The filter accepts the following options:
  1147. @table @option
  1148. @item sample_rate, r
  1149. Set the output sample rate. Default is 44100 Hz.
  1150. @end table
  1151. @section ashowinfo
  1152. Show a line containing various information for each input audio frame.
  1153. The input audio is not modified.
  1154. The shown line contains a sequence of key/value pairs of the form
  1155. @var{key}:@var{value}.
  1156. The following values are shown in the output:
  1157. @table @option
  1158. @item n
  1159. The (sequential) number of the input frame, starting from 0.
  1160. @item pts
  1161. The presentation timestamp of the input frame, in time base units; the time base
  1162. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1163. @item pts_time
  1164. The presentation timestamp of the input frame in seconds.
  1165. @item pos
  1166. position of the frame in the input stream, -1 if this information in
  1167. unavailable and/or meaningless (for example in case of synthetic audio)
  1168. @item fmt
  1169. The sample format.
  1170. @item chlayout
  1171. The channel layout.
  1172. @item rate
  1173. The sample rate for the audio frame.
  1174. @item nb_samples
  1175. The number of samples (per channel) in the frame.
  1176. @item checksum
  1177. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1178. audio, the data is treated as if all the planes were concatenated.
  1179. @item plane_checksums
  1180. A list of Adler-32 checksums for each data plane.
  1181. @end table
  1182. @anchor{astats}
  1183. @section astats
  1184. Display time domain statistical information about the audio channels.
  1185. Statistics are calculated and displayed for each audio channel and,
  1186. where applicable, an overall figure is also given.
  1187. It accepts the following option:
  1188. @table @option
  1189. @item length
  1190. Short window length in seconds, used for peak and trough RMS measurement.
  1191. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1192. @item metadata
  1193. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1194. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1195. disabled.
  1196. Available keys for each channel are:
  1197. DC_offset
  1198. Min_level
  1199. Max_level
  1200. Min_difference
  1201. Max_difference
  1202. Mean_difference
  1203. Peak_level
  1204. RMS_peak
  1205. RMS_trough
  1206. Crest_factor
  1207. Flat_factor
  1208. Peak_count
  1209. Bit_depth
  1210. and for Overall:
  1211. DC_offset
  1212. Min_level
  1213. Max_level
  1214. Min_difference
  1215. Max_difference
  1216. Mean_difference
  1217. Peak_level
  1218. RMS_level
  1219. RMS_peak
  1220. RMS_trough
  1221. Flat_factor
  1222. Peak_count
  1223. Bit_depth
  1224. Number_of_samples
  1225. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1226. this @code{lavfi.astats.Overall.Peak_count}.
  1227. For description what each key means read below.
  1228. @item reset
  1229. Set number of frame after which stats are going to be recalculated.
  1230. Default is disabled.
  1231. @end table
  1232. A description of each shown parameter follows:
  1233. @table @option
  1234. @item DC offset
  1235. Mean amplitude displacement from zero.
  1236. @item Min level
  1237. Minimal sample level.
  1238. @item Max level
  1239. Maximal sample level.
  1240. @item Min difference
  1241. Minimal difference between two consecutive samples.
  1242. @item Max difference
  1243. Maximal difference between two consecutive samples.
  1244. @item Mean difference
  1245. Mean difference between two consecutive samples.
  1246. The average of each difference between two consecutive samples.
  1247. @item Peak level dB
  1248. @item RMS level dB
  1249. Standard peak and RMS level measured in dBFS.
  1250. @item RMS peak dB
  1251. @item RMS trough dB
  1252. Peak and trough values for RMS level measured over a short window.
  1253. @item Crest factor
  1254. Standard ratio of peak to RMS level (note: not in dB).
  1255. @item Flat factor
  1256. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1257. (i.e. either @var{Min level} or @var{Max level}).
  1258. @item Peak count
  1259. Number of occasions (not the number of samples) that the signal attained either
  1260. @var{Min level} or @var{Max level}.
  1261. @item Bit depth
  1262. Overall bit depth of audio. Number of bits used for each sample.
  1263. @end table
  1264. @section asyncts
  1265. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1266. dropping samples/adding silence when needed.
  1267. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1268. It accepts the following parameters:
  1269. @table @option
  1270. @item compensate
  1271. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1272. by default. When disabled, time gaps are covered with silence.
  1273. @item min_delta
  1274. The minimum difference between timestamps and audio data (in seconds) to trigger
  1275. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1276. sync with this filter, try setting this parameter to 0.
  1277. @item max_comp
  1278. The maximum compensation in samples per second. Only relevant with compensate=1.
  1279. The default value is 500.
  1280. @item first_pts
  1281. Assume that the first PTS should be this value. The time base is 1 / sample
  1282. rate. This allows for padding/trimming at the start of the stream. By default,
  1283. no assumption is made about the first frame's expected PTS, so no padding or
  1284. trimming is done. For example, this could be set to 0 to pad the beginning with
  1285. silence if an audio stream starts after the video stream or to trim any samples
  1286. with a negative PTS due to encoder delay.
  1287. @end table
  1288. @section atempo
  1289. Adjust audio tempo.
  1290. The filter accepts exactly one parameter, the audio tempo. If not
  1291. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1292. be in the [0.5, 2.0] range.
  1293. @subsection Examples
  1294. @itemize
  1295. @item
  1296. Slow down audio to 80% tempo:
  1297. @example
  1298. atempo=0.8
  1299. @end example
  1300. @item
  1301. To speed up audio to 125% tempo:
  1302. @example
  1303. atempo=1.25
  1304. @end example
  1305. @end itemize
  1306. @section atrim
  1307. Trim the input so that the output contains one continuous subpart of the input.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item start
  1311. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1312. sample with the timestamp @var{start} will be the first sample in the output.
  1313. @item end
  1314. Specify time of the first audio sample that will be dropped, i.e. the
  1315. audio sample immediately preceding the one with the timestamp @var{end} will be
  1316. the last sample in the output.
  1317. @item start_pts
  1318. Same as @var{start}, except this option sets the start timestamp in samples
  1319. instead of seconds.
  1320. @item end_pts
  1321. Same as @var{end}, except this option sets the end timestamp in samples instead
  1322. of seconds.
  1323. @item duration
  1324. The maximum duration of the output in seconds.
  1325. @item start_sample
  1326. The number of the first sample that should be output.
  1327. @item end_sample
  1328. The number of the first sample that should be dropped.
  1329. @end table
  1330. @option{start}, @option{end}, and @option{duration} are expressed as time
  1331. duration specifications; see
  1332. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1333. Note that the first two sets of the start/end options and the @option{duration}
  1334. option look at the frame timestamp, while the _sample options simply count the
  1335. samples that pass through the filter. So start/end_pts and start/end_sample will
  1336. give different results when the timestamps are wrong, inexact or do not start at
  1337. zero. Also note that this filter does not modify the timestamps. If you wish
  1338. to have the output timestamps start at zero, insert the asetpts filter after the
  1339. atrim filter.
  1340. If multiple start or end options are set, this filter tries to be greedy and
  1341. keep all samples that match at least one of the specified constraints. To keep
  1342. only the part that matches all the constraints at once, chain multiple atrim
  1343. filters.
  1344. The defaults are such that all the input is kept. So it is possible to set e.g.
  1345. just the end values to keep everything before the specified time.
  1346. Examples:
  1347. @itemize
  1348. @item
  1349. Drop everything except the second minute of input:
  1350. @example
  1351. ffmpeg -i INPUT -af atrim=60:120
  1352. @end example
  1353. @item
  1354. Keep only the first 1000 samples:
  1355. @example
  1356. ffmpeg -i INPUT -af atrim=end_sample=1000
  1357. @end example
  1358. @end itemize
  1359. @section bandpass
  1360. Apply a two-pole Butterworth band-pass filter with central
  1361. frequency @var{frequency}, and (3dB-point) band-width width.
  1362. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1363. instead of the default: constant 0dB peak gain.
  1364. The filter roll off at 6dB per octave (20dB per decade).
  1365. The filter accepts the following options:
  1366. @table @option
  1367. @item frequency, f
  1368. Set the filter's central frequency. Default is @code{3000}.
  1369. @item csg
  1370. Constant skirt gain if set to 1. Defaults to 0.
  1371. @item width_type
  1372. Set method to specify band-width of filter.
  1373. @table @option
  1374. @item h
  1375. Hz
  1376. @item q
  1377. Q-Factor
  1378. @item o
  1379. octave
  1380. @item s
  1381. slope
  1382. @end table
  1383. @item width, w
  1384. Specify the band-width of a filter in width_type units.
  1385. @end table
  1386. @section bandreject
  1387. Apply a two-pole Butterworth band-reject filter with central
  1388. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1389. The filter roll off at 6dB per octave (20dB per decade).
  1390. The filter accepts the following options:
  1391. @table @option
  1392. @item frequency, f
  1393. Set the filter's central frequency. Default is @code{3000}.
  1394. @item width_type
  1395. Set method to specify band-width of filter.
  1396. @table @option
  1397. @item h
  1398. Hz
  1399. @item q
  1400. Q-Factor
  1401. @item o
  1402. octave
  1403. @item s
  1404. slope
  1405. @end table
  1406. @item width, w
  1407. Specify the band-width of a filter in width_type units.
  1408. @end table
  1409. @section bass
  1410. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1411. shelving filter with a response similar to that of a standard
  1412. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1413. The filter accepts the following options:
  1414. @table @option
  1415. @item gain, g
  1416. Give the gain at 0 Hz. Its useful range is about -20
  1417. (for a large cut) to +20 (for a large boost).
  1418. Beware of clipping when using a positive gain.
  1419. @item frequency, f
  1420. Set the filter's central frequency and so can be used
  1421. to extend or reduce the frequency range to be boosted or cut.
  1422. The default value is @code{100} Hz.
  1423. @item width_type
  1424. Set method to specify band-width of filter.
  1425. @table @option
  1426. @item h
  1427. Hz
  1428. @item q
  1429. Q-Factor
  1430. @item o
  1431. octave
  1432. @item s
  1433. slope
  1434. @end table
  1435. @item width, w
  1436. Determine how steep is the filter's shelf transition.
  1437. @end table
  1438. @section biquad
  1439. Apply a biquad IIR filter with the given coefficients.
  1440. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1441. are the numerator and denominator coefficients respectively.
  1442. @section bs2b
  1443. Bauer stereo to binaural transformation, which improves headphone listening of
  1444. stereo audio records.
  1445. It accepts the following parameters:
  1446. @table @option
  1447. @item profile
  1448. Pre-defined crossfeed level.
  1449. @table @option
  1450. @item default
  1451. Default level (fcut=700, feed=50).
  1452. @item cmoy
  1453. Chu Moy circuit (fcut=700, feed=60).
  1454. @item jmeier
  1455. Jan Meier circuit (fcut=650, feed=95).
  1456. @end table
  1457. @item fcut
  1458. Cut frequency (in Hz).
  1459. @item feed
  1460. Feed level (in Hz).
  1461. @end table
  1462. @section channelmap
  1463. Remap input channels to new locations.
  1464. It accepts the following parameters:
  1465. @table @option
  1466. @item map
  1467. Map channels from input to output. The argument is a '|'-separated list of
  1468. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1469. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1470. channel (e.g. FL for front left) or its index in the input channel layout.
  1471. @var{out_channel} is the name of the output channel or its index in the output
  1472. channel layout. If @var{out_channel} is not given then it is implicitly an
  1473. index, starting with zero and increasing by one for each mapping.
  1474. @item channel_layout
  1475. The channel layout of the output stream.
  1476. @end table
  1477. If no mapping is present, the filter will implicitly map input channels to
  1478. output channels, preserving indices.
  1479. For example, assuming a 5.1+downmix input MOV file,
  1480. @example
  1481. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1482. @end example
  1483. will create an output WAV file tagged as stereo from the downmix channels of
  1484. the input.
  1485. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1486. @example
  1487. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1488. @end example
  1489. @section channelsplit
  1490. Split each channel from an input audio stream into a separate output stream.
  1491. It accepts the following parameters:
  1492. @table @option
  1493. @item channel_layout
  1494. The channel layout of the input stream. The default is "stereo".
  1495. @end table
  1496. For example, assuming a stereo input MP3 file,
  1497. @example
  1498. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1499. @end example
  1500. will create an output Matroska file with two audio streams, one containing only
  1501. the left channel and the other the right channel.
  1502. Split a 5.1 WAV file into per-channel files:
  1503. @example
  1504. ffmpeg -i in.wav -filter_complex
  1505. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1506. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1507. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1508. side_right.wav
  1509. @end example
  1510. @section chorus
  1511. Add a chorus effect to the audio.
  1512. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1513. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1514. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1515. The modulation depth defines the range the modulated delay is played before or after
  1516. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1517. sound tuned around the original one, like in a chorus where some vocals are slightly
  1518. off key.
  1519. It accepts the following parameters:
  1520. @table @option
  1521. @item in_gain
  1522. Set input gain. Default is 0.4.
  1523. @item out_gain
  1524. Set output gain. Default is 0.4.
  1525. @item delays
  1526. Set delays. A typical delay is around 40ms to 60ms.
  1527. @item decays
  1528. Set decays.
  1529. @item speeds
  1530. Set speeds.
  1531. @item depths
  1532. Set depths.
  1533. @end table
  1534. @subsection Examples
  1535. @itemize
  1536. @item
  1537. A single delay:
  1538. @example
  1539. chorus=0.7:0.9:55:0.4:0.25:2
  1540. @end example
  1541. @item
  1542. Two delays:
  1543. @example
  1544. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1545. @end example
  1546. @item
  1547. Fuller sounding chorus with three delays:
  1548. @example
  1549. 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
  1550. @end example
  1551. @end itemize
  1552. @section compand
  1553. Compress or expand the audio's dynamic range.
  1554. It accepts the following parameters:
  1555. @table @option
  1556. @item attacks
  1557. @item decays
  1558. A list of times in seconds for each channel over which the instantaneous level
  1559. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1560. increase of volume and @var{decays} refers to decrease of volume. For most
  1561. situations, the attack time (response to the audio getting louder) should be
  1562. shorter than the decay time, because the human ear is more sensitive to sudden
  1563. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1564. a typical value for decay is 0.8 seconds.
  1565. If specified number of attacks & decays is lower than number of channels, the last
  1566. set attack/decay will be used for all remaining channels.
  1567. @item points
  1568. A list of points for the transfer function, specified in dB relative to the
  1569. maximum possible signal amplitude. Each key points list must be defined using
  1570. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1571. @code{x0/y0 x1/y1 x2/y2 ....}
  1572. The input values must be in strictly increasing order but the transfer function
  1573. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1574. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1575. function are @code{-70/-70|-60/-20}.
  1576. @item soft-knee
  1577. Set the curve radius in dB for all joints. It defaults to 0.01.
  1578. @item gain
  1579. Set the additional gain in dB to be applied at all points on the transfer
  1580. function. This allows for easy adjustment of the overall gain.
  1581. It defaults to 0.
  1582. @item volume
  1583. Set an initial volume, in dB, to be assumed for each channel when filtering
  1584. starts. This permits the user to supply a nominal level initially, so that, for
  1585. example, a very large gain is not applied to initial signal levels before the
  1586. companding has begun to operate. A typical value for audio which is initially
  1587. quiet is -90 dB. It defaults to 0.
  1588. @item delay
  1589. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1590. delayed before being fed to the volume adjuster. Specifying a delay
  1591. approximately equal to the attack/decay times allows the filter to effectively
  1592. operate in predictive rather than reactive mode. It defaults to 0.
  1593. @end table
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. Make music with both quiet and loud passages suitable for listening to in a
  1598. noisy environment:
  1599. @example
  1600. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1601. @end example
  1602. Another example for audio with whisper and explosion parts:
  1603. @example
  1604. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1605. @end example
  1606. @item
  1607. A noise gate for when the noise is at a lower level than the signal:
  1608. @example
  1609. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1610. @end example
  1611. @item
  1612. Here is another noise gate, this time for when the noise is at a higher level
  1613. than the signal (making it, in some ways, similar to squelch):
  1614. @example
  1615. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1616. @end example
  1617. @item
  1618. 2:1 compression starting at -6dB:
  1619. @example
  1620. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1621. @end example
  1622. @item
  1623. 2:1 compression starting at -9dB:
  1624. @example
  1625. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1626. @end example
  1627. @item
  1628. 2:1 compression starting at -12dB:
  1629. @example
  1630. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1631. @end example
  1632. @item
  1633. 2:1 compression starting at -18dB:
  1634. @example
  1635. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1636. @end example
  1637. @item
  1638. 3:1 compression starting at -15dB:
  1639. @example
  1640. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1641. @end example
  1642. @item
  1643. Compressor/Gate:
  1644. @example
  1645. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1646. @end example
  1647. @item
  1648. Expander:
  1649. @example
  1650. 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
  1651. @end example
  1652. @item
  1653. Hard limiter at -6dB:
  1654. @example
  1655. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1656. @end example
  1657. @item
  1658. Hard limiter at -12dB:
  1659. @example
  1660. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1661. @end example
  1662. @item
  1663. Hard noise gate at -35 dB:
  1664. @example
  1665. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1666. @end example
  1667. @item
  1668. Soft limiter:
  1669. @example
  1670. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1671. @end example
  1672. @end itemize
  1673. @section compensationdelay
  1674. Compensation Delay Line is a metric based delay to compensate differing
  1675. positions of microphones or speakers.
  1676. For example, you have recorded guitar with two microphones placed in
  1677. different location. Because the front of sound wave has fixed speed in
  1678. normal conditions, the phasing of microphones can vary and depends on
  1679. their location and interposition. The best sound mix can be achieved when
  1680. these microphones are in phase (synchronized). Note that distance of
  1681. ~30 cm between microphones makes one microphone to capture signal in
  1682. antiphase to another microphone. That makes the final mix sounding moody.
  1683. This filter helps to solve phasing problems by adding different delays
  1684. to each microphone track and make them synchronized.
  1685. The best result can be reached when you take one track as base and
  1686. synchronize other tracks one by one with it.
  1687. Remember that synchronization/delay tolerance depends on sample rate, too.
  1688. Higher sample rates will give more tolerance.
  1689. It accepts the following parameters:
  1690. @table @option
  1691. @item mm
  1692. Set millimeters distance. This is compensation distance for fine tuning.
  1693. Default is 0.
  1694. @item cm
  1695. Set cm distance. This is compensation distance for tightening distance setup.
  1696. Default is 0.
  1697. @item m
  1698. Set meters distance. This is compensation distance for hard distance setup.
  1699. Default is 0.
  1700. @item dry
  1701. Set dry amount. Amount of unprocessed (dry) signal.
  1702. Default is 0.
  1703. @item wet
  1704. Set wet amount. Amount of processed (wet) signal.
  1705. Default is 1.
  1706. @item temp
  1707. Set temperature degree in Celsius. This is the temperature of the environment.
  1708. Default is 20.
  1709. @end table
  1710. @section crystalizer
  1711. Simple algorithm to expand audio dynamic range.
  1712. The filter accepts the following options:
  1713. @table @option
  1714. @item i
  1715. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1716. (unchanged sound) to 10.0 (maximum effect).
  1717. @item c
  1718. Enable clipping. By default is enabled.
  1719. @end table
  1720. @section dcshift
  1721. Apply a DC shift to the audio.
  1722. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1723. in the recording chain) from the audio. The effect of a DC offset is reduced
  1724. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1725. a signal has a DC offset.
  1726. @table @option
  1727. @item shift
  1728. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1729. the audio.
  1730. @item limitergain
  1731. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1732. used to prevent clipping.
  1733. @end table
  1734. @section dynaudnorm
  1735. Dynamic Audio Normalizer.
  1736. This filter applies a certain amount of gain to the input audio in order
  1737. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1738. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1739. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1740. This allows for applying extra gain to the "quiet" sections of the audio
  1741. while avoiding distortions or clipping the "loud" sections. In other words:
  1742. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1743. sections, in the sense that the volume of each section is brought to the
  1744. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1745. this goal *without* applying "dynamic range compressing". It will retain 100%
  1746. of the dynamic range *within* each section of the audio file.
  1747. @table @option
  1748. @item f
  1749. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1750. Default is 500 milliseconds.
  1751. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1752. referred to as frames. This is required, because a peak magnitude has no
  1753. meaning for just a single sample value. Instead, we need to determine the
  1754. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1755. normalizer would simply use the peak magnitude of the complete file, the
  1756. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1757. frame. The length of a frame is specified in milliseconds. By default, the
  1758. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1759. been found to give good results with most files.
  1760. Note that the exact frame length, in number of samples, will be determined
  1761. automatically, based on the sampling rate of the individual input audio file.
  1762. @item g
  1763. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1764. number. Default is 31.
  1765. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1766. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1767. is specified in frames, centered around the current frame. For the sake of
  1768. simplicity, this must be an odd number. Consequently, the default value of 31
  1769. takes into account the current frame, as well as the 15 preceding frames and
  1770. the 15 subsequent frames. Using a larger window results in a stronger
  1771. smoothing effect and thus in less gain variation, i.e. slower gain
  1772. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1773. effect and thus in more gain variation, i.e. faster gain adaptation.
  1774. In other words, the more you increase this value, the more the Dynamic Audio
  1775. Normalizer will behave like a "traditional" normalization filter. On the
  1776. contrary, the more you decrease this value, the more the Dynamic Audio
  1777. Normalizer will behave like a dynamic range compressor.
  1778. @item p
  1779. Set the target peak value. This specifies the highest permissible magnitude
  1780. level for the normalized audio input. This filter will try to approach the
  1781. target peak magnitude as closely as possible, but at the same time it also
  1782. makes sure that the normalized signal will never exceed the peak magnitude.
  1783. A frame's maximum local gain factor is imposed directly by the target peak
  1784. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1785. It is not recommended to go above this value.
  1786. @item m
  1787. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1788. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1789. factor for each input frame, i.e. the maximum gain factor that does not
  1790. result in clipping or distortion. The maximum gain factor is determined by
  1791. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1792. additionally bounds the frame's maximum gain factor by a predetermined
  1793. (global) maximum gain factor. This is done in order to avoid excessive gain
  1794. factors in "silent" or almost silent frames. By default, the maximum gain
  1795. factor is 10.0, For most inputs the default value should be sufficient and
  1796. it usually is not recommended to increase this value. Though, for input
  1797. with an extremely low overall volume level, it may be necessary to allow even
  1798. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1799. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1800. Instead, a "sigmoid" threshold function will be applied. This way, the
  1801. gain factors will smoothly approach the threshold value, but never exceed that
  1802. value.
  1803. @item r
  1804. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1805. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1806. This means that the maximum local gain factor for each frame is defined
  1807. (only) by the frame's highest magnitude sample. This way, the samples can
  1808. be amplified as much as possible without exceeding the maximum signal
  1809. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1810. Normalizer can also take into account the frame's root mean square,
  1811. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1812. determine the power of a time-varying signal. It is therefore considered
  1813. that the RMS is a better approximation of the "perceived loudness" than
  1814. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1815. frames to a constant RMS value, a uniform "perceived loudness" can be
  1816. established. If a target RMS value has been specified, a frame's local gain
  1817. factor is defined as the factor that would result in exactly that RMS value.
  1818. Note, however, that the maximum local gain factor is still restricted by the
  1819. frame's highest magnitude sample, in order to prevent clipping.
  1820. @item n
  1821. Enable channels coupling. By default is enabled.
  1822. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1823. amount. This means the same gain factor will be applied to all channels, i.e.
  1824. the maximum possible gain factor is determined by the "loudest" channel.
  1825. However, in some recordings, it may happen that the volume of the different
  1826. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1827. In this case, this option can be used to disable the channel coupling. This way,
  1828. the gain factor will be determined independently for each channel, depending
  1829. only on the individual channel's highest magnitude sample. This allows for
  1830. harmonizing the volume of the different channels.
  1831. @item c
  1832. Enable DC bias correction. By default is disabled.
  1833. An audio signal (in the time domain) is a sequence of sample values.
  1834. In the Dynamic Audio Normalizer these sample values are represented in the
  1835. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1836. audio signal, or "waveform", should be centered around the zero point.
  1837. That means if we calculate the mean value of all samples in a file, or in a
  1838. single frame, then the result should be 0.0 or at least very close to that
  1839. value. If, however, there is a significant deviation of the mean value from
  1840. 0.0, in either positive or negative direction, this is referred to as a
  1841. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1842. Audio Normalizer provides optional DC bias correction.
  1843. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1844. the mean value, or "DC correction" offset, of each input frame and subtract
  1845. that value from all of the frame's sample values which ensures those samples
  1846. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1847. boundaries, the DC correction offset values will be interpolated smoothly
  1848. between neighbouring frames.
  1849. @item b
  1850. Enable alternative boundary mode. By default is disabled.
  1851. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1852. around each frame. This includes the preceding frames as well as the
  1853. subsequent frames. However, for the "boundary" frames, located at the very
  1854. beginning and at the very end of the audio file, not all neighbouring
  1855. frames are available. In particular, for the first few frames in the audio
  1856. file, the preceding frames are not known. And, similarly, for the last few
  1857. frames in the audio file, the subsequent frames are not known. Thus, the
  1858. question arises which gain factors should be assumed for the missing frames
  1859. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1860. to deal with this situation. The default boundary mode assumes a gain factor
  1861. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1862. "fade out" at the beginning and at the end of the input, respectively.
  1863. @item s
  1864. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1865. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1866. compression. This means that signal peaks will not be pruned and thus the
  1867. full dynamic range will be retained within each local neighbourhood. However,
  1868. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1869. normalization algorithm with a more "traditional" compression.
  1870. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1871. (thresholding) function. If (and only if) the compression feature is enabled,
  1872. all input frames will be processed by a soft knee thresholding function prior
  1873. to the actual normalization process. Put simply, the thresholding function is
  1874. going to prune all samples whose magnitude exceeds a certain threshold value.
  1875. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1876. value. Instead, the threshold value will be adjusted for each individual
  1877. frame.
  1878. In general, smaller parameters result in stronger compression, and vice versa.
  1879. Values below 3.0 are not recommended, because audible distortion may appear.
  1880. @end table
  1881. @section earwax
  1882. Make audio easier to listen to on headphones.
  1883. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1884. so that when listened to on headphones the stereo image is moved from
  1885. inside your head (standard for headphones) to outside and in front of
  1886. the listener (standard for speakers).
  1887. Ported from SoX.
  1888. @section equalizer
  1889. Apply a two-pole peaking equalisation (EQ) filter. With this
  1890. filter, the signal-level at and around a selected frequency can
  1891. be increased or decreased, whilst (unlike bandpass and bandreject
  1892. filters) that at all other frequencies is unchanged.
  1893. In order to produce complex equalisation curves, this filter can
  1894. be given several times, each with a different central frequency.
  1895. The filter accepts the following options:
  1896. @table @option
  1897. @item frequency, f
  1898. Set the filter's central frequency in Hz.
  1899. @item width_type
  1900. Set method to specify band-width of filter.
  1901. @table @option
  1902. @item h
  1903. Hz
  1904. @item q
  1905. Q-Factor
  1906. @item o
  1907. octave
  1908. @item s
  1909. slope
  1910. @end table
  1911. @item width, w
  1912. Specify the band-width of a filter in width_type units.
  1913. @item gain, g
  1914. Set the required gain or attenuation in dB.
  1915. Beware of clipping when using a positive gain.
  1916. @end table
  1917. @subsection Examples
  1918. @itemize
  1919. @item
  1920. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1921. @example
  1922. equalizer=f=1000:width_type=h:width=200:g=-10
  1923. @end example
  1924. @item
  1925. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1926. @example
  1927. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1928. @end example
  1929. @end itemize
  1930. @section extrastereo
  1931. Linearly increases the difference between left and right channels which
  1932. adds some sort of "live" effect to playback.
  1933. The filter accepts the following options:
  1934. @table @option
  1935. @item m
  1936. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1937. (average of both channels), with 1.0 sound will be unchanged, with
  1938. -1.0 left and right channels will be swapped.
  1939. @item c
  1940. Enable clipping. By default is enabled.
  1941. @end table
  1942. @section firequalizer
  1943. Apply FIR Equalization using arbitrary frequency response.
  1944. The filter accepts the following option:
  1945. @table @option
  1946. @item gain
  1947. Set gain curve equation (in dB). The expression can contain variables:
  1948. @table @option
  1949. @item f
  1950. the evaluated frequency
  1951. @item sr
  1952. sample rate
  1953. @item ch
  1954. channel number, set to 0 when multichannels evaluation is disabled
  1955. @item chid
  1956. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1957. multichannels evaluation is disabled
  1958. @item chs
  1959. number of channels
  1960. @item chlayout
  1961. channel_layout, see libavutil/channel_layout.h
  1962. @end table
  1963. and functions:
  1964. @table @option
  1965. @item gain_interpolate(f)
  1966. interpolate gain on frequency f based on gain_entry
  1967. @item cubic_interpolate(f)
  1968. same as gain_interpolate, but smoother
  1969. @end table
  1970. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1971. @item gain_entry
  1972. Set gain entry for gain_interpolate function. The expression can
  1973. contain functions:
  1974. @table @option
  1975. @item entry(f, g)
  1976. store gain entry at frequency f with value g
  1977. @end table
  1978. This option is also available as command.
  1979. @item delay
  1980. Set filter delay in seconds. Higher value means more accurate.
  1981. Default is @code{0.01}.
  1982. @item accuracy
  1983. Set filter accuracy in Hz. Lower value means more accurate.
  1984. Default is @code{5}.
  1985. @item wfunc
  1986. Set window function. Acceptable values are:
  1987. @table @option
  1988. @item rectangular
  1989. rectangular window, useful when gain curve is already smooth
  1990. @item hann
  1991. hann window (default)
  1992. @item hamming
  1993. hamming window
  1994. @item blackman
  1995. blackman window
  1996. @item nuttall3
  1997. 3-terms continuous 1st derivative nuttall window
  1998. @item mnuttall3
  1999. minimum 3-terms discontinuous nuttall window
  2000. @item nuttall
  2001. 4-terms continuous 1st derivative nuttall window
  2002. @item bnuttall
  2003. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2004. @item bharris
  2005. blackman-harris window
  2006. @item tukey
  2007. tukey window
  2008. @end table
  2009. @item fixed
  2010. If enabled, use fixed number of audio samples. This improves speed when
  2011. filtering with large delay. Default is disabled.
  2012. @item multi
  2013. Enable multichannels evaluation on gain. Default is disabled.
  2014. @item zero_phase
  2015. Enable zero phase mode by subtracting timestamp to compensate delay.
  2016. Default is disabled.
  2017. @item scale
  2018. Set scale used by gain. Acceptable values are:
  2019. @table @option
  2020. @item linlin
  2021. linear frequency, linear gain
  2022. @item linlog
  2023. linear frequency, logarithmic (in dB) gain (default)
  2024. @item loglin
  2025. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2026. @item loglog
  2027. logarithmic frequency, logarithmic gain
  2028. @end table
  2029. @item dumpfile
  2030. Set file for dumping, suitable for gnuplot.
  2031. @item dumpscale
  2032. Set scale for dumpfile. Acceptable values are same with scale option.
  2033. Default is linlog.
  2034. @item fft2
  2035. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2036. Default is disabled.
  2037. @end table
  2038. @subsection Examples
  2039. @itemize
  2040. @item
  2041. lowpass at 1000 Hz:
  2042. @example
  2043. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2044. @end example
  2045. @item
  2046. lowpass at 1000 Hz with gain_entry:
  2047. @example
  2048. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2049. @end example
  2050. @item
  2051. custom equalization:
  2052. @example
  2053. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2054. @end example
  2055. @item
  2056. higher delay with zero phase to compensate delay:
  2057. @example
  2058. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2059. @end example
  2060. @item
  2061. lowpass on left channel, highpass on right channel:
  2062. @example
  2063. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2064. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2065. @end example
  2066. @end itemize
  2067. @section flanger
  2068. Apply a flanging effect to the audio.
  2069. The filter accepts the following options:
  2070. @table @option
  2071. @item delay
  2072. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2073. @item depth
  2074. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2075. @item regen
  2076. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2077. Default value is 0.
  2078. @item width
  2079. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2080. Default value is 71.
  2081. @item speed
  2082. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2083. @item shape
  2084. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2085. Default value is @var{sinusoidal}.
  2086. @item phase
  2087. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2088. Default value is 25.
  2089. @item interp
  2090. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2091. Default is @var{linear}.
  2092. @end table
  2093. @section hdcd
  2094. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2095. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2096. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2097. of HDCD, and detects the Transient Filter flag.
  2098. @example
  2099. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2100. @end example
  2101. When using the filter with wav, note the default encoding for wav is 16-bit,
  2102. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2103. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2104. @example
  2105. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2106. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2107. @end example
  2108. The filter accepts the following options:
  2109. @table @option
  2110. @item disable_autoconvert
  2111. Disable any automatic format conversion or resampling in the filter graph.
  2112. @item process_stereo
  2113. Process the stereo channels together. If target_gain does not match between
  2114. channels, consider it invalid and use the last valid target_gain.
  2115. @item cdt_ms
  2116. Set the code detect timer period in ms.
  2117. @item force_pe
  2118. Always extend peaks above -3dBFS even if PE isn't signaled.
  2119. @item analyze_mode
  2120. Replace audio with a solid tone and adjust the amplitude to signal some
  2121. specific aspect of the decoding process. The output file can be loaded in
  2122. an audio editor alongside the original to aid analysis.
  2123. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2124. Modes are:
  2125. @table @samp
  2126. @item 0, off
  2127. Disabled
  2128. @item 1, lle
  2129. Gain adjustment level at each sample
  2130. @item 2, pe
  2131. Samples where peak extend occurs
  2132. @item 3, cdt
  2133. Samples where the code detect timer is active
  2134. @item 4, tgm
  2135. Samples where the target gain does not match between channels
  2136. @end table
  2137. @end table
  2138. @section highpass
  2139. Apply a high-pass filter with 3dB point frequency.
  2140. The filter can be either single-pole, or double-pole (the default).
  2141. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2142. The filter accepts the following options:
  2143. @table @option
  2144. @item frequency, f
  2145. Set frequency in Hz. Default is 3000.
  2146. @item poles, p
  2147. Set number of poles. Default is 2.
  2148. @item width_type
  2149. Set method to specify band-width of filter.
  2150. @table @option
  2151. @item h
  2152. Hz
  2153. @item q
  2154. Q-Factor
  2155. @item o
  2156. octave
  2157. @item s
  2158. slope
  2159. @end table
  2160. @item width, w
  2161. Specify the band-width of a filter in width_type units.
  2162. Applies only to double-pole filter.
  2163. The default is 0.707q and gives a Butterworth response.
  2164. @end table
  2165. @section join
  2166. Join multiple input streams into one multi-channel stream.
  2167. It accepts the following parameters:
  2168. @table @option
  2169. @item inputs
  2170. The number of input streams. It defaults to 2.
  2171. @item channel_layout
  2172. The desired output channel layout. It defaults to stereo.
  2173. @item map
  2174. Map channels from inputs to output. The argument is a '|'-separated list of
  2175. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2176. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2177. can be either the name of the input channel (e.g. FL for front left) or its
  2178. index in the specified input stream. @var{out_channel} is the name of the output
  2179. channel.
  2180. @end table
  2181. The filter will attempt to guess the mappings when they are not specified
  2182. explicitly. It does so by first trying to find an unused matching input channel
  2183. and if that fails it picks the first unused input channel.
  2184. Join 3 inputs (with properly set channel layouts):
  2185. @example
  2186. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2187. @end example
  2188. Build a 5.1 output from 6 single-channel streams:
  2189. @example
  2190. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2191. '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'
  2192. out
  2193. @end example
  2194. @section ladspa
  2195. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2196. To enable compilation of this filter you need to configure FFmpeg with
  2197. @code{--enable-ladspa}.
  2198. @table @option
  2199. @item file, f
  2200. Specifies the name of LADSPA plugin library to load. If the environment
  2201. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2202. each one of the directories specified by the colon separated list in
  2203. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2204. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2205. @file{/usr/lib/ladspa/}.
  2206. @item plugin, p
  2207. Specifies the plugin within the library. Some libraries contain only
  2208. one plugin, but others contain many of them. If this is not set filter
  2209. will list all available plugins within the specified library.
  2210. @item controls, c
  2211. Set the '|' separated list of controls which are zero or more floating point
  2212. values that determine the behavior of the loaded plugin (for example delay,
  2213. threshold or gain).
  2214. Controls need to be defined using the following syntax:
  2215. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2216. @var{valuei} is the value set on the @var{i}-th control.
  2217. Alternatively they can be also defined using the following syntax:
  2218. @var{value0}|@var{value1}|@var{value2}|..., where
  2219. @var{valuei} is the value set on the @var{i}-th control.
  2220. If @option{controls} is set to @code{help}, all available controls and
  2221. their valid ranges are printed.
  2222. @item sample_rate, s
  2223. Specify the sample rate, default to 44100. Only used if plugin have
  2224. zero inputs.
  2225. @item nb_samples, n
  2226. Set the number of samples per channel per each output frame, default
  2227. is 1024. Only used if plugin have zero inputs.
  2228. @item duration, d
  2229. Set the minimum duration of the sourced audio. See
  2230. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2231. for the accepted syntax.
  2232. Note that the resulting duration may be greater than the specified duration,
  2233. as the generated audio is always cut at the end of a complete frame.
  2234. If not specified, or the expressed duration is negative, the audio is
  2235. supposed to be generated forever.
  2236. Only used if plugin have zero inputs.
  2237. @end table
  2238. @subsection Examples
  2239. @itemize
  2240. @item
  2241. List all available plugins within amp (LADSPA example plugin) library:
  2242. @example
  2243. ladspa=file=amp
  2244. @end example
  2245. @item
  2246. List all available controls and their valid ranges for @code{vcf_notch}
  2247. plugin from @code{VCF} library:
  2248. @example
  2249. ladspa=f=vcf:p=vcf_notch:c=help
  2250. @end example
  2251. @item
  2252. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2253. plugin library:
  2254. @example
  2255. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2256. @end example
  2257. @item
  2258. Add reverberation to the audio using TAP-plugins
  2259. (Tom's Audio Processing plugins):
  2260. @example
  2261. ladspa=file=tap_reverb:tap_reverb
  2262. @end example
  2263. @item
  2264. Generate white noise, with 0.2 amplitude:
  2265. @example
  2266. ladspa=file=cmt:noise_source_white:c=c0=.2
  2267. @end example
  2268. @item
  2269. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2270. @code{C* Audio Plugin Suite} (CAPS) library:
  2271. @example
  2272. ladspa=file=caps:Click:c=c1=20'
  2273. @end example
  2274. @item
  2275. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2276. @example
  2277. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2278. @end example
  2279. @item
  2280. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2281. @code{SWH Plugins} collection:
  2282. @example
  2283. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2284. @end example
  2285. @item
  2286. Attenuate low frequencies using Multiband EQ from Steve Harris
  2287. @code{SWH Plugins} collection:
  2288. @example
  2289. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2290. @end example
  2291. @end itemize
  2292. @subsection Commands
  2293. This filter supports the following commands:
  2294. @table @option
  2295. @item cN
  2296. Modify the @var{N}-th control value.
  2297. If the specified value is not valid, it is ignored and prior one is kept.
  2298. @end table
  2299. @section loudnorm
  2300. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2301. Support for both single pass (livestreams, files) and double pass (files) modes.
  2302. This algorithm can target IL, LRA, and maximum true peak.
  2303. The filter accepts the following options:
  2304. @table @option
  2305. @item I, i
  2306. Set integrated loudness target.
  2307. Range is -70.0 - -5.0. Default value is -24.0.
  2308. @item LRA, lra
  2309. Set loudness range target.
  2310. Range is 1.0 - 20.0. Default value is 7.0.
  2311. @item TP, tp
  2312. Set maximum true peak.
  2313. Range is -9.0 - +0.0. Default value is -2.0.
  2314. @item measured_I, measured_i
  2315. Measured IL of input file.
  2316. Range is -99.0 - +0.0.
  2317. @item measured_LRA, measured_lra
  2318. Measured LRA of input file.
  2319. Range is 0.0 - 99.0.
  2320. @item measured_TP, measured_tp
  2321. Measured true peak of input file.
  2322. Range is -99.0 - +99.0.
  2323. @item measured_thresh
  2324. Measured threshold of input file.
  2325. Range is -99.0 - +0.0.
  2326. @item offset
  2327. Set offset gain. Gain is applied before the true-peak limiter.
  2328. Range is -99.0 - +99.0. Default is +0.0.
  2329. @item linear
  2330. Normalize linearly if possible.
  2331. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2332. to be specified in order to use this mode.
  2333. Options are true or false. Default is true.
  2334. @item dual_mono
  2335. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2336. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2337. If set to @code{true}, this option will compensate for this effect.
  2338. Multi-channel input files are not affected by this option.
  2339. Options are true or false. Default is false.
  2340. @item print_format
  2341. Set print format for stats. Options are summary, json, or none.
  2342. Default value is none.
  2343. @end table
  2344. @section lowpass
  2345. Apply a low-pass filter with 3dB point frequency.
  2346. The filter can be either single-pole or double-pole (the default).
  2347. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2348. The filter accepts the following options:
  2349. @table @option
  2350. @item frequency, f
  2351. Set frequency in Hz. Default is 500.
  2352. @item poles, p
  2353. Set number of poles. Default is 2.
  2354. @item width_type
  2355. Set method to specify band-width of filter.
  2356. @table @option
  2357. @item h
  2358. Hz
  2359. @item q
  2360. Q-Factor
  2361. @item o
  2362. octave
  2363. @item s
  2364. slope
  2365. @end table
  2366. @item width, w
  2367. Specify the band-width of a filter in width_type units.
  2368. Applies only to double-pole filter.
  2369. The default is 0.707q and gives a Butterworth response.
  2370. @end table
  2371. @anchor{pan}
  2372. @section pan
  2373. Mix channels with specific gain levels. The filter accepts the output
  2374. channel layout followed by a set of channels definitions.
  2375. This filter is also designed to efficiently remap the channels of an audio
  2376. stream.
  2377. The filter accepts parameters of the form:
  2378. "@var{l}|@var{outdef}|@var{outdef}|..."
  2379. @table @option
  2380. @item l
  2381. output channel layout or number of channels
  2382. @item outdef
  2383. output channel specification, of the form:
  2384. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2385. @item out_name
  2386. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2387. number (c0, c1, etc.)
  2388. @item gain
  2389. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2390. @item in_name
  2391. input channel to use, see out_name for details; it is not possible to mix
  2392. named and numbered input channels
  2393. @end table
  2394. If the `=' in a channel specification is replaced by `<', then the gains for
  2395. that specification will be renormalized so that the total is 1, thus
  2396. avoiding clipping noise.
  2397. @subsection Mixing examples
  2398. For example, if you want to down-mix from stereo to mono, but with a bigger
  2399. factor for the left channel:
  2400. @example
  2401. pan=1c|c0=0.9*c0+0.1*c1
  2402. @end example
  2403. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2404. 7-channels surround:
  2405. @example
  2406. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2407. @end example
  2408. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2409. that should be preferred (see "-ac" option) unless you have very specific
  2410. needs.
  2411. @subsection Remapping examples
  2412. The channel remapping will be effective if, and only if:
  2413. @itemize
  2414. @item gain coefficients are zeroes or ones,
  2415. @item only one input per channel output,
  2416. @end itemize
  2417. If all these conditions are satisfied, the filter will notify the user ("Pure
  2418. channel mapping detected"), and use an optimized and lossless method to do the
  2419. remapping.
  2420. For example, if you have a 5.1 source and want a stereo audio stream by
  2421. dropping the extra channels:
  2422. @example
  2423. pan="stereo| c0=FL | c1=FR"
  2424. @end example
  2425. Given the same source, you can also switch front left and front right channels
  2426. and keep the input channel layout:
  2427. @example
  2428. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2429. @end example
  2430. If the input is a stereo audio stream, you can mute the front left channel (and
  2431. still keep the stereo channel layout) with:
  2432. @example
  2433. pan="stereo|c1=c1"
  2434. @end example
  2435. Still with a stereo audio stream input, you can copy the right channel in both
  2436. front left and right:
  2437. @example
  2438. pan="stereo| c0=FR | c1=FR"
  2439. @end example
  2440. @section replaygain
  2441. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2442. outputs it unchanged.
  2443. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2444. @section resample
  2445. Convert the audio sample format, sample rate and channel layout. It is
  2446. not meant to be used directly.
  2447. @section rubberband
  2448. Apply time-stretching and pitch-shifting with librubberband.
  2449. The filter accepts the following options:
  2450. @table @option
  2451. @item tempo
  2452. Set tempo scale factor.
  2453. @item pitch
  2454. Set pitch scale factor.
  2455. @item transients
  2456. Set transients detector.
  2457. Possible values are:
  2458. @table @var
  2459. @item crisp
  2460. @item mixed
  2461. @item smooth
  2462. @end table
  2463. @item detector
  2464. Set detector.
  2465. Possible values are:
  2466. @table @var
  2467. @item compound
  2468. @item percussive
  2469. @item soft
  2470. @end table
  2471. @item phase
  2472. Set phase.
  2473. Possible values are:
  2474. @table @var
  2475. @item laminar
  2476. @item independent
  2477. @end table
  2478. @item window
  2479. Set processing window size.
  2480. Possible values are:
  2481. @table @var
  2482. @item standard
  2483. @item short
  2484. @item long
  2485. @end table
  2486. @item smoothing
  2487. Set smoothing.
  2488. Possible values are:
  2489. @table @var
  2490. @item off
  2491. @item on
  2492. @end table
  2493. @item formant
  2494. Enable formant preservation when shift pitching.
  2495. Possible values are:
  2496. @table @var
  2497. @item shifted
  2498. @item preserved
  2499. @end table
  2500. @item pitchq
  2501. Set pitch quality.
  2502. Possible values are:
  2503. @table @var
  2504. @item quality
  2505. @item speed
  2506. @item consistency
  2507. @end table
  2508. @item channels
  2509. Set channels.
  2510. Possible values are:
  2511. @table @var
  2512. @item apart
  2513. @item together
  2514. @end table
  2515. @end table
  2516. @section sidechaincompress
  2517. This filter acts like normal compressor but has the ability to compress
  2518. detected signal using second input signal.
  2519. It needs two input streams and returns one output stream.
  2520. First input stream will be processed depending on second stream signal.
  2521. The filtered signal then can be filtered with other filters in later stages of
  2522. processing. See @ref{pan} and @ref{amerge} filter.
  2523. The filter accepts the following options:
  2524. @table @option
  2525. @item level_in
  2526. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2527. @item threshold
  2528. If a signal of second stream raises above this level it will affect the gain
  2529. reduction of first stream.
  2530. By default is 0.125. Range is between 0.00097563 and 1.
  2531. @item ratio
  2532. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2533. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2534. Default is 2. Range is between 1 and 20.
  2535. @item attack
  2536. Amount of milliseconds the signal has to rise above the threshold before gain
  2537. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2538. @item release
  2539. Amount of milliseconds the signal has to fall below the threshold before
  2540. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2541. @item makeup
  2542. Set the amount by how much signal will be amplified after processing.
  2543. Default is 2. Range is from 1 and 64.
  2544. @item knee
  2545. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2546. Default is 2.82843. Range is between 1 and 8.
  2547. @item link
  2548. Choose if the @code{average} level between all channels of side-chain stream
  2549. or the louder(@code{maximum}) channel of side-chain stream affects the
  2550. reduction. Default is @code{average}.
  2551. @item detection
  2552. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2553. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2554. @item level_sc
  2555. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2556. @item mix
  2557. How much to use compressed signal in output. Default is 1.
  2558. Range is between 0 and 1.
  2559. @end table
  2560. @subsection Examples
  2561. @itemize
  2562. @item
  2563. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2564. depending on the signal of 2nd input and later compressed signal to be
  2565. merged with 2nd input:
  2566. @example
  2567. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2568. @end example
  2569. @end itemize
  2570. @section sidechaingate
  2571. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2572. filter the detected signal before sending it to the gain reduction stage.
  2573. Normally a gate uses the full range signal to detect a level above the
  2574. threshold.
  2575. For example: If you cut all lower frequencies from your sidechain signal
  2576. the gate will decrease the volume of your track only if not enough highs
  2577. appear. With this technique you are able to reduce the resonation of a
  2578. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2579. guitar.
  2580. It needs two input streams and returns one output stream.
  2581. First input stream will be processed depending on second stream signal.
  2582. The filter accepts the following options:
  2583. @table @option
  2584. @item level_in
  2585. Set input level before filtering.
  2586. Default is 1. Allowed range is from 0.015625 to 64.
  2587. @item range
  2588. Set the level of gain reduction when the signal is below the threshold.
  2589. Default is 0.06125. Allowed range is from 0 to 1.
  2590. @item threshold
  2591. If a signal rises above this level the gain reduction is released.
  2592. Default is 0.125. Allowed range is from 0 to 1.
  2593. @item ratio
  2594. Set a ratio about which the signal is reduced.
  2595. Default is 2. Allowed range is from 1 to 9000.
  2596. @item attack
  2597. Amount of milliseconds the signal has to rise above the threshold before gain
  2598. reduction stops.
  2599. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2600. @item release
  2601. Amount of milliseconds the signal has to fall below the threshold before the
  2602. reduction is increased again. Default is 250 milliseconds.
  2603. Allowed range is from 0.01 to 9000.
  2604. @item makeup
  2605. Set amount of amplification of signal after processing.
  2606. Default is 1. Allowed range is from 1 to 64.
  2607. @item knee
  2608. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2609. Default is 2.828427125. Allowed range is from 1 to 8.
  2610. @item detection
  2611. Choose if exact signal should be taken for detection or an RMS like one.
  2612. Default is rms. Can be peak or rms.
  2613. @item link
  2614. Choose if the average level between all channels or the louder channel affects
  2615. the reduction.
  2616. Default is average. Can be average or maximum.
  2617. @item level_sc
  2618. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2619. @end table
  2620. @section silencedetect
  2621. Detect silence in an audio stream.
  2622. This filter logs a message when it detects that the input audio volume is less
  2623. or equal to a noise tolerance value for a duration greater or equal to the
  2624. minimum detected noise duration.
  2625. The printed times and duration are expressed in seconds.
  2626. The filter accepts the following options:
  2627. @table @option
  2628. @item duration, d
  2629. Set silence duration until notification (default is 2 seconds).
  2630. @item noise, n
  2631. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2632. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2633. @end table
  2634. @subsection Examples
  2635. @itemize
  2636. @item
  2637. Detect 5 seconds of silence with -50dB noise tolerance:
  2638. @example
  2639. silencedetect=n=-50dB:d=5
  2640. @end example
  2641. @item
  2642. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2643. tolerance in @file{silence.mp3}:
  2644. @example
  2645. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2646. @end example
  2647. @end itemize
  2648. @section silenceremove
  2649. Remove silence from the beginning, middle or end of the audio.
  2650. The filter accepts the following options:
  2651. @table @option
  2652. @item start_periods
  2653. This value is used to indicate if audio should be trimmed at beginning of
  2654. the audio. A value of zero indicates no silence should be trimmed from the
  2655. beginning. When specifying a non-zero value, it trims audio up until it
  2656. finds non-silence. Normally, when trimming silence from beginning of audio
  2657. the @var{start_periods} will be @code{1} but it can be increased to higher
  2658. values to trim all audio up to specific count of non-silence periods.
  2659. Default value is @code{0}.
  2660. @item start_duration
  2661. Specify the amount of time that non-silence must be detected before it stops
  2662. trimming audio. By increasing the duration, bursts of noises can be treated
  2663. as silence and trimmed off. Default value is @code{0}.
  2664. @item start_threshold
  2665. This indicates what sample value should be treated as silence. For digital
  2666. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2667. you may wish to increase the value to account for background noise.
  2668. Can be specified in dB (in case "dB" is appended to the specified value)
  2669. or amplitude ratio. Default value is @code{0}.
  2670. @item stop_periods
  2671. Set the count for trimming silence from the end of audio.
  2672. To remove silence from the middle of a file, specify a @var{stop_periods}
  2673. that is negative. This value is then treated as a positive value and is
  2674. used to indicate the effect should restart processing as specified by
  2675. @var{start_periods}, making it suitable for removing periods of silence
  2676. in the middle of the audio.
  2677. Default value is @code{0}.
  2678. @item stop_duration
  2679. Specify a duration of silence that must exist before audio is not copied any
  2680. more. By specifying a higher duration, silence that is wanted can be left in
  2681. the audio.
  2682. Default value is @code{0}.
  2683. @item stop_threshold
  2684. This is the same as @option{start_threshold} but for trimming silence from
  2685. the end of audio.
  2686. Can be specified in dB (in case "dB" is appended to the specified value)
  2687. or amplitude ratio. Default value is @code{0}.
  2688. @item leave_silence
  2689. This indicates that @var{stop_duration} length of audio should be left intact
  2690. at the beginning of each period of silence.
  2691. For example, if you want to remove long pauses between words but do not want
  2692. to remove the pauses completely. Default value is @code{0}.
  2693. @item detection
  2694. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2695. and works better with digital silence which is exactly 0.
  2696. Default value is @code{rms}.
  2697. @item window
  2698. Set ratio used to calculate size of window for detecting silence.
  2699. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2700. @end table
  2701. @subsection Examples
  2702. @itemize
  2703. @item
  2704. The following example shows how this filter can be used to start a recording
  2705. that does not contain the delay at the start which usually occurs between
  2706. pressing the record button and the start of the performance:
  2707. @example
  2708. silenceremove=1:5:0.02
  2709. @end example
  2710. @item
  2711. Trim all silence encountered from beginning to end where there is more than 1
  2712. second of silence in audio:
  2713. @example
  2714. silenceremove=0:0:0:-1:1:-90dB
  2715. @end example
  2716. @end itemize
  2717. @section sofalizer
  2718. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2719. loudspeakers around the user for binaural listening via headphones (audio
  2720. formats up to 9 channels supported).
  2721. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2722. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2723. Austrian Academy of Sciences.
  2724. To enable compilation of this filter you need to configure FFmpeg with
  2725. @code{--enable-netcdf}.
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item sofa
  2729. Set the SOFA file used for rendering.
  2730. @item gain
  2731. Set gain applied to audio. Value is in dB. Default is 0.
  2732. @item rotation
  2733. Set rotation of virtual loudspeakers in deg. Default is 0.
  2734. @item elevation
  2735. Set elevation of virtual speakers in deg. Default is 0.
  2736. @item radius
  2737. Set distance in meters between loudspeakers and the listener with near-field
  2738. HRTFs. Default is 1.
  2739. @item type
  2740. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2741. processing audio in time domain which is slow.
  2742. @var{freq} is processing audio in frequency domain which is fast.
  2743. Default is @var{freq}.
  2744. @item speakers
  2745. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2746. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2747. Each virtual loudspeaker is described with short channel name following with
  2748. azimuth and elevation in degreees.
  2749. Each virtual loudspeaker description is separated by '|'.
  2750. For example to override front left and front right channel positions use:
  2751. 'speakers=FL 45 15|FR 345 15'.
  2752. Descriptions with unrecognised channel names are ignored.
  2753. @end table
  2754. @subsection Examples
  2755. @itemize
  2756. @item
  2757. Using ClubFritz6 sofa file:
  2758. @example
  2759. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2760. @end example
  2761. @item
  2762. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2763. @example
  2764. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2765. @end example
  2766. @item
  2767. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2768. and also with custom gain:
  2769. @example
  2770. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2771. @end example
  2772. @end itemize
  2773. @section stereotools
  2774. This filter has some handy utilities to manage stereo signals, for converting
  2775. M/S stereo recordings to L/R signal while having control over the parameters
  2776. or spreading the stereo image of master track.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item level_in
  2780. Set input level before filtering for both channels. Defaults is 1.
  2781. Allowed range is from 0.015625 to 64.
  2782. @item level_out
  2783. Set output level after filtering for both channels. Defaults is 1.
  2784. Allowed range is from 0.015625 to 64.
  2785. @item balance_in
  2786. Set input balance between both channels. Default is 0.
  2787. Allowed range is from -1 to 1.
  2788. @item balance_out
  2789. Set output balance between both channels. Default is 0.
  2790. Allowed range is from -1 to 1.
  2791. @item softclip
  2792. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2793. clipping. Disabled by default.
  2794. @item mutel
  2795. Mute the left channel. Disabled by default.
  2796. @item muter
  2797. Mute the right channel. Disabled by default.
  2798. @item phasel
  2799. Change the phase of the left channel. Disabled by default.
  2800. @item phaser
  2801. Change the phase of the right channel. Disabled by default.
  2802. @item mode
  2803. Set stereo mode. Available values are:
  2804. @table @samp
  2805. @item lr>lr
  2806. Left/Right to Left/Right, this is default.
  2807. @item lr>ms
  2808. Left/Right to Mid/Side.
  2809. @item ms>lr
  2810. Mid/Side to Left/Right.
  2811. @item lr>ll
  2812. Left/Right to Left/Left.
  2813. @item lr>rr
  2814. Left/Right to Right/Right.
  2815. @item lr>l+r
  2816. Left/Right to Left + Right.
  2817. @item lr>rl
  2818. Left/Right to Right/Left.
  2819. @end table
  2820. @item slev
  2821. Set level of side signal. Default is 1.
  2822. Allowed range is from 0.015625 to 64.
  2823. @item sbal
  2824. Set balance of side signal. Default is 0.
  2825. Allowed range is from -1 to 1.
  2826. @item mlev
  2827. Set level of the middle signal. Default is 1.
  2828. Allowed range is from 0.015625 to 64.
  2829. @item mpan
  2830. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2831. @item base
  2832. Set stereo base between mono and inversed channels. Default is 0.
  2833. Allowed range is from -1 to 1.
  2834. @item delay
  2835. Set delay in milliseconds how much to delay left from right channel and
  2836. vice versa. Default is 0. Allowed range is from -20 to 20.
  2837. @item sclevel
  2838. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2839. @item phase
  2840. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2841. @end table
  2842. @subsection Examples
  2843. @itemize
  2844. @item
  2845. Apply karaoke like effect:
  2846. @example
  2847. stereotools=mlev=0.015625
  2848. @end example
  2849. @item
  2850. Convert M/S signal to L/R:
  2851. @example
  2852. "stereotools=mode=ms>lr"
  2853. @end example
  2854. @end itemize
  2855. @section stereowiden
  2856. This filter enhance the stereo effect by suppressing signal common to both
  2857. channels and by delaying the signal of left into right and vice versa,
  2858. thereby widening the stereo effect.
  2859. The filter accepts the following options:
  2860. @table @option
  2861. @item delay
  2862. Time in milliseconds of the delay of left signal into right and vice versa.
  2863. Default is 20 milliseconds.
  2864. @item feedback
  2865. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2866. effect of left signal in right output and vice versa which gives widening
  2867. effect. Default is 0.3.
  2868. @item crossfeed
  2869. Cross feed of left into right with inverted phase. This helps in suppressing
  2870. the mono. If the value is 1 it will cancel all the signal common to both
  2871. channels. Default is 0.3.
  2872. @item drymix
  2873. Set level of input signal of original channel. Default is 0.8.
  2874. @end table
  2875. @section treble
  2876. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2877. shelving filter with a response similar to that of a standard
  2878. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item gain, g
  2882. Give the gain at whichever is the lower of ~22 kHz and the
  2883. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2884. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2885. @item frequency, f
  2886. Set the filter's central frequency and so can be used
  2887. to extend or reduce the frequency range to be boosted or cut.
  2888. The default value is @code{3000} Hz.
  2889. @item width_type
  2890. Set method to specify band-width of filter.
  2891. @table @option
  2892. @item h
  2893. Hz
  2894. @item q
  2895. Q-Factor
  2896. @item o
  2897. octave
  2898. @item s
  2899. slope
  2900. @end table
  2901. @item width, w
  2902. Determine how steep is the filter's shelf transition.
  2903. @end table
  2904. @section tremolo
  2905. Sinusoidal amplitude modulation.
  2906. The filter accepts the following options:
  2907. @table @option
  2908. @item f
  2909. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2910. (20 Hz or lower) will result in a tremolo effect.
  2911. This filter may also be used as a ring modulator by specifying
  2912. a modulation frequency higher than 20 Hz.
  2913. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2914. @item d
  2915. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2916. Default value is 0.5.
  2917. @end table
  2918. @section vibrato
  2919. Sinusoidal phase modulation.
  2920. The filter accepts the following options:
  2921. @table @option
  2922. @item f
  2923. Modulation frequency in Hertz.
  2924. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2925. @item d
  2926. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2927. Default value is 0.5.
  2928. @end table
  2929. @section volume
  2930. Adjust the input audio volume.
  2931. It accepts the following parameters:
  2932. @table @option
  2933. @item volume
  2934. Set audio volume expression.
  2935. Output values are clipped to the maximum value.
  2936. The output audio volume is given by the relation:
  2937. @example
  2938. @var{output_volume} = @var{volume} * @var{input_volume}
  2939. @end example
  2940. The default value for @var{volume} is "1.0".
  2941. @item precision
  2942. This parameter represents the mathematical precision.
  2943. It determines which input sample formats will be allowed, which affects the
  2944. precision of the volume scaling.
  2945. @table @option
  2946. @item fixed
  2947. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2948. @item float
  2949. 32-bit floating-point; this limits input sample format to FLT. (default)
  2950. @item double
  2951. 64-bit floating-point; this limits input sample format to DBL.
  2952. @end table
  2953. @item replaygain
  2954. Choose the behaviour on encountering ReplayGain side data in input frames.
  2955. @table @option
  2956. @item drop
  2957. Remove ReplayGain side data, ignoring its contents (the default).
  2958. @item ignore
  2959. Ignore ReplayGain side data, but leave it in the frame.
  2960. @item track
  2961. Prefer the track gain, if present.
  2962. @item album
  2963. Prefer the album gain, if present.
  2964. @end table
  2965. @item replaygain_preamp
  2966. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2967. Default value for @var{replaygain_preamp} is 0.0.
  2968. @item eval
  2969. Set when the volume expression is evaluated.
  2970. It accepts the following values:
  2971. @table @samp
  2972. @item once
  2973. only evaluate expression once during the filter initialization, or
  2974. when the @samp{volume} command is sent
  2975. @item frame
  2976. evaluate expression for each incoming frame
  2977. @end table
  2978. Default value is @samp{once}.
  2979. @end table
  2980. The volume expression can contain the following parameters.
  2981. @table @option
  2982. @item n
  2983. frame number (starting at zero)
  2984. @item nb_channels
  2985. number of channels
  2986. @item nb_consumed_samples
  2987. number of samples consumed by the filter
  2988. @item nb_samples
  2989. number of samples in the current frame
  2990. @item pos
  2991. original frame position in the file
  2992. @item pts
  2993. frame PTS
  2994. @item sample_rate
  2995. sample rate
  2996. @item startpts
  2997. PTS at start of stream
  2998. @item startt
  2999. time at start of stream
  3000. @item t
  3001. frame time
  3002. @item tb
  3003. timestamp timebase
  3004. @item volume
  3005. last set volume value
  3006. @end table
  3007. Note that when @option{eval} is set to @samp{once} only the
  3008. @var{sample_rate} and @var{tb} variables are available, all other
  3009. variables will evaluate to NAN.
  3010. @subsection Commands
  3011. This filter supports the following commands:
  3012. @table @option
  3013. @item volume
  3014. Modify the volume expression.
  3015. The command accepts the same syntax of the corresponding option.
  3016. If the specified expression is not valid, it is kept at its current
  3017. value.
  3018. @item replaygain_noclip
  3019. Prevent clipping by limiting the gain applied.
  3020. Default value for @var{replaygain_noclip} is 1.
  3021. @end table
  3022. @subsection Examples
  3023. @itemize
  3024. @item
  3025. Halve the input audio volume:
  3026. @example
  3027. volume=volume=0.5
  3028. volume=volume=1/2
  3029. volume=volume=-6.0206dB
  3030. @end example
  3031. In all the above example the named key for @option{volume} can be
  3032. omitted, for example like in:
  3033. @example
  3034. volume=0.5
  3035. @end example
  3036. @item
  3037. Increase input audio power by 6 decibels using fixed-point precision:
  3038. @example
  3039. volume=volume=6dB:precision=fixed
  3040. @end example
  3041. @item
  3042. Fade volume after time 10 with an annihilation period of 5 seconds:
  3043. @example
  3044. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3045. @end example
  3046. @end itemize
  3047. @section volumedetect
  3048. Detect the volume of the input video.
  3049. The filter has no parameters. The input is not modified. Statistics about
  3050. the volume will be printed in the log when the input stream end is reached.
  3051. In particular it will show the mean volume (root mean square), maximum
  3052. volume (on a per-sample basis), and the beginning of a histogram of the
  3053. registered volume values (from the maximum value to a cumulated 1/1000 of
  3054. the samples).
  3055. All volumes are in decibels relative to the maximum PCM value.
  3056. @subsection Examples
  3057. Here is an excerpt of the output:
  3058. @example
  3059. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3060. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3061. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3062. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3067. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3068. @end example
  3069. It means that:
  3070. @itemize
  3071. @item
  3072. The mean square energy is approximately -27 dB, or 10^-2.7.
  3073. @item
  3074. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3075. @item
  3076. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3077. @end itemize
  3078. In other words, raising the volume by +4 dB does not cause any clipping,
  3079. raising it by +5 dB causes clipping for 6 samples, etc.
  3080. @c man end AUDIO FILTERS
  3081. @chapter Audio Sources
  3082. @c man begin AUDIO SOURCES
  3083. Below is a description of the currently available audio sources.
  3084. @section abuffer
  3085. Buffer audio frames, and make them available to the filter chain.
  3086. This source is mainly intended for a programmatic use, in particular
  3087. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3088. It accepts the following parameters:
  3089. @table @option
  3090. @item time_base
  3091. The timebase which will be used for timestamps of submitted frames. It must be
  3092. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3093. @item sample_rate
  3094. The sample rate of the incoming audio buffers.
  3095. @item sample_fmt
  3096. The sample format of the incoming audio buffers.
  3097. Either a sample format name or its corresponding integer representation from
  3098. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3099. @item channel_layout
  3100. The channel layout of the incoming audio buffers.
  3101. Either a channel layout name from channel_layout_map in
  3102. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3103. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3104. @item channels
  3105. The number of channels of the incoming audio buffers.
  3106. If both @var{channels} and @var{channel_layout} are specified, then they
  3107. must be consistent.
  3108. @end table
  3109. @subsection Examples
  3110. @example
  3111. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3112. @end example
  3113. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3114. Since the sample format with name "s16p" corresponds to the number
  3115. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3116. equivalent to:
  3117. @example
  3118. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3119. @end example
  3120. @section aevalsrc
  3121. Generate an audio signal specified by an expression.
  3122. This source accepts in input one or more expressions (one for each
  3123. channel), which are evaluated and used to generate a corresponding
  3124. audio signal.
  3125. This source accepts the following options:
  3126. @table @option
  3127. @item exprs
  3128. Set the '|'-separated expressions list for each separate channel. In case the
  3129. @option{channel_layout} option is not specified, the selected channel layout
  3130. depends on the number of provided expressions. Otherwise the last
  3131. specified expression is applied to the remaining output channels.
  3132. @item channel_layout, c
  3133. Set the channel layout. The number of channels in the specified layout
  3134. must be equal to the number of specified expressions.
  3135. @item duration, d
  3136. Set the minimum duration of the sourced audio. See
  3137. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3138. for the accepted syntax.
  3139. Note that the resulting duration may be greater than the specified
  3140. duration, as the generated audio is always cut at the end of a
  3141. complete frame.
  3142. If not specified, or the expressed duration is negative, the audio is
  3143. supposed to be generated forever.
  3144. @item nb_samples, n
  3145. Set the number of samples per channel per each output frame,
  3146. default to 1024.
  3147. @item sample_rate, s
  3148. Specify the sample rate, default to 44100.
  3149. @end table
  3150. Each expression in @var{exprs} can contain the following constants:
  3151. @table @option
  3152. @item n
  3153. number of the evaluated sample, starting from 0
  3154. @item t
  3155. time of the evaluated sample expressed in seconds, starting from 0
  3156. @item s
  3157. sample rate
  3158. @end table
  3159. @subsection Examples
  3160. @itemize
  3161. @item
  3162. Generate silence:
  3163. @example
  3164. aevalsrc=0
  3165. @end example
  3166. @item
  3167. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3168. 8000 Hz:
  3169. @example
  3170. aevalsrc="sin(440*2*PI*t):s=8000"
  3171. @end example
  3172. @item
  3173. Generate a two channels signal, specify the channel layout (Front
  3174. Center + Back Center) explicitly:
  3175. @example
  3176. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3177. @end example
  3178. @item
  3179. Generate white noise:
  3180. @example
  3181. aevalsrc="-2+random(0)"
  3182. @end example
  3183. @item
  3184. Generate an amplitude modulated signal:
  3185. @example
  3186. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3187. @end example
  3188. @item
  3189. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3190. @example
  3191. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3192. @end example
  3193. @end itemize
  3194. @section anullsrc
  3195. The null audio source, return unprocessed audio frames. It is mainly useful
  3196. as a template and to be employed in analysis / debugging tools, or as
  3197. the source for filters which ignore the input data (for example the sox
  3198. synth filter).
  3199. This source accepts the following options:
  3200. @table @option
  3201. @item channel_layout, cl
  3202. Specifies the channel layout, and can be either an integer or a string
  3203. representing a channel layout. The default value of @var{channel_layout}
  3204. is "stereo".
  3205. Check the channel_layout_map definition in
  3206. @file{libavutil/channel_layout.c} for the mapping between strings and
  3207. channel layout values.
  3208. @item sample_rate, r
  3209. Specifies the sample rate, and defaults to 44100.
  3210. @item nb_samples, n
  3211. Set the number of samples per requested frames.
  3212. @end table
  3213. @subsection Examples
  3214. @itemize
  3215. @item
  3216. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3217. @example
  3218. anullsrc=r=48000:cl=4
  3219. @end example
  3220. @item
  3221. Do the same operation with a more obvious syntax:
  3222. @example
  3223. anullsrc=r=48000:cl=mono
  3224. @end example
  3225. @end itemize
  3226. All the parameters need to be explicitly defined.
  3227. @section flite
  3228. Synthesize a voice utterance using the libflite library.
  3229. To enable compilation of this filter you need to configure FFmpeg with
  3230. @code{--enable-libflite}.
  3231. Note that the flite library is not thread-safe.
  3232. The filter accepts the following options:
  3233. @table @option
  3234. @item list_voices
  3235. If set to 1, list the names of the available voices and exit
  3236. immediately. Default value is 0.
  3237. @item nb_samples, n
  3238. Set the maximum number of samples per frame. Default value is 512.
  3239. @item textfile
  3240. Set the filename containing the text to speak.
  3241. @item text
  3242. Set the text to speak.
  3243. @item voice, v
  3244. Set the voice to use for the speech synthesis. Default value is
  3245. @code{kal}. See also the @var{list_voices} option.
  3246. @end table
  3247. @subsection Examples
  3248. @itemize
  3249. @item
  3250. Read from file @file{speech.txt}, and synthesize the text using the
  3251. standard flite voice:
  3252. @example
  3253. flite=textfile=speech.txt
  3254. @end example
  3255. @item
  3256. Read the specified text selecting the @code{slt} voice:
  3257. @example
  3258. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3259. @end example
  3260. @item
  3261. Input text to ffmpeg:
  3262. @example
  3263. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3264. @end example
  3265. @item
  3266. Make @file{ffplay} speak the specified text, using @code{flite} and
  3267. the @code{lavfi} device:
  3268. @example
  3269. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3270. @end example
  3271. @end itemize
  3272. For more information about libflite, check:
  3273. @url{http://www.speech.cs.cmu.edu/flite/}
  3274. @section anoisesrc
  3275. Generate a noise audio signal.
  3276. The filter accepts the following options:
  3277. @table @option
  3278. @item sample_rate, r
  3279. Specify the sample rate. Default value is 48000 Hz.
  3280. @item amplitude, a
  3281. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3282. is 1.0.
  3283. @item duration, d
  3284. Specify the duration of the generated audio stream. Not specifying this option
  3285. results in noise with an infinite length.
  3286. @item color, colour, c
  3287. Specify the color of noise. Available noise colors are white, pink, and brown.
  3288. Default color is white.
  3289. @item seed, s
  3290. Specify a value used to seed the PRNG.
  3291. @item nb_samples, n
  3292. Set the number of samples per each output frame, default is 1024.
  3293. @end table
  3294. @subsection Examples
  3295. @itemize
  3296. @item
  3297. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3298. @example
  3299. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3300. @end example
  3301. @end itemize
  3302. @section sine
  3303. Generate an audio signal made of a sine wave with amplitude 1/8.
  3304. The audio signal is bit-exact.
  3305. The filter accepts the following options:
  3306. @table @option
  3307. @item frequency, f
  3308. Set the carrier frequency. Default is 440 Hz.
  3309. @item beep_factor, b
  3310. Enable a periodic beep every second with frequency @var{beep_factor} times
  3311. the carrier frequency. Default is 0, meaning the beep is disabled.
  3312. @item sample_rate, r
  3313. Specify the sample rate, default is 44100.
  3314. @item duration, d
  3315. Specify the duration of the generated audio stream.
  3316. @item samples_per_frame
  3317. Set the number of samples per output frame.
  3318. The expression can contain the following constants:
  3319. @table @option
  3320. @item n
  3321. The (sequential) number of the output audio frame, starting from 0.
  3322. @item pts
  3323. The PTS (Presentation TimeStamp) of the output audio frame,
  3324. expressed in @var{TB} units.
  3325. @item t
  3326. The PTS of the output audio frame, expressed in seconds.
  3327. @item TB
  3328. The timebase of the output audio frames.
  3329. @end table
  3330. Default is @code{1024}.
  3331. @end table
  3332. @subsection Examples
  3333. @itemize
  3334. @item
  3335. Generate a simple 440 Hz sine wave:
  3336. @example
  3337. sine
  3338. @end example
  3339. @item
  3340. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3341. @example
  3342. sine=220:4:d=5
  3343. sine=f=220:b=4:d=5
  3344. sine=frequency=220:beep_factor=4:duration=5
  3345. @end example
  3346. @item
  3347. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3348. pattern:
  3349. @example
  3350. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3351. @end example
  3352. @end itemize
  3353. @c man end AUDIO SOURCES
  3354. @chapter Audio Sinks
  3355. @c man begin AUDIO SINKS
  3356. Below is a description of the currently available audio sinks.
  3357. @section abuffersink
  3358. Buffer audio frames, and make them available to the end of filter chain.
  3359. This sink is mainly intended for programmatic use, in particular
  3360. through the interface defined in @file{libavfilter/buffersink.h}
  3361. or the options system.
  3362. It accepts a pointer to an AVABufferSinkContext structure, which
  3363. defines the incoming buffers' formats, to be passed as the opaque
  3364. parameter to @code{avfilter_init_filter} for initialization.
  3365. @section anullsink
  3366. Null audio sink; do absolutely nothing with the input audio. It is
  3367. mainly useful as a template and for use in analysis / debugging
  3368. tools.
  3369. @c man end AUDIO SINKS
  3370. @chapter Video Filters
  3371. @c man begin VIDEO FILTERS
  3372. When you configure your FFmpeg build, you can disable any of the
  3373. existing filters using @code{--disable-filters}.
  3374. The configure output will show the video filters included in your
  3375. build.
  3376. Below is a description of the currently available video filters.
  3377. @section alphaextract
  3378. Extract the alpha component from the input as a grayscale video. This
  3379. is especially useful with the @var{alphamerge} filter.
  3380. @section alphamerge
  3381. Add or replace the alpha component of the primary input with the
  3382. grayscale value of a second input. This is intended for use with
  3383. @var{alphaextract} to allow the transmission or storage of frame
  3384. sequences that have alpha in a format that doesn't support an alpha
  3385. channel.
  3386. For example, to reconstruct full frames from a normal YUV-encoded video
  3387. and a separate video created with @var{alphaextract}, you might use:
  3388. @example
  3389. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3390. @end example
  3391. Since this filter is designed for reconstruction, it operates on frame
  3392. sequences without considering timestamps, and terminates when either
  3393. input reaches end of stream. This will cause problems if your encoding
  3394. pipeline drops frames. If you're trying to apply an image as an
  3395. overlay to a video stream, consider the @var{overlay} filter instead.
  3396. @section ass
  3397. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3398. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3399. Substation Alpha) subtitles files.
  3400. This filter accepts the following option in addition to the common options from
  3401. the @ref{subtitles} filter:
  3402. @table @option
  3403. @item shaping
  3404. Set the shaping engine
  3405. Available values are:
  3406. @table @samp
  3407. @item auto
  3408. The default libass shaping engine, which is the best available.
  3409. @item simple
  3410. Fast, font-agnostic shaper that can do only substitutions
  3411. @item complex
  3412. Slower shaper using OpenType for substitutions and positioning
  3413. @end table
  3414. The default is @code{auto}.
  3415. @end table
  3416. @section atadenoise
  3417. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3418. The filter accepts the following options:
  3419. @table @option
  3420. @item 0a
  3421. Set threshold A for 1st plane. Default is 0.02.
  3422. Valid range is 0 to 0.3.
  3423. @item 0b
  3424. Set threshold B for 1st plane. Default is 0.04.
  3425. Valid range is 0 to 5.
  3426. @item 1a
  3427. Set threshold A for 2nd plane. Default is 0.02.
  3428. Valid range is 0 to 0.3.
  3429. @item 1b
  3430. Set threshold B for 2nd plane. Default is 0.04.
  3431. Valid range is 0 to 5.
  3432. @item 2a
  3433. Set threshold A for 3rd plane. Default is 0.02.
  3434. Valid range is 0 to 0.3.
  3435. @item 2b
  3436. Set threshold B for 3rd plane. Default is 0.04.
  3437. Valid range is 0 to 5.
  3438. Threshold A is designed to react on abrupt changes in the input signal and
  3439. threshold B is designed to react on continuous changes in the input signal.
  3440. @item s
  3441. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3442. number in range [5, 129].
  3443. @item p
  3444. Set what planes of frame filter will use for averaging. Default is all.
  3445. @end table
  3446. @section avgblur
  3447. Apply average blur filter.
  3448. The filter accepts the following options:
  3449. @table @option
  3450. @item sizeX
  3451. Set horizontal kernel size.
  3452. @item planes
  3453. Set which planes to filter. By default all planes are filtered.
  3454. @item sizeY
  3455. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3456. Default is @code{0}.
  3457. @end table
  3458. @section bbox
  3459. Compute the bounding box for the non-black pixels in the input frame
  3460. luminance plane.
  3461. This filter computes the bounding box containing all the pixels with a
  3462. luminance value greater than the minimum allowed value.
  3463. The parameters describing the bounding box are printed on the filter
  3464. log.
  3465. The filter accepts the following option:
  3466. @table @option
  3467. @item min_val
  3468. Set the minimal luminance value. Default is @code{16}.
  3469. @end table
  3470. @section bitplanenoise
  3471. Show and measure bit plane noise.
  3472. The filter accepts the following options:
  3473. @table @option
  3474. @item bitplane
  3475. Set which plane to analyze. Default is @code{1}.
  3476. @item filter
  3477. Filter out noisy pixels from @code{bitplane} set above.
  3478. Default is disabled.
  3479. @end table
  3480. @section blackdetect
  3481. Detect video intervals that are (almost) completely black. Can be
  3482. useful to detect chapter transitions, commercials, or invalid
  3483. recordings. Output lines contains the time for the start, end and
  3484. duration of the detected black interval expressed in seconds.
  3485. In order to display the output lines, you need to set the loglevel at
  3486. least to the AV_LOG_INFO value.
  3487. The filter accepts the following options:
  3488. @table @option
  3489. @item black_min_duration, d
  3490. Set the minimum detected black duration expressed in seconds. It must
  3491. be a non-negative floating point number.
  3492. Default value is 2.0.
  3493. @item picture_black_ratio_th, pic_th
  3494. Set the threshold for considering a picture "black".
  3495. Express the minimum value for the ratio:
  3496. @example
  3497. @var{nb_black_pixels} / @var{nb_pixels}
  3498. @end example
  3499. for which a picture is considered black.
  3500. Default value is 0.98.
  3501. @item pixel_black_th, pix_th
  3502. Set the threshold for considering a pixel "black".
  3503. The threshold expresses the maximum pixel luminance value for which a
  3504. pixel is considered "black". The provided value is scaled according to
  3505. the following equation:
  3506. @example
  3507. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3508. @end example
  3509. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3510. the input video format, the range is [0-255] for YUV full-range
  3511. formats and [16-235] for YUV non full-range formats.
  3512. Default value is 0.10.
  3513. @end table
  3514. The following example sets the maximum pixel threshold to the minimum
  3515. value, and detects only black intervals of 2 or more seconds:
  3516. @example
  3517. blackdetect=d=2:pix_th=0.00
  3518. @end example
  3519. @section blackframe
  3520. Detect frames that are (almost) completely black. Can be useful to
  3521. detect chapter transitions or commercials. Output lines consist of
  3522. the frame number of the detected frame, the percentage of blackness,
  3523. the position in the file if known or -1 and the timestamp in seconds.
  3524. In order to display the output lines, you need to set the loglevel at
  3525. least to the AV_LOG_INFO value.
  3526. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3527. The value represents the percentage of pixels in the picture that
  3528. are below the threshold value.
  3529. It accepts the following parameters:
  3530. @table @option
  3531. @item amount
  3532. The percentage of the pixels that have to be below the threshold; it defaults to
  3533. @code{98}.
  3534. @item threshold, thresh
  3535. The threshold below which a pixel value is considered black; it defaults to
  3536. @code{32}.
  3537. @end table
  3538. @section blend, tblend
  3539. Blend two video frames into each other.
  3540. The @code{blend} filter takes two input streams and outputs one
  3541. stream, the first input is the "top" layer and second input is
  3542. "bottom" layer. By default, the output terminates when the longest input terminates.
  3543. The @code{tblend} (time blend) filter takes two consecutive frames
  3544. from one single stream, and outputs the result obtained by blending
  3545. the new frame on top of the old frame.
  3546. A description of the accepted options follows.
  3547. @table @option
  3548. @item c0_mode
  3549. @item c1_mode
  3550. @item c2_mode
  3551. @item c3_mode
  3552. @item all_mode
  3553. Set blend mode for specific pixel component or all pixel components in case
  3554. of @var{all_mode}. Default value is @code{normal}.
  3555. Available values for component modes are:
  3556. @table @samp
  3557. @item addition
  3558. @item addition128
  3559. @item and
  3560. @item average
  3561. @item burn
  3562. @item darken
  3563. @item difference
  3564. @item difference128
  3565. @item divide
  3566. @item dodge
  3567. @item freeze
  3568. @item exclusion
  3569. @item glow
  3570. @item hardlight
  3571. @item hardmix
  3572. @item heat
  3573. @item lighten
  3574. @item linearlight
  3575. @item multiply
  3576. @item multiply128
  3577. @item negation
  3578. @item normal
  3579. @item or
  3580. @item overlay
  3581. @item phoenix
  3582. @item pinlight
  3583. @item reflect
  3584. @item screen
  3585. @item softlight
  3586. @item subtract
  3587. @item vividlight
  3588. @item xor
  3589. @end table
  3590. @item c0_opacity
  3591. @item c1_opacity
  3592. @item c2_opacity
  3593. @item c3_opacity
  3594. @item all_opacity
  3595. Set blend opacity for specific pixel component or all pixel components in case
  3596. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3597. @item c0_expr
  3598. @item c1_expr
  3599. @item c2_expr
  3600. @item c3_expr
  3601. @item all_expr
  3602. Set blend expression for specific pixel component or all pixel components in case
  3603. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3604. The expressions can use the following variables:
  3605. @table @option
  3606. @item N
  3607. The sequential number of the filtered frame, starting from @code{0}.
  3608. @item X
  3609. @item Y
  3610. the coordinates of the current sample
  3611. @item W
  3612. @item H
  3613. the width and height of currently filtered plane
  3614. @item SW
  3615. @item SH
  3616. Width and height scale depending on the currently filtered plane. It is the
  3617. ratio between the corresponding luma plane number of pixels and the current
  3618. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3619. @code{0.5,0.5} for chroma planes.
  3620. @item T
  3621. Time of the current frame, expressed in seconds.
  3622. @item TOP, A
  3623. Value of pixel component at current location for first video frame (top layer).
  3624. @item BOTTOM, B
  3625. Value of pixel component at current location for second video frame (bottom layer).
  3626. @end table
  3627. @item shortest
  3628. Force termination when the shortest input terminates. Default is
  3629. @code{0}. This option is only defined for the @code{blend} filter.
  3630. @item repeatlast
  3631. Continue applying the last bottom frame after the end of the stream. A value of
  3632. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3633. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3634. @end table
  3635. @subsection Examples
  3636. @itemize
  3637. @item
  3638. Apply transition from bottom layer to top layer in first 10 seconds:
  3639. @example
  3640. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3641. @end example
  3642. @item
  3643. Apply 1x1 checkerboard effect:
  3644. @example
  3645. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3646. @end example
  3647. @item
  3648. Apply uncover left effect:
  3649. @example
  3650. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3651. @end example
  3652. @item
  3653. Apply uncover down effect:
  3654. @example
  3655. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3656. @end example
  3657. @item
  3658. Apply uncover up-left effect:
  3659. @example
  3660. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3661. @end example
  3662. @item
  3663. Split diagonally video and shows top and bottom layer on each side:
  3664. @example
  3665. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3666. @end example
  3667. @item
  3668. Display differences between the current and the previous frame:
  3669. @example
  3670. tblend=all_mode=difference128
  3671. @end example
  3672. @end itemize
  3673. @section boxblur
  3674. Apply a boxblur algorithm to the input video.
  3675. It accepts the following parameters:
  3676. @table @option
  3677. @item luma_radius, lr
  3678. @item luma_power, lp
  3679. @item chroma_radius, cr
  3680. @item chroma_power, cp
  3681. @item alpha_radius, ar
  3682. @item alpha_power, ap
  3683. @end table
  3684. A description of the accepted options follows.
  3685. @table @option
  3686. @item luma_radius, lr
  3687. @item chroma_radius, cr
  3688. @item alpha_radius, ar
  3689. Set an expression for the box radius in pixels used for blurring the
  3690. corresponding input plane.
  3691. The radius value must be a non-negative number, and must not be
  3692. greater than the value of the expression @code{min(w,h)/2} for the
  3693. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3694. planes.
  3695. Default value for @option{luma_radius} is "2". If not specified,
  3696. @option{chroma_radius} and @option{alpha_radius} default to the
  3697. corresponding value set for @option{luma_radius}.
  3698. The expressions can contain the following constants:
  3699. @table @option
  3700. @item w
  3701. @item h
  3702. The input width and height in pixels.
  3703. @item cw
  3704. @item ch
  3705. The input chroma image width and height in pixels.
  3706. @item hsub
  3707. @item vsub
  3708. The horizontal and vertical chroma subsample values. For example, for the
  3709. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3710. @end table
  3711. @item luma_power, lp
  3712. @item chroma_power, cp
  3713. @item alpha_power, ap
  3714. Specify how many times the boxblur filter is applied to the
  3715. corresponding plane.
  3716. Default value for @option{luma_power} is 2. If not specified,
  3717. @option{chroma_power} and @option{alpha_power} default to the
  3718. corresponding value set for @option{luma_power}.
  3719. A value of 0 will disable the effect.
  3720. @end table
  3721. @subsection Examples
  3722. @itemize
  3723. @item
  3724. Apply a boxblur filter with the luma, chroma, and alpha radii
  3725. set to 2:
  3726. @example
  3727. boxblur=luma_radius=2:luma_power=1
  3728. boxblur=2:1
  3729. @end example
  3730. @item
  3731. Set the luma radius to 2, and alpha and chroma radius to 0:
  3732. @example
  3733. boxblur=2:1:cr=0:ar=0
  3734. @end example
  3735. @item
  3736. Set the luma and chroma radii to a fraction of the video dimension:
  3737. @example
  3738. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3739. @end example
  3740. @end itemize
  3741. @section bwdif
  3742. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3743. Deinterlacing Filter").
  3744. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3745. interpolation algorithms.
  3746. It accepts the following parameters:
  3747. @table @option
  3748. @item mode
  3749. The interlacing mode to adopt. It accepts one of the following values:
  3750. @table @option
  3751. @item 0, send_frame
  3752. Output one frame for each frame.
  3753. @item 1, send_field
  3754. Output one frame for each field.
  3755. @end table
  3756. The default value is @code{send_field}.
  3757. @item parity
  3758. The picture field parity assumed for the input interlaced video. It accepts one
  3759. of the following values:
  3760. @table @option
  3761. @item 0, tff
  3762. Assume the top field is first.
  3763. @item 1, bff
  3764. Assume the bottom field is first.
  3765. @item -1, auto
  3766. Enable automatic detection of field parity.
  3767. @end table
  3768. The default value is @code{auto}.
  3769. If the interlacing is unknown or the decoder does not export this information,
  3770. top field first will be assumed.
  3771. @item deint
  3772. Specify which frames to deinterlace. Accept one of the following
  3773. values:
  3774. @table @option
  3775. @item 0, all
  3776. Deinterlace all frames.
  3777. @item 1, interlaced
  3778. Only deinterlace frames marked as interlaced.
  3779. @end table
  3780. The default value is @code{all}.
  3781. @end table
  3782. @section chromakey
  3783. YUV colorspace color/chroma keying.
  3784. The filter accepts the following options:
  3785. @table @option
  3786. @item color
  3787. The color which will be replaced with transparency.
  3788. @item similarity
  3789. Similarity percentage with the key color.
  3790. 0.01 matches only the exact key color, while 1.0 matches everything.
  3791. @item blend
  3792. Blend percentage.
  3793. 0.0 makes pixels either fully transparent, or not transparent at all.
  3794. Higher values result in semi-transparent pixels, with a higher transparency
  3795. the more similar the pixels color is to the key color.
  3796. @item yuv
  3797. Signals that the color passed is already in YUV instead of RGB.
  3798. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3799. This can be used to pass exact YUV values as hexadecimal numbers.
  3800. @end table
  3801. @subsection Examples
  3802. @itemize
  3803. @item
  3804. Make every green pixel in the input image transparent:
  3805. @example
  3806. ffmpeg -i input.png -vf chromakey=green out.png
  3807. @end example
  3808. @item
  3809. Overlay a greenscreen-video on top of a static black background.
  3810. @example
  3811. 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
  3812. @end example
  3813. @end itemize
  3814. @section ciescope
  3815. Display CIE color diagram with pixels overlaid onto it.
  3816. The filter accepts the following options:
  3817. @table @option
  3818. @item system
  3819. Set color system.
  3820. @table @samp
  3821. @item ntsc, 470m
  3822. @item ebu, 470bg
  3823. @item smpte
  3824. @item 240m
  3825. @item apple
  3826. @item widergb
  3827. @item cie1931
  3828. @item rec709, hdtv
  3829. @item uhdtv, rec2020
  3830. @end table
  3831. @item cie
  3832. Set CIE system.
  3833. @table @samp
  3834. @item xyy
  3835. @item ucs
  3836. @item luv
  3837. @end table
  3838. @item gamuts
  3839. Set what gamuts to draw.
  3840. See @code{system} option for available values.
  3841. @item size, s
  3842. Set ciescope size, by default set to 512.
  3843. @item intensity, i
  3844. Set intensity used to map input pixel values to CIE diagram.
  3845. @item contrast
  3846. Set contrast used to draw tongue colors that are out of active color system gamut.
  3847. @item corrgamma
  3848. Correct gamma displayed on scope, by default enabled.
  3849. @item showwhite
  3850. Show white point on CIE diagram, by default disabled.
  3851. @item gamma
  3852. Set input gamma. Used only with XYZ input color space.
  3853. @end table
  3854. @section codecview
  3855. Visualize information exported by some codecs.
  3856. Some codecs can export information through frames using side-data or other
  3857. means. For example, some MPEG based codecs export motion vectors through the
  3858. @var{export_mvs} flag in the codec @option{flags2} option.
  3859. The filter accepts the following option:
  3860. @table @option
  3861. @item mv
  3862. Set motion vectors to visualize.
  3863. Available flags for @var{mv} are:
  3864. @table @samp
  3865. @item pf
  3866. forward predicted MVs of P-frames
  3867. @item bf
  3868. forward predicted MVs of B-frames
  3869. @item bb
  3870. backward predicted MVs of B-frames
  3871. @end table
  3872. @item qp
  3873. Display quantization parameters using the chroma planes.
  3874. @item mv_type, mvt
  3875. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3876. Available flags for @var{mv_type} are:
  3877. @table @samp
  3878. @item fp
  3879. forward predicted MVs
  3880. @item bp
  3881. backward predicted MVs
  3882. @end table
  3883. @item frame_type, ft
  3884. Set frame type to visualize motion vectors of.
  3885. Available flags for @var{frame_type} are:
  3886. @table @samp
  3887. @item if
  3888. intra-coded frames (I-frames)
  3889. @item pf
  3890. predicted frames (P-frames)
  3891. @item bf
  3892. bi-directionally predicted frames (B-frames)
  3893. @end table
  3894. @end table
  3895. @subsection Examples
  3896. @itemize
  3897. @item
  3898. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3899. @example
  3900. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3901. @end example
  3902. @item
  3903. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3904. @example
  3905. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3906. @end example
  3907. @end itemize
  3908. @section colorbalance
  3909. Modify intensity of primary colors (red, green and blue) of input frames.
  3910. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3911. regions for the red-cyan, green-magenta or blue-yellow balance.
  3912. A positive adjustment value shifts the balance towards the primary color, a negative
  3913. value towards the complementary color.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item rs
  3917. @item gs
  3918. @item bs
  3919. Adjust red, green and blue shadows (darkest pixels).
  3920. @item rm
  3921. @item gm
  3922. @item bm
  3923. Adjust red, green and blue midtones (medium pixels).
  3924. @item rh
  3925. @item gh
  3926. @item bh
  3927. Adjust red, green and blue highlights (brightest pixels).
  3928. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3929. @end table
  3930. @subsection Examples
  3931. @itemize
  3932. @item
  3933. Add red color cast to shadows:
  3934. @example
  3935. colorbalance=rs=.3
  3936. @end example
  3937. @end itemize
  3938. @section colorkey
  3939. RGB colorspace color keying.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item color
  3943. The color which will be replaced with transparency.
  3944. @item similarity
  3945. Similarity percentage with the key color.
  3946. 0.01 matches only the exact key color, while 1.0 matches everything.
  3947. @item blend
  3948. Blend percentage.
  3949. 0.0 makes pixels either fully transparent, or not transparent at all.
  3950. Higher values result in semi-transparent pixels, with a higher transparency
  3951. the more similar the pixels color is to the key color.
  3952. @end table
  3953. @subsection Examples
  3954. @itemize
  3955. @item
  3956. Make every green pixel in the input image transparent:
  3957. @example
  3958. ffmpeg -i input.png -vf colorkey=green out.png
  3959. @end example
  3960. @item
  3961. Overlay a greenscreen-video on top of a static background image.
  3962. @example
  3963. 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
  3964. @end example
  3965. @end itemize
  3966. @section colorlevels
  3967. Adjust video input frames using levels.
  3968. The filter accepts the following options:
  3969. @table @option
  3970. @item rimin
  3971. @item gimin
  3972. @item bimin
  3973. @item aimin
  3974. Adjust red, green, blue and alpha input black point.
  3975. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3976. @item rimax
  3977. @item gimax
  3978. @item bimax
  3979. @item aimax
  3980. Adjust red, green, blue and alpha input white point.
  3981. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3982. Input levels are used to lighten highlights (bright tones), darken shadows
  3983. (dark tones), change the balance of bright and dark tones.
  3984. @item romin
  3985. @item gomin
  3986. @item bomin
  3987. @item aomin
  3988. Adjust red, green, blue and alpha output black point.
  3989. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3990. @item romax
  3991. @item gomax
  3992. @item bomax
  3993. @item aomax
  3994. Adjust red, green, blue and alpha output white point.
  3995. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3996. Output levels allows manual selection of a constrained output level range.
  3997. @end table
  3998. @subsection Examples
  3999. @itemize
  4000. @item
  4001. Make video output darker:
  4002. @example
  4003. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4004. @end example
  4005. @item
  4006. Increase contrast:
  4007. @example
  4008. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4009. @end example
  4010. @item
  4011. Make video output lighter:
  4012. @example
  4013. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4014. @end example
  4015. @item
  4016. Increase brightness:
  4017. @example
  4018. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4019. @end example
  4020. @end itemize
  4021. @section colorchannelmixer
  4022. Adjust video input frames by re-mixing color channels.
  4023. This filter modifies a color channel by adding the values associated to
  4024. the other channels of the same pixels. For example if the value to
  4025. modify is red, the output value will be:
  4026. @example
  4027. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4028. @end example
  4029. The filter accepts the following options:
  4030. @table @option
  4031. @item rr
  4032. @item rg
  4033. @item rb
  4034. @item ra
  4035. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4036. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4037. @item gr
  4038. @item gg
  4039. @item gb
  4040. @item ga
  4041. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4042. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4043. @item br
  4044. @item bg
  4045. @item bb
  4046. @item ba
  4047. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4048. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4049. @item ar
  4050. @item ag
  4051. @item ab
  4052. @item aa
  4053. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4054. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4055. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4056. @end table
  4057. @subsection Examples
  4058. @itemize
  4059. @item
  4060. Convert source to grayscale:
  4061. @example
  4062. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4063. @end example
  4064. @item
  4065. Simulate sepia tones:
  4066. @example
  4067. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4068. @end example
  4069. @end itemize
  4070. @section colormatrix
  4071. Convert color matrix.
  4072. The filter accepts the following options:
  4073. @table @option
  4074. @item src
  4075. @item dst
  4076. Specify the source and destination color matrix. Both values must be
  4077. specified.
  4078. The accepted values are:
  4079. @table @samp
  4080. @item bt709
  4081. BT.709
  4082. @item bt601
  4083. BT.601
  4084. @item smpte240m
  4085. SMPTE-240M
  4086. @item fcc
  4087. FCC
  4088. @item bt2020
  4089. BT.2020
  4090. @end table
  4091. @end table
  4092. For example to convert from BT.601 to SMPTE-240M, use the command:
  4093. @example
  4094. colormatrix=bt601:smpte240m
  4095. @end example
  4096. @section colorspace
  4097. Convert colorspace, transfer characteristics or color primaries.
  4098. Input video needs to have an even size.
  4099. The filter accepts the following options:
  4100. @table @option
  4101. @anchor{all}
  4102. @item all
  4103. Specify all color properties at once.
  4104. The accepted values are:
  4105. @table @samp
  4106. @item bt470m
  4107. BT.470M
  4108. @item bt470bg
  4109. BT.470BG
  4110. @item bt601-6-525
  4111. BT.601-6 525
  4112. @item bt601-6-625
  4113. BT.601-6 625
  4114. @item bt709
  4115. BT.709
  4116. @item smpte170m
  4117. SMPTE-170M
  4118. @item smpte240m
  4119. SMPTE-240M
  4120. @item bt2020
  4121. BT.2020
  4122. @end table
  4123. @anchor{space}
  4124. @item space
  4125. Specify output colorspace.
  4126. The accepted values are:
  4127. @table @samp
  4128. @item bt709
  4129. BT.709
  4130. @item fcc
  4131. FCC
  4132. @item bt470bg
  4133. BT.470BG or BT.601-6 625
  4134. @item smpte170m
  4135. SMPTE-170M or BT.601-6 525
  4136. @item smpte240m
  4137. SMPTE-240M
  4138. @item ycgco
  4139. YCgCo
  4140. @item bt2020ncl
  4141. BT.2020 with non-constant luminance
  4142. @end table
  4143. @anchor{trc}
  4144. @item trc
  4145. Specify output transfer characteristics.
  4146. The accepted values are:
  4147. @table @samp
  4148. @item bt709
  4149. BT.709
  4150. @item bt470m
  4151. BT.470M
  4152. @item bt470bg
  4153. BT.470BG
  4154. @item gamma22
  4155. Constant gamma of 2.2
  4156. @item gamma28
  4157. Constant gamma of 2.8
  4158. @item smpte170m
  4159. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4160. @item smpte240m
  4161. SMPTE-240M
  4162. @item srgb
  4163. SRGB
  4164. @item iec61966-2-1
  4165. iec61966-2-1
  4166. @item iec61966-2-4
  4167. iec61966-2-4
  4168. @item xvycc
  4169. xvycc
  4170. @item bt2020-10
  4171. BT.2020 for 10-bits content
  4172. @item bt2020-12
  4173. BT.2020 for 12-bits content
  4174. @end table
  4175. @anchor{primaries}
  4176. @item primaries
  4177. Specify output color primaries.
  4178. The accepted values are:
  4179. @table @samp
  4180. @item bt709
  4181. BT.709
  4182. @item bt470m
  4183. BT.470M
  4184. @item bt470bg
  4185. BT.470BG or BT.601-6 625
  4186. @item smpte170m
  4187. SMPTE-170M or BT.601-6 525
  4188. @item smpte240m
  4189. SMPTE-240M
  4190. @item film
  4191. film
  4192. @item smpte431
  4193. SMPTE-431
  4194. @item smpte432
  4195. SMPTE-432
  4196. @item bt2020
  4197. BT.2020
  4198. @end table
  4199. @anchor{range}
  4200. @item range
  4201. Specify output color range.
  4202. The accepted values are:
  4203. @table @samp
  4204. @item tv
  4205. TV (restricted) range
  4206. @item mpeg
  4207. MPEG (restricted) range
  4208. @item pc
  4209. PC (full) range
  4210. @item jpeg
  4211. JPEG (full) range
  4212. @end table
  4213. @item format
  4214. Specify output color format.
  4215. The accepted values are:
  4216. @table @samp
  4217. @item yuv420p
  4218. YUV 4:2:0 planar 8-bits
  4219. @item yuv420p10
  4220. YUV 4:2:0 planar 10-bits
  4221. @item yuv420p12
  4222. YUV 4:2:0 planar 12-bits
  4223. @item yuv422p
  4224. YUV 4:2:2 planar 8-bits
  4225. @item yuv422p10
  4226. YUV 4:2:2 planar 10-bits
  4227. @item yuv422p12
  4228. YUV 4:2:2 planar 12-bits
  4229. @item yuv444p
  4230. YUV 4:4:4 planar 8-bits
  4231. @item yuv444p10
  4232. YUV 4:4:4 planar 10-bits
  4233. @item yuv444p12
  4234. YUV 4:4:4 planar 12-bits
  4235. @end table
  4236. @item fast
  4237. Do a fast conversion, which skips gamma/primary correction. This will take
  4238. significantly less CPU, but will be mathematically incorrect. To get output
  4239. compatible with that produced by the colormatrix filter, use fast=1.
  4240. @item dither
  4241. Specify dithering mode.
  4242. The accepted values are:
  4243. @table @samp
  4244. @item none
  4245. No dithering
  4246. @item fsb
  4247. Floyd-Steinberg dithering
  4248. @end table
  4249. @item wpadapt
  4250. Whitepoint adaptation mode.
  4251. The accepted values are:
  4252. @table @samp
  4253. @item bradford
  4254. Bradford whitepoint adaptation
  4255. @item vonkries
  4256. von Kries whitepoint adaptation
  4257. @item identity
  4258. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4259. @end table
  4260. @item iall
  4261. Override all input properties at once. Same accepted values as @ref{all}.
  4262. @item ispace
  4263. Override input colorspace. Same accepted values as @ref{space}.
  4264. @item iprimaries
  4265. Override input color primaries. Same accepted values as @ref{primaries}.
  4266. @item itrc
  4267. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4268. @item irange
  4269. Override input color range. Same accepted values as @ref{range}.
  4270. @end table
  4271. The filter converts the transfer characteristics, color space and color
  4272. primaries to the specified user values. The output value, if not specified,
  4273. is set to a default value based on the "all" property. If that property is
  4274. also not specified, the filter will log an error. The output color range and
  4275. format default to the same value as the input color range and format. The
  4276. input transfer characteristics, color space, color primaries and color range
  4277. should be set on the input data. If any of these are missing, the filter will
  4278. log an error and no conversion will take place.
  4279. For example to convert the input to SMPTE-240M, use the command:
  4280. @example
  4281. colorspace=smpte240m
  4282. @end example
  4283. @section convolution
  4284. Apply convolution 3x3 or 5x5 filter.
  4285. The filter accepts the following options:
  4286. @table @option
  4287. @item 0m
  4288. @item 1m
  4289. @item 2m
  4290. @item 3m
  4291. Set matrix for each plane.
  4292. Matrix is sequence of 9 or 25 signed integers.
  4293. @item 0rdiv
  4294. @item 1rdiv
  4295. @item 2rdiv
  4296. @item 3rdiv
  4297. Set multiplier for calculated value for each plane.
  4298. @item 0bias
  4299. @item 1bias
  4300. @item 2bias
  4301. @item 3bias
  4302. Set bias for each plane. This value is added to the result of the multiplication.
  4303. Useful for making the overall image brighter or darker. Default is 0.0.
  4304. @end table
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. Apply sharpen:
  4309. @example
  4310. 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"
  4311. @end example
  4312. @item
  4313. Apply blur:
  4314. @example
  4315. 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"
  4316. @end example
  4317. @item
  4318. Apply edge enhance:
  4319. @example
  4320. 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"
  4321. @end example
  4322. @item
  4323. Apply edge detect:
  4324. @example
  4325. 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"
  4326. @end example
  4327. @item
  4328. Apply emboss:
  4329. @example
  4330. 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"
  4331. @end example
  4332. @end itemize
  4333. @section copy
  4334. Copy the input source unchanged to the output. This is mainly useful for
  4335. testing purposes.
  4336. @anchor{coreimage}
  4337. @section coreimage
  4338. Video filtering on GPU using Apple's CoreImage API on OSX.
  4339. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4340. processed by video hardware. However, software-based OpenGL implementations
  4341. exist which means there is no guarantee for hardware processing. It depends on
  4342. the respective OSX.
  4343. There are many filters and image generators provided by Apple that come with a
  4344. large variety of options. The filter has to be referenced by its name along
  4345. with its options.
  4346. The coreimage filter accepts the following options:
  4347. @table @option
  4348. @item list_filters
  4349. List all available filters and generators along with all their respective
  4350. options as well as possible minimum and maximum values along with the default
  4351. values.
  4352. @example
  4353. list_filters=true
  4354. @end example
  4355. @item filter
  4356. Specify all filters by their respective name and options.
  4357. Use @var{list_filters} to determine all valid filter names and options.
  4358. Numerical options are specified by a float value and are automatically clamped
  4359. to their respective value range. Vector and color options have to be specified
  4360. by a list of space separated float values. Character escaping has to be done.
  4361. A special option name @code{default} is available to use default options for a
  4362. filter.
  4363. It is required to specify either @code{default} or at least one of the filter options.
  4364. All omitted options are used with their default values.
  4365. The syntax of the filter string is as follows:
  4366. @example
  4367. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4368. @end example
  4369. @item output_rect
  4370. Specify a rectangle where the output of the filter chain is copied into the
  4371. input image. It is given by a list of space separated float values:
  4372. @example
  4373. output_rect=x\ y\ width\ height
  4374. @end example
  4375. If not given, the output rectangle equals the dimensions of the input image.
  4376. The output rectangle is automatically cropped at the borders of the input
  4377. image. Negative values are valid for each component.
  4378. @example
  4379. output_rect=25\ 25\ 100\ 100
  4380. @end example
  4381. @end table
  4382. Several filters can be chained for successive processing without GPU-HOST
  4383. transfers allowing for fast processing of complex filter chains.
  4384. Currently, only filters with zero (generators) or exactly one (filters) input
  4385. image and one output image are supported. Also, transition filters are not yet
  4386. usable as intended.
  4387. Some filters generate output images with additional padding depending on the
  4388. respective filter kernel. The padding is automatically removed to ensure the
  4389. filter output has the same size as the input image.
  4390. For image generators, the size of the output image is determined by the
  4391. previous output image of the filter chain or the input image of the whole
  4392. filterchain, respectively. The generators do not use the pixel information of
  4393. this image to generate their output. However, the generated output is
  4394. blended onto this image, resulting in partial or complete coverage of the
  4395. output image.
  4396. The @ref{coreimagesrc} video source can be used for generating input images
  4397. which are directly fed into the filter chain. By using it, providing input
  4398. images by another video source or an input video is not required.
  4399. @subsection Examples
  4400. @itemize
  4401. @item
  4402. List all filters available:
  4403. @example
  4404. coreimage=list_filters=true
  4405. @end example
  4406. @item
  4407. Use the CIBoxBlur filter with default options to blur an image:
  4408. @example
  4409. coreimage=filter=CIBoxBlur@@default
  4410. @end example
  4411. @item
  4412. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4413. its center at 100x100 and a radius of 50 pixels:
  4414. @example
  4415. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4416. @end example
  4417. @item
  4418. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4419. given as complete and escaped command-line for Apple's standard bash shell:
  4420. @example
  4421. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4422. @end example
  4423. @end itemize
  4424. @section crop
  4425. Crop the input video to given dimensions.
  4426. It accepts the following parameters:
  4427. @table @option
  4428. @item w, out_w
  4429. The width of the output video. It defaults to @code{iw}.
  4430. This expression is evaluated only once during the filter
  4431. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4432. @item h, out_h
  4433. The height of the output video. It defaults to @code{ih}.
  4434. This expression is evaluated only once during the filter
  4435. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4436. @item x
  4437. The horizontal position, in the input video, of the left edge of the output
  4438. video. It defaults to @code{(in_w-out_w)/2}.
  4439. This expression is evaluated per-frame.
  4440. @item y
  4441. The vertical position, in the input video, of the top edge of the output video.
  4442. It defaults to @code{(in_h-out_h)/2}.
  4443. This expression is evaluated per-frame.
  4444. @item keep_aspect
  4445. If set to 1 will force the output display aspect ratio
  4446. to be the same of the input, by changing the output sample aspect
  4447. ratio. It defaults to 0.
  4448. @item exact
  4449. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4450. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4451. It defaults to 0.
  4452. @end table
  4453. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4454. expressions containing the following constants:
  4455. @table @option
  4456. @item x
  4457. @item y
  4458. The computed values for @var{x} and @var{y}. They are evaluated for
  4459. each new frame.
  4460. @item in_w
  4461. @item in_h
  4462. The input width and height.
  4463. @item iw
  4464. @item ih
  4465. These are the same as @var{in_w} and @var{in_h}.
  4466. @item out_w
  4467. @item out_h
  4468. The output (cropped) width and height.
  4469. @item ow
  4470. @item oh
  4471. These are the same as @var{out_w} and @var{out_h}.
  4472. @item a
  4473. same as @var{iw} / @var{ih}
  4474. @item sar
  4475. input sample aspect ratio
  4476. @item dar
  4477. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4478. @item hsub
  4479. @item vsub
  4480. horizontal and vertical chroma subsample values. For example for the
  4481. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4482. @item n
  4483. The number of the input frame, starting from 0.
  4484. @item pos
  4485. the position in the file of the input frame, NAN if unknown
  4486. @item t
  4487. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4488. @end table
  4489. The expression for @var{out_w} may depend on the value of @var{out_h},
  4490. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4491. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4492. evaluated after @var{out_w} and @var{out_h}.
  4493. The @var{x} and @var{y} parameters specify the expressions for the
  4494. position of the top-left corner of the output (non-cropped) area. They
  4495. are evaluated for each frame. If the evaluated value is not valid, it
  4496. is approximated to the nearest valid value.
  4497. The expression for @var{x} may depend on @var{y}, and the expression
  4498. for @var{y} may depend on @var{x}.
  4499. @subsection Examples
  4500. @itemize
  4501. @item
  4502. Crop area with size 100x100 at position (12,34).
  4503. @example
  4504. crop=100:100:12:34
  4505. @end example
  4506. Using named options, the example above becomes:
  4507. @example
  4508. crop=w=100:h=100:x=12:y=34
  4509. @end example
  4510. @item
  4511. Crop the central input area with size 100x100:
  4512. @example
  4513. crop=100:100
  4514. @end example
  4515. @item
  4516. Crop the central input area with size 2/3 of the input video:
  4517. @example
  4518. crop=2/3*in_w:2/3*in_h
  4519. @end example
  4520. @item
  4521. Crop the input video central square:
  4522. @example
  4523. crop=out_w=in_h
  4524. crop=in_h
  4525. @end example
  4526. @item
  4527. Delimit the rectangle with the top-left corner placed at position
  4528. 100:100 and the right-bottom corner corresponding to the right-bottom
  4529. corner of the input image.
  4530. @example
  4531. crop=in_w-100:in_h-100:100:100
  4532. @end example
  4533. @item
  4534. Crop 10 pixels from the left and right borders, and 20 pixels from
  4535. the top and bottom borders
  4536. @example
  4537. crop=in_w-2*10:in_h-2*20
  4538. @end example
  4539. @item
  4540. Keep only the bottom right quarter of the input image:
  4541. @example
  4542. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4543. @end example
  4544. @item
  4545. Crop height for getting Greek harmony:
  4546. @example
  4547. crop=in_w:1/PHI*in_w
  4548. @end example
  4549. @item
  4550. Apply trembling effect:
  4551. @example
  4552. 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)
  4553. @end example
  4554. @item
  4555. Apply erratic camera effect depending on timestamp:
  4556. @example
  4557. 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)"
  4558. @end example
  4559. @item
  4560. Set x depending on the value of y:
  4561. @example
  4562. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4563. @end example
  4564. @end itemize
  4565. @subsection Commands
  4566. This filter supports the following commands:
  4567. @table @option
  4568. @item w, out_w
  4569. @item h, out_h
  4570. @item x
  4571. @item y
  4572. Set width/height of the output video and the horizontal/vertical position
  4573. in the input video.
  4574. The command accepts the same syntax of the corresponding option.
  4575. If the specified expression is not valid, it is kept at its current
  4576. value.
  4577. @end table
  4578. @section cropdetect
  4579. Auto-detect the crop size.
  4580. It calculates the necessary cropping parameters and prints the
  4581. recommended parameters via the logging system. The detected dimensions
  4582. correspond to the non-black area of the input video.
  4583. It accepts the following parameters:
  4584. @table @option
  4585. @item limit
  4586. Set higher black value threshold, which can be optionally specified
  4587. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4588. value greater to the set value is considered non-black. It defaults to 24.
  4589. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4590. on the bitdepth of the pixel format.
  4591. @item round
  4592. The value which the width/height should be divisible by. It defaults to
  4593. 16. The offset is automatically adjusted to center the video. Use 2 to
  4594. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4595. encoding to most video codecs.
  4596. @item reset_count, reset
  4597. Set the counter that determines after how many frames cropdetect will
  4598. reset the previously detected largest video area and start over to
  4599. detect the current optimal crop area. Default value is 0.
  4600. This can be useful when channel logos distort the video area. 0
  4601. indicates 'never reset', and returns the largest area encountered during
  4602. playback.
  4603. @end table
  4604. @anchor{curves}
  4605. @section curves
  4606. Apply color adjustments using curves.
  4607. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4608. component (red, green and blue) has its values defined by @var{N} key points
  4609. tied from each other using a smooth curve. The x-axis represents the pixel
  4610. values from the input frame, and the y-axis the new pixel values to be set for
  4611. the output frame.
  4612. By default, a component curve is defined by the two points @var{(0;0)} and
  4613. @var{(1;1)}. This creates a straight line where each original pixel value is
  4614. "adjusted" to its own value, which means no change to the image.
  4615. The filter allows you to redefine these two points and add some more. A new
  4616. curve (using a natural cubic spline interpolation) will be define to pass
  4617. smoothly through all these new coordinates. The new defined points needs to be
  4618. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4619. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4620. the vector spaces, the values will be clipped accordingly.
  4621. The filter accepts the following options:
  4622. @table @option
  4623. @item preset
  4624. Select one of the available color presets. This option can be used in addition
  4625. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4626. options takes priority on the preset values.
  4627. Available presets are:
  4628. @table @samp
  4629. @item none
  4630. @item color_negative
  4631. @item cross_process
  4632. @item darker
  4633. @item increase_contrast
  4634. @item lighter
  4635. @item linear_contrast
  4636. @item medium_contrast
  4637. @item negative
  4638. @item strong_contrast
  4639. @item vintage
  4640. @end table
  4641. Default is @code{none}.
  4642. @item master, m
  4643. Set the master key points. These points will define a second pass mapping. It
  4644. is sometimes called a "luminance" or "value" mapping. It can be used with
  4645. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4646. post-processing LUT.
  4647. @item red, r
  4648. Set the key points for the red component.
  4649. @item green, g
  4650. Set the key points for the green component.
  4651. @item blue, b
  4652. Set the key points for the blue component.
  4653. @item all
  4654. Set the key points for all components (not including master).
  4655. Can be used in addition to the other key points component
  4656. options. In this case, the unset component(s) will fallback on this
  4657. @option{all} setting.
  4658. @item psfile
  4659. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4660. @item plot
  4661. Save Gnuplot script of the curves in specified file.
  4662. @end table
  4663. To avoid some filtergraph syntax conflicts, each key points list need to be
  4664. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4665. @subsection Examples
  4666. @itemize
  4667. @item
  4668. Increase slightly the middle level of blue:
  4669. @example
  4670. curves=blue='0/0 0.5/0.58 1/1'
  4671. @end example
  4672. @item
  4673. Vintage effect:
  4674. @example
  4675. 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'
  4676. @end example
  4677. Here we obtain the following coordinates for each components:
  4678. @table @var
  4679. @item red
  4680. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4681. @item green
  4682. @code{(0;0) (0.50;0.48) (1;1)}
  4683. @item blue
  4684. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4685. @end table
  4686. @item
  4687. The previous example can also be achieved with the associated built-in preset:
  4688. @example
  4689. curves=preset=vintage
  4690. @end example
  4691. @item
  4692. Or simply:
  4693. @example
  4694. curves=vintage
  4695. @end example
  4696. @item
  4697. Use a Photoshop preset and redefine the points of the green component:
  4698. @example
  4699. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4700. @end example
  4701. @item
  4702. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4703. and @command{gnuplot}:
  4704. @example
  4705. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4706. gnuplot -p /tmp/curves.plt
  4707. @end example
  4708. @end itemize
  4709. @section datascope
  4710. Video data analysis filter.
  4711. This filter shows hexadecimal pixel values of part of video.
  4712. The filter accepts the following options:
  4713. @table @option
  4714. @item size, s
  4715. Set output video size.
  4716. @item x
  4717. Set x offset from where to pick pixels.
  4718. @item y
  4719. Set y offset from where to pick pixels.
  4720. @item mode
  4721. Set scope mode, can be one of the following:
  4722. @table @samp
  4723. @item mono
  4724. Draw hexadecimal pixel values with white color on black background.
  4725. @item color
  4726. Draw hexadecimal pixel values with input video pixel color on black
  4727. background.
  4728. @item color2
  4729. Draw hexadecimal pixel values on color background picked from input video,
  4730. the text color is picked in such way so its always visible.
  4731. @end table
  4732. @item axis
  4733. Draw rows and columns numbers on left and top of video.
  4734. @item opacity
  4735. Set background opacity.
  4736. @end table
  4737. @section dctdnoiz
  4738. Denoise frames using 2D DCT (frequency domain filtering).
  4739. This filter is not designed for real time.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @item sigma, s
  4743. Set the noise sigma constant.
  4744. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4745. coefficient (absolute value) below this threshold with be dropped.
  4746. If you need a more advanced filtering, see @option{expr}.
  4747. Default is @code{0}.
  4748. @item overlap
  4749. Set number overlapping pixels for each block. Since the filter can be slow, you
  4750. may want to reduce this value, at the cost of a less effective filter and the
  4751. risk of various artefacts.
  4752. If the overlapping value doesn't permit processing the whole input width or
  4753. height, a warning will be displayed and according borders won't be denoised.
  4754. Default value is @var{blocksize}-1, which is the best possible setting.
  4755. @item expr, e
  4756. Set the coefficient factor expression.
  4757. For each coefficient of a DCT block, this expression will be evaluated as a
  4758. multiplier value for the coefficient.
  4759. If this is option is set, the @option{sigma} option will be ignored.
  4760. The absolute value of the coefficient can be accessed through the @var{c}
  4761. variable.
  4762. @item n
  4763. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4764. @var{blocksize}, which is the width and height of the processed blocks.
  4765. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4766. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4767. on the speed processing. Also, a larger block size does not necessarily means a
  4768. better de-noising.
  4769. @end table
  4770. @subsection Examples
  4771. Apply a denoise with a @option{sigma} of @code{4.5}:
  4772. @example
  4773. dctdnoiz=4.5
  4774. @end example
  4775. The same operation can be achieved using the expression system:
  4776. @example
  4777. dctdnoiz=e='gte(c, 4.5*3)'
  4778. @end example
  4779. Violent denoise using a block size of @code{16x16}:
  4780. @example
  4781. dctdnoiz=15:n=4
  4782. @end example
  4783. @section deband
  4784. Remove banding artifacts from input video.
  4785. It works by replacing banded pixels with average value of referenced pixels.
  4786. The filter accepts the following options:
  4787. @table @option
  4788. @item 1thr
  4789. @item 2thr
  4790. @item 3thr
  4791. @item 4thr
  4792. Set banding detection threshold for each plane. Default is 0.02.
  4793. Valid range is 0.00003 to 0.5.
  4794. If difference between current pixel and reference pixel is less than threshold,
  4795. it will be considered as banded.
  4796. @item range, r
  4797. Banding detection range in pixels. Default is 16. If positive, random number
  4798. in range 0 to set value will be used. If negative, exact absolute value
  4799. will be used.
  4800. The range defines square of four pixels around current pixel.
  4801. @item direction, d
  4802. Set direction in radians from which four pixel will be compared. If positive,
  4803. random direction from 0 to set direction will be picked. If negative, exact of
  4804. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4805. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4806. column.
  4807. @item blur, b
  4808. If enabled, current pixel is compared with average value of all four
  4809. surrounding pixels. The default is enabled. If disabled current pixel is
  4810. compared with all four surrounding pixels. The pixel is considered banded
  4811. if only all four differences with surrounding pixels are less than threshold.
  4812. @item coupling, c
  4813. If enabled, current pixel is changed if and only if all pixel components are banded,
  4814. e.g. banding detection threshold is triggered for all color components.
  4815. The default is disabled.
  4816. @end table
  4817. @anchor{decimate}
  4818. @section decimate
  4819. Drop duplicated frames at regular intervals.
  4820. The filter accepts the following options:
  4821. @table @option
  4822. @item cycle
  4823. Set the number of frames from which one will be dropped. Setting this to
  4824. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4825. Default is @code{5}.
  4826. @item dupthresh
  4827. Set the threshold for duplicate detection. If the difference metric for a frame
  4828. is less than or equal to this value, then it is declared as duplicate. Default
  4829. is @code{1.1}
  4830. @item scthresh
  4831. Set scene change threshold. Default is @code{15}.
  4832. @item blockx
  4833. @item blocky
  4834. Set the size of the x and y-axis blocks used during metric calculations.
  4835. Larger blocks give better noise suppression, but also give worse detection of
  4836. small movements. Must be a power of two. Default is @code{32}.
  4837. @item ppsrc
  4838. Mark main input as a pre-processed input and activate clean source input
  4839. stream. This allows the input to be pre-processed with various filters to help
  4840. the metrics calculation while keeping the frame selection lossless. When set to
  4841. @code{1}, the first stream is for the pre-processed input, and the second
  4842. stream is the clean source from where the kept frames are chosen. Default is
  4843. @code{0}.
  4844. @item chroma
  4845. Set whether or not chroma is considered in the metric calculations. Default is
  4846. @code{1}.
  4847. @end table
  4848. @section deflate
  4849. Apply deflate effect to the video.
  4850. This filter replaces the pixel by the local(3x3) average by taking into account
  4851. only values lower than the pixel.
  4852. It accepts the following options:
  4853. @table @option
  4854. @item threshold0
  4855. @item threshold1
  4856. @item threshold2
  4857. @item threshold3
  4858. Limit the maximum change for each plane, default is 65535.
  4859. If 0, plane will remain unchanged.
  4860. @end table
  4861. @section dejudder
  4862. Remove judder produced by partially interlaced telecined content.
  4863. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4864. source was partially telecined content then the output of @code{pullup,dejudder}
  4865. will have a variable frame rate. May change the recorded frame rate of the
  4866. container. Aside from that change, this filter will not affect constant frame
  4867. rate video.
  4868. The option available in this filter is:
  4869. @table @option
  4870. @item cycle
  4871. Specify the length of the window over which the judder repeats.
  4872. Accepts any integer greater than 1. Useful values are:
  4873. @table @samp
  4874. @item 4
  4875. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4876. @item 5
  4877. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4878. @item 20
  4879. If a mixture of the two.
  4880. @end table
  4881. The default is @samp{4}.
  4882. @end table
  4883. @section delogo
  4884. Suppress a TV station logo by a simple interpolation of the surrounding
  4885. pixels. Just set a rectangle covering the logo and watch it disappear
  4886. (and sometimes something even uglier appear - your mileage may vary).
  4887. It accepts the following parameters:
  4888. @table @option
  4889. @item x
  4890. @item y
  4891. Specify the top left corner coordinates of the logo. They must be
  4892. specified.
  4893. @item w
  4894. @item h
  4895. Specify the width and height of the logo to clear. They must be
  4896. specified.
  4897. @item band, t
  4898. Specify the thickness of the fuzzy edge of the rectangle (added to
  4899. @var{w} and @var{h}). The default value is 1. This option is
  4900. deprecated, setting higher values should no longer be necessary and
  4901. is not recommended.
  4902. @item show
  4903. When set to 1, a green rectangle is drawn on the screen to simplify
  4904. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4905. The default value is 0.
  4906. The rectangle is drawn on the outermost pixels which will be (partly)
  4907. replaced with interpolated values. The values of the next pixels
  4908. immediately outside this rectangle in each direction will be used to
  4909. compute the interpolated pixel values inside the rectangle.
  4910. @end table
  4911. @subsection Examples
  4912. @itemize
  4913. @item
  4914. Set a rectangle covering the area with top left corner coordinates 0,0
  4915. and size 100x77, and a band of size 10:
  4916. @example
  4917. delogo=x=0:y=0:w=100:h=77:band=10
  4918. @end example
  4919. @end itemize
  4920. @section deshake
  4921. Attempt to fix small changes in horizontal and/or vertical shift. This
  4922. filter helps remove camera shake from hand-holding a camera, bumping a
  4923. tripod, moving on a vehicle, etc.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item x
  4927. @item y
  4928. @item w
  4929. @item h
  4930. Specify a rectangular area where to limit the search for motion
  4931. vectors.
  4932. If desired the search for motion vectors can be limited to a
  4933. rectangular area of the frame defined by its top left corner, width
  4934. and height. These parameters have the same meaning as the drawbox
  4935. filter which can be used to visualise the position of the bounding
  4936. box.
  4937. This is useful when simultaneous movement of subjects within the frame
  4938. might be confused for camera motion by the motion vector search.
  4939. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4940. then the full frame is used. This allows later options to be set
  4941. without specifying the bounding box for the motion vector search.
  4942. Default - search the whole frame.
  4943. @item rx
  4944. @item ry
  4945. Specify the maximum extent of movement in x and y directions in the
  4946. range 0-64 pixels. Default 16.
  4947. @item edge
  4948. Specify how to generate pixels to fill blanks at the edge of the
  4949. frame. Available values are:
  4950. @table @samp
  4951. @item blank, 0
  4952. Fill zeroes at blank locations
  4953. @item original, 1
  4954. Original image at blank locations
  4955. @item clamp, 2
  4956. Extruded edge value at blank locations
  4957. @item mirror, 3
  4958. Mirrored edge at blank locations
  4959. @end table
  4960. Default value is @samp{mirror}.
  4961. @item blocksize
  4962. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4963. default 8.
  4964. @item contrast
  4965. Specify the contrast threshold for blocks. Only blocks with more than
  4966. the specified contrast (difference between darkest and lightest
  4967. pixels) will be considered. Range 1-255, default 125.
  4968. @item search
  4969. Specify the search strategy. Available values are:
  4970. @table @samp
  4971. @item exhaustive, 0
  4972. Set exhaustive search
  4973. @item less, 1
  4974. Set less exhaustive search.
  4975. @end table
  4976. Default value is @samp{exhaustive}.
  4977. @item filename
  4978. If set then a detailed log of the motion search is written to the
  4979. specified file.
  4980. @item opencl
  4981. If set to 1, specify using OpenCL capabilities, only available if
  4982. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4983. @end table
  4984. @section detelecine
  4985. Apply an exact inverse of the telecine operation. It requires a predefined
  4986. pattern specified using the pattern option which must be the same as that passed
  4987. to the telecine filter.
  4988. This filter accepts the following options:
  4989. @table @option
  4990. @item first_field
  4991. @table @samp
  4992. @item top, t
  4993. top field first
  4994. @item bottom, b
  4995. bottom field first
  4996. The default value is @code{top}.
  4997. @end table
  4998. @item pattern
  4999. A string of numbers representing the pulldown pattern you wish to apply.
  5000. The default value is @code{23}.
  5001. @item start_frame
  5002. A number representing position of the first frame with respect to the telecine
  5003. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5004. @end table
  5005. @section dilation
  5006. Apply dilation effect to the video.
  5007. This filter replaces the pixel by the local(3x3) maximum.
  5008. It accepts the following options:
  5009. @table @option
  5010. @item threshold0
  5011. @item threshold1
  5012. @item threshold2
  5013. @item threshold3
  5014. Limit the maximum change for each plane, default is 65535.
  5015. If 0, plane will remain unchanged.
  5016. @item coordinates
  5017. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5018. pixels are used.
  5019. Flags to local 3x3 coordinates maps like this:
  5020. 1 2 3
  5021. 4 5
  5022. 6 7 8
  5023. @end table
  5024. @section displace
  5025. Displace pixels as indicated by second and third input stream.
  5026. It takes three input streams and outputs one stream, the first input is the
  5027. source, and second and third input are displacement maps.
  5028. The second input specifies how much to displace pixels along the
  5029. x-axis, while the third input specifies how much to displace pixels
  5030. along the y-axis.
  5031. If one of displacement map streams terminates, last frame from that
  5032. displacement map will be used.
  5033. Note that once generated, displacements maps can be reused over and over again.
  5034. A description of the accepted options follows.
  5035. @table @option
  5036. @item edge
  5037. Set displace behavior for pixels that are out of range.
  5038. Available values are:
  5039. @table @samp
  5040. @item blank
  5041. Missing pixels are replaced by black pixels.
  5042. @item smear
  5043. Adjacent pixels will spread out to replace missing pixels.
  5044. @item wrap
  5045. Out of range pixels are wrapped so they point to pixels of other side.
  5046. @end table
  5047. Default is @samp{smear}.
  5048. @end table
  5049. @subsection Examples
  5050. @itemize
  5051. @item
  5052. Add ripple effect to rgb input of video size hd720:
  5053. @example
  5054. 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
  5055. @end example
  5056. @item
  5057. Add wave effect to rgb input of video size hd720:
  5058. @example
  5059. 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
  5060. @end example
  5061. @end itemize
  5062. @section drawbox
  5063. Draw a colored box on the input image.
  5064. It accepts the following parameters:
  5065. @table @option
  5066. @item x
  5067. @item y
  5068. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5069. @item width, w
  5070. @item height, h
  5071. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5072. the input width and height. It defaults to 0.
  5073. @item color, c
  5074. Specify the color of the box to write. For the general syntax of this option,
  5075. check the "Color" section in the ffmpeg-utils manual. If the special
  5076. value @code{invert} is used, the box edge color is the same as the
  5077. video with inverted luma.
  5078. @item thickness, t
  5079. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5080. See below for the list of accepted constants.
  5081. @end table
  5082. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5083. following constants:
  5084. @table @option
  5085. @item dar
  5086. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5087. @item hsub
  5088. @item vsub
  5089. horizontal and vertical chroma subsample values. For example for the
  5090. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5091. @item in_h, ih
  5092. @item in_w, iw
  5093. The input width and height.
  5094. @item sar
  5095. The input sample aspect ratio.
  5096. @item x
  5097. @item y
  5098. The x and y offset coordinates where the box is drawn.
  5099. @item w
  5100. @item h
  5101. The width and height of the drawn box.
  5102. @item t
  5103. The thickness of the drawn box.
  5104. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5105. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5106. @end table
  5107. @subsection Examples
  5108. @itemize
  5109. @item
  5110. Draw a black box around the edge of the input image:
  5111. @example
  5112. drawbox
  5113. @end example
  5114. @item
  5115. Draw a box with color red and an opacity of 50%:
  5116. @example
  5117. drawbox=10:20:200:60:red@@0.5
  5118. @end example
  5119. The previous example can be specified as:
  5120. @example
  5121. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5122. @end example
  5123. @item
  5124. Fill the box with pink color:
  5125. @example
  5126. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5127. @end example
  5128. @item
  5129. Draw a 2-pixel red 2.40:1 mask:
  5130. @example
  5131. 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
  5132. @end example
  5133. @end itemize
  5134. @section drawgrid
  5135. Draw a grid on the input image.
  5136. It accepts the following parameters:
  5137. @table @option
  5138. @item x
  5139. @item y
  5140. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5141. @item width, w
  5142. @item height, h
  5143. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5144. input width and height, respectively, minus @code{thickness}, so image gets
  5145. framed. Default to 0.
  5146. @item color, c
  5147. Specify the color of the grid. For the general syntax of this option,
  5148. check the "Color" section in the ffmpeg-utils manual. If the special
  5149. value @code{invert} is used, the grid color is the same as the
  5150. video with inverted luma.
  5151. @item thickness, t
  5152. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5153. See below for the list of accepted constants.
  5154. @end table
  5155. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5156. following constants:
  5157. @table @option
  5158. @item dar
  5159. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5160. @item hsub
  5161. @item vsub
  5162. horizontal and vertical chroma subsample values. For example for the
  5163. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5164. @item in_h, ih
  5165. @item in_w, iw
  5166. The input grid cell width and height.
  5167. @item sar
  5168. The input sample aspect ratio.
  5169. @item x
  5170. @item y
  5171. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5172. @item w
  5173. @item h
  5174. The width and height of the drawn cell.
  5175. @item t
  5176. The thickness of the drawn cell.
  5177. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5178. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5179. @end table
  5180. @subsection Examples
  5181. @itemize
  5182. @item
  5183. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5184. @example
  5185. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5186. @end example
  5187. @item
  5188. Draw a white 3x3 grid with an opacity of 50%:
  5189. @example
  5190. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5191. @end example
  5192. @end itemize
  5193. @anchor{drawtext}
  5194. @section drawtext
  5195. Draw a text string or text from a specified file on top of a video, using the
  5196. libfreetype library.
  5197. To enable compilation of this filter, you need to configure FFmpeg with
  5198. @code{--enable-libfreetype}.
  5199. To enable default font fallback and the @var{font} option you need to
  5200. configure FFmpeg with @code{--enable-libfontconfig}.
  5201. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5202. @code{--enable-libfribidi}.
  5203. @subsection Syntax
  5204. It accepts the following parameters:
  5205. @table @option
  5206. @item box
  5207. Used to draw a box around text using the background color.
  5208. The value must be either 1 (enable) or 0 (disable).
  5209. The default value of @var{box} is 0.
  5210. @item boxborderw
  5211. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5212. The default value of @var{boxborderw} is 0.
  5213. @item boxcolor
  5214. The color to be used for drawing box around text. For the syntax of this
  5215. option, check the "Color" section in the ffmpeg-utils manual.
  5216. The default value of @var{boxcolor} is "white".
  5217. @item line_spacing
  5218. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5219. The default value of @var{line_spacing} is 0.
  5220. @item borderw
  5221. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5222. The default value of @var{borderw} is 0.
  5223. @item bordercolor
  5224. Set the color to be used for drawing border around text. For the syntax of this
  5225. option, check the "Color" section in the ffmpeg-utils manual.
  5226. The default value of @var{bordercolor} is "black".
  5227. @item expansion
  5228. Select how the @var{text} is expanded. Can be either @code{none},
  5229. @code{strftime} (deprecated) or
  5230. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5231. below for details.
  5232. @item basetime
  5233. Set a start time for the count. Value is in microseconds. Only applied
  5234. in the deprecated strftime expansion mode. To emulate in normal expansion
  5235. mode use the @code{pts} function, supplying the start time (in seconds)
  5236. as the second argument.
  5237. @item fix_bounds
  5238. If true, check and fix text coords to avoid clipping.
  5239. @item fontcolor
  5240. The color to be used for drawing fonts. For the syntax of this option, check
  5241. the "Color" section in the ffmpeg-utils manual.
  5242. The default value of @var{fontcolor} is "black".
  5243. @item fontcolor_expr
  5244. String which is expanded the same way as @var{text} to obtain dynamic
  5245. @var{fontcolor} value. By default this option has empty value and is not
  5246. processed. When this option is set, it overrides @var{fontcolor} option.
  5247. @item font
  5248. The font family to be used for drawing text. By default Sans.
  5249. @item fontfile
  5250. The font file to be used for drawing text. The path must be included.
  5251. This parameter is mandatory if the fontconfig support is disabled.
  5252. @item alpha
  5253. Draw the text applying alpha blending. The value can
  5254. be a number between 0.0 and 1.0.
  5255. The expression accepts the same variables @var{x, y} as well.
  5256. The default value is 1.
  5257. Please see @var{fontcolor_expr}.
  5258. @item fontsize
  5259. The font size to be used for drawing text.
  5260. The default value of @var{fontsize} is 16.
  5261. @item text_shaping
  5262. If set to 1, attempt to shape the text (for example, reverse the order of
  5263. right-to-left text and join Arabic characters) before drawing it.
  5264. Otherwise, just draw the text exactly as given.
  5265. By default 1 (if supported).
  5266. @item ft_load_flags
  5267. The flags to be used for loading the fonts.
  5268. The flags map the corresponding flags supported by libfreetype, and are
  5269. a combination of the following values:
  5270. @table @var
  5271. @item default
  5272. @item no_scale
  5273. @item no_hinting
  5274. @item render
  5275. @item no_bitmap
  5276. @item vertical_layout
  5277. @item force_autohint
  5278. @item crop_bitmap
  5279. @item pedantic
  5280. @item ignore_global_advance_width
  5281. @item no_recurse
  5282. @item ignore_transform
  5283. @item monochrome
  5284. @item linear_design
  5285. @item no_autohint
  5286. @end table
  5287. Default value is "default".
  5288. For more information consult the documentation for the FT_LOAD_*
  5289. libfreetype flags.
  5290. @item shadowcolor
  5291. The color to be used for drawing a shadow behind the drawn text. For the
  5292. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5293. The default value of @var{shadowcolor} is "black".
  5294. @item shadowx
  5295. @item shadowy
  5296. The x and y offsets for the text shadow position with respect to the
  5297. position of the text. They can be either positive or negative
  5298. values. The default value for both is "0".
  5299. @item start_number
  5300. The starting frame number for the n/frame_num variable. The default value
  5301. is "0".
  5302. @item tabsize
  5303. The size in number of spaces to use for rendering the tab.
  5304. Default value is 4.
  5305. @item timecode
  5306. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5307. format. It can be used with or without text parameter. @var{timecode_rate}
  5308. option must be specified.
  5309. @item timecode_rate, rate, r
  5310. Set the timecode frame rate (timecode only).
  5311. @item tc24hmax
  5312. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5313. Default is 0 (disabled).
  5314. @item text
  5315. The text string to be drawn. The text must be a sequence of UTF-8
  5316. encoded characters.
  5317. This parameter is mandatory if no file is specified with the parameter
  5318. @var{textfile}.
  5319. @item textfile
  5320. A text file containing text to be drawn. The text must be a sequence
  5321. of UTF-8 encoded characters.
  5322. This parameter is mandatory if no text string is specified with the
  5323. parameter @var{text}.
  5324. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5325. @item reload
  5326. If set to 1, the @var{textfile} will be reloaded before each frame.
  5327. Be sure to update it atomically, or it may be read partially, or even fail.
  5328. @item x
  5329. @item y
  5330. The expressions which specify the offsets where text will be drawn
  5331. within the video frame. They are relative to the top/left border of the
  5332. output image.
  5333. The default value of @var{x} and @var{y} is "0".
  5334. See below for the list of accepted constants and functions.
  5335. @end table
  5336. The parameters for @var{x} and @var{y} are expressions containing the
  5337. following constants and functions:
  5338. @table @option
  5339. @item dar
  5340. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5341. @item hsub
  5342. @item vsub
  5343. horizontal and vertical chroma subsample values. For example for the
  5344. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5345. @item line_h, lh
  5346. the height of each text line
  5347. @item main_h, h, H
  5348. the input height
  5349. @item main_w, w, W
  5350. the input width
  5351. @item max_glyph_a, ascent
  5352. the maximum distance from the baseline to the highest/upper grid
  5353. coordinate used to place a glyph outline point, for all the rendered
  5354. glyphs.
  5355. It is a positive value, due to the grid's orientation with the Y axis
  5356. upwards.
  5357. @item max_glyph_d, descent
  5358. the maximum distance from the baseline to the lowest grid coordinate
  5359. used to place a glyph outline point, for all the rendered glyphs.
  5360. This is a negative value, due to the grid's orientation, with the Y axis
  5361. upwards.
  5362. @item max_glyph_h
  5363. maximum glyph height, that is the maximum height for all the glyphs
  5364. contained in the rendered text, it is equivalent to @var{ascent} -
  5365. @var{descent}.
  5366. @item max_glyph_w
  5367. maximum glyph width, that is the maximum width for all the glyphs
  5368. contained in the rendered text
  5369. @item n
  5370. the number of input frame, starting from 0
  5371. @item rand(min, max)
  5372. return a random number included between @var{min} and @var{max}
  5373. @item sar
  5374. The input sample aspect ratio.
  5375. @item t
  5376. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5377. @item text_h, th
  5378. the height of the rendered text
  5379. @item text_w, tw
  5380. the width of the rendered text
  5381. @item x
  5382. @item y
  5383. the x and y offset coordinates where the text is drawn.
  5384. These parameters allow the @var{x} and @var{y} expressions to refer
  5385. each other, so you can for example specify @code{y=x/dar}.
  5386. @end table
  5387. @anchor{drawtext_expansion}
  5388. @subsection Text expansion
  5389. If @option{expansion} is set to @code{strftime},
  5390. the filter recognizes strftime() sequences in the provided text and
  5391. expands them accordingly. Check the documentation of strftime(). This
  5392. feature is deprecated.
  5393. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5394. If @option{expansion} is set to @code{normal} (which is the default),
  5395. the following expansion mechanism is used.
  5396. The backslash character @samp{\}, followed by any character, always expands to
  5397. the second character.
  5398. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5399. braces is a function name, possibly followed by arguments separated by ':'.
  5400. If the arguments contain special characters or delimiters (':' or '@}'),
  5401. they should be escaped.
  5402. Note that they probably must also be escaped as the value for the
  5403. @option{text} option in the filter argument string and as the filter
  5404. argument in the filtergraph description, and possibly also for the shell,
  5405. that makes up to four levels of escaping; using a text file avoids these
  5406. problems.
  5407. The following functions are available:
  5408. @table @command
  5409. @item expr, e
  5410. The expression evaluation result.
  5411. It must take one argument specifying the expression to be evaluated,
  5412. which accepts the same constants and functions as the @var{x} and
  5413. @var{y} values. Note that not all constants should be used, for
  5414. example the text size is not known when evaluating the expression, so
  5415. the constants @var{text_w} and @var{text_h} will have an undefined
  5416. value.
  5417. @item expr_int_format, eif
  5418. Evaluate the expression's value and output as formatted integer.
  5419. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5420. The second argument specifies the output format. Allowed values are @samp{x},
  5421. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5422. @code{printf} function.
  5423. The third parameter is optional and sets the number of positions taken by the output.
  5424. It can be used to add padding with zeros from the left.
  5425. @item gmtime
  5426. The time at which the filter is running, expressed in UTC.
  5427. It can accept an argument: a strftime() format string.
  5428. @item localtime
  5429. The time at which the filter is running, expressed in the local time zone.
  5430. It can accept an argument: a strftime() format string.
  5431. @item metadata
  5432. Frame metadata. Takes one or two arguments.
  5433. The first argument is mandatory and specifies the metadata key.
  5434. The second argument is optional and specifies a default value, used when the
  5435. metadata key is not found or empty.
  5436. @item n, frame_num
  5437. The frame number, starting from 0.
  5438. @item pict_type
  5439. A 1 character description of the current picture type.
  5440. @item pts
  5441. The timestamp of the current frame.
  5442. It can take up to three arguments.
  5443. The first argument is the format of the timestamp; it defaults to @code{flt}
  5444. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5445. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5446. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5447. @code{localtime} stands for the timestamp of the frame formatted as
  5448. local time zone time.
  5449. The second argument is an offset added to the timestamp.
  5450. If the format is set to @code{localtime} or @code{gmtime},
  5451. a third argument may be supplied: a strftime() format string.
  5452. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5453. @end table
  5454. @subsection Examples
  5455. @itemize
  5456. @item
  5457. Draw "Test Text" with font FreeSerif, using the default values for the
  5458. optional parameters.
  5459. @example
  5460. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5461. @end example
  5462. @item
  5463. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5464. and y=50 (counting from the top-left corner of the screen), text is
  5465. yellow with a red box around it. Both the text and the box have an
  5466. opacity of 20%.
  5467. @example
  5468. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5469. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5470. @end example
  5471. Note that the double quotes are not necessary if spaces are not used
  5472. within the parameter list.
  5473. @item
  5474. Show the text at the center of the video frame:
  5475. @example
  5476. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5477. @end example
  5478. @item
  5479. Show the text at a random position, switching to a new position every 30 seconds:
  5480. @example
  5481. 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)"
  5482. @end example
  5483. @item
  5484. Show a text line sliding from right to left in the last row of the video
  5485. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5486. with no newlines.
  5487. @example
  5488. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5489. @end example
  5490. @item
  5491. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5492. @example
  5493. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5494. @end example
  5495. @item
  5496. Draw a single green letter "g", at the center of the input video.
  5497. The glyph baseline is placed at half screen height.
  5498. @example
  5499. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5500. @end example
  5501. @item
  5502. Show text for 1 second every 3 seconds:
  5503. @example
  5504. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5505. @end example
  5506. @item
  5507. Use fontconfig to set the font. Note that the colons need to be escaped.
  5508. @example
  5509. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5510. @end example
  5511. @item
  5512. Print the date of a real-time encoding (see strftime(3)):
  5513. @example
  5514. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5515. @end example
  5516. @item
  5517. Show text fading in and out (appearing/disappearing):
  5518. @example
  5519. #!/bin/sh
  5520. DS=1.0 # display start
  5521. DE=10.0 # display end
  5522. FID=1.5 # fade in duration
  5523. FOD=5 # fade out duration
  5524. 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 @}"
  5525. @end example
  5526. @item
  5527. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5528. and the @option{fontsize} value are included in the @option{y} offset.
  5529. @example
  5530. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5531. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5532. @end example
  5533. @end itemize
  5534. For more information about libfreetype, check:
  5535. @url{http://www.freetype.org/}.
  5536. For more information about fontconfig, check:
  5537. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5538. For more information about libfribidi, check:
  5539. @url{http://fribidi.org/}.
  5540. @section edgedetect
  5541. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5542. The filter accepts the following options:
  5543. @table @option
  5544. @item low
  5545. @item high
  5546. Set low and high threshold values used by the Canny thresholding
  5547. algorithm.
  5548. The high threshold selects the "strong" edge pixels, which are then
  5549. connected through 8-connectivity with the "weak" edge pixels selected
  5550. by the low threshold.
  5551. @var{low} and @var{high} threshold values must be chosen in the range
  5552. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5553. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5554. is @code{50/255}.
  5555. @item mode
  5556. Define the drawing mode.
  5557. @table @samp
  5558. @item wires
  5559. Draw white/gray wires on black background.
  5560. @item colormix
  5561. Mix the colors to create a paint/cartoon effect.
  5562. @end table
  5563. Default value is @var{wires}.
  5564. @end table
  5565. @subsection Examples
  5566. @itemize
  5567. @item
  5568. Standard edge detection with custom values for the hysteresis thresholding:
  5569. @example
  5570. edgedetect=low=0.1:high=0.4
  5571. @end example
  5572. @item
  5573. Painting effect without thresholding:
  5574. @example
  5575. edgedetect=mode=colormix:high=0
  5576. @end example
  5577. @end itemize
  5578. @section eq
  5579. Set brightness, contrast, saturation and approximate gamma adjustment.
  5580. The filter accepts the following options:
  5581. @table @option
  5582. @item contrast
  5583. Set the contrast expression. The value must be a float value in range
  5584. @code{-2.0} to @code{2.0}. The default value is "1".
  5585. @item brightness
  5586. Set the brightness expression. The value must be a float value in
  5587. range @code{-1.0} to @code{1.0}. The default value is "0".
  5588. @item saturation
  5589. Set the saturation expression. The value must be a float in
  5590. range @code{0.0} to @code{3.0}. The default value is "1".
  5591. @item gamma
  5592. Set the gamma expression. The value must be a float in range
  5593. @code{0.1} to @code{10.0}. The default value is "1".
  5594. @item gamma_r
  5595. Set the gamma expression for red. The value must be a float in
  5596. range @code{0.1} to @code{10.0}. The default value is "1".
  5597. @item gamma_g
  5598. Set the gamma expression for green. The value must be a float in range
  5599. @code{0.1} to @code{10.0}. The default value is "1".
  5600. @item gamma_b
  5601. Set the gamma expression for blue. The value must be a float in range
  5602. @code{0.1} to @code{10.0}. The default value is "1".
  5603. @item gamma_weight
  5604. Set the gamma weight expression. It can be used to reduce the effect
  5605. of a high gamma value on bright image areas, e.g. keep them from
  5606. getting overamplified and just plain white. The value must be a float
  5607. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5608. gamma correction all the way down while @code{1.0} leaves it at its
  5609. full strength. Default is "1".
  5610. @item eval
  5611. Set when the expressions for brightness, contrast, saturation and
  5612. gamma expressions are evaluated.
  5613. It accepts the following values:
  5614. @table @samp
  5615. @item init
  5616. only evaluate expressions once during the filter initialization or
  5617. when a command is processed
  5618. @item frame
  5619. evaluate expressions for each incoming frame
  5620. @end table
  5621. Default value is @samp{init}.
  5622. @end table
  5623. The expressions accept the following parameters:
  5624. @table @option
  5625. @item n
  5626. frame count of the input frame starting from 0
  5627. @item pos
  5628. byte position of the corresponding packet in the input file, NAN if
  5629. unspecified
  5630. @item r
  5631. frame rate of the input video, NAN if the input frame rate is unknown
  5632. @item t
  5633. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5634. @end table
  5635. @subsection Commands
  5636. The filter supports the following commands:
  5637. @table @option
  5638. @item contrast
  5639. Set the contrast expression.
  5640. @item brightness
  5641. Set the brightness expression.
  5642. @item saturation
  5643. Set the saturation expression.
  5644. @item gamma
  5645. Set the gamma expression.
  5646. @item gamma_r
  5647. Set the gamma_r expression.
  5648. @item gamma_g
  5649. Set gamma_g expression.
  5650. @item gamma_b
  5651. Set gamma_b expression.
  5652. @item gamma_weight
  5653. Set gamma_weight expression.
  5654. The command accepts the same syntax of the corresponding option.
  5655. If the specified expression is not valid, it is kept at its current
  5656. value.
  5657. @end table
  5658. @section erosion
  5659. Apply erosion effect to the video.
  5660. This filter replaces the pixel by the local(3x3) minimum.
  5661. It accepts the following options:
  5662. @table @option
  5663. @item threshold0
  5664. @item threshold1
  5665. @item threshold2
  5666. @item threshold3
  5667. Limit the maximum change for each plane, default is 65535.
  5668. If 0, plane will remain unchanged.
  5669. @item coordinates
  5670. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5671. pixels are used.
  5672. Flags to local 3x3 coordinates maps like this:
  5673. 1 2 3
  5674. 4 5
  5675. 6 7 8
  5676. @end table
  5677. @section extractplanes
  5678. Extract color channel components from input video stream into
  5679. separate grayscale video streams.
  5680. The filter accepts the following option:
  5681. @table @option
  5682. @item planes
  5683. Set plane(s) to extract.
  5684. Available values for planes are:
  5685. @table @samp
  5686. @item y
  5687. @item u
  5688. @item v
  5689. @item a
  5690. @item r
  5691. @item g
  5692. @item b
  5693. @end table
  5694. Choosing planes not available in the input will result in an error.
  5695. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5696. with @code{y}, @code{u}, @code{v} planes at same time.
  5697. @end table
  5698. @subsection Examples
  5699. @itemize
  5700. @item
  5701. Extract luma, u and v color channel component from input video frame
  5702. into 3 grayscale outputs:
  5703. @example
  5704. 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
  5705. @end example
  5706. @end itemize
  5707. @section elbg
  5708. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5709. For each input image, the filter will compute the optimal mapping from
  5710. the input to the output given the codebook length, that is the number
  5711. of distinct output colors.
  5712. This filter accepts the following options.
  5713. @table @option
  5714. @item codebook_length, l
  5715. Set codebook length. The value must be a positive integer, and
  5716. represents the number of distinct output colors. Default value is 256.
  5717. @item nb_steps, n
  5718. Set the maximum number of iterations to apply for computing the optimal
  5719. mapping. The higher the value the better the result and the higher the
  5720. computation time. Default value is 1.
  5721. @item seed, s
  5722. Set a random seed, must be an integer included between 0 and
  5723. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5724. will try to use a good random seed on a best effort basis.
  5725. @item pal8
  5726. Set pal8 output pixel format. This option does not work with codebook
  5727. length greater than 256.
  5728. @end table
  5729. @section fade
  5730. Apply a fade-in/out effect to the input video.
  5731. It accepts the following parameters:
  5732. @table @option
  5733. @item type, t
  5734. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5735. effect.
  5736. Default is @code{in}.
  5737. @item start_frame, s
  5738. Specify the number of the frame to start applying the fade
  5739. effect at. Default is 0.
  5740. @item nb_frames, n
  5741. The number of frames that the fade effect lasts. At the end of the
  5742. fade-in effect, the output video will have the same intensity as the input video.
  5743. At the end of the fade-out transition, the output video will be filled with the
  5744. selected @option{color}.
  5745. Default is 25.
  5746. @item alpha
  5747. If set to 1, fade only alpha channel, if one exists on the input.
  5748. Default value is 0.
  5749. @item start_time, st
  5750. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5751. effect. If both start_frame and start_time are specified, the fade will start at
  5752. whichever comes last. Default is 0.
  5753. @item duration, d
  5754. The number of seconds for which the fade effect has to last. At the end of the
  5755. fade-in effect the output video will have the same intensity as the input video,
  5756. at the end of the fade-out transition the output video will be filled with the
  5757. selected @option{color}.
  5758. If both duration and nb_frames are specified, duration is used. Default is 0
  5759. (nb_frames is used by default).
  5760. @item color, c
  5761. Specify the color of the fade. Default is "black".
  5762. @end table
  5763. @subsection Examples
  5764. @itemize
  5765. @item
  5766. Fade in the first 30 frames of video:
  5767. @example
  5768. fade=in:0:30
  5769. @end example
  5770. The command above is equivalent to:
  5771. @example
  5772. fade=t=in:s=0:n=30
  5773. @end example
  5774. @item
  5775. Fade out the last 45 frames of a 200-frame video:
  5776. @example
  5777. fade=out:155:45
  5778. fade=type=out:start_frame=155:nb_frames=45
  5779. @end example
  5780. @item
  5781. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5782. @example
  5783. fade=in:0:25, fade=out:975:25
  5784. @end example
  5785. @item
  5786. Make the first 5 frames yellow, then fade in from frame 5-24:
  5787. @example
  5788. fade=in:5:20:color=yellow
  5789. @end example
  5790. @item
  5791. Fade in alpha over first 25 frames of video:
  5792. @example
  5793. fade=in:0:25:alpha=1
  5794. @end example
  5795. @item
  5796. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5797. @example
  5798. fade=t=in:st=5.5:d=0.5
  5799. @end example
  5800. @end itemize
  5801. @section fftfilt
  5802. Apply arbitrary expressions to samples in frequency domain
  5803. @table @option
  5804. @item dc_Y
  5805. Adjust the dc value (gain) of the luma plane of the image. The filter
  5806. accepts an integer value in range @code{0} to @code{1000}. The default
  5807. value is set to @code{0}.
  5808. @item dc_U
  5809. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5810. filter accepts an integer value in range @code{0} to @code{1000}. The
  5811. default value is set to @code{0}.
  5812. @item dc_V
  5813. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5814. filter accepts an integer value in range @code{0} to @code{1000}. The
  5815. default value is set to @code{0}.
  5816. @item weight_Y
  5817. Set the frequency domain weight expression for the luma plane.
  5818. @item weight_U
  5819. Set the frequency domain weight expression for the 1st chroma plane.
  5820. @item weight_V
  5821. Set the frequency domain weight expression for the 2nd chroma plane.
  5822. The filter accepts the following variables:
  5823. @item X
  5824. @item Y
  5825. The coordinates of the current sample.
  5826. @item W
  5827. @item H
  5828. The width and height of the image.
  5829. @end table
  5830. @subsection Examples
  5831. @itemize
  5832. @item
  5833. High-pass:
  5834. @example
  5835. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5836. @end example
  5837. @item
  5838. Low-pass:
  5839. @example
  5840. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5841. @end example
  5842. @item
  5843. Sharpen:
  5844. @example
  5845. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5846. @end example
  5847. @item
  5848. Blur:
  5849. @example
  5850. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5851. @end example
  5852. @end itemize
  5853. @section field
  5854. Extract a single field from an interlaced image using stride
  5855. arithmetic to avoid wasting CPU time. The output frames are marked as
  5856. non-interlaced.
  5857. The filter accepts the following options:
  5858. @table @option
  5859. @item type
  5860. Specify whether to extract the top (if the value is @code{0} or
  5861. @code{top}) or the bottom field (if the value is @code{1} or
  5862. @code{bottom}).
  5863. @end table
  5864. @section fieldhint
  5865. Create new frames by copying the top and bottom fields from surrounding frames
  5866. supplied as numbers by the hint file.
  5867. @table @option
  5868. @item hint
  5869. Set file containing hints: absolute/relative frame numbers.
  5870. There must be one line for each frame in a clip. Each line must contain two
  5871. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5872. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5873. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5874. for @code{relative} mode. First number tells from which frame to pick up top
  5875. field and second number tells from which frame to pick up bottom field.
  5876. If optionally followed by @code{+} output frame will be marked as interlaced,
  5877. else if followed by @code{-} output frame will be marked as progressive, else
  5878. it will be marked same as input frame.
  5879. If line starts with @code{#} or @code{;} that line is skipped.
  5880. @item mode
  5881. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5882. @end table
  5883. Example of first several lines of @code{hint} file for @code{relative} mode:
  5884. @example
  5885. 0,0 - # first frame
  5886. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5887. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5888. 1,0 -
  5889. 0,0 -
  5890. 0,0 -
  5891. 1,0 -
  5892. 1,0 -
  5893. 1,0 -
  5894. 0,0 -
  5895. 0,0 -
  5896. 1,0 -
  5897. 1,0 -
  5898. 1,0 -
  5899. 0,0 -
  5900. @end example
  5901. @section fieldmatch
  5902. Field matching filter for inverse telecine. It is meant to reconstruct the
  5903. progressive frames from a telecined stream. The filter does not drop duplicated
  5904. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5905. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5906. The separation of the field matching and the decimation is notably motivated by
  5907. the possibility of inserting a de-interlacing filter fallback between the two.
  5908. If the source has mixed telecined and real interlaced content,
  5909. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5910. But these remaining combed frames will be marked as interlaced, and thus can be
  5911. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5912. In addition to the various configuration options, @code{fieldmatch} can take an
  5913. optional second stream, activated through the @option{ppsrc} option. If
  5914. enabled, the frames reconstruction will be based on the fields and frames from
  5915. this second stream. This allows the first input to be pre-processed in order to
  5916. help the various algorithms of the filter, while keeping the output lossless
  5917. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5918. or brightness/contrast adjustments can help.
  5919. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5920. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5921. which @code{fieldmatch} is based on. While the semantic and usage are very
  5922. close, some behaviour and options names can differ.
  5923. The @ref{decimate} filter currently only works for constant frame rate input.
  5924. If your input has mixed telecined (30fps) and progressive content with a lower
  5925. framerate like 24fps use the following filterchain to produce the necessary cfr
  5926. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5927. The filter accepts the following options:
  5928. @table @option
  5929. @item order
  5930. Specify the assumed field order of the input stream. Available values are:
  5931. @table @samp
  5932. @item auto
  5933. Auto detect parity (use FFmpeg's internal parity value).
  5934. @item bff
  5935. Assume bottom field first.
  5936. @item tff
  5937. Assume top field first.
  5938. @end table
  5939. Note that it is sometimes recommended not to trust the parity announced by the
  5940. stream.
  5941. Default value is @var{auto}.
  5942. @item mode
  5943. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5944. sense that it won't risk creating jerkiness due to duplicate frames when
  5945. possible, but if there are bad edits or blended fields it will end up
  5946. outputting combed frames when a good match might actually exist. On the other
  5947. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5948. but will almost always find a good frame if there is one. The other values are
  5949. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5950. jerkiness and creating duplicate frames versus finding good matches in sections
  5951. with bad edits, orphaned fields, blended fields, etc.
  5952. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5953. Available values are:
  5954. @table @samp
  5955. @item pc
  5956. 2-way matching (p/c)
  5957. @item pc_n
  5958. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5959. @item pc_u
  5960. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5961. @item pc_n_ub
  5962. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5963. still combed (p/c + n + u/b)
  5964. @item pcn
  5965. 3-way matching (p/c/n)
  5966. @item pcn_ub
  5967. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5968. detected as combed (p/c/n + u/b)
  5969. @end table
  5970. The parenthesis at the end indicate the matches that would be used for that
  5971. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5972. @var{top}).
  5973. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5974. the slowest.
  5975. Default value is @var{pc_n}.
  5976. @item ppsrc
  5977. Mark the main input stream as a pre-processed input, and enable the secondary
  5978. input stream as the clean source to pick the fields from. See the filter
  5979. introduction for more details. It is similar to the @option{clip2} feature from
  5980. VFM/TFM.
  5981. Default value is @code{0} (disabled).
  5982. @item field
  5983. Set the field to match from. It is recommended to set this to the same value as
  5984. @option{order} unless you experience matching failures with that setting. In
  5985. certain circumstances changing the field that is used to match from can have a
  5986. large impact on matching performance. Available values are:
  5987. @table @samp
  5988. @item auto
  5989. Automatic (same value as @option{order}).
  5990. @item bottom
  5991. Match from the bottom field.
  5992. @item top
  5993. Match from the top field.
  5994. @end table
  5995. Default value is @var{auto}.
  5996. @item mchroma
  5997. Set whether or not chroma is included during the match comparisons. In most
  5998. cases it is recommended to leave this enabled. You should set this to @code{0}
  5999. only if your clip has bad chroma problems such as heavy rainbowing or other
  6000. artifacts. Setting this to @code{0} could also be used to speed things up at
  6001. the cost of some accuracy.
  6002. Default value is @code{1}.
  6003. @item y0
  6004. @item y1
  6005. These define an exclusion band which excludes the lines between @option{y0} and
  6006. @option{y1} from being included in the field matching decision. An exclusion
  6007. band can be used to ignore subtitles, a logo, or other things that may
  6008. interfere with the matching. @option{y0} sets the starting scan line and
  6009. @option{y1} sets the ending line; all lines in between @option{y0} and
  6010. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6011. @option{y0} and @option{y1} to the same value will disable the feature.
  6012. @option{y0} and @option{y1} defaults to @code{0}.
  6013. @item scthresh
  6014. Set the scene change detection threshold as a percentage of maximum change on
  6015. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6016. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6017. @option{scthresh} is @code{[0.0, 100.0]}.
  6018. Default value is @code{12.0}.
  6019. @item combmatch
  6020. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6021. account the combed scores of matches when deciding what match to use as the
  6022. final match. Available values are:
  6023. @table @samp
  6024. @item none
  6025. No final matching based on combed scores.
  6026. @item sc
  6027. Combed scores are only used when a scene change is detected.
  6028. @item full
  6029. Use combed scores all the time.
  6030. @end table
  6031. Default is @var{sc}.
  6032. @item combdbg
  6033. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6034. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6035. Available values are:
  6036. @table @samp
  6037. @item none
  6038. No forced calculation.
  6039. @item pcn
  6040. Force p/c/n calculations.
  6041. @item pcnub
  6042. Force p/c/n/u/b calculations.
  6043. @end table
  6044. Default value is @var{none}.
  6045. @item cthresh
  6046. This is the area combing threshold used for combed frame detection. This
  6047. essentially controls how "strong" or "visible" combing must be to be detected.
  6048. Larger values mean combing must be more visible and smaller values mean combing
  6049. can be less visible or strong and still be detected. Valid settings are from
  6050. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6051. be detected as combed). This is basically a pixel difference value. A good
  6052. range is @code{[8, 12]}.
  6053. Default value is @code{9}.
  6054. @item chroma
  6055. Sets whether or not chroma is considered in the combed frame decision. Only
  6056. disable this if your source has chroma problems (rainbowing, etc.) that are
  6057. causing problems for the combed frame detection with chroma enabled. Actually,
  6058. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6059. where there is chroma only combing in the source.
  6060. Default value is @code{0}.
  6061. @item blockx
  6062. @item blocky
  6063. Respectively set the x-axis and y-axis size of the window used during combed
  6064. frame detection. This has to do with the size of the area in which
  6065. @option{combpel} pixels are required to be detected as combed for a frame to be
  6066. declared combed. See the @option{combpel} parameter description for more info.
  6067. Possible values are any number that is a power of 2 starting at 4 and going up
  6068. to 512.
  6069. Default value is @code{16}.
  6070. @item combpel
  6071. The number of combed pixels inside any of the @option{blocky} by
  6072. @option{blockx} size blocks on the frame for the frame to be detected as
  6073. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6074. setting controls "how much" combing there must be in any localized area (a
  6075. window defined by the @option{blockx} and @option{blocky} settings) on the
  6076. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6077. which point no frames will ever be detected as combed). This setting is known
  6078. as @option{MI} in TFM/VFM vocabulary.
  6079. Default value is @code{80}.
  6080. @end table
  6081. @anchor{p/c/n/u/b meaning}
  6082. @subsection p/c/n/u/b meaning
  6083. @subsubsection p/c/n
  6084. We assume the following telecined stream:
  6085. @example
  6086. Top fields: 1 2 2 3 4
  6087. Bottom fields: 1 2 3 4 4
  6088. @end example
  6089. The numbers correspond to the progressive frame the fields relate to. Here, the
  6090. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6091. When @code{fieldmatch} is configured to run a matching from bottom
  6092. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6093. @example
  6094. Input stream:
  6095. T 1 2 2 3 4
  6096. B 1 2 3 4 4 <-- matching reference
  6097. Matches: c c n n c
  6098. Output stream:
  6099. T 1 2 3 4 4
  6100. B 1 2 3 4 4
  6101. @end example
  6102. As a result of the field matching, we can see that some frames get duplicated.
  6103. To perform a complete inverse telecine, you need to rely on a decimation filter
  6104. after this operation. See for instance the @ref{decimate} filter.
  6105. The same operation now matching from top fields (@option{field}=@var{top})
  6106. looks like this:
  6107. @example
  6108. Input stream:
  6109. T 1 2 2 3 4 <-- matching reference
  6110. B 1 2 3 4 4
  6111. Matches: c c p p c
  6112. Output stream:
  6113. T 1 2 2 3 4
  6114. B 1 2 2 3 4
  6115. @end example
  6116. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6117. basically, they refer to the frame and field of the opposite parity:
  6118. @itemize
  6119. @item @var{p} matches the field of the opposite parity in the previous frame
  6120. @item @var{c} matches the field of the opposite parity in the current frame
  6121. @item @var{n} matches the field of the opposite parity in the next frame
  6122. @end itemize
  6123. @subsubsection u/b
  6124. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6125. from the opposite parity flag. In the following examples, we assume that we are
  6126. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6127. 'x' is placed above and below each matched fields.
  6128. With bottom matching (@option{field}=@var{bottom}):
  6129. @example
  6130. Match: c p n b u
  6131. x x x x x
  6132. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6133. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6134. x x x x x
  6135. Output frames:
  6136. 2 1 2 2 2
  6137. 2 2 2 1 3
  6138. @end example
  6139. With top matching (@option{field}=@var{top}):
  6140. @example
  6141. Match: c p n b u
  6142. x x x x x
  6143. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6144. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6145. x x x x x
  6146. Output frames:
  6147. 2 2 2 1 2
  6148. 2 1 3 2 2
  6149. @end example
  6150. @subsection Examples
  6151. Simple IVTC of a top field first telecined stream:
  6152. @example
  6153. fieldmatch=order=tff:combmatch=none, decimate
  6154. @end example
  6155. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6156. @example
  6157. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6158. @end example
  6159. @section fieldorder
  6160. Transform the field order of the input video.
  6161. It accepts the following parameters:
  6162. @table @option
  6163. @item order
  6164. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6165. for bottom field first.
  6166. @end table
  6167. The default value is @samp{tff}.
  6168. The transformation is done by shifting the picture content up or down
  6169. by one line, and filling the remaining line with appropriate picture content.
  6170. This method is consistent with most broadcast field order converters.
  6171. If the input video is not flagged as being interlaced, or it is already
  6172. flagged as being of the required output field order, then this filter does
  6173. not alter the incoming video.
  6174. It is very useful when converting to or from PAL DV material,
  6175. which is bottom field first.
  6176. For example:
  6177. @example
  6178. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6179. @end example
  6180. @section fifo, afifo
  6181. Buffer input images and send them when they are requested.
  6182. It is mainly useful when auto-inserted by the libavfilter
  6183. framework.
  6184. It does not take parameters.
  6185. @section find_rect
  6186. Find a rectangular object
  6187. It accepts the following options:
  6188. @table @option
  6189. @item object
  6190. Filepath of the object image, needs to be in gray8.
  6191. @item threshold
  6192. Detection threshold, default is 0.5.
  6193. @item mipmaps
  6194. Number of mipmaps, default is 3.
  6195. @item xmin, ymin, xmax, ymax
  6196. Specifies the rectangle in which to search.
  6197. @end table
  6198. @subsection Examples
  6199. @itemize
  6200. @item
  6201. Generate a representative palette of a given video using @command{ffmpeg}:
  6202. @example
  6203. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6204. @end example
  6205. @end itemize
  6206. @section cover_rect
  6207. Cover a rectangular object
  6208. It accepts the following options:
  6209. @table @option
  6210. @item cover
  6211. Filepath of the optional cover image, needs to be in yuv420.
  6212. @item mode
  6213. Set covering mode.
  6214. It accepts the following values:
  6215. @table @samp
  6216. @item cover
  6217. cover it by the supplied image
  6218. @item blur
  6219. cover it by interpolating the surrounding pixels
  6220. @end table
  6221. Default value is @var{blur}.
  6222. @end table
  6223. @subsection Examples
  6224. @itemize
  6225. @item
  6226. Generate a representative palette of a given video using @command{ffmpeg}:
  6227. @example
  6228. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6229. @end example
  6230. @end itemize
  6231. @anchor{format}
  6232. @section format
  6233. Convert the input video to one of the specified pixel formats.
  6234. Libavfilter will try to pick one that is suitable as input to
  6235. the next filter.
  6236. It accepts the following parameters:
  6237. @table @option
  6238. @item pix_fmts
  6239. A '|'-separated list of pixel format names, such as
  6240. "pix_fmts=yuv420p|monow|rgb24".
  6241. @end table
  6242. @subsection Examples
  6243. @itemize
  6244. @item
  6245. Convert the input video to the @var{yuv420p} format
  6246. @example
  6247. format=pix_fmts=yuv420p
  6248. @end example
  6249. Convert the input video to any of the formats in the list
  6250. @example
  6251. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6252. @end example
  6253. @end itemize
  6254. @anchor{fps}
  6255. @section fps
  6256. Convert the video to specified constant frame rate by duplicating or dropping
  6257. frames as necessary.
  6258. It accepts the following parameters:
  6259. @table @option
  6260. @item fps
  6261. The desired output frame rate. The default is @code{25}.
  6262. @item round
  6263. Rounding method.
  6264. Possible values are:
  6265. @table @option
  6266. @item zero
  6267. zero round towards 0
  6268. @item inf
  6269. round away from 0
  6270. @item down
  6271. round towards -infinity
  6272. @item up
  6273. round towards +infinity
  6274. @item near
  6275. round to nearest
  6276. @end table
  6277. The default is @code{near}.
  6278. @item start_time
  6279. Assume the first PTS should be the given value, in seconds. This allows for
  6280. padding/trimming at the start of stream. By default, no assumption is made
  6281. about the first frame's expected PTS, so no padding or trimming is done.
  6282. For example, this could be set to 0 to pad the beginning with duplicates of
  6283. the first frame if a video stream starts after the audio stream or to trim any
  6284. frames with a negative PTS.
  6285. @end table
  6286. Alternatively, the options can be specified as a flat string:
  6287. @var{fps}[:@var{round}].
  6288. See also the @ref{setpts} filter.
  6289. @subsection Examples
  6290. @itemize
  6291. @item
  6292. A typical usage in order to set the fps to 25:
  6293. @example
  6294. fps=fps=25
  6295. @end example
  6296. @item
  6297. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6298. @example
  6299. fps=fps=film:round=near
  6300. @end example
  6301. @end itemize
  6302. @section framepack
  6303. Pack two different video streams into a stereoscopic video, setting proper
  6304. metadata on supported codecs. The two views should have the same size and
  6305. framerate and processing will stop when the shorter video ends. Please note
  6306. that you may conveniently adjust view properties with the @ref{scale} and
  6307. @ref{fps} filters.
  6308. It accepts the following parameters:
  6309. @table @option
  6310. @item format
  6311. The desired packing format. Supported values are:
  6312. @table @option
  6313. @item sbs
  6314. The views are next to each other (default).
  6315. @item tab
  6316. The views are on top of each other.
  6317. @item lines
  6318. The views are packed by line.
  6319. @item columns
  6320. The views are packed by column.
  6321. @item frameseq
  6322. The views are temporally interleaved.
  6323. @end table
  6324. @end table
  6325. Some examples:
  6326. @example
  6327. # Convert left and right views into a frame-sequential video
  6328. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6329. # Convert views into a side-by-side video with the same output resolution as the input
  6330. 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
  6331. @end example
  6332. @section framerate
  6333. Change the frame rate by interpolating new video output frames from the source
  6334. frames.
  6335. This filter is not designed to function correctly with interlaced media. If
  6336. you wish to change the frame rate of interlaced media then you are required
  6337. to deinterlace before this filter and re-interlace after this filter.
  6338. A description of the accepted options follows.
  6339. @table @option
  6340. @item fps
  6341. Specify the output frames per second. This option can also be specified
  6342. as a value alone. The default is @code{50}.
  6343. @item interp_start
  6344. Specify the start of a range where the output frame will be created as a
  6345. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6346. the default is @code{15}.
  6347. @item interp_end
  6348. Specify the end of a range where the output frame will be created as a
  6349. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6350. the default is @code{240}.
  6351. @item scene
  6352. Specify the level at which a scene change is detected as a value between
  6353. 0 and 100 to indicate a new scene; a low value reflects a low
  6354. probability for the current frame to introduce a new scene, while a higher
  6355. value means the current frame is more likely to be one.
  6356. The default is @code{7}.
  6357. @item flags
  6358. Specify flags influencing the filter process.
  6359. Available value for @var{flags} is:
  6360. @table @option
  6361. @item scene_change_detect, scd
  6362. Enable scene change detection using the value of the option @var{scene}.
  6363. This flag is enabled by default.
  6364. @end table
  6365. @end table
  6366. @section framestep
  6367. Select one frame every N-th frame.
  6368. This filter accepts the following option:
  6369. @table @option
  6370. @item step
  6371. Select frame after every @code{step} frames.
  6372. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6373. @end table
  6374. @anchor{frei0r}
  6375. @section frei0r
  6376. Apply a frei0r effect to the input video.
  6377. To enable the compilation of this filter, you need to install the frei0r
  6378. header and configure FFmpeg with @code{--enable-frei0r}.
  6379. It accepts the following parameters:
  6380. @table @option
  6381. @item filter_name
  6382. The name of the frei0r effect to load. If the environment variable
  6383. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6384. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6385. Otherwise, the standard frei0r paths are searched, in this order:
  6386. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6387. @file{/usr/lib/frei0r-1/}.
  6388. @item filter_params
  6389. A '|'-separated list of parameters to pass to the frei0r effect.
  6390. @end table
  6391. A frei0r effect parameter can be a boolean (its value is either
  6392. "y" or "n"), a double, a color (specified as
  6393. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6394. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6395. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6396. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6397. The number and types of parameters depend on the loaded effect. If an
  6398. effect parameter is not specified, the default value is set.
  6399. @subsection Examples
  6400. @itemize
  6401. @item
  6402. Apply the distort0r effect, setting the first two double parameters:
  6403. @example
  6404. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6405. @end example
  6406. @item
  6407. Apply the colordistance effect, taking a color as the first parameter:
  6408. @example
  6409. frei0r=colordistance:0.2/0.3/0.4
  6410. frei0r=colordistance:violet
  6411. frei0r=colordistance:0x112233
  6412. @end example
  6413. @item
  6414. Apply the perspective effect, specifying the top left and top right image
  6415. positions:
  6416. @example
  6417. frei0r=perspective:0.2/0.2|0.8/0.2
  6418. @end example
  6419. @end itemize
  6420. For more information, see
  6421. @url{http://frei0r.dyne.org}
  6422. @section fspp
  6423. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6424. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6425. processing filter, one of them is performed once per block, not per pixel.
  6426. This allows for much higher speed.
  6427. The filter accepts the following options:
  6428. @table @option
  6429. @item quality
  6430. Set quality. This option defines the number of levels for averaging. It accepts
  6431. an integer in the range 4-5. Default value is @code{4}.
  6432. @item qp
  6433. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6434. If not set, the filter will use the QP from the video stream (if available).
  6435. @item strength
  6436. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6437. more details but also more artifacts, while higher values make the image smoother
  6438. but also blurrier. Default value is @code{0} − PSNR optimal.
  6439. @item use_bframe_qp
  6440. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6441. option may cause flicker since the B-Frames have often larger QP. Default is
  6442. @code{0} (not enabled).
  6443. @end table
  6444. @section gblur
  6445. Apply Gaussian blur filter.
  6446. The filter accepts the following options:
  6447. @table @option
  6448. @item sigma
  6449. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6450. @item steps
  6451. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6452. @item planes
  6453. Set which planes to filter. By default all planes are filtered.
  6454. @item sigmaV
  6455. Set vertical sigma, if negative it will be same as @code{sigma}.
  6456. Default is @code{-1}.
  6457. @end table
  6458. @section geq
  6459. The filter accepts the following options:
  6460. @table @option
  6461. @item lum_expr, lum
  6462. Set the luminance expression.
  6463. @item cb_expr, cb
  6464. Set the chrominance blue expression.
  6465. @item cr_expr, cr
  6466. Set the chrominance red expression.
  6467. @item alpha_expr, a
  6468. Set the alpha expression.
  6469. @item red_expr, r
  6470. Set the red expression.
  6471. @item green_expr, g
  6472. Set the green expression.
  6473. @item blue_expr, b
  6474. Set the blue expression.
  6475. @end table
  6476. The colorspace is selected according to the specified options. If one
  6477. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6478. options is specified, the filter will automatically select a YCbCr
  6479. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6480. @option{blue_expr} options is specified, it will select an RGB
  6481. colorspace.
  6482. If one of the chrominance expression is not defined, it falls back on the other
  6483. one. If no alpha expression is specified it will evaluate to opaque value.
  6484. If none of chrominance expressions are specified, they will evaluate
  6485. to the luminance expression.
  6486. The expressions can use the following variables and functions:
  6487. @table @option
  6488. @item N
  6489. The sequential number of the filtered frame, starting from @code{0}.
  6490. @item X
  6491. @item Y
  6492. The coordinates of the current sample.
  6493. @item W
  6494. @item H
  6495. The width and height of the image.
  6496. @item SW
  6497. @item SH
  6498. Width and height scale depending on the currently filtered plane. It is the
  6499. ratio between the corresponding luma plane number of pixels and the current
  6500. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6501. @code{0.5,0.5} for chroma planes.
  6502. @item T
  6503. Time of the current frame, expressed in seconds.
  6504. @item p(x, y)
  6505. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6506. plane.
  6507. @item lum(x, y)
  6508. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6509. plane.
  6510. @item cb(x, y)
  6511. Return the value of the pixel at location (@var{x},@var{y}) of the
  6512. blue-difference chroma plane. Return 0 if there is no such plane.
  6513. @item cr(x, y)
  6514. Return the value of the pixel at location (@var{x},@var{y}) of the
  6515. red-difference chroma plane. Return 0 if there is no such plane.
  6516. @item r(x, y)
  6517. @item g(x, y)
  6518. @item b(x, y)
  6519. Return the value of the pixel at location (@var{x},@var{y}) of the
  6520. red/green/blue component. Return 0 if there is no such component.
  6521. @item alpha(x, y)
  6522. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6523. plane. Return 0 if there is no such plane.
  6524. @end table
  6525. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6526. automatically clipped to the closer edge.
  6527. @subsection Examples
  6528. @itemize
  6529. @item
  6530. Flip the image horizontally:
  6531. @example
  6532. geq=p(W-X\,Y)
  6533. @end example
  6534. @item
  6535. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6536. wavelength of 100 pixels:
  6537. @example
  6538. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6539. @end example
  6540. @item
  6541. Generate a fancy enigmatic moving light:
  6542. @example
  6543. 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
  6544. @end example
  6545. @item
  6546. Generate a quick emboss effect:
  6547. @example
  6548. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6549. @end example
  6550. @item
  6551. Modify RGB components depending on pixel position:
  6552. @example
  6553. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6554. @end example
  6555. @item
  6556. Create a radial gradient that is the same size as the input (also see
  6557. the @ref{vignette} filter):
  6558. @example
  6559. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6560. @end example
  6561. @end itemize
  6562. @section gradfun
  6563. Fix the banding artifacts that are sometimes introduced into nearly flat
  6564. regions by truncation to 8-bit color depth.
  6565. Interpolate the gradients that should go where the bands are, and
  6566. dither them.
  6567. It is designed for playback only. Do not use it prior to
  6568. lossy compression, because compression tends to lose the dither and
  6569. bring back the bands.
  6570. It accepts the following parameters:
  6571. @table @option
  6572. @item strength
  6573. The maximum amount by which the filter will change any one pixel. This is also
  6574. the threshold for detecting nearly flat regions. Acceptable values range from
  6575. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6576. valid range.
  6577. @item radius
  6578. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6579. gradients, but also prevents the filter from modifying the pixels near detailed
  6580. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6581. values will be clipped to the valid range.
  6582. @end table
  6583. Alternatively, the options can be specified as a flat string:
  6584. @var{strength}[:@var{radius}]
  6585. @subsection Examples
  6586. @itemize
  6587. @item
  6588. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6589. @example
  6590. gradfun=3.5:8
  6591. @end example
  6592. @item
  6593. Specify radius, omitting the strength (which will fall-back to the default
  6594. value):
  6595. @example
  6596. gradfun=radius=8
  6597. @end example
  6598. @end itemize
  6599. @anchor{haldclut}
  6600. @section haldclut
  6601. Apply a Hald CLUT to a video stream.
  6602. First input is the video stream to process, and second one is the Hald CLUT.
  6603. The Hald CLUT input can be a simple picture or a complete video stream.
  6604. The filter accepts the following options:
  6605. @table @option
  6606. @item shortest
  6607. Force termination when the shortest input terminates. Default is @code{0}.
  6608. @item repeatlast
  6609. Continue applying the last CLUT after the end of the stream. A value of
  6610. @code{0} disable the filter after the last frame of the CLUT is reached.
  6611. Default is @code{1}.
  6612. @end table
  6613. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6614. filters share the same internals).
  6615. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6616. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6617. @subsection Workflow examples
  6618. @subsubsection Hald CLUT video stream
  6619. Generate an identity Hald CLUT stream altered with various effects:
  6620. @example
  6621. 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
  6622. @end example
  6623. Note: make sure you use a lossless codec.
  6624. Then use it with @code{haldclut} to apply it on some random stream:
  6625. @example
  6626. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6627. @end example
  6628. The Hald CLUT will be applied to the 10 first seconds (duration of
  6629. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6630. to the remaining frames of the @code{mandelbrot} stream.
  6631. @subsubsection Hald CLUT with preview
  6632. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6633. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6634. biggest possible square starting at the top left of the picture. The remaining
  6635. padding pixels (bottom or right) will be ignored. This area can be used to add
  6636. a preview of the Hald CLUT.
  6637. Typically, the following generated Hald CLUT will be supported by the
  6638. @code{haldclut} filter:
  6639. @example
  6640. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6641. pad=iw+320 [padded_clut];
  6642. smptebars=s=320x256, split [a][b];
  6643. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6644. [main][b] overlay=W-320" -frames:v 1 clut.png
  6645. @end example
  6646. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6647. bars are displayed on the right-top, and below the same color bars processed by
  6648. the color changes.
  6649. Then, the effect of this Hald CLUT can be visualized with:
  6650. @example
  6651. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6652. @end example
  6653. @section hflip
  6654. Flip the input video horizontally.
  6655. For example, to horizontally flip the input video with @command{ffmpeg}:
  6656. @example
  6657. ffmpeg -i in.avi -vf "hflip" out.avi
  6658. @end example
  6659. @section histeq
  6660. This filter applies a global color histogram equalization on a
  6661. per-frame basis.
  6662. It can be used to correct video that has a compressed range of pixel
  6663. intensities. The filter redistributes the pixel intensities to
  6664. equalize their distribution across the intensity range. It may be
  6665. viewed as an "automatically adjusting contrast filter". This filter is
  6666. useful only for correcting degraded or poorly captured source
  6667. video.
  6668. The filter accepts the following options:
  6669. @table @option
  6670. @item strength
  6671. Determine the amount of equalization to be applied. As the strength
  6672. is reduced, the distribution of pixel intensities more-and-more
  6673. approaches that of the input frame. The value must be a float number
  6674. in the range [0,1] and defaults to 0.200.
  6675. @item intensity
  6676. Set the maximum intensity that can generated and scale the output
  6677. values appropriately. The strength should be set as desired and then
  6678. the intensity can be limited if needed to avoid washing-out. The value
  6679. must be a float number in the range [0,1] and defaults to 0.210.
  6680. @item antibanding
  6681. Set the antibanding level. If enabled the filter will randomly vary
  6682. the luminance of output pixels by a small amount to avoid banding of
  6683. the histogram. Possible values are @code{none}, @code{weak} or
  6684. @code{strong}. It defaults to @code{none}.
  6685. @end table
  6686. @section histogram
  6687. Compute and draw a color distribution histogram for the input video.
  6688. The computed histogram is a representation of the color component
  6689. distribution in an image.
  6690. Standard histogram displays the color components distribution in an image.
  6691. Displays color graph for each color component. Shows distribution of
  6692. the Y, U, V, A or R, G, B components, depending on input format, in the
  6693. current frame. Below each graph a color component scale meter is shown.
  6694. The filter accepts the following options:
  6695. @table @option
  6696. @item level_height
  6697. Set height of level. Default value is @code{200}.
  6698. Allowed range is [50, 2048].
  6699. @item scale_height
  6700. Set height of color scale. Default value is @code{12}.
  6701. Allowed range is [0, 40].
  6702. @item display_mode
  6703. Set display mode.
  6704. It accepts the following values:
  6705. @table @samp
  6706. @item parade
  6707. Per color component graphs are placed below each other.
  6708. @item overlay
  6709. Presents information identical to that in the @code{parade}, except
  6710. that the graphs representing color components are superimposed directly
  6711. over one another.
  6712. @end table
  6713. Default is @code{parade}.
  6714. @item levels_mode
  6715. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6716. Default is @code{linear}.
  6717. @item components
  6718. Set what color components to display.
  6719. Default is @code{7}.
  6720. @item fgopacity
  6721. Set foreground opacity. Default is @code{0.7}.
  6722. @item bgopacity
  6723. Set background opacity. Default is @code{0.5}.
  6724. @end table
  6725. @subsection Examples
  6726. @itemize
  6727. @item
  6728. Calculate and draw histogram:
  6729. @example
  6730. ffplay -i input -vf histogram
  6731. @end example
  6732. @end itemize
  6733. @anchor{hqdn3d}
  6734. @section hqdn3d
  6735. This is a high precision/quality 3d denoise filter. It aims to reduce
  6736. image noise, producing smooth images and making still images really
  6737. still. It should enhance compressibility.
  6738. It accepts the following optional parameters:
  6739. @table @option
  6740. @item luma_spatial
  6741. A non-negative floating point number which specifies spatial luma strength.
  6742. It defaults to 4.0.
  6743. @item chroma_spatial
  6744. A non-negative floating point number which specifies spatial chroma strength.
  6745. It defaults to 3.0*@var{luma_spatial}/4.0.
  6746. @item luma_tmp
  6747. A floating point number which specifies luma temporal strength. It defaults to
  6748. 6.0*@var{luma_spatial}/4.0.
  6749. @item chroma_tmp
  6750. A floating point number which specifies chroma temporal strength. It defaults to
  6751. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6752. @end table
  6753. @anchor{hwupload_cuda}
  6754. @section hwupload_cuda
  6755. Upload system memory frames to a CUDA device.
  6756. It accepts the following optional parameters:
  6757. @table @option
  6758. @item device
  6759. The number of the CUDA device to use
  6760. @end table
  6761. @section hqx
  6762. Apply a high-quality magnification filter designed for pixel art. This filter
  6763. was originally created by Maxim Stepin.
  6764. It accepts the following option:
  6765. @table @option
  6766. @item n
  6767. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6768. @code{hq3x} and @code{4} for @code{hq4x}.
  6769. Default is @code{3}.
  6770. @end table
  6771. @section hstack
  6772. Stack input videos horizontally.
  6773. All streams must be of same pixel format and of same height.
  6774. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6775. to create same output.
  6776. The filter accept the following option:
  6777. @table @option
  6778. @item inputs
  6779. Set number of input streams. Default is 2.
  6780. @item shortest
  6781. If set to 1, force the output to terminate when the shortest input
  6782. terminates. Default value is 0.
  6783. @end table
  6784. @section hue
  6785. Modify the hue and/or the saturation of the input.
  6786. It accepts the following parameters:
  6787. @table @option
  6788. @item h
  6789. Specify the hue angle as a number of degrees. It accepts an expression,
  6790. and defaults to "0".
  6791. @item s
  6792. Specify the saturation in the [-10,10] range. It accepts an expression and
  6793. defaults to "1".
  6794. @item H
  6795. Specify the hue angle as a number of radians. It accepts an
  6796. expression, and defaults to "0".
  6797. @item b
  6798. Specify the brightness in the [-10,10] range. It accepts an expression and
  6799. defaults to "0".
  6800. @end table
  6801. @option{h} and @option{H} are mutually exclusive, and can't be
  6802. specified at the same time.
  6803. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6804. expressions containing the following constants:
  6805. @table @option
  6806. @item n
  6807. frame count of the input frame starting from 0
  6808. @item pts
  6809. presentation timestamp of the input frame expressed in time base units
  6810. @item r
  6811. frame rate of the input video, NAN if the input frame rate is unknown
  6812. @item t
  6813. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6814. @item tb
  6815. time base of the input video
  6816. @end table
  6817. @subsection Examples
  6818. @itemize
  6819. @item
  6820. Set the hue to 90 degrees and the saturation to 1.0:
  6821. @example
  6822. hue=h=90:s=1
  6823. @end example
  6824. @item
  6825. Same command but expressing the hue in radians:
  6826. @example
  6827. hue=H=PI/2:s=1
  6828. @end example
  6829. @item
  6830. Rotate hue and make the saturation swing between 0
  6831. and 2 over a period of 1 second:
  6832. @example
  6833. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6834. @end example
  6835. @item
  6836. Apply a 3 seconds saturation fade-in effect starting at 0:
  6837. @example
  6838. hue="s=min(t/3\,1)"
  6839. @end example
  6840. The general fade-in expression can be written as:
  6841. @example
  6842. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6843. @end example
  6844. @item
  6845. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6846. @example
  6847. hue="s=max(0\, min(1\, (8-t)/3))"
  6848. @end example
  6849. The general fade-out expression can be written as:
  6850. @example
  6851. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6852. @end example
  6853. @end itemize
  6854. @subsection Commands
  6855. This filter supports the following commands:
  6856. @table @option
  6857. @item b
  6858. @item s
  6859. @item h
  6860. @item H
  6861. Modify the hue and/or the saturation and/or brightness of the input video.
  6862. The command accepts the same syntax of the corresponding option.
  6863. If the specified expression is not valid, it is kept at its current
  6864. value.
  6865. @end table
  6866. @section hysteresis
  6867. Grow first stream into second stream by connecting components.
  6868. This makes it possible to build more robust edge masks.
  6869. This filter accepts the following options:
  6870. @table @option
  6871. @item planes
  6872. Set which planes will be processed as bitmap, unprocessed planes will be
  6873. copied from first stream.
  6874. By default value 0xf, all planes will be processed.
  6875. @item threshold
  6876. Set threshold which is used in filtering. If pixel component value is higher than
  6877. this value filter algorithm for connecting components is activated.
  6878. By default value is 0.
  6879. @end table
  6880. @section idet
  6881. Detect video interlacing type.
  6882. This filter tries to detect if the input frames are interlaced, progressive,
  6883. top or bottom field first. It will also try to detect fields that are
  6884. repeated between adjacent frames (a sign of telecine).
  6885. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6886. Multiple frame detection incorporates the classification history of previous frames.
  6887. The filter will log these metadata values:
  6888. @table @option
  6889. @item single.current_frame
  6890. Detected type of current frame using single-frame detection. One of:
  6891. ``tff'' (top field first), ``bff'' (bottom field first),
  6892. ``progressive'', or ``undetermined''
  6893. @item single.tff
  6894. Cumulative number of frames detected as top field first using single-frame detection.
  6895. @item multiple.tff
  6896. Cumulative number of frames detected as top field first using multiple-frame detection.
  6897. @item single.bff
  6898. Cumulative number of frames detected as bottom field first using single-frame detection.
  6899. @item multiple.current_frame
  6900. Detected type of current frame using multiple-frame detection. One of:
  6901. ``tff'' (top field first), ``bff'' (bottom field first),
  6902. ``progressive'', or ``undetermined''
  6903. @item multiple.bff
  6904. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6905. @item single.progressive
  6906. Cumulative number of frames detected as progressive using single-frame detection.
  6907. @item multiple.progressive
  6908. Cumulative number of frames detected as progressive using multiple-frame detection.
  6909. @item single.undetermined
  6910. Cumulative number of frames that could not be classified using single-frame detection.
  6911. @item multiple.undetermined
  6912. Cumulative number of frames that could not be classified using multiple-frame detection.
  6913. @item repeated.current_frame
  6914. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6915. @item repeated.neither
  6916. Cumulative number of frames with no repeated field.
  6917. @item repeated.top
  6918. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6919. @item repeated.bottom
  6920. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6921. @end table
  6922. The filter accepts the following options:
  6923. @table @option
  6924. @item intl_thres
  6925. Set interlacing threshold.
  6926. @item prog_thres
  6927. Set progressive threshold.
  6928. @item rep_thres
  6929. Threshold for repeated field detection.
  6930. @item half_life
  6931. Number of frames after which a given frame's contribution to the
  6932. statistics is halved (i.e., it contributes only 0.5 to its
  6933. classification). The default of 0 means that all frames seen are given
  6934. full weight of 1.0 forever.
  6935. @item analyze_interlaced_flag
  6936. When this is not 0 then idet will use the specified number of frames to determine
  6937. if the interlaced flag is accurate, it will not count undetermined frames.
  6938. If the flag is found to be accurate it will be used without any further
  6939. computations, if it is found to be inaccurate it will be cleared without any
  6940. further computations. This allows inserting the idet filter as a low computational
  6941. method to clean up the interlaced flag
  6942. @end table
  6943. @section il
  6944. Deinterleave or interleave fields.
  6945. This filter allows one to process interlaced images fields without
  6946. deinterlacing them. Deinterleaving splits the input frame into 2
  6947. fields (so called half pictures). Odd lines are moved to the top
  6948. half of the output image, even lines to the bottom half.
  6949. You can process (filter) them independently and then re-interleave them.
  6950. The filter accepts the following options:
  6951. @table @option
  6952. @item luma_mode, l
  6953. @item chroma_mode, c
  6954. @item alpha_mode, a
  6955. Available values for @var{luma_mode}, @var{chroma_mode} and
  6956. @var{alpha_mode} are:
  6957. @table @samp
  6958. @item none
  6959. Do nothing.
  6960. @item deinterleave, d
  6961. Deinterleave fields, placing one above the other.
  6962. @item interleave, i
  6963. Interleave fields. Reverse the effect of deinterleaving.
  6964. @end table
  6965. Default value is @code{none}.
  6966. @item luma_swap, ls
  6967. @item chroma_swap, cs
  6968. @item alpha_swap, as
  6969. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6970. @end table
  6971. @section inflate
  6972. Apply inflate effect to the video.
  6973. This filter replaces the pixel by the local(3x3) average by taking into account
  6974. only values higher than the pixel.
  6975. It accepts the following options:
  6976. @table @option
  6977. @item threshold0
  6978. @item threshold1
  6979. @item threshold2
  6980. @item threshold3
  6981. Limit the maximum change for each plane, default is 65535.
  6982. If 0, plane will remain unchanged.
  6983. @end table
  6984. @section interlace
  6985. Simple interlacing filter from progressive contents. This interleaves upper (or
  6986. lower) lines from odd frames with lower (or upper) lines from even frames,
  6987. halving the frame rate and preserving image height.
  6988. @example
  6989. Original Original New Frame
  6990. Frame 'j' Frame 'j+1' (tff)
  6991. ========== =========== ==================
  6992. Line 0 --------------------> Frame 'j' Line 0
  6993. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6994. Line 2 ---------------------> Frame 'j' Line 2
  6995. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6996. ... ... ...
  6997. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6998. @end example
  6999. It accepts the following optional parameters:
  7000. @table @option
  7001. @item scan
  7002. This determines whether the interlaced frame is taken from the even
  7003. (tff - default) or odd (bff) lines of the progressive frame.
  7004. @item lowpass
  7005. Enable (default) or disable the vertical lowpass filter to avoid twitter
  7006. interlacing and reduce moire patterns.
  7007. @end table
  7008. @section kerndeint
  7009. Deinterlace input video by applying Donald Graft's adaptive kernel
  7010. deinterling. Work on interlaced parts of a video to produce
  7011. progressive frames.
  7012. The description of the accepted parameters follows.
  7013. @table @option
  7014. @item thresh
  7015. Set the threshold which affects the filter's tolerance when
  7016. determining if a pixel line must be processed. It must be an integer
  7017. in the range [0,255] and defaults to 10. A value of 0 will result in
  7018. applying the process on every pixels.
  7019. @item map
  7020. Paint pixels exceeding the threshold value to white if set to 1.
  7021. Default is 0.
  7022. @item order
  7023. Set the fields order. Swap fields if set to 1, leave fields alone if
  7024. 0. Default is 0.
  7025. @item sharp
  7026. Enable additional sharpening if set to 1. Default is 0.
  7027. @item twoway
  7028. Enable twoway sharpening if set to 1. Default is 0.
  7029. @end table
  7030. @subsection Examples
  7031. @itemize
  7032. @item
  7033. Apply default values:
  7034. @example
  7035. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7036. @end example
  7037. @item
  7038. Enable additional sharpening:
  7039. @example
  7040. kerndeint=sharp=1
  7041. @end example
  7042. @item
  7043. Paint processed pixels in white:
  7044. @example
  7045. kerndeint=map=1
  7046. @end example
  7047. @end itemize
  7048. @section lenscorrection
  7049. Correct radial lens distortion
  7050. This filter can be used to correct for radial distortion as can result from the use
  7051. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7052. one can use tools available for example as part of opencv or simply trial-and-error.
  7053. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7054. and extract the k1 and k2 coefficients from the resulting matrix.
  7055. Note that effectively the same filter is available in the open-source tools Krita and
  7056. Digikam from the KDE project.
  7057. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7058. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7059. brightness distribution, so you may want to use both filters together in certain
  7060. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7061. be applied before or after lens correction.
  7062. @subsection Options
  7063. The filter accepts the following options:
  7064. @table @option
  7065. @item cx
  7066. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7067. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7068. width.
  7069. @item cy
  7070. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7071. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7072. height.
  7073. @item k1
  7074. Coefficient of the quadratic correction term. 0.5 means no correction.
  7075. @item k2
  7076. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7077. @end table
  7078. The formula that generates the correction is:
  7079. @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)
  7080. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7081. distances from the focal point in the source and target images, respectively.
  7082. @section loop
  7083. Loop video frames.
  7084. The filter accepts the following options:
  7085. @table @option
  7086. @item loop
  7087. Set the number of loops.
  7088. @item size
  7089. Set maximal size in number of frames.
  7090. @item start
  7091. Set first frame of loop.
  7092. @end table
  7093. @anchor{lut3d}
  7094. @section lut3d
  7095. Apply a 3D LUT to an input video.
  7096. The filter accepts the following options:
  7097. @table @option
  7098. @item file
  7099. Set the 3D LUT file name.
  7100. Currently supported formats:
  7101. @table @samp
  7102. @item 3dl
  7103. AfterEffects
  7104. @item cube
  7105. Iridas
  7106. @item dat
  7107. DaVinci
  7108. @item m3d
  7109. Pandora
  7110. @end table
  7111. @item interp
  7112. Select interpolation mode.
  7113. Available values are:
  7114. @table @samp
  7115. @item nearest
  7116. Use values from the nearest defined point.
  7117. @item trilinear
  7118. Interpolate values using the 8 points defining a cube.
  7119. @item tetrahedral
  7120. Interpolate values using a tetrahedron.
  7121. @end table
  7122. @end table
  7123. @section lut, lutrgb, lutyuv
  7124. Compute a look-up table for binding each pixel component input value
  7125. to an output value, and apply it to the input video.
  7126. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7127. to an RGB input video.
  7128. These filters accept the following parameters:
  7129. @table @option
  7130. @item c0
  7131. set first pixel component expression
  7132. @item c1
  7133. set second pixel component expression
  7134. @item c2
  7135. set third pixel component expression
  7136. @item c3
  7137. set fourth pixel component expression, corresponds to the alpha component
  7138. @item r
  7139. set red component expression
  7140. @item g
  7141. set green component expression
  7142. @item b
  7143. set blue component expression
  7144. @item a
  7145. alpha component expression
  7146. @item y
  7147. set Y/luminance component expression
  7148. @item u
  7149. set U/Cb component expression
  7150. @item v
  7151. set V/Cr component expression
  7152. @end table
  7153. Each of them specifies the expression to use for computing the lookup table for
  7154. the corresponding pixel component values.
  7155. The exact component associated to each of the @var{c*} options depends on the
  7156. format in input.
  7157. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7158. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7159. The expressions can contain the following constants and functions:
  7160. @table @option
  7161. @item w
  7162. @item h
  7163. The input width and height.
  7164. @item val
  7165. The input value for the pixel component.
  7166. @item clipval
  7167. The input value, clipped to the @var{minval}-@var{maxval} range.
  7168. @item maxval
  7169. The maximum value for the pixel component.
  7170. @item minval
  7171. The minimum value for the pixel component.
  7172. @item negval
  7173. The negated value for the pixel component value, clipped to the
  7174. @var{minval}-@var{maxval} range; it corresponds to the expression
  7175. "maxval-clipval+minval".
  7176. @item clip(val)
  7177. The computed value in @var{val}, clipped to the
  7178. @var{minval}-@var{maxval} range.
  7179. @item gammaval(gamma)
  7180. The computed gamma correction value of the pixel component value,
  7181. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7182. expression
  7183. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7184. @end table
  7185. All expressions default to "val".
  7186. @subsection Examples
  7187. @itemize
  7188. @item
  7189. Negate input video:
  7190. @example
  7191. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7192. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7193. @end example
  7194. The above is the same as:
  7195. @example
  7196. lutrgb="r=negval:g=negval:b=negval"
  7197. lutyuv="y=negval:u=negval:v=negval"
  7198. @end example
  7199. @item
  7200. Negate luminance:
  7201. @example
  7202. lutyuv=y=negval
  7203. @end example
  7204. @item
  7205. Remove chroma components, turning the video into a graytone image:
  7206. @example
  7207. lutyuv="u=128:v=128"
  7208. @end example
  7209. @item
  7210. Apply a luma burning effect:
  7211. @example
  7212. lutyuv="y=2*val"
  7213. @end example
  7214. @item
  7215. Remove green and blue components:
  7216. @example
  7217. lutrgb="g=0:b=0"
  7218. @end example
  7219. @item
  7220. Set a constant alpha channel value on input:
  7221. @example
  7222. format=rgba,lutrgb=a="maxval-minval/2"
  7223. @end example
  7224. @item
  7225. Correct luminance gamma by a factor of 0.5:
  7226. @example
  7227. lutyuv=y=gammaval(0.5)
  7228. @end example
  7229. @item
  7230. Discard least significant bits of luma:
  7231. @example
  7232. lutyuv=y='bitand(val, 128+64+32)'
  7233. @end example
  7234. @item
  7235. Technicolor like effect:
  7236. @example
  7237. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7238. @end example
  7239. @end itemize
  7240. @section lut2
  7241. Compute and apply a lookup table from two video inputs.
  7242. This filter accepts the following parameters:
  7243. @table @option
  7244. @item c0
  7245. set first pixel component expression
  7246. @item c1
  7247. set second pixel component expression
  7248. @item c2
  7249. set third pixel component expression
  7250. @item c3
  7251. set fourth pixel component expression, corresponds to the alpha component
  7252. @end table
  7253. Each of them specifies the expression to use for computing the lookup table for
  7254. the corresponding pixel component values.
  7255. The exact component associated to each of the @var{c*} options depends on the
  7256. format in inputs.
  7257. The expressions can contain the following constants:
  7258. @table @option
  7259. @item w
  7260. @item h
  7261. The input width and height.
  7262. @item x
  7263. The first input value for the pixel component.
  7264. @item y
  7265. The second input value for the pixel component.
  7266. @item bdx
  7267. The first input video bit depth.
  7268. @item bdy
  7269. The second input video bit depth.
  7270. @end table
  7271. All expressions default to "x".
  7272. @subsection Examples
  7273. @itemize
  7274. @item
  7275. Highlight differences between two RGB video streams:
  7276. @example
  7277. 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)'
  7278. @end example
  7279. @item
  7280. Highlight differences between two YUV video streams:
  7281. @example
  7282. 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)'
  7283. @end example
  7284. @end itemize
  7285. @section maskedclamp
  7286. Clamp the first input stream with the second input and third input stream.
  7287. Returns the value of first stream to be between second input
  7288. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7289. This filter accepts the following options:
  7290. @table @option
  7291. @item undershoot
  7292. Default value is @code{0}.
  7293. @item overshoot
  7294. Default value is @code{0}.
  7295. @item planes
  7296. Set which planes will be processed as bitmap, unprocessed planes will be
  7297. copied from first stream.
  7298. By default value 0xf, all planes will be processed.
  7299. @end table
  7300. @section maskedmerge
  7301. Merge the first input stream with the second input stream using per pixel
  7302. weights in the third input stream.
  7303. A value of 0 in the third stream pixel component means that pixel component
  7304. from first stream is returned unchanged, while maximum value (eg. 255 for
  7305. 8-bit videos) means that pixel component from second stream is returned
  7306. unchanged. Intermediate values define the amount of merging between both
  7307. input stream's pixel components.
  7308. This filter accepts the following options:
  7309. @table @option
  7310. @item planes
  7311. Set which planes will be processed as bitmap, unprocessed planes will be
  7312. copied from first stream.
  7313. By default value 0xf, all planes will be processed.
  7314. @end table
  7315. @section mcdeint
  7316. Apply motion-compensation deinterlacing.
  7317. It needs one field per frame as input and must thus be used together
  7318. with yadif=1/3 or equivalent.
  7319. This filter accepts the following options:
  7320. @table @option
  7321. @item mode
  7322. Set the deinterlacing mode.
  7323. It accepts one of the following values:
  7324. @table @samp
  7325. @item fast
  7326. @item medium
  7327. @item slow
  7328. use iterative motion estimation
  7329. @item extra_slow
  7330. like @samp{slow}, but use multiple reference frames.
  7331. @end table
  7332. Default value is @samp{fast}.
  7333. @item parity
  7334. Set the picture field parity assumed for the input video. It must be
  7335. one of the following values:
  7336. @table @samp
  7337. @item 0, tff
  7338. assume top field first
  7339. @item 1, bff
  7340. assume bottom field first
  7341. @end table
  7342. Default value is @samp{bff}.
  7343. @item qp
  7344. Set per-block quantization parameter (QP) used by the internal
  7345. encoder.
  7346. Higher values should result in a smoother motion vector field but less
  7347. optimal individual vectors. Default value is 1.
  7348. @end table
  7349. @section mergeplanes
  7350. Merge color channel components from several video streams.
  7351. The filter accepts up to 4 input streams, and merge selected input
  7352. planes to the output video.
  7353. This filter accepts the following options:
  7354. @table @option
  7355. @item mapping
  7356. Set input to output plane mapping. Default is @code{0}.
  7357. The mappings is specified as a bitmap. It should be specified as a
  7358. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7359. mapping for the first plane of the output stream. 'A' sets the number of
  7360. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7361. corresponding input to use (from 0 to 3). The rest of the mappings is
  7362. similar, 'Bb' describes the mapping for the output stream second
  7363. plane, 'Cc' describes the mapping for the output stream third plane and
  7364. 'Dd' describes the mapping for the output stream fourth plane.
  7365. @item format
  7366. Set output pixel format. Default is @code{yuva444p}.
  7367. @end table
  7368. @subsection Examples
  7369. @itemize
  7370. @item
  7371. Merge three gray video streams of same width and height into single video stream:
  7372. @example
  7373. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7374. @end example
  7375. @item
  7376. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7377. @example
  7378. [a0][a1]mergeplanes=0x00010210:yuva444p
  7379. @end example
  7380. @item
  7381. Swap Y and A plane in yuva444p stream:
  7382. @example
  7383. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7384. @end example
  7385. @item
  7386. Swap U and V plane in yuv420p stream:
  7387. @example
  7388. format=yuv420p,mergeplanes=0x000201:yuv420p
  7389. @end example
  7390. @item
  7391. Cast a rgb24 clip to yuv444p:
  7392. @example
  7393. format=rgb24,mergeplanes=0x000102:yuv444p
  7394. @end example
  7395. @end itemize
  7396. @section mestimate
  7397. Estimate and export motion vectors using block matching algorithms.
  7398. Motion vectors are stored in frame side data to be used by other filters.
  7399. This filter accepts the following options:
  7400. @table @option
  7401. @item method
  7402. Specify the motion estimation method. Accepts one of the following values:
  7403. @table @samp
  7404. @item esa
  7405. Exhaustive search algorithm.
  7406. @item tss
  7407. Three step search algorithm.
  7408. @item tdls
  7409. Two dimensional logarithmic search algorithm.
  7410. @item ntss
  7411. New three step search algorithm.
  7412. @item fss
  7413. Four step search algorithm.
  7414. @item ds
  7415. Diamond search algorithm.
  7416. @item hexbs
  7417. Hexagon-based search algorithm.
  7418. @item epzs
  7419. Enhanced predictive zonal search algorithm.
  7420. @item umh
  7421. Uneven multi-hexagon search algorithm.
  7422. @end table
  7423. Default value is @samp{esa}.
  7424. @item mb_size
  7425. Macroblock size. Default @code{16}.
  7426. @item search_param
  7427. Search parameter. Default @code{7}.
  7428. @end table
  7429. @section midequalizer
  7430. Apply Midway Image Equalization effect using two video streams.
  7431. Midway Image Equalization adjusts a pair of images to have the same
  7432. histogram, while maintaining their dynamics as much as possible. It's
  7433. useful for e.g. matching exposures from a pair of stereo cameras.
  7434. This filter has two inputs and one output, which must be of same pixel format, but
  7435. may be of different sizes. The output of filter is first input adjusted with
  7436. midway histogram of both inputs.
  7437. This filter accepts the following option:
  7438. @table @option
  7439. @item planes
  7440. Set which planes to process. Default is @code{15}, which is all available planes.
  7441. @end table
  7442. @section minterpolate
  7443. Convert the video to specified frame rate using motion interpolation.
  7444. This filter accepts the following options:
  7445. @table @option
  7446. @item fps
  7447. 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}.
  7448. @item mi_mode
  7449. Motion interpolation mode. Following values are accepted:
  7450. @table @samp
  7451. @item dup
  7452. Duplicate previous or next frame for interpolating new ones.
  7453. @item blend
  7454. Blend source frames. Interpolated frame is mean of previous and next frames.
  7455. @item mci
  7456. Motion compensated interpolation. Following options are effective when this mode is selected:
  7457. @table @samp
  7458. @item mc_mode
  7459. Motion compensation mode. Following values are accepted:
  7460. @table @samp
  7461. @item obmc
  7462. Overlapped block motion compensation.
  7463. @item aobmc
  7464. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7465. @end table
  7466. Default mode is @samp{obmc}.
  7467. @item me_mode
  7468. Motion estimation mode. Following values are accepted:
  7469. @table @samp
  7470. @item bidir
  7471. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7472. @item bilat
  7473. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7474. @end table
  7475. Default mode is @samp{bilat}.
  7476. @item me
  7477. The algorithm to be used for motion estimation. Following values are accepted:
  7478. @table @samp
  7479. @item esa
  7480. Exhaustive search algorithm.
  7481. @item tss
  7482. Three step search algorithm.
  7483. @item tdls
  7484. Two dimensional logarithmic search algorithm.
  7485. @item ntss
  7486. New three step search algorithm.
  7487. @item fss
  7488. Four step search algorithm.
  7489. @item ds
  7490. Diamond search algorithm.
  7491. @item hexbs
  7492. Hexagon-based search algorithm.
  7493. @item epzs
  7494. Enhanced predictive zonal search algorithm.
  7495. @item umh
  7496. Uneven multi-hexagon search algorithm.
  7497. @end table
  7498. Default algorithm is @samp{epzs}.
  7499. @item mb_size
  7500. Macroblock size. Default @code{16}.
  7501. @item search_param
  7502. Motion estimation search parameter. Default @code{32}.
  7503. @item vsbmc
  7504. 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).
  7505. @end table
  7506. @end table
  7507. @item scd
  7508. 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:
  7509. @table @samp
  7510. @item none
  7511. Disable scene change detection.
  7512. @item fdiff
  7513. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7514. @end table
  7515. Default method is @samp{fdiff}.
  7516. @item scd_threshold
  7517. Scene change detection threshold. Default is @code{5.0}.
  7518. @end table
  7519. @section mpdecimate
  7520. Drop frames that do not differ greatly from the previous frame in
  7521. order to reduce frame rate.
  7522. The main use of this filter is for very-low-bitrate encoding
  7523. (e.g. streaming over dialup modem), but it could in theory be used for
  7524. fixing movies that were inverse-telecined incorrectly.
  7525. A description of the accepted options follows.
  7526. @table @option
  7527. @item max
  7528. Set the maximum number of consecutive frames which can be dropped (if
  7529. positive), or the minimum interval between dropped frames (if
  7530. negative). If the value is 0, the frame is dropped unregarding the
  7531. number of previous sequentially dropped frames.
  7532. Default value is 0.
  7533. @item hi
  7534. @item lo
  7535. @item frac
  7536. Set the dropping threshold values.
  7537. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7538. represent actual pixel value differences, so a threshold of 64
  7539. corresponds to 1 unit of difference for each pixel, or the same spread
  7540. out differently over the block.
  7541. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7542. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7543. meaning the whole image) differ by more than a threshold of @option{lo}.
  7544. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7545. 64*5, and default value for @option{frac} is 0.33.
  7546. @end table
  7547. @section negate
  7548. Negate input video.
  7549. It accepts an integer in input; if non-zero it negates the
  7550. alpha component (if available). The default value in input is 0.
  7551. @section nlmeans
  7552. Denoise frames using Non-Local Means algorithm.
  7553. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7554. context similarity is defined by comparing their surrounding patches of size
  7555. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7556. around the pixel.
  7557. Note that the research area defines centers for patches, which means some
  7558. patches will be made of pixels outside that research area.
  7559. The filter accepts the following options.
  7560. @table @option
  7561. @item s
  7562. Set denoising strength.
  7563. @item p
  7564. Set patch size.
  7565. @item pc
  7566. Same as @option{p} but for chroma planes.
  7567. The default value is @var{0} and means automatic.
  7568. @item r
  7569. Set research size.
  7570. @item rc
  7571. Same as @option{r} but for chroma planes.
  7572. The default value is @var{0} and means automatic.
  7573. @end table
  7574. @section nnedi
  7575. Deinterlace video using neural network edge directed interpolation.
  7576. This filter accepts the following options:
  7577. @table @option
  7578. @item weights
  7579. Mandatory option, without binary file filter can not work.
  7580. Currently file can be found here:
  7581. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7582. @item deint
  7583. Set which frames to deinterlace, by default it is @code{all}.
  7584. Can be @code{all} or @code{interlaced}.
  7585. @item field
  7586. Set mode of operation.
  7587. Can be one of the following:
  7588. @table @samp
  7589. @item af
  7590. Use frame flags, both fields.
  7591. @item a
  7592. Use frame flags, single field.
  7593. @item t
  7594. Use top field only.
  7595. @item b
  7596. Use bottom field only.
  7597. @item tf
  7598. Use both fields, top first.
  7599. @item bf
  7600. Use both fields, bottom first.
  7601. @end table
  7602. @item planes
  7603. Set which planes to process, by default filter process all frames.
  7604. @item nsize
  7605. Set size of local neighborhood around each pixel, used by the predictor neural
  7606. network.
  7607. Can be one of the following:
  7608. @table @samp
  7609. @item s8x6
  7610. @item s16x6
  7611. @item s32x6
  7612. @item s48x6
  7613. @item s8x4
  7614. @item s16x4
  7615. @item s32x4
  7616. @end table
  7617. @item nns
  7618. Set the number of neurons in predicctor neural network.
  7619. Can be one of the following:
  7620. @table @samp
  7621. @item n16
  7622. @item n32
  7623. @item n64
  7624. @item n128
  7625. @item n256
  7626. @end table
  7627. @item qual
  7628. Controls the number of different neural network predictions that are blended
  7629. together to compute the final output value. Can be @code{fast}, default or
  7630. @code{slow}.
  7631. @item etype
  7632. Set which set of weights to use in the predictor.
  7633. Can be one of the following:
  7634. @table @samp
  7635. @item a
  7636. weights trained to minimize absolute error
  7637. @item s
  7638. weights trained to minimize squared error
  7639. @end table
  7640. @item pscrn
  7641. Controls whether or not the prescreener neural network is used to decide
  7642. which pixels should be processed by the predictor neural network and which
  7643. can be handled by simple cubic interpolation.
  7644. The prescreener is trained to know whether cubic interpolation will be
  7645. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7646. The computational complexity of the prescreener nn is much less than that of
  7647. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7648. using the prescreener generally results in much faster processing.
  7649. The prescreener is pretty accurate, so the difference between using it and not
  7650. using it is almost always unnoticeable.
  7651. Can be one of the following:
  7652. @table @samp
  7653. @item none
  7654. @item original
  7655. @item new
  7656. @end table
  7657. Default is @code{new}.
  7658. @item fapprox
  7659. Set various debugging flags.
  7660. @end table
  7661. @section noformat
  7662. Force libavfilter not to use any of the specified pixel formats for the
  7663. input to the next filter.
  7664. It accepts the following parameters:
  7665. @table @option
  7666. @item pix_fmts
  7667. A '|'-separated list of pixel format names, such as
  7668. apix_fmts=yuv420p|monow|rgb24".
  7669. @end table
  7670. @subsection Examples
  7671. @itemize
  7672. @item
  7673. Force libavfilter to use a format different from @var{yuv420p} for the
  7674. input to the vflip filter:
  7675. @example
  7676. noformat=pix_fmts=yuv420p,vflip
  7677. @end example
  7678. @item
  7679. Convert the input video to any of the formats not contained in the list:
  7680. @example
  7681. noformat=yuv420p|yuv444p|yuv410p
  7682. @end example
  7683. @end itemize
  7684. @section noise
  7685. Add noise on video input frame.
  7686. The filter accepts the following options:
  7687. @table @option
  7688. @item all_seed
  7689. @item c0_seed
  7690. @item c1_seed
  7691. @item c2_seed
  7692. @item c3_seed
  7693. Set noise seed for specific pixel component or all pixel components in case
  7694. of @var{all_seed}. Default value is @code{123457}.
  7695. @item all_strength, alls
  7696. @item c0_strength, c0s
  7697. @item c1_strength, c1s
  7698. @item c2_strength, c2s
  7699. @item c3_strength, c3s
  7700. Set noise strength for specific pixel component or all pixel components in case
  7701. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7702. @item all_flags, allf
  7703. @item c0_flags, c0f
  7704. @item c1_flags, c1f
  7705. @item c2_flags, c2f
  7706. @item c3_flags, c3f
  7707. Set pixel component flags or set flags for all components if @var{all_flags}.
  7708. Available values for component flags are:
  7709. @table @samp
  7710. @item a
  7711. averaged temporal noise (smoother)
  7712. @item p
  7713. mix random noise with a (semi)regular pattern
  7714. @item t
  7715. temporal noise (noise pattern changes between frames)
  7716. @item u
  7717. uniform noise (gaussian otherwise)
  7718. @end table
  7719. @end table
  7720. @subsection Examples
  7721. Add temporal and uniform noise to input video:
  7722. @example
  7723. noise=alls=20:allf=t+u
  7724. @end example
  7725. @section null
  7726. Pass the video source unchanged to the output.
  7727. @section ocr
  7728. Optical Character Recognition
  7729. This filter uses Tesseract for optical character recognition.
  7730. It accepts the following options:
  7731. @table @option
  7732. @item datapath
  7733. Set datapath to tesseract data. Default is to use whatever was
  7734. set at installation.
  7735. @item language
  7736. Set language, default is "eng".
  7737. @item whitelist
  7738. Set character whitelist.
  7739. @item blacklist
  7740. Set character blacklist.
  7741. @end table
  7742. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7743. @section ocv
  7744. Apply a video transform using libopencv.
  7745. To enable this filter, install the libopencv library and headers and
  7746. configure FFmpeg with @code{--enable-libopencv}.
  7747. It accepts the following parameters:
  7748. @table @option
  7749. @item filter_name
  7750. The name of the libopencv filter to apply.
  7751. @item filter_params
  7752. The parameters to pass to the libopencv filter. If not specified, the default
  7753. values are assumed.
  7754. @end table
  7755. Refer to the official libopencv documentation for more precise
  7756. information:
  7757. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7758. Several libopencv filters are supported; see the following subsections.
  7759. @anchor{dilate}
  7760. @subsection dilate
  7761. Dilate an image by using a specific structuring element.
  7762. It corresponds to the libopencv function @code{cvDilate}.
  7763. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7764. @var{struct_el} represents a structuring element, and has the syntax:
  7765. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7766. @var{cols} and @var{rows} represent the number of columns and rows of
  7767. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7768. point, and @var{shape} the shape for the structuring element. @var{shape}
  7769. must be "rect", "cross", "ellipse", or "custom".
  7770. If the value for @var{shape} is "custom", it must be followed by a
  7771. string of the form "=@var{filename}". The file with name
  7772. @var{filename} is assumed to represent a binary image, with each
  7773. printable character corresponding to a bright pixel. When a custom
  7774. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7775. or columns and rows of the read file are assumed instead.
  7776. The default value for @var{struct_el} is "3x3+0x0/rect".
  7777. @var{nb_iterations} specifies the number of times the transform is
  7778. applied to the image, and defaults to 1.
  7779. Some examples:
  7780. @example
  7781. # Use the default values
  7782. ocv=dilate
  7783. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7784. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7785. # Read the shape from the file diamond.shape, iterating two times.
  7786. # The file diamond.shape may contain a pattern of characters like this
  7787. # *
  7788. # ***
  7789. # *****
  7790. # ***
  7791. # *
  7792. # The specified columns and rows are ignored
  7793. # but the anchor point coordinates are not
  7794. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7795. @end example
  7796. @subsection erode
  7797. Erode an image by using a specific structuring element.
  7798. It corresponds to the libopencv function @code{cvErode}.
  7799. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7800. with the same syntax and semantics as the @ref{dilate} filter.
  7801. @subsection smooth
  7802. Smooth the input video.
  7803. The filter takes the following parameters:
  7804. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7805. @var{type} is the type of smooth filter to apply, and must be one of
  7806. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7807. or "bilateral". The default value is "gaussian".
  7808. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7809. depend on the smooth type. @var{param1} and
  7810. @var{param2} accept integer positive values or 0. @var{param3} and
  7811. @var{param4} accept floating point values.
  7812. The default value for @var{param1} is 3. The default value for the
  7813. other parameters is 0.
  7814. These parameters correspond to the parameters assigned to the
  7815. libopencv function @code{cvSmooth}.
  7816. @anchor{overlay}
  7817. @section overlay
  7818. Overlay one video on top of another.
  7819. It takes two inputs and has one output. The first input is the "main"
  7820. video on which the second input is overlaid.
  7821. It accepts the following parameters:
  7822. A description of the accepted options follows.
  7823. @table @option
  7824. @item x
  7825. @item y
  7826. Set the expression for the x and y coordinates of the overlaid video
  7827. on the main video. Default value is "0" for both expressions. In case
  7828. the expression is invalid, it is set to a huge value (meaning that the
  7829. overlay will not be displayed within the output visible area).
  7830. @item eof_action
  7831. The action to take when EOF is encountered on the secondary input; it accepts
  7832. one of the following values:
  7833. @table @option
  7834. @item repeat
  7835. Repeat the last frame (the default).
  7836. @item endall
  7837. End both streams.
  7838. @item pass
  7839. Pass the main input through.
  7840. @end table
  7841. @item eval
  7842. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7843. It accepts the following values:
  7844. @table @samp
  7845. @item init
  7846. only evaluate expressions once during the filter initialization or
  7847. when a command is processed
  7848. @item frame
  7849. evaluate expressions for each incoming frame
  7850. @end table
  7851. Default value is @samp{frame}.
  7852. @item shortest
  7853. If set to 1, force the output to terminate when the shortest input
  7854. terminates. Default value is 0.
  7855. @item format
  7856. Set the format for the output video.
  7857. It accepts the following values:
  7858. @table @samp
  7859. @item yuv420
  7860. force YUV420 output
  7861. @item yuv422
  7862. force YUV422 output
  7863. @item yuv444
  7864. force YUV444 output
  7865. @item rgb
  7866. force packed RGB output
  7867. @item gbrp
  7868. force planar RGB output
  7869. @end table
  7870. Default value is @samp{yuv420}.
  7871. @item rgb @emph{(deprecated)}
  7872. If set to 1, force the filter to accept inputs in the RGB
  7873. color space. Default value is 0. This option is deprecated, use
  7874. @option{format} instead.
  7875. @item repeatlast
  7876. If set to 1, force the filter to draw the last overlay frame over the
  7877. main input until the end of the stream. A value of 0 disables this
  7878. behavior. Default value is 1.
  7879. @end table
  7880. The @option{x}, and @option{y} expressions can contain the following
  7881. parameters.
  7882. @table @option
  7883. @item main_w, W
  7884. @item main_h, H
  7885. The main input width and height.
  7886. @item overlay_w, w
  7887. @item overlay_h, h
  7888. The overlay input width and height.
  7889. @item x
  7890. @item y
  7891. The computed values for @var{x} and @var{y}. They are evaluated for
  7892. each new frame.
  7893. @item hsub
  7894. @item vsub
  7895. horizontal and vertical chroma subsample values of the output
  7896. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7897. @var{vsub} is 1.
  7898. @item n
  7899. the number of input frame, starting from 0
  7900. @item pos
  7901. the position in the file of the input frame, NAN if unknown
  7902. @item t
  7903. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7904. @end table
  7905. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7906. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7907. when @option{eval} is set to @samp{init}.
  7908. Be aware that frames are taken from each input video in timestamp
  7909. order, hence, if their initial timestamps differ, it is a good idea
  7910. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7911. have them begin in the same zero timestamp, as the example for
  7912. the @var{movie} filter does.
  7913. You can chain together more overlays but you should test the
  7914. efficiency of such approach.
  7915. @subsection Commands
  7916. This filter supports the following commands:
  7917. @table @option
  7918. @item x
  7919. @item y
  7920. Modify the x and y of the overlay input.
  7921. The command accepts the same syntax of the corresponding option.
  7922. If the specified expression is not valid, it is kept at its current
  7923. value.
  7924. @end table
  7925. @subsection Examples
  7926. @itemize
  7927. @item
  7928. Draw the overlay at 10 pixels from the bottom right corner of the main
  7929. video:
  7930. @example
  7931. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7932. @end example
  7933. Using named options the example above becomes:
  7934. @example
  7935. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7936. @end example
  7937. @item
  7938. Insert a transparent PNG logo in the bottom left corner of the input,
  7939. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7940. @example
  7941. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7942. @end example
  7943. @item
  7944. Insert 2 different transparent PNG logos (second logo on bottom
  7945. right corner) using the @command{ffmpeg} tool:
  7946. @example
  7947. 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
  7948. @end example
  7949. @item
  7950. Add a transparent color layer on top of the main video; @code{WxH}
  7951. must specify the size of the main input to the overlay filter:
  7952. @example
  7953. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7954. @end example
  7955. @item
  7956. Play an original video and a filtered version (here with the deshake
  7957. filter) side by side using the @command{ffplay} tool:
  7958. @example
  7959. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7960. @end example
  7961. The above command is the same as:
  7962. @example
  7963. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7964. @end example
  7965. @item
  7966. Make a sliding overlay appearing from the left to the right top part of the
  7967. screen starting since time 2:
  7968. @example
  7969. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7970. @end example
  7971. @item
  7972. Compose output by putting two input videos side to side:
  7973. @example
  7974. ffmpeg -i left.avi -i right.avi -filter_complex "
  7975. nullsrc=size=200x100 [background];
  7976. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7977. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7978. [background][left] overlay=shortest=1 [background+left];
  7979. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7980. "
  7981. @end example
  7982. @item
  7983. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7984. @example
  7985. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7986. -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]'
  7987. masked.avi
  7988. @end example
  7989. @item
  7990. Chain several overlays in cascade:
  7991. @example
  7992. nullsrc=s=200x200 [bg];
  7993. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7994. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7995. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7996. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7997. [in3] null, [mid2] overlay=100:100 [out0]
  7998. @end example
  7999. @end itemize
  8000. @section owdenoise
  8001. Apply Overcomplete Wavelet denoiser.
  8002. The filter accepts the following options:
  8003. @table @option
  8004. @item depth
  8005. Set depth.
  8006. Larger depth values will denoise lower frequency components more, but
  8007. slow down filtering.
  8008. Must be an int in the range 8-16, default is @code{8}.
  8009. @item luma_strength, ls
  8010. Set luma strength.
  8011. Must be a double value in the range 0-1000, default is @code{1.0}.
  8012. @item chroma_strength, cs
  8013. Set chroma strength.
  8014. Must be a double value in the range 0-1000, default is @code{1.0}.
  8015. @end table
  8016. @anchor{pad}
  8017. @section pad
  8018. Add paddings to the input image, and place the original input at the
  8019. provided @var{x}, @var{y} coordinates.
  8020. It accepts the following parameters:
  8021. @table @option
  8022. @item width, w
  8023. @item height, h
  8024. Specify an expression for the size of the output image with the
  8025. paddings added. If the value for @var{width} or @var{height} is 0, the
  8026. corresponding input size is used for the output.
  8027. The @var{width} expression can reference the value set by the
  8028. @var{height} expression, and vice versa.
  8029. The default value of @var{width} and @var{height} is 0.
  8030. @item x
  8031. @item y
  8032. Specify the offsets to place the input image at within the padded area,
  8033. with respect to the top/left border of the output image.
  8034. The @var{x} expression can reference the value set by the @var{y}
  8035. expression, and vice versa.
  8036. The default value of @var{x} and @var{y} is 0.
  8037. @item color
  8038. Specify the color of the padded area. For the syntax of this option,
  8039. check the "Color" section in the ffmpeg-utils manual.
  8040. The default value of @var{color} is "black".
  8041. @item eval
  8042. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8043. It accepts the following values:
  8044. @table @samp
  8045. @item init
  8046. Only evaluate expressions once during the filter initialization or when
  8047. a command is processed.
  8048. @item frame
  8049. Evaluate expressions for each incoming frame.
  8050. @end table
  8051. Default value is @samp{init}.
  8052. @end table
  8053. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8054. options are expressions containing the following constants:
  8055. @table @option
  8056. @item in_w
  8057. @item in_h
  8058. The input video width and height.
  8059. @item iw
  8060. @item ih
  8061. These are the same as @var{in_w} and @var{in_h}.
  8062. @item out_w
  8063. @item out_h
  8064. The output width and height (the size of the padded area), as
  8065. specified by the @var{width} and @var{height} expressions.
  8066. @item ow
  8067. @item oh
  8068. These are the same as @var{out_w} and @var{out_h}.
  8069. @item x
  8070. @item y
  8071. The x and y offsets as specified by the @var{x} and @var{y}
  8072. expressions, or NAN if not yet specified.
  8073. @item a
  8074. same as @var{iw} / @var{ih}
  8075. @item sar
  8076. input sample aspect ratio
  8077. @item dar
  8078. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8079. @item hsub
  8080. @item vsub
  8081. The horizontal and vertical chroma subsample values. For example for the
  8082. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8083. @end table
  8084. @subsection Examples
  8085. @itemize
  8086. @item
  8087. Add paddings with the color "violet" to the input video. The output video
  8088. size is 640x480, and the top-left corner of the input video is placed at
  8089. column 0, row 40
  8090. @example
  8091. pad=640:480:0:40:violet
  8092. @end example
  8093. The example above is equivalent to the following command:
  8094. @example
  8095. pad=width=640:height=480:x=0:y=40:color=violet
  8096. @end example
  8097. @item
  8098. Pad the input to get an output with dimensions increased by 3/2,
  8099. and put the input video at the center of the padded area:
  8100. @example
  8101. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8102. @end example
  8103. @item
  8104. Pad the input to get a squared output with size equal to the maximum
  8105. value between the input width and height, and put the input video at
  8106. the center of the padded area:
  8107. @example
  8108. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8109. @end example
  8110. @item
  8111. Pad the input to get a final w/h ratio of 16:9:
  8112. @example
  8113. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8114. @end example
  8115. @item
  8116. In case of anamorphic video, in order to set the output display aspect
  8117. correctly, it is necessary to use @var{sar} in the expression,
  8118. according to the relation:
  8119. @example
  8120. (ih * X / ih) * sar = output_dar
  8121. X = output_dar / sar
  8122. @end example
  8123. Thus the previous example needs to be modified to:
  8124. @example
  8125. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8126. @end example
  8127. @item
  8128. Double the output size and put the input video in the bottom-right
  8129. corner of the output padded area:
  8130. @example
  8131. pad="2*iw:2*ih:ow-iw:oh-ih"
  8132. @end example
  8133. @end itemize
  8134. @anchor{palettegen}
  8135. @section palettegen
  8136. Generate one palette for a whole video stream.
  8137. It accepts the following options:
  8138. @table @option
  8139. @item max_colors
  8140. Set the maximum number of colors to quantize in the palette.
  8141. Note: the palette will still contain 256 colors; the unused palette entries
  8142. will be black.
  8143. @item reserve_transparent
  8144. Create a palette of 255 colors maximum and reserve the last one for
  8145. transparency. Reserving the transparency color is useful for GIF optimization.
  8146. If not set, the maximum of colors in the palette will be 256. You probably want
  8147. to disable this option for a standalone image.
  8148. Set by default.
  8149. @item stats_mode
  8150. Set statistics mode.
  8151. It accepts the following values:
  8152. @table @samp
  8153. @item full
  8154. Compute full frame histograms.
  8155. @item diff
  8156. Compute histograms only for the part that differs from previous frame. This
  8157. might be relevant to give more importance to the moving part of your input if
  8158. the background is static.
  8159. @item single
  8160. Compute new histogram for each frame.
  8161. @end table
  8162. Default value is @var{full}.
  8163. @end table
  8164. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8165. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8166. color quantization of the palette. This information is also visible at
  8167. @var{info} logging level.
  8168. @subsection Examples
  8169. @itemize
  8170. @item
  8171. Generate a representative palette of a given video using @command{ffmpeg}:
  8172. @example
  8173. ffmpeg -i input.mkv -vf palettegen palette.png
  8174. @end example
  8175. @end itemize
  8176. @section paletteuse
  8177. Use a palette to downsample an input video stream.
  8178. The filter takes two inputs: one video stream and a palette. The palette must
  8179. be a 256 pixels image.
  8180. It accepts the following options:
  8181. @table @option
  8182. @item dither
  8183. Select dithering mode. Available algorithms are:
  8184. @table @samp
  8185. @item bayer
  8186. Ordered 8x8 bayer dithering (deterministic)
  8187. @item heckbert
  8188. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8189. Note: this dithering is sometimes considered "wrong" and is included as a
  8190. reference.
  8191. @item floyd_steinberg
  8192. Floyd and Steingberg dithering (error diffusion)
  8193. @item sierra2
  8194. Frankie Sierra dithering v2 (error diffusion)
  8195. @item sierra2_4a
  8196. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8197. @end table
  8198. Default is @var{sierra2_4a}.
  8199. @item bayer_scale
  8200. When @var{bayer} dithering is selected, this option defines the scale of the
  8201. pattern (how much the crosshatch pattern is visible). A low value means more
  8202. visible pattern for less banding, and higher value means less visible pattern
  8203. at the cost of more banding.
  8204. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8205. @item diff_mode
  8206. If set, define the zone to process
  8207. @table @samp
  8208. @item rectangle
  8209. Only the changing rectangle will be reprocessed. This is similar to GIF
  8210. cropping/offsetting compression mechanism. This option can be useful for speed
  8211. if only a part of the image is changing, and has use cases such as limiting the
  8212. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8213. moving scene (it leads to more deterministic output if the scene doesn't change
  8214. much, and as a result less moving noise and better GIF compression).
  8215. @end table
  8216. Default is @var{none}.
  8217. @item new
  8218. Take new palette for each output frame.
  8219. @end table
  8220. @subsection Examples
  8221. @itemize
  8222. @item
  8223. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8224. using @command{ffmpeg}:
  8225. @example
  8226. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8227. @end example
  8228. @end itemize
  8229. @section perspective
  8230. Correct perspective of video not recorded perpendicular to the screen.
  8231. A description of the accepted parameters follows.
  8232. @table @option
  8233. @item x0
  8234. @item y0
  8235. @item x1
  8236. @item y1
  8237. @item x2
  8238. @item y2
  8239. @item x3
  8240. @item y3
  8241. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8242. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8243. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8244. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8245. then the corners of the source will be sent to the specified coordinates.
  8246. The expressions can use the following variables:
  8247. @table @option
  8248. @item W
  8249. @item H
  8250. the width and height of video frame.
  8251. @item in
  8252. Input frame count.
  8253. @item on
  8254. Output frame count.
  8255. @end table
  8256. @item interpolation
  8257. Set interpolation for perspective correction.
  8258. It accepts the following values:
  8259. @table @samp
  8260. @item linear
  8261. @item cubic
  8262. @end table
  8263. Default value is @samp{linear}.
  8264. @item sense
  8265. Set interpretation of coordinate options.
  8266. It accepts the following values:
  8267. @table @samp
  8268. @item 0, source
  8269. Send point in the source specified by the given coordinates to
  8270. the corners of the destination.
  8271. @item 1, destination
  8272. Send the corners of the source to the point in the destination specified
  8273. by the given coordinates.
  8274. Default value is @samp{source}.
  8275. @end table
  8276. @item eval
  8277. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8278. It accepts the following values:
  8279. @table @samp
  8280. @item init
  8281. only evaluate expressions once during the filter initialization or
  8282. when a command is processed
  8283. @item frame
  8284. evaluate expressions for each incoming frame
  8285. @end table
  8286. Default value is @samp{init}.
  8287. @end table
  8288. @section phase
  8289. Delay interlaced video by one field time so that the field order changes.
  8290. The intended use is to fix PAL movies that have been captured with the
  8291. opposite field order to the film-to-video transfer.
  8292. A description of the accepted parameters follows.
  8293. @table @option
  8294. @item mode
  8295. Set phase mode.
  8296. It accepts the following values:
  8297. @table @samp
  8298. @item t
  8299. Capture field order top-first, transfer bottom-first.
  8300. Filter will delay the bottom field.
  8301. @item b
  8302. Capture field order bottom-first, transfer top-first.
  8303. Filter will delay the top field.
  8304. @item p
  8305. Capture and transfer with the same field order. This mode only exists
  8306. for the documentation of the other options to refer to, but if you
  8307. actually select it, the filter will faithfully do nothing.
  8308. @item a
  8309. Capture field order determined automatically by field flags, transfer
  8310. opposite.
  8311. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8312. basis using field flags. If no field information is available,
  8313. then this works just like @samp{u}.
  8314. @item u
  8315. Capture unknown or varying, transfer opposite.
  8316. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8317. analyzing the images and selecting the alternative that produces best
  8318. match between the fields.
  8319. @item T
  8320. Capture top-first, transfer unknown or varying.
  8321. Filter selects among @samp{t} and @samp{p} using image analysis.
  8322. @item B
  8323. Capture bottom-first, transfer unknown or varying.
  8324. Filter selects among @samp{b} and @samp{p} using image analysis.
  8325. @item A
  8326. Capture determined by field flags, transfer unknown or varying.
  8327. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8328. image analysis. If no field information is available, then this works just
  8329. like @samp{U}. This is the default mode.
  8330. @item U
  8331. Both capture and transfer unknown or varying.
  8332. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8333. @end table
  8334. @end table
  8335. @section pixdesctest
  8336. Pixel format descriptor test filter, mainly useful for internal
  8337. testing. The output video should be equal to the input video.
  8338. For example:
  8339. @example
  8340. format=monow, pixdesctest
  8341. @end example
  8342. can be used to test the monowhite pixel format descriptor definition.
  8343. @section pp
  8344. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8345. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8346. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8347. Each subfilter and some options have a short and a long name that can be used
  8348. interchangeably, i.e. dr/dering are the same.
  8349. The filters accept the following options:
  8350. @table @option
  8351. @item subfilters
  8352. Set postprocessing subfilters string.
  8353. @end table
  8354. All subfilters share common options to determine their scope:
  8355. @table @option
  8356. @item a/autoq
  8357. Honor the quality commands for this subfilter.
  8358. @item c/chrom
  8359. Do chrominance filtering, too (default).
  8360. @item y/nochrom
  8361. Do luminance filtering only (no chrominance).
  8362. @item n/noluma
  8363. Do chrominance filtering only (no luminance).
  8364. @end table
  8365. These options can be appended after the subfilter name, separated by a '|'.
  8366. Available subfilters are:
  8367. @table @option
  8368. @item hb/hdeblock[|difference[|flatness]]
  8369. 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 vb/vdeblock[|difference[|flatness]]
  8377. 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. @item ha/hadeblock[|difference[|flatness]]
  8385. Accurate horizontal deblocking filter
  8386. @table @option
  8387. @item difference
  8388. Difference factor where higher values mean more deblocking (default: @code{32}).
  8389. @item flatness
  8390. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8391. @end table
  8392. @item va/vadeblock[|difference[|flatness]]
  8393. Accurate vertical deblocking filter
  8394. @table @option
  8395. @item difference
  8396. Difference factor where higher values mean more deblocking (default: @code{32}).
  8397. @item flatness
  8398. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8399. @end table
  8400. @end table
  8401. The horizontal and vertical deblocking filters share the difference and
  8402. flatness values so you cannot set different horizontal and vertical
  8403. thresholds.
  8404. @table @option
  8405. @item h1/x1hdeblock
  8406. Experimental horizontal deblocking filter
  8407. @item v1/x1vdeblock
  8408. Experimental vertical deblocking filter
  8409. @item dr/dering
  8410. Deringing filter
  8411. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8412. @table @option
  8413. @item threshold1
  8414. larger -> stronger filtering
  8415. @item threshold2
  8416. larger -> stronger filtering
  8417. @item threshold3
  8418. larger -> stronger filtering
  8419. @end table
  8420. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8421. @table @option
  8422. @item f/fullyrange
  8423. Stretch luminance to @code{0-255}.
  8424. @end table
  8425. @item lb/linblenddeint
  8426. Linear blend deinterlacing filter that deinterlaces the given block by
  8427. filtering all lines with a @code{(1 2 1)} filter.
  8428. @item li/linipoldeint
  8429. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8430. linearly interpolating every second line.
  8431. @item ci/cubicipoldeint
  8432. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8433. cubically interpolating every second line.
  8434. @item md/mediandeint
  8435. Median deinterlacing filter that deinterlaces the given block by applying a
  8436. median filter to every second line.
  8437. @item fd/ffmpegdeint
  8438. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8439. second line with a @code{(-1 4 2 4 -1)} filter.
  8440. @item l5/lowpass5
  8441. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8442. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8443. @item fq/forceQuant[|quantizer]
  8444. Overrides the quantizer table from the input with the constant quantizer you
  8445. specify.
  8446. @table @option
  8447. @item quantizer
  8448. Quantizer to use
  8449. @end table
  8450. @item de/default
  8451. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8452. @item fa/fast
  8453. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8454. @item ac
  8455. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8456. @end table
  8457. @subsection Examples
  8458. @itemize
  8459. @item
  8460. Apply horizontal and vertical deblocking, deringing and automatic
  8461. brightness/contrast:
  8462. @example
  8463. pp=hb/vb/dr/al
  8464. @end example
  8465. @item
  8466. Apply default filters without brightness/contrast correction:
  8467. @example
  8468. pp=de/-al
  8469. @end example
  8470. @item
  8471. Apply default filters and temporal denoiser:
  8472. @example
  8473. pp=default/tmpnoise|1|2|3
  8474. @end example
  8475. @item
  8476. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8477. automatically depending on available CPU time:
  8478. @example
  8479. pp=hb|y/vb|a
  8480. @end example
  8481. @end itemize
  8482. @section pp7
  8483. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8484. similar to spp = 6 with 7 point DCT, where only the center sample is
  8485. used after IDCT.
  8486. The filter accepts the following options:
  8487. @table @option
  8488. @item qp
  8489. Force a constant quantization parameter. It accepts an integer in range
  8490. 0 to 63. If not set, the filter will use the QP from the video stream
  8491. (if available).
  8492. @item mode
  8493. Set thresholding mode. Available modes are:
  8494. @table @samp
  8495. @item hard
  8496. Set hard thresholding.
  8497. @item soft
  8498. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8499. @item medium
  8500. Set medium thresholding (good results, default).
  8501. @end table
  8502. @end table
  8503. @section premultiply
  8504. Apply alpha premultiply effect to input video stream using first plane
  8505. of second stream as alpha.
  8506. Both streams must have same dimensions and same pixel format.
  8507. @section prewitt
  8508. Apply prewitt operator to input video stream.
  8509. The filter accepts the following option:
  8510. @table @option
  8511. @item planes
  8512. Set which planes will be processed, unprocessed planes will be copied.
  8513. By default value 0xf, all planes will be processed.
  8514. @item scale
  8515. Set value which will be multiplied with filtered result.
  8516. @item delta
  8517. Set value which will be added to filtered result.
  8518. @end table
  8519. @section psnr
  8520. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8521. Ratio) between two input videos.
  8522. This filter takes in input two input videos, the first input is
  8523. considered the "main" source and is passed unchanged to the
  8524. output. The second input is used as a "reference" video for computing
  8525. the PSNR.
  8526. Both video inputs must have the same resolution and pixel format for
  8527. this filter to work correctly. Also it assumes that both inputs
  8528. have the same number of frames, which are compared one by one.
  8529. The obtained average PSNR is printed through the logging system.
  8530. The filter stores the accumulated MSE (mean squared error) of each
  8531. frame, and at the end of the processing it is averaged across all frames
  8532. equally, and the following formula is applied to obtain the PSNR:
  8533. @example
  8534. PSNR = 10*log10(MAX^2/MSE)
  8535. @end example
  8536. Where MAX is the average of the maximum values of each component of the
  8537. image.
  8538. The description of the accepted parameters follows.
  8539. @table @option
  8540. @item stats_file, f
  8541. If specified the filter will use the named file to save the PSNR of
  8542. each individual frame. When filename equals "-" the data is sent to
  8543. standard output.
  8544. @item stats_version
  8545. Specifies which version of the stats file format to use. Details of
  8546. each format are written below.
  8547. Default value is 1.
  8548. @item stats_add_max
  8549. Determines whether the max value is output to the stats log.
  8550. Default value is 0.
  8551. Requires stats_version >= 2. If this is set and stats_version < 2,
  8552. the filter will return an error.
  8553. @end table
  8554. The file printed if @var{stats_file} is selected, contains a sequence of
  8555. key/value pairs of the form @var{key}:@var{value} for each compared
  8556. couple of frames.
  8557. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8558. the list of per-frame-pair stats, with key value pairs following the frame
  8559. format with the following parameters:
  8560. @table @option
  8561. @item psnr_log_version
  8562. The version of the log file format. Will match @var{stats_version}.
  8563. @item fields
  8564. A comma separated list of the per-frame-pair parameters included in
  8565. the log.
  8566. @end table
  8567. A description of each shown per-frame-pair parameter follows:
  8568. @table @option
  8569. @item n
  8570. sequential number of the input frame, starting from 1
  8571. @item mse_avg
  8572. Mean Square Error pixel-by-pixel average difference of the compared
  8573. frames, averaged over all the image components.
  8574. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8575. Mean Square Error pixel-by-pixel average difference of the compared
  8576. frames for the component specified by the suffix.
  8577. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8578. Peak Signal to Noise ratio of the compared frames for the component
  8579. specified by the suffix.
  8580. @item max_avg, max_y, max_u, max_v
  8581. Maximum allowed value for each channel, and average over all
  8582. channels.
  8583. @end table
  8584. For example:
  8585. @example
  8586. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8587. [main][ref] psnr="stats_file=stats.log" [out]
  8588. @end example
  8589. On this example the input file being processed is compared with the
  8590. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8591. is stored in @file{stats.log}.
  8592. @anchor{pullup}
  8593. @section pullup
  8594. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8595. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8596. content.
  8597. The pullup filter is designed to take advantage of future context in making
  8598. its decisions. This filter is stateless in the sense that it does not lock
  8599. onto a pattern to follow, but it instead looks forward to the following
  8600. fields in order to identify matches and rebuild progressive frames.
  8601. To produce content with an even framerate, insert the fps filter after
  8602. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8603. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8604. The filter accepts the following options:
  8605. @table @option
  8606. @item jl
  8607. @item jr
  8608. @item jt
  8609. @item jb
  8610. These options set the amount of "junk" to ignore at the left, right, top, and
  8611. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8612. while top and bottom are in units of 2 lines.
  8613. The default is 8 pixels on each side.
  8614. @item sb
  8615. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8616. filter generating an occasional mismatched frame, but it may also cause an
  8617. excessive number of frames to be dropped during high motion sequences.
  8618. Conversely, setting it to -1 will make filter match fields more easily.
  8619. This may help processing of video where there is slight blurring between
  8620. the fields, but may also cause there to be interlaced frames in the output.
  8621. Default value is @code{0}.
  8622. @item mp
  8623. Set the metric plane to use. It accepts the following values:
  8624. @table @samp
  8625. @item l
  8626. Use luma plane.
  8627. @item u
  8628. Use chroma blue plane.
  8629. @item v
  8630. Use chroma red plane.
  8631. @end table
  8632. This option may be set to use chroma plane instead of the default luma plane
  8633. for doing filter's computations. This may improve accuracy on very clean
  8634. source material, but more likely will decrease accuracy, especially if there
  8635. is chroma noise (rainbow effect) or any grayscale video.
  8636. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8637. load and make pullup usable in realtime on slow machines.
  8638. @end table
  8639. For best results (without duplicated frames in the output file) it is
  8640. necessary to change the output frame rate. For example, to inverse
  8641. telecine NTSC input:
  8642. @example
  8643. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8644. @end example
  8645. @section qp
  8646. Change video quantization parameters (QP).
  8647. The filter accepts the following option:
  8648. @table @option
  8649. @item qp
  8650. Set expression for quantization parameter.
  8651. @end table
  8652. The expression is evaluated through the eval API and can contain, among others,
  8653. the following constants:
  8654. @table @var
  8655. @item known
  8656. 1 if index is not 129, 0 otherwise.
  8657. @item qp
  8658. Sequentional index starting from -129 to 128.
  8659. @end table
  8660. @subsection Examples
  8661. @itemize
  8662. @item
  8663. Some equation like:
  8664. @example
  8665. qp=2+2*sin(PI*qp)
  8666. @end example
  8667. @end itemize
  8668. @section random
  8669. Flush video frames from internal cache of frames into a random order.
  8670. No frame is discarded.
  8671. Inspired by @ref{frei0r} nervous filter.
  8672. @table @option
  8673. @item frames
  8674. Set size in number of frames of internal cache, in range from @code{2} to
  8675. @code{512}. Default is @code{30}.
  8676. @item seed
  8677. Set seed for random number generator, must be an integer included between
  8678. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8679. less than @code{0}, the filter will try to use a good random seed on a
  8680. best effort basis.
  8681. @end table
  8682. @section readeia608
  8683. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8684. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8685. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8686. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8687. @table @option
  8688. @item lavfi.readeia608.X.cc
  8689. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8690. @item lavfi.readeia608.X.line
  8691. The number of the line on which the EIA-608 data was identified and read.
  8692. @end table
  8693. This filter accepts the following options:
  8694. @table @option
  8695. @item scan_min
  8696. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8697. @item scan_max
  8698. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8699. @item mac
  8700. Set minimal acceptable amplitude change for sync codes detection.
  8701. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8702. @item spw
  8703. Set the ratio of width reserved for sync code detection.
  8704. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8705. @item mhd
  8706. Set the max peaks height difference for sync code detection.
  8707. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8708. @item mpd
  8709. Set max peaks period difference for sync code detection.
  8710. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8711. @item msd
  8712. Set the first two max start code bits differences.
  8713. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8714. @item bhd
  8715. Set the minimum ratio of bits height compared to 3rd start code bit.
  8716. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8717. @item th_w
  8718. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8719. @item th_b
  8720. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8721. @item chp
  8722. Enable checking the parity bit. In the event of a parity error, the filter will output
  8723. @code{0x00} for that character. Default is false.
  8724. @end table
  8725. @subsection Examples
  8726. @itemize
  8727. @item
  8728. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8729. @example
  8730. 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
  8731. @end example
  8732. @end itemize
  8733. @section readvitc
  8734. Read vertical interval timecode (VITC) information from the top lines of a
  8735. video frame.
  8736. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8737. timecode value, if a valid timecode has been detected. Further metadata key
  8738. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8739. timecode data has been found or not.
  8740. This filter accepts the following options:
  8741. @table @option
  8742. @item scan_max
  8743. Set the maximum number of lines to scan for VITC data. If the value is set to
  8744. @code{-1} the full video frame is scanned. Default is @code{45}.
  8745. @item thr_b
  8746. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8747. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8748. @item thr_w
  8749. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8750. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8751. @end table
  8752. @subsection Examples
  8753. @itemize
  8754. @item
  8755. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8756. draw @code{--:--:--:--} as a placeholder:
  8757. @example
  8758. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8759. @end example
  8760. @end itemize
  8761. @section remap
  8762. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8763. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8764. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8765. value for pixel will be used for destination pixel.
  8766. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8767. will have Xmap/Ymap video stream dimensions.
  8768. Xmap and Ymap input video streams are 16bit depth, single channel.
  8769. @section removegrain
  8770. The removegrain filter is a spatial denoiser for progressive video.
  8771. @table @option
  8772. @item m0
  8773. Set mode for the first plane.
  8774. @item m1
  8775. Set mode for the second plane.
  8776. @item m2
  8777. Set mode for the third plane.
  8778. @item m3
  8779. Set mode for the fourth plane.
  8780. @end table
  8781. Range of mode is from 0 to 24. Description of each mode follows:
  8782. @table @var
  8783. @item 0
  8784. Leave input plane unchanged. Default.
  8785. @item 1
  8786. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8787. @item 2
  8788. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8789. @item 3
  8790. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8791. @item 4
  8792. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8793. This is equivalent to a median filter.
  8794. @item 5
  8795. Line-sensitive clipping giving the minimal change.
  8796. @item 6
  8797. Line-sensitive clipping, intermediate.
  8798. @item 7
  8799. Line-sensitive clipping, intermediate.
  8800. @item 8
  8801. Line-sensitive clipping, intermediate.
  8802. @item 9
  8803. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8804. @item 10
  8805. Replaces the target pixel with the closest neighbour.
  8806. @item 11
  8807. [1 2 1] horizontal and vertical kernel blur.
  8808. @item 12
  8809. Same as mode 11.
  8810. @item 13
  8811. Bob mode, interpolates top field from the line where the neighbours
  8812. pixels are the closest.
  8813. @item 14
  8814. Bob mode, interpolates bottom field from the line where the neighbours
  8815. pixels are the closest.
  8816. @item 15
  8817. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8818. interpolation formula.
  8819. @item 16
  8820. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8821. interpolation formula.
  8822. @item 17
  8823. Clips the pixel with the minimum and maximum of respectively the maximum and
  8824. minimum of each pair of opposite neighbour pixels.
  8825. @item 18
  8826. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8827. the current pixel is minimal.
  8828. @item 19
  8829. Replaces the pixel with the average of its 8 neighbours.
  8830. @item 20
  8831. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8832. @item 21
  8833. Clips pixels using the averages of opposite neighbour.
  8834. @item 22
  8835. Same as mode 21 but simpler and faster.
  8836. @item 23
  8837. Small edge and halo removal, but reputed useless.
  8838. @item 24
  8839. Similar as 23.
  8840. @end table
  8841. @section removelogo
  8842. Suppress a TV station logo, using an image file to determine which
  8843. pixels comprise the logo. It works by filling in the pixels that
  8844. comprise the logo with neighboring pixels.
  8845. The filter accepts the following options:
  8846. @table @option
  8847. @item filename, f
  8848. Set the filter bitmap file, which can be any image format supported by
  8849. libavformat. The width and height of the image file must match those of the
  8850. video stream being processed.
  8851. @end table
  8852. Pixels in the provided bitmap image with a value of zero are not
  8853. considered part of the logo, non-zero pixels are considered part of
  8854. the logo. If you use white (255) for the logo and black (0) for the
  8855. rest, you will be safe. For making the filter bitmap, it is
  8856. recommended to take a screen capture of a black frame with the logo
  8857. visible, and then using a threshold filter followed by the erode
  8858. filter once or twice.
  8859. If needed, little splotches can be fixed manually. Remember that if
  8860. logo pixels are not covered, the filter quality will be much
  8861. reduced. Marking too many pixels as part of the logo does not hurt as
  8862. much, but it will increase the amount of blurring needed to cover over
  8863. the image and will destroy more information than necessary, and extra
  8864. pixels will slow things down on a large logo.
  8865. @section repeatfields
  8866. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8867. fields based on its value.
  8868. @section reverse
  8869. Reverse a video clip.
  8870. Warning: This filter requires memory to buffer the entire clip, so trimming
  8871. is suggested.
  8872. @subsection Examples
  8873. @itemize
  8874. @item
  8875. Take the first 5 seconds of a clip, and reverse it.
  8876. @example
  8877. trim=end=5,reverse
  8878. @end example
  8879. @end itemize
  8880. @section rotate
  8881. Rotate video by an arbitrary angle expressed in radians.
  8882. The filter accepts the following options:
  8883. A description of the optional parameters follows.
  8884. @table @option
  8885. @item angle, a
  8886. Set an expression for the angle by which to rotate the input video
  8887. clockwise, expressed as a number of radians. A negative value will
  8888. result in a counter-clockwise rotation. By default it is set to "0".
  8889. This expression is evaluated for each frame.
  8890. @item out_w, ow
  8891. Set the output width expression, default value is "iw".
  8892. This expression is evaluated just once during configuration.
  8893. @item out_h, oh
  8894. Set the output height expression, default value is "ih".
  8895. This expression is evaluated just once during configuration.
  8896. @item bilinear
  8897. Enable bilinear interpolation if set to 1, a value of 0 disables
  8898. it. Default value is 1.
  8899. @item fillcolor, c
  8900. Set the color used to fill the output area not covered by the rotated
  8901. image. For the general syntax of this option, check the "Color" section in the
  8902. ffmpeg-utils manual. If the special value "none" is selected then no
  8903. background is printed (useful for example if the background is never shown).
  8904. Default value is "black".
  8905. @end table
  8906. The expressions for the angle and the output size can contain the
  8907. following constants and functions:
  8908. @table @option
  8909. @item n
  8910. sequential number of the input frame, starting from 0. It is always NAN
  8911. before the first frame is filtered.
  8912. @item t
  8913. time in seconds of the input frame, it is set to 0 when the filter is
  8914. configured. It is always NAN before the first frame is filtered.
  8915. @item hsub
  8916. @item vsub
  8917. horizontal and vertical chroma subsample values. For example for the
  8918. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8919. @item in_w, iw
  8920. @item in_h, ih
  8921. the input video width and height
  8922. @item out_w, ow
  8923. @item out_h, oh
  8924. the output width and height, that is the size of the padded area as
  8925. specified by the @var{width} and @var{height} expressions
  8926. @item rotw(a)
  8927. @item roth(a)
  8928. the minimal width/height required for completely containing the input
  8929. video rotated by @var{a} radians.
  8930. These are only available when computing the @option{out_w} and
  8931. @option{out_h} expressions.
  8932. @end table
  8933. @subsection Examples
  8934. @itemize
  8935. @item
  8936. Rotate the input by PI/6 radians clockwise:
  8937. @example
  8938. rotate=PI/6
  8939. @end example
  8940. @item
  8941. Rotate the input by PI/6 radians counter-clockwise:
  8942. @example
  8943. rotate=-PI/6
  8944. @end example
  8945. @item
  8946. Rotate the input by 45 degrees clockwise:
  8947. @example
  8948. rotate=45*PI/180
  8949. @end example
  8950. @item
  8951. Apply a constant rotation with period T, starting from an angle of PI/3:
  8952. @example
  8953. rotate=PI/3+2*PI*t/T
  8954. @end example
  8955. @item
  8956. Make the input video rotation oscillating with a period of T
  8957. seconds and an amplitude of A radians:
  8958. @example
  8959. rotate=A*sin(2*PI/T*t)
  8960. @end example
  8961. @item
  8962. Rotate the video, output size is chosen so that the whole rotating
  8963. input video is always completely contained in the output:
  8964. @example
  8965. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8966. @end example
  8967. @item
  8968. Rotate the video, reduce the output size so that no background is ever
  8969. shown:
  8970. @example
  8971. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8972. @end example
  8973. @end itemize
  8974. @subsection Commands
  8975. The filter supports the following commands:
  8976. @table @option
  8977. @item a, angle
  8978. Set the angle expression.
  8979. The command accepts the same syntax of the corresponding option.
  8980. If the specified expression is not valid, it is kept at its current
  8981. value.
  8982. @end table
  8983. @section sab
  8984. Apply Shape Adaptive Blur.
  8985. The filter accepts the following options:
  8986. @table @option
  8987. @item luma_radius, lr
  8988. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8989. value is 1.0. A greater value will result in a more blurred image, and
  8990. in slower processing.
  8991. @item luma_pre_filter_radius, lpfr
  8992. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8993. value is 1.0.
  8994. @item luma_strength, ls
  8995. Set luma maximum difference between pixels to still be considered, must
  8996. be a value in the 0.1-100.0 range, default value is 1.0.
  8997. @item chroma_radius, cr
  8998. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8999. greater value will result in a more blurred image, and in slower
  9000. processing.
  9001. @item chroma_pre_filter_radius, cpfr
  9002. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9003. @item chroma_strength, cs
  9004. Set chroma maximum difference between pixels to still be considered,
  9005. must be a value in the -0.9-100.0 range.
  9006. @end table
  9007. Each chroma option value, if not explicitly specified, is set to the
  9008. corresponding luma option value.
  9009. @anchor{scale}
  9010. @section scale
  9011. Scale (resize) the input video, using the libswscale library.
  9012. The scale filter forces the output display aspect ratio to be the same
  9013. of the input, by changing the output sample aspect ratio.
  9014. If the input image format is different from the format requested by
  9015. the next filter, the scale filter will convert the input to the
  9016. requested format.
  9017. @subsection Options
  9018. The filter accepts the following options, or any of the options
  9019. supported by the libswscale scaler.
  9020. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9021. the complete list of scaler options.
  9022. @table @option
  9023. @item width, w
  9024. @item height, h
  9025. Set the output video dimension expression. Default value is the input
  9026. dimension.
  9027. If the value is 0, the input width is used for the output.
  9028. If one of the values is -1, the scale filter will use a value that
  9029. maintains the aspect ratio of the input image, calculated from the
  9030. other specified dimension. If both of them are -1, the input size is
  9031. used
  9032. If one of the values is -n with n > 1, the scale filter will also use a value
  9033. that maintains the aspect ratio of the input image, calculated from the other
  9034. specified dimension. After that it will, however, make sure that the calculated
  9035. dimension is divisible by n and adjust the value if necessary.
  9036. See below for the list of accepted constants for use in the dimension
  9037. expression.
  9038. @item eval
  9039. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9040. @table @samp
  9041. @item init
  9042. Only evaluate expressions once during the filter initialization or when a command is processed.
  9043. @item frame
  9044. Evaluate expressions for each incoming frame.
  9045. @end table
  9046. Default value is @samp{init}.
  9047. @item interl
  9048. Set the interlacing mode. It accepts the following values:
  9049. @table @samp
  9050. @item 1
  9051. Force interlaced aware scaling.
  9052. @item 0
  9053. Do not apply interlaced scaling.
  9054. @item -1
  9055. Select interlaced aware scaling depending on whether the source frames
  9056. are flagged as interlaced or not.
  9057. @end table
  9058. Default value is @samp{0}.
  9059. @item flags
  9060. Set libswscale scaling flags. See
  9061. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9062. complete list of values. If not explicitly specified the filter applies
  9063. the default flags.
  9064. @item param0, param1
  9065. Set libswscale input parameters for scaling algorithms that need them. See
  9066. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9067. complete documentation. If not explicitly specified the filter applies
  9068. empty parameters.
  9069. @item size, s
  9070. Set the video size. For the syntax of this option, check the
  9071. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9072. @item in_color_matrix
  9073. @item out_color_matrix
  9074. Set in/output YCbCr color space type.
  9075. This allows the autodetected value to be overridden as well as allows forcing
  9076. a specific value used for the output and encoder.
  9077. If not specified, the color space type depends on the pixel format.
  9078. Possible values:
  9079. @table @samp
  9080. @item auto
  9081. Choose automatically.
  9082. @item bt709
  9083. Format conforming to International Telecommunication Union (ITU)
  9084. Recommendation BT.709.
  9085. @item fcc
  9086. Set color space conforming to the United States Federal Communications
  9087. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9088. @item bt601
  9089. Set color space conforming to:
  9090. @itemize
  9091. @item
  9092. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9093. @item
  9094. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9095. @item
  9096. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9097. @end itemize
  9098. @item smpte240m
  9099. Set color space conforming to SMPTE ST 240:1999.
  9100. @end table
  9101. @item in_range
  9102. @item out_range
  9103. Set in/output YCbCr sample range.
  9104. This allows the autodetected value to be overridden as well as allows forcing
  9105. a specific value used for the output and encoder. If not specified, the
  9106. range depends on the pixel format. Possible values:
  9107. @table @samp
  9108. @item auto
  9109. Choose automatically.
  9110. @item jpeg/full/pc
  9111. Set full range (0-255 in case of 8-bit luma).
  9112. @item mpeg/tv
  9113. Set "MPEG" range (16-235 in case of 8-bit luma).
  9114. @end table
  9115. @item force_original_aspect_ratio
  9116. Enable decreasing or increasing output video width or height if necessary to
  9117. keep the original aspect ratio. Possible values:
  9118. @table @samp
  9119. @item disable
  9120. Scale the video as specified and disable this feature.
  9121. @item decrease
  9122. The output video dimensions will automatically be decreased if needed.
  9123. @item increase
  9124. The output video dimensions will automatically be increased if needed.
  9125. @end table
  9126. One useful instance of this option is that when you know a specific device's
  9127. maximum allowed resolution, you can use this to limit the output video to
  9128. that, while retaining the aspect ratio. For example, device A allows
  9129. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9130. decrease) and specifying 1280x720 to the command line makes the output
  9131. 1280x533.
  9132. Please note that this is a different thing than specifying -1 for @option{w}
  9133. or @option{h}, you still need to specify the output resolution for this option
  9134. to work.
  9135. @end table
  9136. The values of the @option{w} and @option{h} options are expressions
  9137. containing the following constants:
  9138. @table @var
  9139. @item in_w
  9140. @item in_h
  9141. The input width and height
  9142. @item iw
  9143. @item ih
  9144. These are the same as @var{in_w} and @var{in_h}.
  9145. @item out_w
  9146. @item out_h
  9147. The output (scaled) width and height
  9148. @item ow
  9149. @item oh
  9150. These are the same as @var{out_w} and @var{out_h}
  9151. @item a
  9152. The same as @var{iw} / @var{ih}
  9153. @item sar
  9154. input sample aspect ratio
  9155. @item dar
  9156. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9157. @item hsub
  9158. @item vsub
  9159. horizontal and vertical input chroma subsample values. For example for the
  9160. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9161. @item ohsub
  9162. @item ovsub
  9163. horizontal and vertical output chroma subsample values. For example for the
  9164. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9165. @end table
  9166. @subsection Examples
  9167. @itemize
  9168. @item
  9169. Scale the input video to a size of 200x100
  9170. @example
  9171. scale=w=200:h=100
  9172. @end example
  9173. This is equivalent to:
  9174. @example
  9175. scale=200:100
  9176. @end example
  9177. or:
  9178. @example
  9179. scale=200x100
  9180. @end example
  9181. @item
  9182. Specify a size abbreviation for the output size:
  9183. @example
  9184. scale=qcif
  9185. @end example
  9186. which can also be written as:
  9187. @example
  9188. scale=size=qcif
  9189. @end example
  9190. @item
  9191. Scale the input to 2x:
  9192. @example
  9193. scale=w=2*iw:h=2*ih
  9194. @end example
  9195. @item
  9196. The above is the same as:
  9197. @example
  9198. scale=2*in_w:2*in_h
  9199. @end example
  9200. @item
  9201. Scale the input to 2x with forced interlaced scaling:
  9202. @example
  9203. scale=2*iw:2*ih:interl=1
  9204. @end example
  9205. @item
  9206. Scale the input to half size:
  9207. @example
  9208. scale=w=iw/2:h=ih/2
  9209. @end example
  9210. @item
  9211. Increase the width, and set the height to the same size:
  9212. @example
  9213. scale=3/2*iw:ow
  9214. @end example
  9215. @item
  9216. Seek Greek harmony:
  9217. @example
  9218. scale=iw:1/PHI*iw
  9219. scale=ih*PHI:ih
  9220. @end example
  9221. @item
  9222. Increase the height, and set the width to 3/2 of the height:
  9223. @example
  9224. scale=w=3/2*oh:h=3/5*ih
  9225. @end example
  9226. @item
  9227. Increase the size, making the size a multiple of the chroma
  9228. subsample values:
  9229. @example
  9230. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9231. @end example
  9232. @item
  9233. Increase the width to a maximum of 500 pixels,
  9234. keeping the same aspect ratio as the input:
  9235. @example
  9236. scale=w='min(500\, iw*3/2):h=-1'
  9237. @end example
  9238. @end itemize
  9239. @subsection Commands
  9240. This filter supports the following commands:
  9241. @table @option
  9242. @item width, w
  9243. @item height, h
  9244. Set the output video dimension expression.
  9245. The command accepts the same syntax of the corresponding option.
  9246. If the specified expression is not valid, it is kept at its current
  9247. value.
  9248. @end table
  9249. @section scale_npp
  9250. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9251. format conversion on CUDA video frames. Setting the output width and height
  9252. works in the same way as for the @var{scale} filter.
  9253. The following additional options are accepted:
  9254. @table @option
  9255. @item format
  9256. The pixel format of the output CUDA frames. If set to the string "same" (the
  9257. default), the input format will be kept. Note that automatic format negotiation
  9258. and conversion is not yet supported for hardware frames
  9259. @item interp_algo
  9260. The interpolation algorithm used for resizing. One of the following:
  9261. @table @option
  9262. @item nn
  9263. Nearest neighbour.
  9264. @item linear
  9265. @item cubic
  9266. @item cubic2p_bspline
  9267. 2-parameter cubic (B=1, C=0)
  9268. @item cubic2p_catmullrom
  9269. 2-parameter cubic (B=0, C=1/2)
  9270. @item cubic2p_b05c03
  9271. 2-parameter cubic (B=1/2, C=3/10)
  9272. @item super
  9273. Supersampling
  9274. @item lanczos
  9275. @end table
  9276. @end table
  9277. @section scale2ref
  9278. Scale (resize) the input video, based on a reference video.
  9279. See the scale filter for available options, scale2ref supports the same but
  9280. uses the reference video instead of the main input as basis.
  9281. @subsection Examples
  9282. @itemize
  9283. @item
  9284. Scale a subtitle stream to match the main video in size before overlaying
  9285. @example
  9286. 'scale2ref[b][a];[a][b]overlay'
  9287. @end example
  9288. @end itemize
  9289. @anchor{selectivecolor}
  9290. @section selectivecolor
  9291. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9292. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9293. by the "purity" of the color (that is, how saturated it already is).
  9294. This filter is similar to the Adobe Photoshop Selective Color tool.
  9295. The filter accepts the following options:
  9296. @table @option
  9297. @item correction_method
  9298. Select color correction method.
  9299. Available values are:
  9300. @table @samp
  9301. @item absolute
  9302. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9303. component value).
  9304. @item relative
  9305. Specified adjustments are relative to the original component value.
  9306. @end table
  9307. Default is @code{absolute}.
  9308. @item reds
  9309. Adjustments for red pixels (pixels where the red component is the maximum)
  9310. @item yellows
  9311. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9312. @item greens
  9313. Adjustments for green pixels (pixels where the green component is the maximum)
  9314. @item cyans
  9315. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9316. @item blues
  9317. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9318. @item magentas
  9319. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9320. @item whites
  9321. Adjustments for white pixels (pixels where all components are greater than 128)
  9322. @item neutrals
  9323. Adjustments for all pixels except pure black and pure white
  9324. @item blacks
  9325. Adjustments for black pixels (pixels where all components are lesser than 128)
  9326. @item psfile
  9327. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9328. @end table
  9329. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9330. 4 space separated floating point adjustment values in the [-1,1] range,
  9331. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9332. pixels of its range.
  9333. @subsection Examples
  9334. @itemize
  9335. @item
  9336. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9337. increase magenta by 27% in blue areas:
  9338. @example
  9339. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9340. @end example
  9341. @item
  9342. Use a Photoshop selective color preset:
  9343. @example
  9344. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9345. @end example
  9346. @end itemize
  9347. @anchor{separatefields}
  9348. @section separatefields
  9349. The @code{separatefields} takes a frame-based video input and splits
  9350. each frame into its components fields, producing a new half height clip
  9351. with twice the frame rate and twice the frame count.
  9352. This filter use field-dominance information in frame to decide which
  9353. of each pair of fields to place first in the output.
  9354. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9355. @section setdar, setsar
  9356. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9357. output video.
  9358. This is done by changing the specified Sample (aka Pixel) Aspect
  9359. Ratio, according to the following equation:
  9360. @example
  9361. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9362. @end example
  9363. Keep in mind that the @code{setdar} filter does not modify the pixel
  9364. dimensions of the video frame. Also, the display aspect ratio set by
  9365. this filter may be changed by later filters in the filterchain,
  9366. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9367. applied.
  9368. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9369. the filter output video.
  9370. Note that as a consequence of the application of this filter, the
  9371. output display aspect ratio will change according to the equation
  9372. above.
  9373. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9374. filter may be changed by later filters in the filterchain, e.g. if
  9375. another "setsar" or a "setdar" filter is applied.
  9376. It accepts the following parameters:
  9377. @table @option
  9378. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9379. Set the aspect ratio used by the filter.
  9380. The parameter can be a floating point number string, an expression, or
  9381. a string of the form @var{num}:@var{den}, where @var{num} and
  9382. @var{den} are the numerator and denominator of the aspect ratio. If
  9383. the parameter is not specified, it is assumed the value "0".
  9384. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9385. should be escaped.
  9386. @item max
  9387. Set the maximum integer value to use for expressing numerator and
  9388. denominator when reducing the expressed aspect ratio to a rational.
  9389. Default value is @code{100}.
  9390. @end table
  9391. The parameter @var{sar} is an expression containing
  9392. the following constants:
  9393. @table @option
  9394. @item E, PI, PHI
  9395. These are approximated values for the mathematical constants e
  9396. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9397. @item w, h
  9398. The input width and height.
  9399. @item a
  9400. These are the same as @var{w} / @var{h}.
  9401. @item sar
  9402. The input sample aspect ratio.
  9403. @item dar
  9404. The input display aspect ratio. It is the same as
  9405. (@var{w} / @var{h}) * @var{sar}.
  9406. @item hsub, vsub
  9407. Horizontal and vertical chroma subsample values. For example, for the
  9408. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9409. @end table
  9410. @subsection Examples
  9411. @itemize
  9412. @item
  9413. To change the display aspect ratio to 16:9, specify one of the following:
  9414. @example
  9415. setdar=dar=1.77777
  9416. setdar=dar=16/9
  9417. @end example
  9418. @item
  9419. To change the sample aspect ratio to 10:11, specify:
  9420. @example
  9421. setsar=sar=10/11
  9422. @end example
  9423. @item
  9424. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9425. 1000 in the aspect ratio reduction, use the command:
  9426. @example
  9427. setdar=ratio=16/9:max=1000
  9428. @end example
  9429. @end itemize
  9430. @anchor{setfield}
  9431. @section setfield
  9432. Force field for the output video frame.
  9433. The @code{setfield} filter marks the interlace type field for the
  9434. output frames. It does not change the input frame, but only sets the
  9435. corresponding property, which affects how the frame is treated by
  9436. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9437. The filter accepts the following options:
  9438. @table @option
  9439. @item mode
  9440. Available values are:
  9441. @table @samp
  9442. @item auto
  9443. Keep the same field property.
  9444. @item bff
  9445. Mark the frame as bottom-field-first.
  9446. @item tff
  9447. Mark the frame as top-field-first.
  9448. @item prog
  9449. Mark the frame as progressive.
  9450. @end table
  9451. @end table
  9452. @section showinfo
  9453. Show a line containing various information for each input video frame.
  9454. The input video is not modified.
  9455. The shown line contains a sequence of key/value pairs of the form
  9456. @var{key}:@var{value}.
  9457. The following values are shown in the output:
  9458. @table @option
  9459. @item n
  9460. The (sequential) number of the input frame, starting from 0.
  9461. @item pts
  9462. The Presentation TimeStamp of the input frame, expressed as a number of
  9463. time base units. The time base unit depends on the filter input pad.
  9464. @item pts_time
  9465. The Presentation TimeStamp of the input frame, expressed as a number of
  9466. seconds.
  9467. @item pos
  9468. The position of the frame in the input stream, or -1 if this information is
  9469. unavailable and/or meaningless (for example in case of synthetic video).
  9470. @item fmt
  9471. The pixel format name.
  9472. @item sar
  9473. The sample aspect ratio of the input frame, expressed in the form
  9474. @var{num}/@var{den}.
  9475. @item s
  9476. The size of the input frame. For the syntax of this option, check the
  9477. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9478. @item i
  9479. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9480. for bottom field first).
  9481. @item iskey
  9482. This is 1 if the frame is a key frame, 0 otherwise.
  9483. @item type
  9484. The picture type of the input frame ("I" for an I-frame, "P" for a
  9485. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9486. Also refer to the documentation of the @code{AVPictureType} enum and of
  9487. the @code{av_get_picture_type_char} function defined in
  9488. @file{libavutil/avutil.h}.
  9489. @item checksum
  9490. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9491. @item plane_checksum
  9492. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9493. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9494. @end table
  9495. @section showpalette
  9496. Displays the 256 colors palette of each frame. This filter is only relevant for
  9497. @var{pal8} pixel format frames.
  9498. It accepts the following option:
  9499. @table @option
  9500. @item s
  9501. Set the size of the box used to represent one palette color entry. Default is
  9502. @code{30} (for a @code{30x30} pixel box).
  9503. @end table
  9504. @section shuffleframes
  9505. Reorder and/or duplicate and/or drop video frames.
  9506. It accepts the following parameters:
  9507. @table @option
  9508. @item mapping
  9509. Set the destination indexes of input frames.
  9510. This is space or '|' separated list of indexes that maps input frames to output
  9511. frames. Number of indexes also sets maximal value that each index may have.
  9512. '-1' index have special meaning and that is to drop frame.
  9513. @end table
  9514. The first frame has the index 0. The default is to keep the input unchanged.
  9515. @subsection Examples
  9516. @itemize
  9517. @item
  9518. Swap second and third frame of every three frames of the input:
  9519. @example
  9520. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9521. @end example
  9522. @item
  9523. Swap 10th and 1st frame of every ten frames of the input:
  9524. @example
  9525. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9526. @end example
  9527. @end itemize
  9528. @section shuffleplanes
  9529. Reorder and/or duplicate video planes.
  9530. It accepts the following parameters:
  9531. @table @option
  9532. @item map0
  9533. The index of the input plane to be used as the first output plane.
  9534. @item map1
  9535. The index of the input plane to be used as the second output plane.
  9536. @item map2
  9537. The index of the input plane to be used as the third output plane.
  9538. @item map3
  9539. The index of the input plane to be used as the fourth output plane.
  9540. @end table
  9541. The first plane has the index 0. The default is to keep the input unchanged.
  9542. @subsection Examples
  9543. @itemize
  9544. @item
  9545. Swap the second and third planes of the input:
  9546. @example
  9547. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9548. @end example
  9549. @end itemize
  9550. @anchor{signalstats}
  9551. @section signalstats
  9552. Evaluate various visual metrics that assist in determining issues associated
  9553. with the digitization of analog video media.
  9554. By default the filter will log these metadata values:
  9555. @table @option
  9556. @item YMIN
  9557. Display the minimal Y value contained within the input frame. Expressed in
  9558. range of [0-255].
  9559. @item YLOW
  9560. Display the Y value at the 10% percentile within the input frame. Expressed in
  9561. range of [0-255].
  9562. @item YAVG
  9563. Display the average Y value within the input frame. Expressed in range of
  9564. [0-255].
  9565. @item YHIGH
  9566. Display the Y value at the 90% percentile within the input frame. Expressed in
  9567. range of [0-255].
  9568. @item YMAX
  9569. Display the maximum Y value contained within the input frame. Expressed in
  9570. range of [0-255].
  9571. @item UMIN
  9572. Display the minimal U value contained within the input frame. Expressed in
  9573. range of [0-255].
  9574. @item ULOW
  9575. Display the U value at the 10% percentile within the input frame. Expressed in
  9576. range of [0-255].
  9577. @item UAVG
  9578. Display the average U value within the input frame. Expressed in range of
  9579. [0-255].
  9580. @item UHIGH
  9581. Display the U value at the 90% percentile within the input frame. Expressed in
  9582. range of [0-255].
  9583. @item UMAX
  9584. Display the maximum U value contained within the input frame. Expressed in
  9585. range of [0-255].
  9586. @item VMIN
  9587. Display the minimal V value contained within the input frame. Expressed in
  9588. range of [0-255].
  9589. @item VLOW
  9590. Display the V value at the 10% percentile within the input frame. Expressed in
  9591. range of [0-255].
  9592. @item VAVG
  9593. Display the average V value within the input frame. Expressed in range of
  9594. [0-255].
  9595. @item VHIGH
  9596. Display the V value at the 90% percentile within the input frame. Expressed in
  9597. range of [0-255].
  9598. @item VMAX
  9599. Display the maximum V value contained within the input frame. Expressed in
  9600. range of [0-255].
  9601. @item SATMIN
  9602. Display the minimal saturation value contained within the input frame.
  9603. Expressed in range of [0-~181.02].
  9604. @item SATLOW
  9605. Display the saturation value at the 10% percentile within the input frame.
  9606. Expressed in range of [0-~181.02].
  9607. @item SATAVG
  9608. Display the average saturation value within the input frame. Expressed in range
  9609. of [0-~181.02].
  9610. @item SATHIGH
  9611. Display the saturation value at the 90% percentile within the input frame.
  9612. Expressed in range of [0-~181.02].
  9613. @item SATMAX
  9614. Display the maximum saturation value contained within the input frame.
  9615. Expressed in range of [0-~181.02].
  9616. @item HUEMED
  9617. Display the median value for hue within the input frame. Expressed in range of
  9618. [0-360].
  9619. @item HUEAVG
  9620. Display the average value for hue within the input frame. Expressed in range of
  9621. [0-360].
  9622. @item YDIF
  9623. Display the average of sample value difference between all values of the Y
  9624. plane in the current frame and corresponding values of the previous input frame.
  9625. Expressed in range of [0-255].
  9626. @item UDIF
  9627. Display the average of sample value difference between all values of the U
  9628. plane in the current frame and corresponding values of the previous input frame.
  9629. Expressed in range of [0-255].
  9630. @item VDIF
  9631. Display the average of sample value difference between all values of the V
  9632. plane in the current frame and corresponding values of the previous input frame.
  9633. Expressed in range of [0-255].
  9634. @item YBITDEPTH
  9635. Display bit depth of Y plane in current frame.
  9636. Expressed in range of [0-16].
  9637. @item UBITDEPTH
  9638. Display bit depth of U plane in current frame.
  9639. Expressed in range of [0-16].
  9640. @item VBITDEPTH
  9641. Display bit depth of V plane in current frame.
  9642. Expressed in range of [0-16].
  9643. @end table
  9644. The filter accepts the following options:
  9645. @table @option
  9646. @item stat
  9647. @item out
  9648. @option{stat} specify an additional form of image analysis.
  9649. @option{out} output video with the specified type of pixel highlighted.
  9650. Both options accept the following values:
  9651. @table @samp
  9652. @item tout
  9653. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9654. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9655. include the results of video dropouts, head clogs, or tape tracking issues.
  9656. @item vrep
  9657. Identify @var{vertical line repetition}. Vertical line repetition includes
  9658. similar rows of pixels within a frame. In born-digital video vertical line
  9659. repetition is common, but this pattern is uncommon in video digitized from an
  9660. analog source. When it occurs in video that results from the digitization of an
  9661. analog source it can indicate concealment from a dropout compensator.
  9662. @item brng
  9663. Identify pixels that fall outside of legal broadcast range.
  9664. @end table
  9665. @item color, c
  9666. Set the highlight color for the @option{out} option. The default color is
  9667. yellow.
  9668. @end table
  9669. @subsection Examples
  9670. @itemize
  9671. @item
  9672. Output data of various video metrics:
  9673. @example
  9674. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9675. @end example
  9676. @item
  9677. Output specific data about the minimum and maximum values of the Y plane per frame:
  9678. @example
  9679. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9680. @end example
  9681. @item
  9682. Playback video while highlighting pixels that are outside of broadcast range in red.
  9683. @example
  9684. ffplay example.mov -vf signalstats="out=brng:color=red"
  9685. @end example
  9686. @item
  9687. Playback video with signalstats metadata drawn over the frame.
  9688. @example
  9689. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9690. @end example
  9691. The contents of signalstat_drawtext.txt used in the command are:
  9692. @example
  9693. time %@{pts:hms@}
  9694. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9695. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9696. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9697. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9698. @end example
  9699. @end itemize
  9700. @anchor{smartblur}
  9701. @section smartblur
  9702. Blur the input video without impacting the outlines.
  9703. It accepts the following options:
  9704. @table @option
  9705. @item luma_radius, lr
  9706. Set the luma radius. The option value must be a float number in
  9707. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9708. used to blur the image (slower if larger). Default value is 1.0.
  9709. @item luma_strength, ls
  9710. Set the luma strength. The option value must be a float number
  9711. in the range [-1.0,1.0] that configures the blurring. A value included
  9712. in [0.0,1.0] will blur the image whereas a value included in
  9713. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9714. @item luma_threshold, lt
  9715. Set the luma threshold used as a coefficient to determine
  9716. whether a pixel should be blurred or not. The option value must be an
  9717. integer in the range [-30,30]. A value of 0 will filter all the image,
  9718. a value included in [0,30] will filter flat areas and a value included
  9719. in [-30,0] will filter edges. Default value is 0.
  9720. @item chroma_radius, cr
  9721. Set the chroma radius. The option value must be a float number in
  9722. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9723. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  9724. @item chroma_strength, cs
  9725. Set the chroma strength. The option value must be a float number
  9726. in the range [-1.0,1.0] that configures the blurring. A value included
  9727. in [0.0,1.0] will blur the image whereas a value included in
  9728. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  9729. @item chroma_threshold, ct
  9730. Set the chroma threshold used as a coefficient to determine
  9731. whether a pixel should be blurred or not. The option value must be an
  9732. integer in the range [-30,30]. A value of 0 will filter all the image,
  9733. a value included in [0,30] will filter flat areas and a value included
  9734. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  9735. @end table
  9736. If a chroma option is not explicitly set, the corresponding luma value
  9737. is set.
  9738. @section ssim
  9739. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9740. This filter takes in input two input videos, the first input is
  9741. considered the "main" source and is passed unchanged to the
  9742. output. The second input is used as a "reference" video for computing
  9743. the SSIM.
  9744. Both video inputs must have the same resolution and pixel format for
  9745. this filter to work correctly. Also it assumes that both inputs
  9746. have the same number of frames, which are compared one by one.
  9747. The filter stores the calculated SSIM of each frame.
  9748. The description of the accepted parameters follows.
  9749. @table @option
  9750. @item stats_file, f
  9751. If specified the filter will use the named file to save the SSIM of
  9752. each individual frame. When filename equals "-" the data is sent to
  9753. standard output.
  9754. @end table
  9755. The file printed if @var{stats_file} is selected, contains a sequence of
  9756. key/value pairs of the form @var{key}:@var{value} for each compared
  9757. couple of frames.
  9758. A description of each shown parameter follows:
  9759. @table @option
  9760. @item n
  9761. sequential number of the input frame, starting from 1
  9762. @item Y, U, V, R, G, B
  9763. SSIM of the compared frames for the component specified by the suffix.
  9764. @item All
  9765. SSIM of the compared frames for the whole frame.
  9766. @item dB
  9767. Same as above but in dB representation.
  9768. @end table
  9769. For example:
  9770. @example
  9771. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9772. [main][ref] ssim="stats_file=stats.log" [out]
  9773. @end example
  9774. On this example the input file being processed is compared with the
  9775. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9776. is stored in @file{stats.log}.
  9777. Another example with both psnr and ssim at same time:
  9778. @example
  9779. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9780. @end example
  9781. @section stereo3d
  9782. Convert between different stereoscopic image formats.
  9783. The filters accept the following options:
  9784. @table @option
  9785. @item in
  9786. Set stereoscopic image format of input.
  9787. Available values for input image formats are:
  9788. @table @samp
  9789. @item sbsl
  9790. side by side parallel (left eye left, right eye right)
  9791. @item sbsr
  9792. side by side crosseye (right eye left, left eye right)
  9793. @item sbs2l
  9794. side by side parallel with half width resolution
  9795. (left eye left, right eye right)
  9796. @item sbs2r
  9797. side by side crosseye with half width resolution
  9798. (right eye left, left eye right)
  9799. @item abl
  9800. above-below (left eye above, right eye below)
  9801. @item abr
  9802. above-below (right eye above, left eye below)
  9803. @item ab2l
  9804. above-below with half height resolution
  9805. (left eye above, right eye below)
  9806. @item ab2r
  9807. above-below with half height resolution
  9808. (right eye above, left eye below)
  9809. @item al
  9810. alternating frames (left eye first, right eye second)
  9811. @item ar
  9812. alternating frames (right eye first, left eye second)
  9813. @item irl
  9814. interleaved rows (left eye has top row, right eye starts on next row)
  9815. @item irr
  9816. interleaved rows (right eye has top row, left eye starts on next row)
  9817. @item icl
  9818. interleaved columns, left eye first
  9819. @item icr
  9820. interleaved columns, right eye first
  9821. Default value is @samp{sbsl}.
  9822. @end table
  9823. @item out
  9824. Set stereoscopic image format of output.
  9825. @table @samp
  9826. @item sbsl
  9827. side by side parallel (left eye left, right eye right)
  9828. @item sbsr
  9829. side by side crosseye (right eye left, left eye right)
  9830. @item sbs2l
  9831. side by side parallel with half width resolution
  9832. (left eye left, right eye right)
  9833. @item sbs2r
  9834. side by side crosseye with half width resolution
  9835. (right eye left, left eye right)
  9836. @item abl
  9837. above-below (left eye above, right eye below)
  9838. @item abr
  9839. above-below (right eye above, left eye below)
  9840. @item ab2l
  9841. above-below with half height resolution
  9842. (left eye above, right eye below)
  9843. @item ab2r
  9844. above-below with half height resolution
  9845. (right eye above, left eye below)
  9846. @item al
  9847. alternating frames (left eye first, right eye second)
  9848. @item ar
  9849. alternating frames (right eye first, left eye second)
  9850. @item irl
  9851. interleaved rows (left eye has top row, right eye starts on next row)
  9852. @item irr
  9853. interleaved rows (right eye has top row, left eye starts on next row)
  9854. @item arbg
  9855. anaglyph red/blue gray
  9856. (red filter on left eye, blue filter on right eye)
  9857. @item argg
  9858. anaglyph red/green gray
  9859. (red filter on left eye, green filter on right eye)
  9860. @item arcg
  9861. anaglyph red/cyan gray
  9862. (red filter on left eye, cyan filter on right eye)
  9863. @item arch
  9864. anaglyph red/cyan half colored
  9865. (red filter on left eye, cyan filter on right eye)
  9866. @item arcc
  9867. anaglyph red/cyan color
  9868. (red filter on left eye, cyan filter on right eye)
  9869. @item arcd
  9870. anaglyph red/cyan color optimized with the least squares projection of dubois
  9871. (red filter on left eye, cyan filter on right eye)
  9872. @item agmg
  9873. anaglyph green/magenta gray
  9874. (green filter on left eye, magenta filter on right eye)
  9875. @item agmh
  9876. anaglyph green/magenta half colored
  9877. (green filter on left eye, magenta filter on right eye)
  9878. @item agmc
  9879. anaglyph green/magenta colored
  9880. (green filter on left eye, magenta filter on right eye)
  9881. @item agmd
  9882. anaglyph green/magenta color optimized with the least squares projection of dubois
  9883. (green filter on left eye, magenta filter on right eye)
  9884. @item aybg
  9885. anaglyph yellow/blue gray
  9886. (yellow filter on left eye, blue filter on right eye)
  9887. @item aybh
  9888. anaglyph yellow/blue half colored
  9889. (yellow filter on left eye, blue filter on right eye)
  9890. @item aybc
  9891. anaglyph yellow/blue colored
  9892. (yellow filter on left eye, blue filter on right eye)
  9893. @item aybd
  9894. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9895. (yellow filter on left eye, blue filter on right eye)
  9896. @item ml
  9897. mono output (left eye only)
  9898. @item mr
  9899. mono output (right eye only)
  9900. @item chl
  9901. checkerboard, left eye first
  9902. @item chr
  9903. checkerboard, right eye first
  9904. @item icl
  9905. interleaved columns, left eye first
  9906. @item icr
  9907. interleaved columns, right eye first
  9908. @item hdmi
  9909. HDMI frame pack
  9910. @end table
  9911. Default value is @samp{arcd}.
  9912. @end table
  9913. @subsection Examples
  9914. @itemize
  9915. @item
  9916. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9917. @example
  9918. stereo3d=sbsl:aybd
  9919. @end example
  9920. @item
  9921. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9922. @example
  9923. stereo3d=abl:sbsr
  9924. @end example
  9925. @end itemize
  9926. @section streamselect, astreamselect
  9927. Select video or audio streams.
  9928. The filter accepts the following options:
  9929. @table @option
  9930. @item inputs
  9931. Set number of inputs. Default is 2.
  9932. @item map
  9933. Set input indexes to remap to outputs.
  9934. @end table
  9935. @subsection Commands
  9936. The @code{streamselect} and @code{astreamselect} filter supports the following
  9937. commands:
  9938. @table @option
  9939. @item map
  9940. Set input indexes to remap to outputs.
  9941. @end table
  9942. @subsection Examples
  9943. @itemize
  9944. @item
  9945. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9946. @example
  9947. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9948. @end example
  9949. @item
  9950. Same as above, but for audio:
  9951. @example
  9952. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9953. @end example
  9954. @end itemize
  9955. @section sobel
  9956. Apply sobel operator to input video stream.
  9957. The filter accepts the following option:
  9958. @table @option
  9959. @item planes
  9960. Set which planes will be processed, unprocessed planes will be copied.
  9961. By default value 0xf, all planes will be processed.
  9962. @item scale
  9963. Set value which will be multiplied with filtered result.
  9964. @item delta
  9965. Set value which will be added to filtered result.
  9966. @end table
  9967. @anchor{spp}
  9968. @section spp
  9969. Apply a simple postprocessing filter that compresses and decompresses the image
  9970. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9971. and average the results.
  9972. The filter accepts the following options:
  9973. @table @option
  9974. @item quality
  9975. Set quality. This option defines the number of levels for averaging. It accepts
  9976. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9977. effect. A value of @code{6} means the higher quality. For each increment of
  9978. that value the speed drops by a factor of approximately 2. Default value is
  9979. @code{3}.
  9980. @item qp
  9981. Force a constant quantization parameter. If not set, the filter will use the QP
  9982. from the video stream (if available).
  9983. @item mode
  9984. Set thresholding mode. Available modes are:
  9985. @table @samp
  9986. @item hard
  9987. Set hard thresholding (default).
  9988. @item soft
  9989. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9990. @end table
  9991. @item use_bframe_qp
  9992. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9993. option may cause flicker since the B-Frames have often larger QP. Default is
  9994. @code{0} (not enabled).
  9995. @end table
  9996. @anchor{subtitles}
  9997. @section subtitles
  9998. Draw subtitles on top of input video using the libass library.
  9999. To enable compilation of this filter you need to configure FFmpeg with
  10000. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10001. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10002. Alpha) subtitles format.
  10003. The filter accepts the following options:
  10004. @table @option
  10005. @item filename, f
  10006. Set the filename of the subtitle file to read. It must be specified.
  10007. @item original_size
  10008. Specify the size of the original video, the video for which the ASS file
  10009. was composed. For the syntax of this option, check the
  10010. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10011. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10012. correctly scale the fonts if the aspect ratio has been changed.
  10013. @item fontsdir
  10014. Set a directory path containing fonts that can be used by the filter.
  10015. These fonts will be used in addition to whatever the font provider uses.
  10016. @item charenc
  10017. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10018. useful if not UTF-8.
  10019. @item stream_index, si
  10020. Set subtitles stream index. @code{subtitles} filter only.
  10021. @item force_style
  10022. Override default style or script info parameters of the subtitles. It accepts a
  10023. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10024. @end table
  10025. If the first key is not specified, it is assumed that the first value
  10026. specifies the @option{filename}.
  10027. For example, to render the file @file{sub.srt} on top of the input
  10028. video, use the command:
  10029. @example
  10030. subtitles=sub.srt
  10031. @end example
  10032. which is equivalent to:
  10033. @example
  10034. subtitles=filename=sub.srt
  10035. @end example
  10036. To render the default subtitles stream from file @file{video.mkv}, use:
  10037. @example
  10038. subtitles=video.mkv
  10039. @end example
  10040. To render the second subtitles stream from that file, use:
  10041. @example
  10042. subtitles=video.mkv:si=1
  10043. @end example
  10044. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10045. @code{DejaVu Serif}, use:
  10046. @example
  10047. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10048. @end example
  10049. @section super2xsai
  10050. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10051. Interpolate) pixel art scaling algorithm.
  10052. Useful for enlarging pixel art images without reducing sharpness.
  10053. @section swaprect
  10054. Swap two rectangular objects in video.
  10055. This filter accepts the following options:
  10056. @table @option
  10057. @item w
  10058. Set object width.
  10059. @item h
  10060. Set object height.
  10061. @item x1
  10062. Set 1st rect x coordinate.
  10063. @item y1
  10064. Set 1st rect y coordinate.
  10065. @item x2
  10066. Set 2nd rect x coordinate.
  10067. @item y2
  10068. Set 2nd rect y coordinate.
  10069. All expressions are evaluated once for each frame.
  10070. @end table
  10071. The all options are expressions containing the following constants:
  10072. @table @option
  10073. @item w
  10074. @item h
  10075. The input width and height.
  10076. @item a
  10077. same as @var{w} / @var{h}
  10078. @item sar
  10079. input sample aspect ratio
  10080. @item dar
  10081. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10082. @item n
  10083. The number of the input frame, starting from 0.
  10084. @item t
  10085. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10086. @item pos
  10087. the position in the file of the input frame, NAN if unknown
  10088. @end table
  10089. @section swapuv
  10090. Swap U & V plane.
  10091. @section telecine
  10092. Apply telecine process to the video.
  10093. This filter accepts the following options:
  10094. @table @option
  10095. @item first_field
  10096. @table @samp
  10097. @item top, t
  10098. top field first
  10099. @item bottom, b
  10100. bottom field first
  10101. The default value is @code{top}.
  10102. @end table
  10103. @item pattern
  10104. A string of numbers representing the pulldown pattern you wish to apply.
  10105. The default value is @code{23}.
  10106. @end table
  10107. @example
  10108. Some typical patterns:
  10109. NTSC output (30i):
  10110. 27.5p: 32222
  10111. 24p: 23 (classic)
  10112. 24p: 2332 (preferred)
  10113. 20p: 33
  10114. 18p: 334
  10115. 16p: 3444
  10116. PAL output (25i):
  10117. 27.5p: 12222
  10118. 24p: 222222222223 ("Euro pulldown")
  10119. 16.67p: 33
  10120. 16p: 33333334
  10121. @end example
  10122. @section threshold
  10123. Apply threshold effect to video stream.
  10124. This filter needs four video streams to perform thresholding.
  10125. First stream is stream we are filtering.
  10126. Second stream is holding threshold values, third stream is holding min values,
  10127. and last, fourth stream is holding max values.
  10128. The filter accepts the following option:
  10129. @table @option
  10130. @item planes
  10131. Set which planes will be processed, unprocessed planes will be copied.
  10132. By default value 0xf, all planes will be processed.
  10133. @end table
  10134. For example if first stream pixel's component value is less then threshold value
  10135. of pixel component from 2nd threshold stream, third stream value will picked,
  10136. otherwise fourth stream pixel component value will be picked.
  10137. Using color source filter one can perform various types of thresholding:
  10138. @subsection Examples
  10139. @itemize
  10140. @item
  10141. Binary threshold, using gray color as threshold:
  10142. @example
  10143. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10144. @end example
  10145. @item
  10146. Inverted binary threshold, using gray color as threshold:
  10147. @example
  10148. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10149. @end example
  10150. @item
  10151. Truncate binary threshold, using gray color as threshold:
  10152. @example
  10153. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10154. @end example
  10155. @item
  10156. Threshold to zero, using gray color as threshold:
  10157. @example
  10158. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10159. @end example
  10160. @item
  10161. Inverted threshold to zero, using gray color as threshold:
  10162. @example
  10163. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10164. @end example
  10165. @end itemize
  10166. @section thumbnail
  10167. Select the most representative frame in a given sequence of consecutive frames.
  10168. The filter accepts the following options:
  10169. @table @option
  10170. @item n
  10171. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10172. will pick one of them, and then handle the next batch of @var{n} frames until
  10173. the end. Default is @code{100}.
  10174. @end table
  10175. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10176. value will result in a higher memory usage, so a high value is not recommended.
  10177. @subsection Examples
  10178. @itemize
  10179. @item
  10180. Extract one picture each 50 frames:
  10181. @example
  10182. thumbnail=50
  10183. @end example
  10184. @item
  10185. Complete example of a thumbnail creation with @command{ffmpeg}:
  10186. @example
  10187. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10188. @end example
  10189. @end itemize
  10190. @section tile
  10191. Tile several successive frames together.
  10192. The filter accepts the following options:
  10193. @table @option
  10194. @item layout
  10195. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10196. this option, check the
  10197. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10198. @item nb_frames
  10199. Set the maximum number of frames to render in the given area. It must be less
  10200. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10201. the area will be used.
  10202. @item margin
  10203. Set the outer border margin in pixels.
  10204. @item padding
  10205. Set the inner border thickness (i.e. the number of pixels between frames). For
  10206. more advanced padding options (such as having different values for the edges),
  10207. refer to the pad video filter.
  10208. @item color
  10209. Specify the color of the unused area. For the syntax of this option, check the
  10210. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10211. is "black".
  10212. @end table
  10213. @subsection Examples
  10214. @itemize
  10215. @item
  10216. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10217. @example
  10218. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10219. @end example
  10220. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10221. duplicating each output frame to accommodate the originally detected frame
  10222. rate.
  10223. @item
  10224. Display @code{5} pictures in an area of @code{3x2} frames,
  10225. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10226. mixed flat and named options:
  10227. @example
  10228. tile=3x2:nb_frames=5:padding=7:margin=2
  10229. @end example
  10230. @end itemize
  10231. @section tinterlace
  10232. Perform various types of temporal field interlacing.
  10233. Frames are counted starting from 1, so the first input frame is
  10234. considered odd.
  10235. The filter accepts the following options:
  10236. @table @option
  10237. @item mode
  10238. Specify the mode of the interlacing. This option can also be specified
  10239. as a value alone. See below for a list of values for this option.
  10240. Available values are:
  10241. @table @samp
  10242. @item merge, 0
  10243. Move odd frames into the upper field, even into the lower field,
  10244. generating a double height frame at half frame rate.
  10245. @example
  10246. ------> time
  10247. Input:
  10248. Frame 1 Frame 2 Frame 3 Frame 4
  10249. 11111 22222 33333 44444
  10250. 11111 22222 33333 44444
  10251. 11111 22222 33333 44444
  10252. 11111 22222 33333 44444
  10253. Output:
  10254. 11111 33333
  10255. 22222 44444
  10256. 11111 33333
  10257. 22222 44444
  10258. 11111 33333
  10259. 22222 44444
  10260. 11111 33333
  10261. 22222 44444
  10262. @end example
  10263. @item drop_even, 1
  10264. Only output odd frames, even frames are dropped, generating a frame with
  10265. unchanged height at half frame rate.
  10266. @example
  10267. ------> time
  10268. Input:
  10269. Frame 1 Frame 2 Frame 3 Frame 4
  10270. 11111 22222 33333 44444
  10271. 11111 22222 33333 44444
  10272. 11111 22222 33333 44444
  10273. 11111 22222 33333 44444
  10274. Output:
  10275. 11111 33333
  10276. 11111 33333
  10277. 11111 33333
  10278. 11111 33333
  10279. @end example
  10280. @item drop_odd, 2
  10281. Only output even frames, odd frames are dropped, generating a frame with
  10282. unchanged height at half frame rate.
  10283. @example
  10284. ------> time
  10285. Input:
  10286. Frame 1 Frame 2 Frame 3 Frame 4
  10287. 11111 22222 33333 44444
  10288. 11111 22222 33333 44444
  10289. 11111 22222 33333 44444
  10290. 11111 22222 33333 44444
  10291. Output:
  10292. 22222 44444
  10293. 22222 44444
  10294. 22222 44444
  10295. 22222 44444
  10296. @end example
  10297. @item pad, 3
  10298. Expand each frame to full height, but pad alternate lines with black,
  10299. generating a frame with double height at the same input frame rate.
  10300. @example
  10301. ------> time
  10302. Input:
  10303. Frame 1 Frame 2 Frame 3 Frame 4
  10304. 11111 22222 33333 44444
  10305. 11111 22222 33333 44444
  10306. 11111 22222 33333 44444
  10307. 11111 22222 33333 44444
  10308. Output:
  10309. 11111 ..... 33333 .....
  10310. ..... 22222 ..... 44444
  10311. 11111 ..... 33333 .....
  10312. ..... 22222 ..... 44444
  10313. 11111 ..... 33333 .....
  10314. ..... 22222 ..... 44444
  10315. 11111 ..... 33333 .....
  10316. ..... 22222 ..... 44444
  10317. @end example
  10318. @item interleave_top, 4
  10319. Interleave the upper field from odd frames with the lower field from
  10320. even frames, generating a frame with unchanged height at half frame rate.
  10321. @example
  10322. ------> time
  10323. Input:
  10324. Frame 1 Frame 2 Frame 3 Frame 4
  10325. 11111<- 22222 33333<- 44444
  10326. 11111 22222<- 33333 44444<-
  10327. 11111<- 22222 33333<- 44444
  10328. 11111 22222<- 33333 44444<-
  10329. Output:
  10330. 11111 33333
  10331. 22222 44444
  10332. 11111 33333
  10333. 22222 44444
  10334. @end example
  10335. @item interleave_bottom, 5
  10336. Interleave the lower field from odd frames with the upper field from
  10337. even frames, generating a frame with unchanged height at half frame rate.
  10338. @example
  10339. ------> time
  10340. Input:
  10341. Frame 1 Frame 2 Frame 3 Frame 4
  10342. 11111 22222<- 33333 44444<-
  10343. 11111<- 22222 33333<- 44444
  10344. 11111 22222<- 33333 44444<-
  10345. 11111<- 22222 33333<- 44444
  10346. Output:
  10347. 22222 44444
  10348. 11111 33333
  10349. 22222 44444
  10350. 11111 33333
  10351. @end example
  10352. @item interlacex2, 6
  10353. Double frame rate with unchanged height. Frames are inserted each
  10354. containing the second temporal field from the previous input frame and
  10355. the first temporal field from the next input frame. This mode relies on
  10356. the top_field_first flag. Useful for interlaced video displays with no
  10357. field synchronisation.
  10358. @example
  10359. ------> time
  10360. Input:
  10361. Frame 1 Frame 2 Frame 3 Frame 4
  10362. 11111 22222 33333 44444
  10363. 11111 22222 33333 44444
  10364. 11111 22222 33333 44444
  10365. 11111 22222 33333 44444
  10366. Output:
  10367. 11111 22222 22222 33333 33333 44444 44444
  10368. 11111 11111 22222 22222 33333 33333 44444
  10369. 11111 22222 22222 33333 33333 44444 44444
  10370. 11111 11111 22222 22222 33333 33333 44444
  10371. @end example
  10372. @item mergex2, 7
  10373. Move odd frames into the upper field, even into the lower field,
  10374. generating a double height frame at same frame rate.
  10375. @example
  10376. ------> time
  10377. Input:
  10378. Frame 1 Frame 2 Frame 3 Frame 4
  10379. 11111 22222 33333 44444
  10380. 11111 22222 33333 44444
  10381. 11111 22222 33333 44444
  10382. 11111 22222 33333 44444
  10383. Output:
  10384. 11111 33333 33333 55555
  10385. 22222 22222 44444 44444
  10386. 11111 33333 33333 55555
  10387. 22222 22222 44444 44444
  10388. 11111 33333 33333 55555
  10389. 22222 22222 44444 44444
  10390. 11111 33333 33333 55555
  10391. 22222 22222 44444 44444
  10392. @end example
  10393. @end table
  10394. Numeric values are deprecated but are accepted for backward
  10395. compatibility reasons.
  10396. Default mode is @code{merge}.
  10397. @item flags
  10398. Specify flags influencing the filter process.
  10399. Available value for @var{flags} is:
  10400. @table @option
  10401. @item low_pass_filter, vlfp
  10402. Enable vertical low-pass filtering in the filter.
  10403. Vertical low-pass filtering is required when creating an interlaced
  10404. destination from a progressive source which contains high-frequency
  10405. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10406. patterning.
  10407. Vertical low-pass filtering can only be enabled for @option{mode}
  10408. @var{interleave_top} and @var{interleave_bottom}.
  10409. @end table
  10410. @end table
  10411. @section transpose
  10412. Transpose rows with columns in the input video and optionally flip it.
  10413. It accepts the following parameters:
  10414. @table @option
  10415. @item dir
  10416. Specify the transposition direction.
  10417. Can assume the following values:
  10418. @table @samp
  10419. @item 0, 4, cclock_flip
  10420. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10421. @example
  10422. L.R L.l
  10423. . . -> . .
  10424. l.r R.r
  10425. @end example
  10426. @item 1, 5, clock
  10427. Rotate by 90 degrees clockwise, that is:
  10428. @example
  10429. L.R l.L
  10430. . . -> . .
  10431. l.r r.R
  10432. @end example
  10433. @item 2, 6, cclock
  10434. Rotate by 90 degrees counterclockwise, that is:
  10435. @example
  10436. L.R R.r
  10437. . . -> . .
  10438. l.r L.l
  10439. @end example
  10440. @item 3, 7, clock_flip
  10441. Rotate by 90 degrees clockwise and vertically flip, that is:
  10442. @example
  10443. L.R r.R
  10444. . . -> . .
  10445. l.r l.L
  10446. @end example
  10447. @end table
  10448. For values between 4-7, the transposition is only done if the input
  10449. video geometry is portrait and not landscape. These values are
  10450. deprecated, the @code{passthrough} option should be used instead.
  10451. Numerical values are deprecated, and should be dropped in favor of
  10452. symbolic constants.
  10453. @item passthrough
  10454. Do not apply the transposition if the input geometry matches the one
  10455. specified by the specified value. It accepts the following values:
  10456. @table @samp
  10457. @item none
  10458. Always apply transposition.
  10459. @item portrait
  10460. Preserve portrait geometry (when @var{height} >= @var{width}).
  10461. @item landscape
  10462. Preserve landscape geometry (when @var{width} >= @var{height}).
  10463. @end table
  10464. Default value is @code{none}.
  10465. @end table
  10466. For example to rotate by 90 degrees clockwise and preserve portrait
  10467. layout:
  10468. @example
  10469. transpose=dir=1:passthrough=portrait
  10470. @end example
  10471. The command above can also be specified as:
  10472. @example
  10473. transpose=1:portrait
  10474. @end example
  10475. @section trim
  10476. Trim the input so that the output contains one continuous subpart of the input.
  10477. It accepts the following parameters:
  10478. @table @option
  10479. @item start
  10480. Specify the time of the start of the kept section, i.e. the frame with the
  10481. timestamp @var{start} will be the first frame in the output.
  10482. @item end
  10483. Specify the time of the first frame that will be dropped, i.e. the frame
  10484. immediately preceding the one with the timestamp @var{end} will be the last
  10485. frame in the output.
  10486. @item start_pts
  10487. This is the same as @var{start}, except this option sets the start timestamp
  10488. in timebase units instead of seconds.
  10489. @item end_pts
  10490. This is the same as @var{end}, except this option sets the end timestamp
  10491. in timebase units instead of seconds.
  10492. @item duration
  10493. The maximum duration of the output in seconds.
  10494. @item start_frame
  10495. The number of the first frame that should be passed to the output.
  10496. @item end_frame
  10497. The number of the first frame that should be dropped.
  10498. @end table
  10499. @option{start}, @option{end}, and @option{duration} are expressed as time
  10500. duration specifications; see
  10501. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10502. for the accepted syntax.
  10503. Note that the first two sets of the start/end options and the @option{duration}
  10504. option look at the frame timestamp, while the _frame variants simply count the
  10505. frames that pass through the filter. Also note that this filter does not modify
  10506. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10507. setpts filter after the trim filter.
  10508. If multiple start or end options are set, this filter tries to be greedy and
  10509. keep all the frames that match at least one of the specified constraints. To keep
  10510. only the part that matches all the constraints at once, chain multiple trim
  10511. filters.
  10512. The defaults are such that all the input is kept. So it is possible to set e.g.
  10513. just the end values to keep everything before the specified time.
  10514. Examples:
  10515. @itemize
  10516. @item
  10517. Drop everything except the second minute of input:
  10518. @example
  10519. ffmpeg -i INPUT -vf trim=60:120
  10520. @end example
  10521. @item
  10522. Keep only the first second:
  10523. @example
  10524. ffmpeg -i INPUT -vf trim=duration=1
  10525. @end example
  10526. @end itemize
  10527. @anchor{unsharp}
  10528. @section unsharp
  10529. Sharpen or blur the input video.
  10530. It accepts the following parameters:
  10531. @table @option
  10532. @item luma_msize_x, lx
  10533. Set the luma matrix horizontal size. It must be an odd integer between
  10534. 3 and 23. The default value is 5.
  10535. @item luma_msize_y, ly
  10536. Set the luma matrix vertical size. It must be an odd integer between 3
  10537. and 23. The default value is 5.
  10538. @item luma_amount, la
  10539. Set the luma effect strength. It must be a floating point number, reasonable
  10540. values lay between -1.5 and 1.5.
  10541. Negative values will blur the input video, while positive values will
  10542. sharpen it, a value of zero will disable the effect.
  10543. Default value is 1.0.
  10544. @item chroma_msize_x, cx
  10545. Set the chroma matrix horizontal size. It must be an odd integer
  10546. between 3 and 23. The default value is 5.
  10547. @item chroma_msize_y, cy
  10548. Set the chroma matrix vertical size. It must be an odd integer
  10549. between 3 and 23. The default value is 5.
  10550. @item chroma_amount, ca
  10551. Set the chroma effect strength. It must be a floating point number, reasonable
  10552. values lay between -1.5 and 1.5.
  10553. Negative values will blur the input video, while positive values will
  10554. sharpen it, a value of zero will disable the effect.
  10555. Default value is 0.0.
  10556. @item opencl
  10557. If set to 1, specify using OpenCL capabilities, only available if
  10558. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10559. @end table
  10560. All parameters are optional and default to the equivalent of the
  10561. string '5:5:1.0:5:5:0.0'.
  10562. @subsection Examples
  10563. @itemize
  10564. @item
  10565. Apply strong luma sharpen effect:
  10566. @example
  10567. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10568. @end example
  10569. @item
  10570. Apply a strong blur of both luma and chroma parameters:
  10571. @example
  10572. unsharp=7:7:-2:7:7:-2
  10573. @end example
  10574. @end itemize
  10575. @section uspp
  10576. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10577. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10578. shifts and average the results.
  10579. The way this differs from the behavior of spp is that uspp actually encodes &
  10580. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10581. DCT similar to MJPEG.
  10582. The filter accepts the following options:
  10583. @table @option
  10584. @item quality
  10585. Set quality. This option defines the number of levels for averaging. It accepts
  10586. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10587. effect. A value of @code{8} means the higher quality. For each increment of
  10588. that value the speed drops by a factor of approximately 2. Default value is
  10589. @code{3}.
  10590. @item qp
  10591. Force a constant quantization parameter. If not set, the filter will use the QP
  10592. from the video stream (if available).
  10593. @end table
  10594. @section vaguedenoiser
  10595. Apply a wavelet based denoiser.
  10596. It transforms each frame from the video input into the wavelet domain,
  10597. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10598. the obtained coefficients. It does an inverse wavelet transform after.
  10599. Due to wavelet properties, it should give a nice smoothed result, and
  10600. reduced noise, without blurring picture features.
  10601. This filter accepts the following options:
  10602. @table @option
  10603. @item threshold
  10604. The filtering strength. The higher, the more filtered the video will be.
  10605. Hard thresholding can use a higher threshold than soft thresholding
  10606. before the video looks overfiltered.
  10607. @item method
  10608. The filtering method the filter will use.
  10609. It accepts the following values:
  10610. @table @samp
  10611. @item hard
  10612. All values under the threshold will be zeroed.
  10613. @item soft
  10614. All values under the threshold will be zeroed. All values above will be
  10615. reduced by the threshold.
  10616. @item garrote
  10617. Scales or nullifies coefficients - intermediary between (more) soft and
  10618. (less) hard thresholding.
  10619. @end table
  10620. @item nsteps
  10621. Number of times, the wavelet will decompose the picture. Picture can't
  10622. be decomposed beyond a particular point (typically, 8 for a 640x480
  10623. frame - as 2^9 = 512 > 480)
  10624. @item percent
  10625. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10626. @item planes
  10627. A list of the planes to process. By default all planes are processed.
  10628. @end table
  10629. @section vectorscope
  10630. Display 2 color component values in the two dimensional graph (which is called
  10631. a vectorscope).
  10632. This filter accepts the following options:
  10633. @table @option
  10634. @item mode, m
  10635. Set vectorscope mode.
  10636. It accepts the following values:
  10637. @table @samp
  10638. @item gray
  10639. Gray values are displayed on graph, higher brightness means more pixels have
  10640. same component color value on location in graph. This is the default mode.
  10641. @item color
  10642. Gray values are displayed on graph. Surrounding pixels values which are not
  10643. present in video frame are drawn in gradient of 2 color components which are
  10644. set by option @code{x} and @code{y}. The 3rd color component is static.
  10645. @item color2
  10646. Actual color components values present in video frame are displayed on graph.
  10647. @item color3
  10648. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10649. on graph increases value of another color component, which is luminance by
  10650. default values of @code{x} and @code{y}.
  10651. @item color4
  10652. Actual colors present in video frame are displayed on graph. If two different
  10653. colors map to same position on graph then color with higher value of component
  10654. not present in graph is picked.
  10655. @item color5
  10656. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10657. component picked from radial gradient.
  10658. @end table
  10659. @item x
  10660. Set which color component will be represented on X-axis. Default is @code{1}.
  10661. @item y
  10662. Set which color component will be represented on Y-axis. Default is @code{2}.
  10663. @item intensity, i
  10664. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10665. of color component which represents frequency of (X, Y) location in graph.
  10666. @item envelope, e
  10667. @table @samp
  10668. @item none
  10669. No envelope, this is default.
  10670. @item instant
  10671. Instant envelope, even darkest single pixel will be clearly highlighted.
  10672. @item peak
  10673. Hold maximum and minimum values presented in graph over time. This way you
  10674. can still spot out of range values without constantly looking at vectorscope.
  10675. @item peak+instant
  10676. Peak and instant envelope combined together.
  10677. @end table
  10678. @item graticule, g
  10679. Set what kind of graticule to draw.
  10680. @table @samp
  10681. @item none
  10682. @item green
  10683. @item color
  10684. @end table
  10685. @item opacity, o
  10686. Set graticule opacity.
  10687. @item flags, f
  10688. Set graticule flags.
  10689. @table @samp
  10690. @item white
  10691. Draw graticule for white point.
  10692. @item black
  10693. Draw graticule for black point.
  10694. @item name
  10695. Draw color points short names.
  10696. @end table
  10697. @item bgopacity, b
  10698. Set background opacity.
  10699. @item lthreshold, l
  10700. Set low threshold for color component not represented on X or Y axis.
  10701. Values lower than this value will be ignored. Default is 0.
  10702. Note this value is multiplied with actual max possible value one pixel component
  10703. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10704. is 0.1 * 255 = 25.
  10705. @item hthreshold, h
  10706. Set high threshold for color component not represented on X or Y axis.
  10707. Values higher than this value will be ignored. Default is 1.
  10708. Note this value is multiplied with actual max possible value one pixel component
  10709. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10710. is 0.9 * 255 = 230.
  10711. @item colorspace, c
  10712. Set what kind of colorspace to use when drawing graticule.
  10713. @table @samp
  10714. @item auto
  10715. @item 601
  10716. @item 709
  10717. @end table
  10718. Default is auto.
  10719. @end table
  10720. @anchor{vidstabdetect}
  10721. @section vidstabdetect
  10722. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10723. @ref{vidstabtransform} for pass 2.
  10724. This filter generates a file with relative translation and rotation
  10725. transform information about subsequent frames, which is then used by
  10726. the @ref{vidstabtransform} filter.
  10727. To enable compilation of this filter you need to configure FFmpeg with
  10728. @code{--enable-libvidstab}.
  10729. This filter accepts the following options:
  10730. @table @option
  10731. @item result
  10732. Set the path to the file used to write the transforms information.
  10733. Default value is @file{transforms.trf}.
  10734. @item shakiness
  10735. Set how shaky the video is and how quick the camera is. It accepts an
  10736. integer in the range 1-10, a value of 1 means little shakiness, a
  10737. value of 10 means strong shakiness. Default value is 5.
  10738. @item accuracy
  10739. Set the accuracy of the detection process. It must be a value in the
  10740. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10741. accuracy. Default value is 15.
  10742. @item stepsize
  10743. Set stepsize of the search process. The region around minimum is
  10744. scanned with 1 pixel resolution. Default value is 6.
  10745. @item mincontrast
  10746. Set minimum contrast. Below this value a local measurement field is
  10747. discarded. Must be a floating point value in the range 0-1. Default
  10748. value is 0.3.
  10749. @item tripod
  10750. Set reference frame number for tripod mode.
  10751. If enabled, the motion of the frames is compared to a reference frame
  10752. in the filtered stream, identified by the specified number. The idea
  10753. is to compensate all movements in a more-or-less static scene and keep
  10754. the camera view absolutely still.
  10755. If set to 0, it is disabled. The frames are counted starting from 1.
  10756. @item show
  10757. Show fields and transforms in the resulting frames. It accepts an
  10758. integer in the range 0-2. Default value is 0, which disables any
  10759. visualization.
  10760. @end table
  10761. @subsection Examples
  10762. @itemize
  10763. @item
  10764. Use default values:
  10765. @example
  10766. vidstabdetect
  10767. @end example
  10768. @item
  10769. Analyze strongly shaky movie and put the results in file
  10770. @file{mytransforms.trf}:
  10771. @example
  10772. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10773. @end example
  10774. @item
  10775. Visualize the result of internal transformations in the resulting
  10776. video:
  10777. @example
  10778. vidstabdetect=show=1
  10779. @end example
  10780. @item
  10781. Analyze a video with medium shakiness using @command{ffmpeg}:
  10782. @example
  10783. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10784. @end example
  10785. @end itemize
  10786. @anchor{vidstabtransform}
  10787. @section vidstabtransform
  10788. Video stabilization/deshaking: pass 2 of 2,
  10789. see @ref{vidstabdetect} for pass 1.
  10790. Read a file with transform information for each frame and
  10791. apply/compensate them. Together with the @ref{vidstabdetect}
  10792. filter this can be used to deshake videos. See also
  10793. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10794. the @ref{unsharp} filter, see below.
  10795. To enable compilation of this filter you need to configure FFmpeg with
  10796. @code{--enable-libvidstab}.
  10797. @subsection Options
  10798. @table @option
  10799. @item input
  10800. Set path to the file used to read the transforms. Default value is
  10801. @file{transforms.trf}.
  10802. @item smoothing
  10803. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10804. camera movements. Default value is 10.
  10805. For example a number of 10 means that 21 frames are used (10 in the
  10806. past and 10 in the future) to smoothen the motion in the video. A
  10807. larger value leads to a smoother video, but limits the acceleration of
  10808. the camera (pan/tilt movements). 0 is a special case where a static
  10809. camera is simulated.
  10810. @item optalgo
  10811. Set the camera path optimization algorithm.
  10812. Accepted values are:
  10813. @table @samp
  10814. @item gauss
  10815. gaussian kernel low-pass filter on camera motion (default)
  10816. @item avg
  10817. averaging on transformations
  10818. @end table
  10819. @item maxshift
  10820. Set maximal number of pixels to translate frames. Default value is -1,
  10821. meaning no limit.
  10822. @item maxangle
  10823. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10824. value is -1, meaning no limit.
  10825. @item crop
  10826. Specify how to deal with borders that may be visible due to movement
  10827. compensation.
  10828. Available values are:
  10829. @table @samp
  10830. @item keep
  10831. keep image information from previous frame (default)
  10832. @item black
  10833. fill the border black
  10834. @end table
  10835. @item invert
  10836. Invert transforms if set to 1. Default value is 0.
  10837. @item relative
  10838. Consider transforms as relative to previous frame if set to 1,
  10839. absolute if set to 0. Default value is 0.
  10840. @item zoom
  10841. Set percentage to zoom. A positive value will result in a zoom-in
  10842. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10843. zoom).
  10844. @item optzoom
  10845. Set optimal zooming to avoid borders.
  10846. Accepted values are:
  10847. @table @samp
  10848. @item 0
  10849. disabled
  10850. @item 1
  10851. optimal static zoom value is determined (only very strong movements
  10852. will lead to visible borders) (default)
  10853. @item 2
  10854. optimal adaptive zoom value is determined (no borders will be
  10855. visible), see @option{zoomspeed}
  10856. @end table
  10857. Note that the value given at zoom is added to the one calculated here.
  10858. @item zoomspeed
  10859. Set percent to zoom maximally each frame (enabled when
  10860. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10861. 0.25.
  10862. @item interpol
  10863. Specify type of interpolation.
  10864. Available values are:
  10865. @table @samp
  10866. @item no
  10867. no interpolation
  10868. @item linear
  10869. linear only horizontal
  10870. @item bilinear
  10871. linear in both directions (default)
  10872. @item bicubic
  10873. cubic in both directions (slow)
  10874. @end table
  10875. @item tripod
  10876. Enable virtual tripod mode if set to 1, which is equivalent to
  10877. @code{relative=0:smoothing=0}. Default value is 0.
  10878. Use also @code{tripod} option of @ref{vidstabdetect}.
  10879. @item debug
  10880. Increase log verbosity if set to 1. Also the detected global motions
  10881. are written to the temporary file @file{global_motions.trf}. Default
  10882. value is 0.
  10883. @end table
  10884. @subsection Examples
  10885. @itemize
  10886. @item
  10887. Use @command{ffmpeg} for a typical stabilization with default values:
  10888. @example
  10889. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10890. @end example
  10891. Note the use of the @ref{unsharp} filter which is always recommended.
  10892. @item
  10893. Zoom in a bit more and load transform data from a given file:
  10894. @example
  10895. vidstabtransform=zoom=5:input="mytransforms.trf"
  10896. @end example
  10897. @item
  10898. Smoothen the video even more:
  10899. @example
  10900. vidstabtransform=smoothing=30
  10901. @end example
  10902. @end itemize
  10903. @section vflip
  10904. Flip the input video vertically.
  10905. For example, to vertically flip a video with @command{ffmpeg}:
  10906. @example
  10907. ffmpeg -i in.avi -vf "vflip" out.avi
  10908. @end example
  10909. @anchor{vignette}
  10910. @section vignette
  10911. Make or reverse a natural vignetting effect.
  10912. The filter accepts the following options:
  10913. @table @option
  10914. @item angle, a
  10915. Set lens angle expression as a number of radians.
  10916. The value is clipped in the @code{[0,PI/2]} range.
  10917. Default value: @code{"PI/5"}
  10918. @item x0
  10919. @item y0
  10920. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10921. by default.
  10922. @item mode
  10923. Set forward/backward mode.
  10924. Available modes are:
  10925. @table @samp
  10926. @item forward
  10927. The larger the distance from the central point, the darker the image becomes.
  10928. @item backward
  10929. The larger the distance from the central point, the brighter the image becomes.
  10930. This can be used to reverse a vignette effect, though there is no automatic
  10931. detection to extract the lens @option{angle} and other settings (yet). It can
  10932. also be used to create a burning effect.
  10933. @end table
  10934. Default value is @samp{forward}.
  10935. @item eval
  10936. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10937. It accepts the following values:
  10938. @table @samp
  10939. @item init
  10940. Evaluate expressions only once during the filter initialization.
  10941. @item frame
  10942. Evaluate expressions for each incoming frame. This is way slower than the
  10943. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10944. allows advanced dynamic expressions.
  10945. @end table
  10946. Default value is @samp{init}.
  10947. @item dither
  10948. Set dithering to reduce the circular banding effects. Default is @code{1}
  10949. (enabled).
  10950. @item aspect
  10951. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10952. Setting this value to the SAR of the input will make a rectangular vignetting
  10953. following the dimensions of the video.
  10954. Default is @code{1/1}.
  10955. @end table
  10956. @subsection Expressions
  10957. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10958. following parameters.
  10959. @table @option
  10960. @item w
  10961. @item h
  10962. input width and height
  10963. @item n
  10964. the number of input frame, starting from 0
  10965. @item pts
  10966. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10967. @var{TB} units, NAN if undefined
  10968. @item r
  10969. frame rate of the input video, NAN if the input frame rate is unknown
  10970. @item t
  10971. the PTS (Presentation TimeStamp) of the filtered video frame,
  10972. expressed in seconds, NAN if undefined
  10973. @item tb
  10974. time base of the input video
  10975. @end table
  10976. @subsection Examples
  10977. @itemize
  10978. @item
  10979. Apply simple strong vignetting effect:
  10980. @example
  10981. vignette=PI/4
  10982. @end example
  10983. @item
  10984. Make a flickering vignetting:
  10985. @example
  10986. vignette='PI/4+random(1)*PI/50':eval=frame
  10987. @end example
  10988. @end itemize
  10989. @section vstack
  10990. Stack input videos vertically.
  10991. All streams must be of same pixel format and of same width.
  10992. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10993. to create same output.
  10994. The filter accept the following option:
  10995. @table @option
  10996. @item inputs
  10997. Set number of input streams. Default is 2.
  10998. @item shortest
  10999. If set to 1, force the output to terminate when the shortest input
  11000. terminates. Default value is 0.
  11001. @end table
  11002. @section w3fdif
  11003. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11004. Deinterlacing Filter").
  11005. Based on the process described by Martin Weston for BBC R&D, and
  11006. implemented based on the de-interlace algorithm written by Jim
  11007. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11008. uses filter coefficients calculated by BBC R&D.
  11009. There are two sets of filter coefficients, so called "simple":
  11010. and "complex". Which set of filter coefficients is used can
  11011. be set by passing an optional parameter:
  11012. @table @option
  11013. @item filter
  11014. Set the interlacing filter coefficients. Accepts one of the following values:
  11015. @table @samp
  11016. @item simple
  11017. Simple filter coefficient set.
  11018. @item complex
  11019. More-complex filter coefficient set.
  11020. @end table
  11021. Default value is @samp{complex}.
  11022. @item deint
  11023. Specify which frames to deinterlace. Accept one of the following values:
  11024. @table @samp
  11025. @item all
  11026. Deinterlace all frames,
  11027. @item interlaced
  11028. Only deinterlace frames marked as interlaced.
  11029. @end table
  11030. Default value is @samp{all}.
  11031. @end table
  11032. @section waveform
  11033. Video waveform monitor.
  11034. The waveform monitor plots color component intensity. By default luminance
  11035. only. Each column of the waveform corresponds to a column of pixels in the
  11036. source video.
  11037. It accepts the following options:
  11038. @table @option
  11039. @item mode, m
  11040. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11041. In row mode, the graph on the left side represents color component value 0 and
  11042. the right side represents value = 255. In column mode, the top side represents
  11043. color component value = 0 and bottom side represents value = 255.
  11044. @item intensity, i
  11045. Set intensity. Smaller values are useful to find out how many values of the same
  11046. luminance are distributed across input rows/columns.
  11047. Default value is @code{0.04}. Allowed range is [0, 1].
  11048. @item mirror, r
  11049. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11050. In mirrored mode, higher values will be represented on the left
  11051. side for @code{row} mode and at the top for @code{column} mode. Default is
  11052. @code{1} (mirrored).
  11053. @item display, d
  11054. Set display mode.
  11055. It accepts the following values:
  11056. @table @samp
  11057. @item overlay
  11058. Presents information identical to that in the @code{parade}, except
  11059. that the graphs representing color components are superimposed directly
  11060. over one another.
  11061. This display mode makes it easier to spot relative differences or similarities
  11062. in overlapping areas of the color components that are supposed to be identical,
  11063. such as neutral whites, grays, or blacks.
  11064. @item stack
  11065. Display separate graph for the color components side by side in
  11066. @code{row} mode or one below the other in @code{column} mode.
  11067. @item parade
  11068. Display separate graph for the color components side by side in
  11069. @code{column} mode or one below the other in @code{row} mode.
  11070. Using this display mode makes it easy to spot color casts in the highlights
  11071. and shadows of an image, by comparing the contours of the top and the bottom
  11072. graphs of each waveform. Since whites, grays, and blacks are characterized
  11073. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11074. should display three waveforms of roughly equal width/height. If not, the
  11075. correction is easy to perform by making level adjustments the three waveforms.
  11076. @end table
  11077. Default is @code{stack}.
  11078. @item components, c
  11079. Set which color components to display. Default is 1, which means only luminance
  11080. or red color component if input is in RGB colorspace. If is set for example to
  11081. 7 it will display all 3 (if) available color components.
  11082. @item envelope, e
  11083. @table @samp
  11084. @item none
  11085. No envelope, this is default.
  11086. @item instant
  11087. Instant envelope, minimum and maximum values presented in graph will be easily
  11088. visible even with small @code{step} value.
  11089. @item peak
  11090. Hold minimum and maximum values presented in graph across time. This way you
  11091. can still spot out of range values without constantly looking at waveforms.
  11092. @item peak+instant
  11093. Peak and instant envelope combined together.
  11094. @end table
  11095. @item filter, f
  11096. @table @samp
  11097. @item lowpass
  11098. No filtering, this is default.
  11099. @item flat
  11100. Luma and chroma combined together.
  11101. @item aflat
  11102. Similar as above, but shows difference between blue and red chroma.
  11103. @item chroma
  11104. Displays only chroma.
  11105. @item color
  11106. Displays actual color value on waveform.
  11107. @item acolor
  11108. Similar as above, but with luma showing frequency of chroma values.
  11109. @end table
  11110. @item graticule, g
  11111. Set which graticule to display.
  11112. @table @samp
  11113. @item none
  11114. Do not display graticule.
  11115. @item green
  11116. Display green graticule showing legal broadcast ranges.
  11117. @end table
  11118. @item opacity, o
  11119. Set graticule opacity.
  11120. @item flags, fl
  11121. Set graticule flags.
  11122. @table @samp
  11123. @item numbers
  11124. Draw numbers above lines. By default enabled.
  11125. @item dots
  11126. Draw dots instead of lines.
  11127. @end table
  11128. @item scale, s
  11129. Set scale used for displaying graticule.
  11130. @table @samp
  11131. @item digital
  11132. @item millivolts
  11133. @item ire
  11134. @end table
  11135. Default is digital.
  11136. @item bgopacity, b
  11137. Set background opacity.
  11138. @end table
  11139. @section weave
  11140. The @code{weave} takes a field-based video input and join
  11141. each two sequential fields into single frame, producing a new double
  11142. height clip with half the frame rate and half the frame count.
  11143. It accepts the following option:
  11144. @table @option
  11145. @item first_field
  11146. Set first field. Available values are:
  11147. @table @samp
  11148. @item top, t
  11149. Set the frame as top-field-first.
  11150. @item bottom, b
  11151. Set the frame as bottom-field-first.
  11152. @end table
  11153. @end table
  11154. @subsection Examples
  11155. @itemize
  11156. @item
  11157. Interlace video using @ref{select} and @ref{separatefields} filter:
  11158. @example
  11159. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11160. @end example
  11161. @end itemize
  11162. @section xbr
  11163. Apply the xBR high-quality magnification filter which is designed for pixel
  11164. art. It follows a set of edge-detection rules, see
  11165. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11166. It accepts the following option:
  11167. @table @option
  11168. @item n
  11169. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11170. @code{3xBR} and @code{4} for @code{4xBR}.
  11171. Default is @code{3}.
  11172. @end table
  11173. @anchor{yadif}
  11174. @section yadif
  11175. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11176. filter").
  11177. It accepts the following parameters:
  11178. @table @option
  11179. @item mode
  11180. The interlacing mode to adopt. It accepts one of the following values:
  11181. @table @option
  11182. @item 0, send_frame
  11183. Output one frame for each frame.
  11184. @item 1, send_field
  11185. Output one frame for each field.
  11186. @item 2, send_frame_nospatial
  11187. Like @code{send_frame}, but it skips the spatial interlacing check.
  11188. @item 3, send_field_nospatial
  11189. Like @code{send_field}, but it skips the spatial interlacing check.
  11190. @end table
  11191. The default value is @code{send_frame}.
  11192. @item parity
  11193. The picture field parity assumed for the input interlaced video. It accepts one
  11194. of the following values:
  11195. @table @option
  11196. @item 0, tff
  11197. Assume the top field is first.
  11198. @item 1, bff
  11199. Assume the bottom field is first.
  11200. @item -1, auto
  11201. Enable automatic detection of field parity.
  11202. @end table
  11203. The default value is @code{auto}.
  11204. If the interlacing is unknown or the decoder does not export this information,
  11205. top field first will be assumed.
  11206. @item deint
  11207. Specify which frames to deinterlace. Accept one of the following
  11208. values:
  11209. @table @option
  11210. @item 0, all
  11211. Deinterlace all frames.
  11212. @item 1, interlaced
  11213. Only deinterlace frames marked as interlaced.
  11214. @end table
  11215. The default value is @code{all}.
  11216. @end table
  11217. @section zoompan
  11218. Apply Zoom & Pan effect.
  11219. This filter accepts the following options:
  11220. @table @option
  11221. @item zoom, z
  11222. Set the zoom expression. Default is 1.
  11223. @item x
  11224. @item y
  11225. Set the x and y expression. Default is 0.
  11226. @item d
  11227. Set the duration expression in number of frames.
  11228. This sets for how many number of frames effect will last for
  11229. single input image.
  11230. @item s
  11231. Set the output image size, default is 'hd720'.
  11232. @item fps
  11233. Set the output frame rate, default is '25'.
  11234. @end table
  11235. Each expression can contain the following constants:
  11236. @table @option
  11237. @item in_w, iw
  11238. Input width.
  11239. @item in_h, ih
  11240. Input height.
  11241. @item out_w, ow
  11242. Output width.
  11243. @item out_h, oh
  11244. Output height.
  11245. @item in
  11246. Input frame count.
  11247. @item on
  11248. Output frame count.
  11249. @item x
  11250. @item y
  11251. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11252. for current input frame.
  11253. @item px
  11254. @item py
  11255. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11256. not yet such frame (first input frame).
  11257. @item zoom
  11258. Last calculated zoom from 'z' expression for current input frame.
  11259. @item pzoom
  11260. Last calculated zoom of last output frame of previous input frame.
  11261. @item duration
  11262. Number of output frames for current input frame. Calculated from 'd' expression
  11263. for each input frame.
  11264. @item pduration
  11265. number of output frames created for previous input frame
  11266. @item a
  11267. Rational number: input width / input height
  11268. @item sar
  11269. sample aspect ratio
  11270. @item dar
  11271. display aspect ratio
  11272. @end table
  11273. @subsection Examples
  11274. @itemize
  11275. @item
  11276. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11277. @example
  11278. 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
  11279. @end example
  11280. @item
  11281. Zoom-in up to 1.5 and pan always at center of picture:
  11282. @example
  11283. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11284. @end example
  11285. @item
  11286. Same as above but without pausing:
  11287. @example
  11288. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11289. @end example
  11290. @end itemize
  11291. @section zscale
  11292. Scale (resize) the input video, using the z.lib library:
  11293. https://github.com/sekrit-twc/zimg.
  11294. The zscale filter forces the output display aspect ratio to be the same
  11295. as the input, by changing the output sample aspect ratio.
  11296. If the input image format is different from the format requested by
  11297. the next filter, the zscale filter will convert the input to the
  11298. requested format.
  11299. @subsection Options
  11300. The filter accepts the following options.
  11301. @table @option
  11302. @item width, w
  11303. @item height, h
  11304. Set the output video dimension expression. Default value is the input
  11305. dimension.
  11306. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11307. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11308. If one of the values is -1, the zscale filter will use a value that
  11309. maintains the aspect ratio of the input image, calculated from the
  11310. other specified dimension. If both of them are -1, the input size is
  11311. used
  11312. If one of the values is -n with n > 1, the zscale filter will also use a value
  11313. that maintains the aspect ratio of the input image, calculated from the other
  11314. specified dimension. After that it will, however, make sure that the calculated
  11315. dimension is divisible by n and adjust the value if necessary.
  11316. See below for the list of accepted constants for use in the dimension
  11317. expression.
  11318. @item size, s
  11319. Set the video size. For the syntax of this option, check the
  11320. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11321. @item dither, d
  11322. Set the dither type.
  11323. Possible values are:
  11324. @table @var
  11325. @item none
  11326. @item ordered
  11327. @item random
  11328. @item error_diffusion
  11329. @end table
  11330. Default is none.
  11331. @item filter, f
  11332. Set the resize filter type.
  11333. Possible values are:
  11334. @table @var
  11335. @item point
  11336. @item bilinear
  11337. @item bicubic
  11338. @item spline16
  11339. @item spline36
  11340. @item lanczos
  11341. @end table
  11342. Default is bilinear.
  11343. @item range, r
  11344. Set the color range.
  11345. Possible values are:
  11346. @table @var
  11347. @item input
  11348. @item limited
  11349. @item full
  11350. @end table
  11351. Default is same as input.
  11352. @item primaries, p
  11353. Set the color primaries.
  11354. Possible values are:
  11355. @table @var
  11356. @item input
  11357. @item 709
  11358. @item unspecified
  11359. @item 170m
  11360. @item 240m
  11361. @item 2020
  11362. @end table
  11363. Default is same as input.
  11364. @item transfer, t
  11365. Set the transfer characteristics.
  11366. Possible values are:
  11367. @table @var
  11368. @item input
  11369. @item 709
  11370. @item unspecified
  11371. @item 601
  11372. @item linear
  11373. @item 2020_10
  11374. @item 2020_12
  11375. @item smpte2084
  11376. @item iec61966-2-1
  11377. @item arib-std-b67
  11378. @end table
  11379. Default is same as input.
  11380. @item matrix, m
  11381. Set the colorspace matrix.
  11382. Possible value are:
  11383. @table @var
  11384. @item input
  11385. @item 709
  11386. @item unspecified
  11387. @item 470bg
  11388. @item 170m
  11389. @item 2020_ncl
  11390. @item 2020_cl
  11391. @end table
  11392. Default is same as input.
  11393. @item rangein, rin
  11394. Set the input color range.
  11395. Possible values are:
  11396. @table @var
  11397. @item input
  11398. @item limited
  11399. @item full
  11400. @end table
  11401. Default is same as input.
  11402. @item primariesin, pin
  11403. Set the input color primaries.
  11404. Possible values are:
  11405. @table @var
  11406. @item input
  11407. @item 709
  11408. @item unspecified
  11409. @item 170m
  11410. @item 240m
  11411. @item 2020
  11412. @end table
  11413. Default is same as input.
  11414. @item transferin, tin
  11415. Set the input transfer characteristics.
  11416. Possible values are:
  11417. @table @var
  11418. @item input
  11419. @item 709
  11420. @item unspecified
  11421. @item 601
  11422. @item linear
  11423. @item 2020_10
  11424. @item 2020_12
  11425. @end table
  11426. Default is same as input.
  11427. @item matrixin, min
  11428. Set the input colorspace matrix.
  11429. Possible value are:
  11430. @table @var
  11431. @item input
  11432. @item 709
  11433. @item unspecified
  11434. @item 470bg
  11435. @item 170m
  11436. @item 2020_ncl
  11437. @item 2020_cl
  11438. @end table
  11439. @item chromal, c
  11440. Set the output chroma location.
  11441. Possible values are:
  11442. @table @var
  11443. @item input
  11444. @item left
  11445. @item center
  11446. @item topleft
  11447. @item top
  11448. @item bottomleft
  11449. @item bottom
  11450. @end table
  11451. @item chromalin, cin
  11452. Set the input chroma location.
  11453. Possible values are:
  11454. @table @var
  11455. @item input
  11456. @item left
  11457. @item center
  11458. @item topleft
  11459. @item top
  11460. @item bottomleft
  11461. @item bottom
  11462. @end table
  11463. @item npl
  11464. Set the nominal peak luminance.
  11465. @end table
  11466. The values of the @option{w} and @option{h} options are expressions
  11467. containing the following constants:
  11468. @table @var
  11469. @item in_w
  11470. @item in_h
  11471. The input width and height
  11472. @item iw
  11473. @item ih
  11474. These are the same as @var{in_w} and @var{in_h}.
  11475. @item out_w
  11476. @item out_h
  11477. The output (scaled) width and height
  11478. @item ow
  11479. @item oh
  11480. These are the same as @var{out_w} and @var{out_h}
  11481. @item a
  11482. The same as @var{iw} / @var{ih}
  11483. @item sar
  11484. input sample aspect ratio
  11485. @item dar
  11486. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11487. @item hsub
  11488. @item vsub
  11489. horizontal and vertical input chroma subsample values. For example for the
  11490. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11491. @item ohsub
  11492. @item ovsub
  11493. horizontal and vertical output chroma subsample values. For example for the
  11494. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11495. @end table
  11496. @table @option
  11497. @end table
  11498. @c man end VIDEO FILTERS
  11499. @chapter Video Sources
  11500. @c man begin VIDEO SOURCES
  11501. Below is a description of the currently available video sources.
  11502. @section buffer
  11503. Buffer video frames, and make them available to the filter chain.
  11504. This source is mainly intended for a programmatic use, in particular
  11505. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11506. It accepts the following parameters:
  11507. @table @option
  11508. @item video_size
  11509. Specify the size (width and height) of the buffered video frames. For the
  11510. syntax of this option, check the
  11511. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11512. @item width
  11513. The input video width.
  11514. @item height
  11515. The input video height.
  11516. @item pix_fmt
  11517. A string representing the pixel format of the buffered video frames.
  11518. It may be a number corresponding to a pixel format, or a pixel format
  11519. name.
  11520. @item time_base
  11521. Specify the timebase assumed by the timestamps of the buffered frames.
  11522. @item frame_rate
  11523. Specify the frame rate expected for the video stream.
  11524. @item pixel_aspect, sar
  11525. The sample (pixel) aspect ratio of the input video.
  11526. @item sws_param
  11527. Specify the optional parameters to be used for the scale filter which
  11528. is automatically inserted when an input change is detected in the
  11529. input size or format.
  11530. @item hw_frames_ctx
  11531. When using a hardware pixel format, this should be a reference to an
  11532. AVHWFramesContext describing input frames.
  11533. @end table
  11534. For example:
  11535. @example
  11536. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11537. @end example
  11538. will instruct the source to accept video frames with size 320x240 and
  11539. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11540. square pixels (1:1 sample aspect ratio).
  11541. Since the pixel format with name "yuv410p" corresponds to the number 6
  11542. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11543. this example corresponds to:
  11544. @example
  11545. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11546. @end example
  11547. Alternatively, the options can be specified as a flat string, but this
  11548. syntax is deprecated:
  11549. @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}]
  11550. @section cellauto
  11551. Create a pattern generated by an elementary cellular automaton.
  11552. The initial state of the cellular automaton can be defined through the
  11553. @option{filename} and @option{pattern} options. If such options are
  11554. not specified an initial state is created randomly.
  11555. At each new frame a new row in the video is filled with the result of
  11556. the cellular automaton next generation. The behavior when the whole
  11557. frame is filled is defined by the @option{scroll} option.
  11558. This source accepts the following options:
  11559. @table @option
  11560. @item filename, f
  11561. Read the initial cellular automaton state, i.e. the starting row, from
  11562. the specified file.
  11563. In the file, each non-whitespace character is considered an alive
  11564. cell, a newline will terminate the row, and further characters in the
  11565. file will be ignored.
  11566. @item pattern, p
  11567. Read the initial cellular automaton state, i.e. the starting row, from
  11568. the specified string.
  11569. Each non-whitespace character in the string is considered an alive
  11570. cell, a newline will terminate the row, and further characters in the
  11571. string will be ignored.
  11572. @item rate, r
  11573. Set the video rate, that is the number of frames generated per second.
  11574. Default is 25.
  11575. @item random_fill_ratio, ratio
  11576. Set the random fill ratio for the initial cellular automaton row. It
  11577. is a floating point number value ranging from 0 to 1, defaults to
  11578. 1/PHI.
  11579. This option is ignored when a file or a pattern is specified.
  11580. @item random_seed, seed
  11581. Set the seed for filling randomly the initial row, must be an integer
  11582. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11583. set to -1, the filter will try to use a good random seed on a best
  11584. effort basis.
  11585. @item rule
  11586. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11587. Default value is 110.
  11588. @item size, s
  11589. Set the size of the output video. For the syntax of this option, check the
  11590. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11591. If @option{filename} or @option{pattern} is specified, the size is set
  11592. by default to the width of the specified initial state row, and the
  11593. height is set to @var{width} * PHI.
  11594. If @option{size} is set, it must contain the width of the specified
  11595. pattern string, and the specified pattern will be centered in the
  11596. larger row.
  11597. If a filename or a pattern string is not specified, the size value
  11598. defaults to "320x518" (used for a randomly generated initial state).
  11599. @item scroll
  11600. If set to 1, scroll the output upward when all the rows in the output
  11601. have been already filled. If set to 0, the new generated row will be
  11602. written over the top row just after the bottom row is filled.
  11603. Defaults to 1.
  11604. @item start_full, full
  11605. If set to 1, completely fill the output with generated rows before
  11606. outputting the first frame.
  11607. This is the default behavior, for disabling set the value to 0.
  11608. @item stitch
  11609. If set to 1, stitch the left and right row edges together.
  11610. This is the default behavior, for disabling set the value to 0.
  11611. @end table
  11612. @subsection Examples
  11613. @itemize
  11614. @item
  11615. Read the initial state from @file{pattern}, and specify an output of
  11616. size 200x400.
  11617. @example
  11618. cellauto=f=pattern:s=200x400
  11619. @end example
  11620. @item
  11621. Generate a random initial row with a width of 200 cells, with a fill
  11622. ratio of 2/3:
  11623. @example
  11624. cellauto=ratio=2/3:s=200x200
  11625. @end example
  11626. @item
  11627. Create a pattern generated by rule 18 starting by a single alive cell
  11628. centered on an initial row with width 100:
  11629. @example
  11630. cellauto=p=@@:s=100x400:full=0:rule=18
  11631. @end example
  11632. @item
  11633. Specify a more elaborated initial pattern:
  11634. @example
  11635. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11636. @end example
  11637. @end itemize
  11638. @anchor{coreimagesrc}
  11639. @section coreimagesrc
  11640. Video source generated on GPU using Apple's CoreImage API on OSX.
  11641. This video source is a specialized version of the @ref{coreimage} video filter.
  11642. Use a core image generator at the beginning of the applied filterchain to
  11643. generate the content.
  11644. The coreimagesrc video source accepts the following options:
  11645. @table @option
  11646. @item list_generators
  11647. List all available generators along with all their respective options as well as
  11648. possible minimum and maximum values along with the default values.
  11649. @example
  11650. list_generators=true
  11651. @end example
  11652. @item size, s
  11653. Specify the size of the sourced video. For the syntax of this option, check the
  11654. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11655. The default value is @code{320x240}.
  11656. @item rate, r
  11657. Specify the frame rate of the sourced video, as the number of frames
  11658. generated per second. It has to be a string in the format
  11659. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11660. number or a valid video frame rate abbreviation. The default value is
  11661. "25".
  11662. @item sar
  11663. Set the sample aspect ratio of the sourced video.
  11664. @item duration, d
  11665. Set the duration of the sourced video. See
  11666. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11667. for the accepted syntax.
  11668. If not specified, or the expressed duration is negative, the video is
  11669. supposed to be generated forever.
  11670. @end table
  11671. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11672. A complete filterchain can be used for further processing of the
  11673. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11674. and examples for details.
  11675. @subsection Examples
  11676. @itemize
  11677. @item
  11678. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11679. given as complete and escaped command-line for Apple's standard bash shell:
  11680. @example
  11681. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11682. @end example
  11683. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11684. need for a nullsrc video source.
  11685. @end itemize
  11686. @section mandelbrot
  11687. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11688. point specified with @var{start_x} and @var{start_y}.
  11689. This source accepts the following options:
  11690. @table @option
  11691. @item end_pts
  11692. Set the terminal pts value. Default value is 400.
  11693. @item end_scale
  11694. Set the terminal scale value.
  11695. Must be a floating point value. Default value is 0.3.
  11696. @item inner
  11697. Set the inner coloring mode, that is the algorithm used to draw the
  11698. Mandelbrot fractal internal region.
  11699. It shall assume one of the following values:
  11700. @table @option
  11701. @item black
  11702. Set black mode.
  11703. @item convergence
  11704. Show time until convergence.
  11705. @item mincol
  11706. Set color based on point closest to the origin of the iterations.
  11707. @item period
  11708. Set period mode.
  11709. @end table
  11710. Default value is @var{mincol}.
  11711. @item bailout
  11712. Set the bailout value. Default value is 10.0.
  11713. @item maxiter
  11714. Set the maximum of iterations performed by the rendering
  11715. algorithm. Default value is 7189.
  11716. @item outer
  11717. Set outer coloring mode.
  11718. It shall assume one of following values:
  11719. @table @option
  11720. @item iteration_count
  11721. Set iteration cound mode.
  11722. @item normalized_iteration_count
  11723. set normalized iteration count mode.
  11724. @end table
  11725. Default value is @var{normalized_iteration_count}.
  11726. @item rate, r
  11727. Set frame rate, expressed as number of frames per second. Default
  11728. value is "25".
  11729. @item size, s
  11730. Set frame size. For the syntax of this option, check the "Video
  11731. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11732. @item start_scale
  11733. Set the initial scale value. Default value is 3.0.
  11734. @item start_x
  11735. Set the initial x position. Must be a floating point value between
  11736. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11737. @item start_y
  11738. Set the initial y position. Must be a floating point value between
  11739. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11740. @end table
  11741. @section mptestsrc
  11742. Generate various test patterns, as generated by the MPlayer test filter.
  11743. The size of the generated video is fixed, and is 256x256.
  11744. This source is useful in particular for testing encoding features.
  11745. This source accepts the following options:
  11746. @table @option
  11747. @item rate, r
  11748. Specify the frame rate of the sourced video, as the number of frames
  11749. generated per second. It has to be a string in the format
  11750. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11751. number or a valid video frame rate abbreviation. The default value is
  11752. "25".
  11753. @item duration, d
  11754. Set the duration of the sourced video. See
  11755. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11756. for the accepted syntax.
  11757. If not specified, or the expressed duration is negative, the video is
  11758. supposed to be generated forever.
  11759. @item test, t
  11760. Set the number or the name of the test to perform. Supported tests are:
  11761. @table @option
  11762. @item dc_luma
  11763. @item dc_chroma
  11764. @item freq_luma
  11765. @item freq_chroma
  11766. @item amp_luma
  11767. @item amp_chroma
  11768. @item cbp
  11769. @item mv
  11770. @item ring1
  11771. @item ring2
  11772. @item all
  11773. @end table
  11774. Default value is "all", which will cycle through the list of all tests.
  11775. @end table
  11776. Some examples:
  11777. @example
  11778. mptestsrc=t=dc_luma
  11779. @end example
  11780. will generate a "dc_luma" test pattern.
  11781. @section frei0r_src
  11782. Provide a frei0r source.
  11783. To enable compilation of this filter you need to install the frei0r
  11784. header and configure FFmpeg with @code{--enable-frei0r}.
  11785. This source accepts the following parameters:
  11786. @table @option
  11787. @item size
  11788. The size of the video to generate. For the syntax of this option, check the
  11789. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11790. @item framerate
  11791. The framerate of the generated video. It may be a string of the form
  11792. @var{num}/@var{den} or a frame rate abbreviation.
  11793. @item filter_name
  11794. The name to the frei0r source to load. For more information regarding frei0r and
  11795. how to set the parameters, read the @ref{frei0r} section in the video filters
  11796. documentation.
  11797. @item filter_params
  11798. A '|'-separated list of parameters to pass to the frei0r source.
  11799. @end table
  11800. For example, to generate a frei0r partik0l source with size 200x200
  11801. and frame rate 10 which is overlaid on the overlay filter main input:
  11802. @example
  11803. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11804. @end example
  11805. @section life
  11806. Generate a life pattern.
  11807. This source is based on a generalization of John Conway's life game.
  11808. The sourced input represents a life grid, each pixel represents a cell
  11809. which can be in one of two possible states, alive or dead. Every cell
  11810. interacts with its eight neighbours, which are the cells that are
  11811. horizontally, vertically, or diagonally adjacent.
  11812. At each interaction the grid evolves according to the adopted rule,
  11813. which specifies the number of neighbor alive cells which will make a
  11814. cell stay alive or born. The @option{rule} option allows one to specify
  11815. the rule to adopt.
  11816. This source accepts the following options:
  11817. @table @option
  11818. @item filename, f
  11819. Set the file from which to read the initial grid state. In the file,
  11820. each non-whitespace character is considered an alive cell, and newline
  11821. is used to delimit the end of each row.
  11822. If this option is not specified, the initial grid is generated
  11823. randomly.
  11824. @item rate, r
  11825. Set the video rate, that is the number of frames generated per second.
  11826. Default is 25.
  11827. @item random_fill_ratio, ratio
  11828. Set the random fill ratio for the initial random grid. It is a
  11829. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11830. It is ignored when a file is specified.
  11831. @item random_seed, seed
  11832. Set the seed for filling the initial random grid, must be an integer
  11833. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11834. set to -1, the filter will try to use a good random seed on a best
  11835. effort basis.
  11836. @item rule
  11837. Set the life rule.
  11838. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11839. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11840. @var{NS} specifies the number of alive neighbor cells which make a
  11841. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11842. which make a dead cell to become alive (i.e. to "born").
  11843. "s" and "b" can be used in place of "S" and "B", respectively.
  11844. Alternatively a rule can be specified by an 18-bits integer. The 9
  11845. high order bits are used to encode the next cell state if it is alive
  11846. for each number of neighbor alive cells, the low order bits specify
  11847. the rule for "borning" new cells. Higher order bits encode for an
  11848. higher number of neighbor cells.
  11849. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11850. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11851. Default value is "S23/B3", which is the original Conway's game of life
  11852. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11853. cells, and will born a new cell if there are three alive cells around
  11854. a dead cell.
  11855. @item size, s
  11856. Set the size of the output video. For the syntax of this option, check the
  11857. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11858. If @option{filename} is specified, the size is set by default to the
  11859. same size of the input file. If @option{size} is set, it must contain
  11860. the size specified in the input file, and the initial grid defined in
  11861. that file is centered in the larger resulting area.
  11862. If a filename is not specified, the size value defaults to "320x240"
  11863. (used for a randomly generated initial grid).
  11864. @item stitch
  11865. If set to 1, stitch the left and right grid edges together, and the
  11866. top and bottom edges also. Defaults to 1.
  11867. @item mold
  11868. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11869. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11870. value from 0 to 255.
  11871. @item life_color
  11872. Set the color of living (or new born) cells.
  11873. @item death_color
  11874. Set the color of dead cells. If @option{mold} is set, this is the first color
  11875. used to represent a dead cell.
  11876. @item mold_color
  11877. Set mold color, for definitely dead and moldy cells.
  11878. For the syntax of these 3 color options, check the "Color" section in the
  11879. ffmpeg-utils manual.
  11880. @end table
  11881. @subsection Examples
  11882. @itemize
  11883. @item
  11884. Read a grid from @file{pattern}, and center it on a grid of size
  11885. 300x300 pixels:
  11886. @example
  11887. life=f=pattern:s=300x300
  11888. @end example
  11889. @item
  11890. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11891. @example
  11892. life=ratio=2/3:s=200x200
  11893. @end example
  11894. @item
  11895. Specify a custom rule for evolving a randomly generated grid:
  11896. @example
  11897. life=rule=S14/B34
  11898. @end example
  11899. @item
  11900. Full example with slow death effect (mold) using @command{ffplay}:
  11901. @example
  11902. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11903. @end example
  11904. @end itemize
  11905. @anchor{allrgb}
  11906. @anchor{allyuv}
  11907. @anchor{color}
  11908. @anchor{haldclutsrc}
  11909. @anchor{nullsrc}
  11910. @anchor{rgbtestsrc}
  11911. @anchor{smptebars}
  11912. @anchor{smptehdbars}
  11913. @anchor{testsrc}
  11914. @anchor{testsrc2}
  11915. @anchor{yuvtestsrc}
  11916. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11917. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11918. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11919. The @code{color} source provides an uniformly colored input.
  11920. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11921. @ref{haldclut} filter.
  11922. The @code{nullsrc} source returns unprocessed video frames. It is
  11923. mainly useful to be employed in analysis / debugging tools, or as the
  11924. source for filters which ignore the input data.
  11925. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11926. detecting RGB vs BGR issues. You should see a red, green and blue
  11927. stripe from top to bottom.
  11928. The @code{smptebars} source generates a color bars pattern, based on
  11929. the SMPTE Engineering Guideline EG 1-1990.
  11930. The @code{smptehdbars} source generates a color bars pattern, based on
  11931. the SMPTE RP 219-2002.
  11932. The @code{testsrc} source generates a test video pattern, showing a
  11933. color pattern, a scrolling gradient and a timestamp. This is mainly
  11934. intended for testing purposes.
  11935. The @code{testsrc2} source is similar to testsrc, but supports more
  11936. pixel formats instead of just @code{rgb24}. This allows using it as an
  11937. input for other tests without requiring a format conversion.
  11938. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11939. see a y, cb and cr stripe from top to bottom.
  11940. The sources accept the following parameters:
  11941. @table @option
  11942. @item color, c
  11943. Specify the color of the source, only available in the @code{color}
  11944. source. For the syntax of this option, check the "Color" section in the
  11945. ffmpeg-utils manual.
  11946. @item level
  11947. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11948. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11949. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11950. coded on a @code{1/(N*N)} scale.
  11951. @item size, s
  11952. Specify the size of the sourced video. For the syntax of this option, check the
  11953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11954. The default value is @code{320x240}.
  11955. This option is not available with the @code{haldclutsrc} filter.
  11956. @item rate, r
  11957. Specify the frame rate of the sourced video, as the number of frames
  11958. generated per second. It has to be a string in the format
  11959. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11960. number or a valid video frame rate abbreviation. The default value is
  11961. "25".
  11962. @item sar
  11963. Set the sample aspect ratio of the sourced video.
  11964. @item duration, d
  11965. Set the duration of the sourced video. See
  11966. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11967. for the accepted syntax.
  11968. If not specified, or the expressed duration is negative, the video is
  11969. supposed to be generated forever.
  11970. @item decimals, n
  11971. Set the number of decimals to show in the timestamp, only available in the
  11972. @code{testsrc} source.
  11973. The displayed timestamp value will correspond to the original
  11974. timestamp value multiplied by the power of 10 of the specified
  11975. value. Default value is 0.
  11976. @end table
  11977. For example the following:
  11978. @example
  11979. testsrc=duration=5.3:size=qcif:rate=10
  11980. @end example
  11981. will generate a video with a duration of 5.3 seconds, with size
  11982. 176x144 and a frame rate of 10 frames per second.
  11983. The following graph description will generate a red source
  11984. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11985. frames per second.
  11986. @example
  11987. color=c=red@@0.2:s=qcif:r=10
  11988. @end example
  11989. If the input content is to be ignored, @code{nullsrc} can be used. The
  11990. following command generates noise in the luminance plane by employing
  11991. the @code{geq} filter:
  11992. @example
  11993. nullsrc=s=256x256, geq=random(1)*255:128:128
  11994. @end example
  11995. @subsection Commands
  11996. The @code{color} source supports the following commands:
  11997. @table @option
  11998. @item c, color
  11999. Set the color of the created image. Accepts the same syntax of the
  12000. corresponding @option{color} option.
  12001. @end table
  12002. @c man end VIDEO SOURCES
  12003. @chapter Video Sinks
  12004. @c man begin VIDEO SINKS
  12005. Below is a description of the currently available video sinks.
  12006. @section buffersink
  12007. Buffer video frames, and make them available to the end of the filter
  12008. graph.
  12009. This sink is mainly intended for programmatic use, in particular
  12010. through the interface defined in @file{libavfilter/buffersink.h}
  12011. or the options system.
  12012. It accepts a pointer to an AVBufferSinkContext structure, which
  12013. defines the incoming buffers' formats, to be passed as the opaque
  12014. parameter to @code{avfilter_init_filter} for initialization.
  12015. @section nullsink
  12016. Null video sink: do absolutely nothing with the input video. It is
  12017. mainly useful as a template and for use in analysis / debugging
  12018. tools.
  12019. @c man end VIDEO SINKS
  12020. @chapter Multimedia Filters
  12021. @c man begin MULTIMEDIA FILTERS
  12022. Below is a description of the currently available multimedia filters.
  12023. @section abitscope
  12024. Convert input audio to a video output, displaying the audio bit scope.
  12025. The filter accepts the following options:
  12026. @table @option
  12027. @item rate, r
  12028. Set frame rate, expressed as number of frames per second. Default
  12029. value is "25".
  12030. @item size, s
  12031. Specify the video size for the output. For the syntax of this option, check the
  12032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12033. Default value is @code{1024x256}.
  12034. @item colors
  12035. Specify list of colors separated by space or by '|' which will be used to
  12036. draw channels. Unrecognized or missing colors will be replaced
  12037. by white color.
  12038. @end table
  12039. @section ahistogram
  12040. Convert input audio to a video output, displaying the volume histogram.
  12041. The filter accepts the following options:
  12042. @table @option
  12043. @item dmode
  12044. Specify how histogram is calculated.
  12045. It accepts the following values:
  12046. @table @samp
  12047. @item single
  12048. Use single histogram for all channels.
  12049. @item separate
  12050. Use separate histogram for each channel.
  12051. @end table
  12052. Default is @code{single}.
  12053. @item rate, r
  12054. Set frame rate, expressed as number of frames per second. Default
  12055. value is "25".
  12056. @item size, s
  12057. Specify the video size for the output. For the syntax of this option, check the
  12058. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12059. Default value is @code{hd720}.
  12060. @item scale
  12061. Set display scale.
  12062. It accepts the following values:
  12063. @table @samp
  12064. @item log
  12065. logarithmic
  12066. @item sqrt
  12067. square root
  12068. @item cbrt
  12069. cubic root
  12070. @item lin
  12071. linear
  12072. @item rlog
  12073. reverse logarithmic
  12074. @end table
  12075. Default is @code{log}.
  12076. @item ascale
  12077. Set amplitude scale.
  12078. It accepts the following values:
  12079. @table @samp
  12080. @item log
  12081. logarithmic
  12082. @item lin
  12083. linear
  12084. @end table
  12085. Default is @code{log}.
  12086. @item acount
  12087. Set how much frames to accumulate in histogram.
  12088. Defauls is 1. Setting this to -1 accumulates all frames.
  12089. @item rheight
  12090. Set histogram ratio of window height.
  12091. @item slide
  12092. Set sonogram sliding.
  12093. It accepts the following values:
  12094. @table @samp
  12095. @item replace
  12096. replace old rows with new ones.
  12097. @item scroll
  12098. scroll from top to bottom.
  12099. @end table
  12100. Default is @code{replace}.
  12101. @end table
  12102. @section aphasemeter
  12103. Convert input audio to a video output, displaying the audio phase.
  12104. The filter accepts the following options:
  12105. @table @option
  12106. @item rate, r
  12107. Set the output frame rate. Default value is @code{25}.
  12108. @item size, s
  12109. Set the video size for the output. For the syntax of this option, check the
  12110. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12111. Default value is @code{800x400}.
  12112. @item rc
  12113. @item gc
  12114. @item bc
  12115. Specify the red, green, blue contrast. Default values are @code{2},
  12116. @code{7} and @code{1}.
  12117. Allowed range is @code{[0, 255]}.
  12118. @item mpc
  12119. Set color which will be used for drawing median phase. If color is
  12120. @code{none} which is default, no median phase value will be drawn.
  12121. @item video
  12122. Enable video output. Default is enabled.
  12123. @end table
  12124. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12125. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12126. The @code{-1} means left and right channels are completely out of phase and
  12127. @code{1} means channels are in phase.
  12128. @section avectorscope
  12129. Convert input audio to a video output, representing the audio vector
  12130. scope.
  12131. The filter is used to measure the difference between channels of stereo
  12132. audio stream. A monoaural signal, consisting of identical left and right
  12133. signal, results in straight vertical line. Any stereo separation is visible
  12134. as a deviation from this line, creating a Lissajous figure.
  12135. If the straight (or deviation from it) but horizontal line appears this
  12136. indicates that the left and right channels are out of phase.
  12137. The filter accepts the following options:
  12138. @table @option
  12139. @item mode, m
  12140. Set the vectorscope mode.
  12141. Available values are:
  12142. @table @samp
  12143. @item lissajous
  12144. Lissajous rotated by 45 degrees.
  12145. @item lissajous_xy
  12146. Same as above but not rotated.
  12147. @item polar
  12148. Shape resembling half of circle.
  12149. @end table
  12150. Default value is @samp{lissajous}.
  12151. @item size, s
  12152. Set the video size for the output. For the syntax of this option, check the
  12153. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12154. Default value is @code{400x400}.
  12155. @item rate, r
  12156. Set the output frame rate. Default value is @code{25}.
  12157. @item rc
  12158. @item gc
  12159. @item bc
  12160. @item ac
  12161. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12162. @code{160}, @code{80} and @code{255}.
  12163. Allowed range is @code{[0, 255]}.
  12164. @item rf
  12165. @item gf
  12166. @item bf
  12167. @item af
  12168. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12169. @code{10}, @code{5} and @code{5}.
  12170. Allowed range is @code{[0, 255]}.
  12171. @item zoom
  12172. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12173. @item draw
  12174. Set the vectorscope drawing mode.
  12175. Available values are:
  12176. @table @samp
  12177. @item dot
  12178. Draw dot for each sample.
  12179. @item line
  12180. Draw line between previous and current sample.
  12181. @end table
  12182. Default value is @samp{dot}.
  12183. @item scale
  12184. Specify amplitude scale of audio samples.
  12185. Available values are:
  12186. @table @samp
  12187. @item lin
  12188. Linear.
  12189. @item sqrt
  12190. Square root.
  12191. @item cbrt
  12192. Cubic root.
  12193. @item log
  12194. Logarithmic.
  12195. @end table
  12196. @end table
  12197. @subsection Examples
  12198. @itemize
  12199. @item
  12200. Complete example using @command{ffplay}:
  12201. @example
  12202. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12203. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12204. @end example
  12205. @end itemize
  12206. @section bench, abench
  12207. Benchmark part of a filtergraph.
  12208. The filter accepts the following options:
  12209. @table @option
  12210. @item action
  12211. Start or stop a timer.
  12212. Available values are:
  12213. @table @samp
  12214. @item start
  12215. Get the current time, set it as frame metadata (using the key
  12216. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12217. @item stop
  12218. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12219. the input frame metadata to get the time difference. Time difference, average,
  12220. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12221. @code{min}) are then printed. The timestamps are expressed in seconds.
  12222. @end table
  12223. @end table
  12224. @subsection Examples
  12225. @itemize
  12226. @item
  12227. Benchmark @ref{selectivecolor} filter:
  12228. @example
  12229. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12230. @end example
  12231. @end itemize
  12232. @section concat
  12233. Concatenate audio and video streams, joining them together one after the
  12234. other.
  12235. The filter works on segments of synchronized video and audio streams. All
  12236. segments must have the same number of streams of each type, and that will
  12237. also be the number of streams at output.
  12238. The filter accepts the following options:
  12239. @table @option
  12240. @item n
  12241. Set the number of segments. Default is 2.
  12242. @item v
  12243. Set the number of output video streams, that is also the number of video
  12244. streams in each segment. Default is 1.
  12245. @item a
  12246. Set the number of output audio streams, that is also the number of audio
  12247. streams in each segment. Default is 0.
  12248. @item unsafe
  12249. Activate unsafe mode: do not fail if segments have a different format.
  12250. @end table
  12251. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12252. @var{a} audio outputs.
  12253. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12254. segment, in the same order as the outputs, then the inputs for the second
  12255. segment, etc.
  12256. Related streams do not always have exactly the same duration, for various
  12257. reasons including codec frame size or sloppy authoring. For that reason,
  12258. related synchronized streams (e.g. a video and its audio track) should be
  12259. concatenated at once. The concat filter will use the duration of the longest
  12260. stream in each segment (except the last one), and if necessary pad shorter
  12261. audio streams with silence.
  12262. For this filter to work correctly, all segments must start at timestamp 0.
  12263. All corresponding streams must have the same parameters in all segments; the
  12264. filtering system will automatically select a common pixel format for video
  12265. streams, and a common sample format, sample rate and channel layout for
  12266. audio streams, but other settings, such as resolution, must be converted
  12267. explicitly by the user.
  12268. Different frame rates are acceptable but will result in variable frame rate
  12269. at output; be sure to configure the output file to handle it.
  12270. @subsection Examples
  12271. @itemize
  12272. @item
  12273. Concatenate an opening, an episode and an ending, all in bilingual version
  12274. (video in stream 0, audio in streams 1 and 2):
  12275. @example
  12276. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12277. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12278. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12279. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12280. @end example
  12281. @item
  12282. Concatenate two parts, handling audio and video separately, using the
  12283. (a)movie sources, and adjusting the resolution:
  12284. @example
  12285. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12286. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12287. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12288. @end example
  12289. Note that a desync will happen at the stitch if the audio and video streams
  12290. do not have exactly the same duration in the first file.
  12291. @end itemize
  12292. @section drawgraph, adrawgraph
  12293. Draw a graph using input video or audio metadata.
  12294. It accepts the following parameters:
  12295. @table @option
  12296. @item m1
  12297. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12298. @item fg1
  12299. Set 1st foreground color expression.
  12300. @item m2
  12301. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12302. @item fg2
  12303. Set 2nd foreground color expression.
  12304. @item m3
  12305. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12306. @item fg3
  12307. Set 3rd foreground color expression.
  12308. @item m4
  12309. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12310. @item fg4
  12311. Set 4th foreground color expression.
  12312. @item min
  12313. Set minimal value of metadata value.
  12314. @item max
  12315. Set maximal value of metadata value.
  12316. @item bg
  12317. Set graph background color. Default is white.
  12318. @item mode
  12319. Set graph mode.
  12320. Available values for mode is:
  12321. @table @samp
  12322. @item bar
  12323. @item dot
  12324. @item line
  12325. @end table
  12326. Default is @code{line}.
  12327. @item slide
  12328. Set slide mode.
  12329. Available values for slide is:
  12330. @table @samp
  12331. @item frame
  12332. Draw new frame when right border is reached.
  12333. @item replace
  12334. Replace old columns with new ones.
  12335. @item scroll
  12336. Scroll from right to left.
  12337. @item rscroll
  12338. Scroll from left to right.
  12339. @item picture
  12340. Draw single picture.
  12341. @end table
  12342. Default is @code{frame}.
  12343. @item size
  12344. Set size of graph video. For the syntax of this option, check the
  12345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12346. The default value is @code{900x256}.
  12347. The foreground color expressions can use the following variables:
  12348. @table @option
  12349. @item MIN
  12350. Minimal value of metadata value.
  12351. @item MAX
  12352. Maximal value of metadata value.
  12353. @item VAL
  12354. Current metadata key value.
  12355. @end table
  12356. The color is defined as 0xAABBGGRR.
  12357. @end table
  12358. Example using metadata from @ref{signalstats} filter:
  12359. @example
  12360. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12361. @end example
  12362. Example using metadata from @ref{ebur128} filter:
  12363. @example
  12364. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12365. @end example
  12366. @anchor{ebur128}
  12367. @section ebur128
  12368. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12369. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12370. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12371. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12372. The filter also has a video output (see the @var{video} option) with a real
  12373. time graph to observe the loudness evolution. The graphic contains the logged
  12374. message mentioned above, so it is not printed anymore when this option is set,
  12375. unless the verbose logging is set. The main graphing area contains the
  12376. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12377. the momentary loudness (400 milliseconds).
  12378. More information about the Loudness Recommendation EBU R128 on
  12379. @url{http://tech.ebu.ch/loudness}.
  12380. The filter accepts the following options:
  12381. @table @option
  12382. @item video
  12383. Activate the video output. The audio stream is passed unchanged whether this
  12384. option is set or no. The video stream will be the first output stream if
  12385. activated. Default is @code{0}.
  12386. @item size
  12387. Set the video size. This option is for video only. For the syntax of this
  12388. option, check the
  12389. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12390. Default and minimum resolution is @code{640x480}.
  12391. @item meter
  12392. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12393. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12394. other integer value between this range is allowed.
  12395. @item metadata
  12396. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12397. into 100ms output frames, each of them containing various loudness information
  12398. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12399. Default is @code{0}.
  12400. @item framelog
  12401. Force the frame logging level.
  12402. Available values are:
  12403. @table @samp
  12404. @item info
  12405. information logging level
  12406. @item verbose
  12407. verbose logging level
  12408. @end table
  12409. By default, the logging level is set to @var{info}. If the @option{video} or
  12410. the @option{metadata} options are set, it switches to @var{verbose}.
  12411. @item peak
  12412. Set peak mode(s).
  12413. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12414. values are:
  12415. @table @samp
  12416. @item none
  12417. Disable any peak mode (default).
  12418. @item sample
  12419. Enable sample-peak mode.
  12420. Simple peak mode looking for the higher sample value. It logs a message
  12421. for sample-peak (identified by @code{SPK}).
  12422. @item true
  12423. Enable true-peak mode.
  12424. If enabled, the peak lookup is done on an over-sampled version of the input
  12425. stream for better peak accuracy. It logs a message for true-peak.
  12426. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12427. This mode requires a build with @code{libswresample}.
  12428. @end table
  12429. @item dualmono
  12430. Treat mono input files as "dual mono". If a mono file is intended for playback
  12431. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12432. If set to @code{true}, this option will compensate for this effect.
  12433. Multi-channel input files are not affected by this option.
  12434. @item panlaw
  12435. Set a specific pan law to be used for the measurement of dual mono files.
  12436. This parameter is optional, and has a default value of -3.01dB.
  12437. @end table
  12438. @subsection Examples
  12439. @itemize
  12440. @item
  12441. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12442. @example
  12443. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12444. @end example
  12445. @item
  12446. Run an analysis with @command{ffmpeg}:
  12447. @example
  12448. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12449. @end example
  12450. @end itemize
  12451. @section interleave, ainterleave
  12452. Temporally interleave frames from several inputs.
  12453. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12454. These filters read frames from several inputs and send the oldest
  12455. queued frame to the output.
  12456. Input streams must have well defined, monotonically increasing frame
  12457. timestamp values.
  12458. In order to submit one frame to output, these filters need to enqueue
  12459. at least one frame for each input, so they cannot work in case one
  12460. input is not yet terminated and will not receive incoming frames.
  12461. For example consider the case when one input is a @code{select} filter
  12462. which always drops input frames. The @code{interleave} filter will keep
  12463. reading from that input, but it will never be able to send new frames
  12464. to output until the input sends an end-of-stream signal.
  12465. Also, depending on inputs synchronization, the filters will drop
  12466. frames in case one input receives more frames than the other ones, and
  12467. the queue is already filled.
  12468. These filters accept the following options:
  12469. @table @option
  12470. @item nb_inputs, n
  12471. Set the number of different inputs, it is 2 by default.
  12472. @end table
  12473. @subsection Examples
  12474. @itemize
  12475. @item
  12476. Interleave frames belonging to different streams using @command{ffmpeg}:
  12477. @example
  12478. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12479. @end example
  12480. @item
  12481. Add flickering blur effect:
  12482. @example
  12483. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12484. @end example
  12485. @end itemize
  12486. @section metadata, ametadata
  12487. Manipulate frame metadata.
  12488. This filter accepts the following options:
  12489. @table @option
  12490. @item mode
  12491. Set mode of operation of the filter.
  12492. Can be one of the following:
  12493. @table @samp
  12494. @item select
  12495. If both @code{value} and @code{key} is set, select frames
  12496. which have such metadata. If only @code{key} is set, select
  12497. every frame that has such key in metadata.
  12498. @item add
  12499. Add new metadata @code{key} and @code{value}. If key is already available
  12500. do nothing.
  12501. @item modify
  12502. Modify value of already present key.
  12503. @item delete
  12504. If @code{value} is set, delete only keys that have such value.
  12505. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12506. the frame.
  12507. @item print
  12508. Print key and its value if metadata was found. If @code{key} is not set print all
  12509. metadata values available in frame.
  12510. @end table
  12511. @item key
  12512. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12513. @item value
  12514. Set metadata value which will be used. This option is mandatory for
  12515. @code{modify} and @code{add} mode.
  12516. @item function
  12517. Which function to use when comparing metadata value and @code{value}.
  12518. Can be one of following:
  12519. @table @samp
  12520. @item same_str
  12521. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12522. @item starts_with
  12523. Values are interpreted as strings, returns true if metadata value starts with
  12524. the @code{value} option string.
  12525. @item less
  12526. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12527. @item equal
  12528. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12529. @item greater
  12530. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12531. @item expr
  12532. Values are interpreted as floats, returns true if expression from option @code{expr}
  12533. evaluates to true.
  12534. @end table
  12535. @item expr
  12536. Set expression which is used when @code{function} is set to @code{expr}.
  12537. The expression is evaluated through the eval API and can contain the following
  12538. constants:
  12539. @table @option
  12540. @item VALUE1
  12541. Float representation of @code{value} from metadata key.
  12542. @item VALUE2
  12543. Float representation of @code{value} as supplied by user in @code{value} option.
  12544. @end table
  12545. @item file
  12546. If specified in @code{print} mode, output is written to the named file. Instead of
  12547. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12548. for standard output. If @code{file} option is not set, output is written to the log
  12549. with AV_LOG_INFO loglevel.
  12550. @end table
  12551. @subsection Examples
  12552. @itemize
  12553. @item
  12554. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12555. between 0 and 1.
  12556. @example
  12557. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12558. @end example
  12559. @item
  12560. Print silencedetect output to file @file{metadata.txt}.
  12561. @example
  12562. silencedetect,ametadata=mode=print:file=metadata.txt
  12563. @end example
  12564. @item
  12565. Direct all metadata to a pipe with file descriptor 4.
  12566. @example
  12567. metadata=mode=print:file='pipe\:4'
  12568. @end example
  12569. @end itemize
  12570. @section perms, aperms
  12571. Set read/write permissions for the output frames.
  12572. These filters are mainly aimed at developers to test direct path in the
  12573. following filter in the filtergraph.
  12574. The filters accept the following options:
  12575. @table @option
  12576. @item mode
  12577. Select the permissions mode.
  12578. It accepts the following values:
  12579. @table @samp
  12580. @item none
  12581. Do nothing. This is the default.
  12582. @item ro
  12583. Set all the output frames read-only.
  12584. @item rw
  12585. Set all the output frames directly writable.
  12586. @item toggle
  12587. Make the frame read-only if writable, and writable if read-only.
  12588. @item random
  12589. Set each output frame read-only or writable randomly.
  12590. @end table
  12591. @item seed
  12592. Set the seed for the @var{random} mode, must be an integer included between
  12593. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12594. @code{-1}, the filter will try to use a good random seed on a best effort
  12595. basis.
  12596. @end table
  12597. Note: in case of auto-inserted filter between the permission filter and the
  12598. following one, the permission might not be received as expected in that
  12599. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12600. perms/aperms filter can avoid this problem.
  12601. @section realtime, arealtime
  12602. Slow down filtering to match real time approximatively.
  12603. These filters will pause the filtering for a variable amount of time to
  12604. match the output rate with the input timestamps.
  12605. They are similar to the @option{re} option to @code{ffmpeg}.
  12606. They accept the following options:
  12607. @table @option
  12608. @item limit
  12609. Time limit for the pauses. Any pause longer than that will be considered
  12610. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12611. @end table
  12612. @anchor{select}
  12613. @section select, aselect
  12614. Select frames to pass in output.
  12615. This filter accepts the following options:
  12616. @table @option
  12617. @item expr, e
  12618. Set expression, which is evaluated for each input frame.
  12619. If the expression is evaluated to zero, the frame is discarded.
  12620. If the evaluation result is negative or NaN, the frame is sent to the
  12621. first output; otherwise it is sent to the output with index
  12622. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12623. For example a value of @code{1.2} corresponds to the output with index
  12624. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12625. @item outputs, n
  12626. Set the number of outputs. The output to which to send the selected
  12627. frame is based on the result of the evaluation. Default value is 1.
  12628. @end table
  12629. The expression can contain the following constants:
  12630. @table @option
  12631. @item n
  12632. The (sequential) number of the filtered frame, starting from 0.
  12633. @item selected_n
  12634. The (sequential) number of the selected frame, starting from 0.
  12635. @item prev_selected_n
  12636. The sequential number of the last selected frame. It's NAN if undefined.
  12637. @item TB
  12638. The timebase of the input timestamps.
  12639. @item pts
  12640. The PTS (Presentation TimeStamp) of the filtered video frame,
  12641. expressed in @var{TB} units. It's NAN if undefined.
  12642. @item t
  12643. The PTS of the filtered video frame,
  12644. expressed in seconds. It's NAN if undefined.
  12645. @item prev_pts
  12646. The PTS of the previously filtered video frame. It's NAN if undefined.
  12647. @item prev_selected_pts
  12648. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12649. @item prev_selected_t
  12650. The PTS of the last previously selected video frame. It's NAN if undefined.
  12651. @item start_pts
  12652. The PTS of the first video frame in the video. It's NAN if undefined.
  12653. @item start_t
  12654. The time of the first video frame in the video. It's NAN if undefined.
  12655. @item pict_type @emph{(video only)}
  12656. The type of the filtered frame. It can assume one of the following
  12657. values:
  12658. @table @option
  12659. @item I
  12660. @item P
  12661. @item B
  12662. @item S
  12663. @item SI
  12664. @item SP
  12665. @item BI
  12666. @end table
  12667. @item interlace_type @emph{(video only)}
  12668. The frame interlace type. It can assume one of the following values:
  12669. @table @option
  12670. @item PROGRESSIVE
  12671. The frame is progressive (not interlaced).
  12672. @item TOPFIRST
  12673. The frame is top-field-first.
  12674. @item BOTTOMFIRST
  12675. The frame is bottom-field-first.
  12676. @end table
  12677. @item consumed_sample_n @emph{(audio only)}
  12678. the number of selected samples before the current frame
  12679. @item samples_n @emph{(audio only)}
  12680. the number of samples in the current frame
  12681. @item sample_rate @emph{(audio only)}
  12682. the input sample rate
  12683. @item key
  12684. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12685. @item pos
  12686. the position in the file of the filtered frame, -1 if the information
  12687. is not available (e.g. for synthetic video)
  12688. @item scene @emph{(video only)}
  12689. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12690. probability for the current frame to introduce a new scene, while a higher
  12691. value means the current frame is more likely to be one (see the example below)
  12692. @item concatdec_select
  12693. The concat demuxer can select only part of a concat input file by setting an
  12694. inpoint and an outpoint, but the output packets may not be entirely contained
  12695. in the selected interval. By using this variable, it is possible to skip frames
  12696. generated by the concat demuxer which are not exactly contained in the selected
  12697. interval.
  12698. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12699. and the @var{lavf.concat.duration} packet metadata values which are also
  12700. present in the decoded frames.
  12701. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12702. start_time and either the duration metadata is missing or the frame pts is less
  12703. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12704. missing.
  12705. That basically means that an input frame is selected if its pts is within the
  12706. interval set by the concat demuxer.
  12707. @end table
  12708. The default value of the select expression is "1".
  12709. @subsection Examples
  12710. @itemize
  12711. @item
  12712. Select all frames in input:
  12713. @example
  12714. select
  12715. @end example
  12716. The example above is the same as:
  12717. @example
  12718. select=1
  12719. @end example
  12720. @item
  12721. Skip all frames:
  12722. @example
  12723. select=0
  12724. @end example
  12725. @item
  12726. Select only I-frames:
  12727. @example
  12728. select='eq(pict_type\,I)'
  12729. @end example
  12730. @item
  12731. Select one frame every 100:
  12732. @example
  12733. select='not(mod(n\,100))'
  12734. @end example
  12735. @item
  12736. Select only frames contained in the 10-20 time interval:
  12737. @example
  12738. select=between(t\,10\,20)
  12739. @end example
  12740. @item
  12741. Select only I-frames contained in the 10-20 time interval:
  12742. @example
  12743. select=between(t\,10\,20)*eq(pict_type\,I)
  12744. @end example
  12745. @item
  12746. Select frames with a minimum distance of 10 seconds:
  12747. @example
  12748. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12749. @end example
  12750. @item
  12751. Use aselect to select only audio frames with samples number > 100:
  12752. @example
  12753. aselect='gt(samples_n\,100)'
  12754. @end example
  12755. @item
  12756. Create a mosaic of the first scenes:
  12757. @example
  12758. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12759. @end example
  12760. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12761. choice.
  12762. @item
  12763. Send even and odd frames to separate outputs, and compose them:
  12764. @example
  12765. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12766. @end example
  12767. @item
  12768. Select useful frames from an ffconcat file which is using inpoints and
  12769. outpoints but where the source files are not intra frame only.
  12770. @example
  12771. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12772. @end example
  12773. @end itemize
  12774. @section sendcmd, asendcmd
  12775. Send commands to filters in the filtergraph.
  12776. These filters read commands to be sent to other filters in the
  12777. filtergraph.
  12778. @code{sendcmd} must be inserted between two video filters,
  12779. @code{asendcmd} must be inserted between two audio filters, but apart
  12780. from that they act the same way.
  12781. The specification of commands can be provided in the filter arguments
  12782. with the @var{commands} option, or in a file specified by the
  12783. @var{filename} option.
  12784. These filters accept the following options:
  12785. @table @option
  12786. @item commands, c
  12787. Set the commands to be read and sent to the other filters.
  12788. @item filename, f
  12789. Set the filename of the commands to be read and sent to the other
  12790. filters.
  12791. @end table
  12792. @subsection Commands syntax
  12793. A commands description consists of a sequence of interval
  12794. specifications, comprising a list of commands to be executed when a
  12795. particular event related to that interval occurs. The occurring event
  12796. is typically the current frame time entering or leaving a given time
  12797. interval.
  12798. An interval is specified by the following syntax:
  12799. @example
  12800. @var{START}[-@var{END}] @var{COMMANDS};
  12801. @end example
  12802. The time interval is specified by the @var{START} and @var{END} times.
  12803. @var{END} is optional and defaults to the maximum time.
  12804. The current frame time is considered within the specified interval if
  12805. it is included in the interval [@var{START}, @var{END}), that is when
  12806. the time is greater or equal to @var{START} and is lesser than
  12807. @var{END}.
  12808. @var{COMMANDS} consists of a sequence of one or more command
  12809. specifications, separated by ",", relating to that interval. The
  12810. syntax of a command specification is given by:
  12811. @example
  12812. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12813. @end example
  12814. @var{FLAGS} is optional and specifies the type of events relating to
  12815. the time interval which enable sending the specified command, and must
  12816. be a non-null sequence of identifier flags separated by "+" or "|" and
  12817. enclosed between "[" and "]".
  12818. The following flags are recognized:
  12819. @table @option
  12820. @item enter
  12821. The command is sent when the current frame timestamp enters the
  12822. specified interval. In other words, the command is sent when the
  12823. previous frame timestamp was not in the given interval, and the
  12824. current is.
  12825. @item leave
  12826. The command is sent when the current frame timestamp leaves the
  12827. specified interval. In other words, the command is sent when the
  12828. previous frame timestamp was in the given interval, and the
  12829. current is not.
  12830. @end table
  12831. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12832. assumed.
  12833. @var{TARGET} specifies the target of the command, usually the name of
  12834. the filter class or a specific filter instance name.
  12835. @var{COMMAND} specifies the name of the command for the target filter.
  12836. @var{ARG} is optional and specifies the optional list of argument for
  12837. the given @var{COMMAND}.
  12838. Between one interval specification and another, whitespaces, or
  12839. sequences of characters starting with @code{#} until the end of line,
  12840. are ignored and can be used to annotate comments.
  12841. A simplified BNF description of the commands specification syntax
  12842. follows:
  12843. @example
  12844. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12845. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12846. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12847. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12848. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12849. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12850. @end example
  12851. @subsection Examples
  12852. @itemize
  12853. @item
  12854. Specify audio tempo change at second 4:
  12855. @example
  12856. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12857. @end example
  12858. @item
  12859. Specify a list of drawtext and hue commands in a file.
  12860. @example
  12861. # show text in the interval 5-10
  12862. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12863. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12864. # desaturate the image in the interval 15-20
  12865. 15.0-20.0 [enter] hue s 0,
  12866. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12867. [leave] hue s 1,
  12868. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12869. # apply an exponential saturation fade-out effect, starting from time 25
  12870. 25 [enter] hue s exp(25-t)
  12871. @end example
  12872. A filtergraph allowing to read and process the above command list
  12873. stored in a file @file{test.cmd}, can be specified with:
  12874. @example
  12875. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12876. @end example
  12877. @end itemize
  12878. @anchor{setpts}
  12879. @section setpts, asetpts
  12880. Change the PTS (presentation timestamp) of the input frames.
  12881. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12882. This filter accepts the following options:
  12883. @table @option
  12884. @item expr
  12885. The expression which is evaluated for each frame to construct its timestamp.
  12886. @end table
  12887. The expression is evaluated through the eval API and can contain the following
  12888. constants:
  12889. @table @option
  12890. @item FRAME_RATE
  12891. frame rate, only defined for constant frame-rate video
  12892. @item PTS
  12893. The presentation timestamp in input
  12894. @item N
  12895. The count of the input frame for video or the number of consumed samples,
  12896. not including the current frame for audio, starting from 0.
  12897. @item NB_CONSUMED_SAMPLES
  12898. The number of consumed samples, not including the current frame (only
  12899. audio)
  12900. @item NB_SAMPLES, S
  12901. The number of samples in the current frame (only audio)
  12902. @item SAMPLE_RATE, SR
  12903. The audio sample rate.
  12904. @item STARTPTS
  12905. The PTS of the first frame.
  12906. @item STARTT
  12907. the time in seconds of the first frame
  12908. @item INTERLACED
  12909. State whether the current frame is interlaced.
  12910. @item T
  12911. the time in seconds of the current frame
  12912. @item POS
  12913. original position in the file of the frame, or undefined if undefined
  12914. for the current frame
  12915. @item PREV_INPTS
  12916. The previous input PTS.
  12917. @item PREV_INT
  12918. previous input time in seconds
  12919. @item PREV_OUTPTS
  12920. The previous output PTS.
  12921. @item PREV_OUTT
  12922. previous output time in seconds
  12923. @item RTCTIME
  12924. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12925. instead.
  12926. @item RTCSTART
  12927. The wallclock (RTC) time at the start of the movie in microseconds.
  12928. @item TB
  12929. The timebase of the input timestamps.
  12930. @end table
  12931. @subsection Examples
  12932. @itemize
  12933. @item
  12934. Start counting PTS from zero
  12935. @example
  12936. setpts=PTS-STARTPTS
  12937. @end example
  12938. @item
  12939. Apply fast motion effect:
  12940. @example
  12941. setpts=0.5*PTS
  12942. @end example
  12943. @item
  12944. Apply slow motion effect:
  12945. @example
  12946. setpts=2.0*PTS
  12947. @end example
  12948. @item
  12949. Set fixed rate of 25 frames per second:
  12950. @example
  12951. setpts=N/(25*TB)
  12952. @end example
  12953. @item
  12954. Set fixed rate 25 fps with some jitter:
  12955. @example
  12956. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12957. @end example
  12958. @item
  12959. Apply an offset of 10 seconds to the input PTS:
  12960. @example
  12961. setpts=PTS+10/TB
  12962. @end example
  12963. @item
  12964. Generate timestamps from a "live source" and rebase onto the current timebase:
  12965. @example
  12966. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12967. @end example
  12968. @item
  12969. Generate timestamps by counting samples:
  12970. @example
  12971. asetpts=N/SR/TB
  12972. @end example
  12973. @end itemize
  12974. @section settb, asettb
  12975. Set the timebase to use for the output frames timestamps.
  12976. It is mainly useful for testing timebase configuration.
  12977. It accepts the following parameters:
  12978. @table @option
  12979. @item expr, tb
  12980. The expression which is evaluated into the output timebase.
  12981. @end table
  12982. The value for @option{tb} is an arithmetic expression representing a
  12983. rational. The expression can contain the constants "AVTB" (the default
  12984. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12985. audio only). Default value is "intb".
  12986. @subsection Examples
  12987. @itemize
  12988. @item
  12989. Set the timebase to 1/25:
  12990. @example
  12991. settb=expr=1/25
  12992. @end example
  12993. @item
  12994. Set the timebase to 1/10:
  12995. @example
  12996. settb=expr=0.1
  12997. @end example
  12998. @item
  12999. Set the timebase to 1001/1000:
  13000. @example
  13001. settb=1+0.001
  13002. @end example
  13003. @item
  13004. Set the timebase to 2*intb:
  13005. @example
  13006. settb=2*intb
  13007. @end example
  13008. @item
  13009. Set the default timebase value:
  13010. @example
  13011. settb=AVTB
  13012. @end example
  13013. @end itemize
  13014. @section showcqt
  13015. Convert input audio to a video output representing frequency spectrum
  13016. logarithmically using Brown-Puckette constant Q transform algorithm with
  13017. direct frequency domain coefficient calculation (but the transform itself
  13018. is not really constant Q, instead the Q factor is actually variable/clamped),
  13019. with musical tone scale, from E0 to D#10.
  13020. The filter accepts the following options:
  13021. @table @option
  13022. @item size, s
  13023. Specify the video size for the output. It must be even. For the syntax of this option,
  13024. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13025. Default value is @code{1920x1080}.
  13026. @item fps, rate, r
  13027. Set the output frame rate. Default value is @code{25}.
  13028. @item bar_h
  13029. Set the bargraph height. It must be even. Default value is @code{-1} which
  13030. computes the bargraph height automatically.
  13031. @item axis_h
  13032. Set the axis height. It must be even. Default value is @code{-1} which computes
  13033. the axis height automatically.
  13034. @item sono_h
  13035. Set the sonogram height. It must be even. Default value is @code{-1} which
  13036. computes the sonogram height automatically.
  13037. @item fullhd
  13038. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13039. instead. Default value is @code{1}.
  13040. @item sono_v, volume
  13041. Specify the sonogram volume expression. It can contain variables:
  13042. @table @option
  13043. @item bar_v
  13044. the @var{bar_v} evaluated expression
  13045. @item frequency, freq, f
  13046. the frequency where it is evaluated
  13047. @item timeclamp, tc
  13048. the value of @var{timeclamp} option
  13049. @end table
  13050. and functions:
  13051. @table @option
  13052. @item a_weighting(f)
  13053. A-weighting of equal loudness
  13054. @item b_weighting(f)
  13055. B-weighting of equal loudness
  13056. @item c_weighting(f)
  13057. C-weighting of equal loudness.
  13058. @end table
  13059. Default value is @code{16}.
  13060. @item bar_v, volume2
  13061. Specify the bargraph volume expression. It can contain variables:
  13062. @table @option
  13063. @item sono_v
  13064. the @var{sono_v} evaluated expression
  13065. @item frequency, freq, f
  13066. the frequency where it is evaluated
  13067. @item timeclamp, tc
  13068. the value of @var{timeclamp} option
  13069. @end table
  13070. and functions:
  13071. @table @option
  13072. @item a_weighting(f)
  13073. A-weighting of equal loudness
  13074. @item b_weighting(f)
  13075. B-weighting of equal loudness
  13076. @item c_weighting(f)
  13077. C-weighting of equal loudness.
  13078. @end table
  13079. Default value is @code{sono_v}.
  13080. @item sono_g, gamma
  13081. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13082. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13083. Acceptable range is @code{[1, 7]}.
  13084. @item bar_g, gamma2
  13085. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13086. @code{[1, 7]}.
  13087. @item bar_t
  13088. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13089. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13090. @item timeclamp, tc
  13091. Specify the transform timeclamp. At low frequency, there is trade-off between
  13092. accuracy in time domain and frequency domain. If timeclamp is lower,
  13093. event in time domain is represented more accurately (such as fast bass drum),
  13094. otherwise event in frequency domain is represented more accurately
  13095. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13096. @item basefreq
  13097. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13098. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13099. @item endfreq
  13100. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13101. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13102. @item coeffclamp
  13103. This option is deprecated and ignored.
  13104. @item tlength
  13105. Specify the transform length in time domain. Use this option to control accuracy
  13106. trade-off between time domain and frequency domain at every frequency sample.
  13107. It can contain variables:
  13108. @table @option
  13109. @item frequency, freq, f
  13110. the frequency where it is evaluated
  13111. @item timeclamp, tc
  13112. the value of @var{timeclamp} option.
  13113. @end table
  13114. Default value is @code{384*tc/(384+tc*f)}.
  13115. @item count
  13116. Specify the transform count for every video frame. Default value is @code{6}.
  13117. Acceptable range is @code{[1, 30]}.
  13118. @item fcount
  13119. Specify the transform count for every single pixel. Default value is @code{0},
  13120. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13121. @item fontfile
  13122. Specify font file for use with freetype to draw the axis. If not specified,
  13123. use embedded font. Note that drawing with font file or embedded font is not
  13124. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13125. option instead.
  13126. @item font
  13127. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13128. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13129. @item fontcolor
  13130. Specify font color expression. This is arithmetic expression that should return
  13131. integer value 0xRRGGBB. It can contain variables:
  13132. @table @option
  13133. @item frequency, freq, f
  13134. the frequency where it is evaluated
  13135. @item timeclamp, tc
  13136. the value of @var{timeclamp} option
  13137. @end table
  13138. and functions:
  13139. @table @option
  13140. @item midi(f)
  13141. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13142. @item r(x), g(x), b(x)
  13143. red, green, and blue value of intensity x.
  13144. @end table
  13145. Default value is @code{st(0, (midi(f)-59.5)/12);
  13146. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13147. r(1-ld(1)) + b(ld(1))}.
  13148. @item axisfile
  13149. Specify image file to draw the axis. This option override @var{fontfile} and
  13150. @var{fontcolor} option.
  13151. @item axis, text
  13152. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13153. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13154. Default value is @code{1}.
  13155. @item csp
  13156. Set colorspace. The accepted values are:
  13157. @table @samp
  13158. @item unspecified
  13159. Unspecified (default)
  13160. @item bt709
  13161. BT.709
  13162. @item fcc
  13163. FCC
  13164. @item bt470bg
  13165. BT.470BG or BT.601-6 625
  13166. @item smpte170m
  13167. SMPTE-170M or BT.601-6 525
  13168. @item smpte240m
  13169. SMPTE-240M
  13170. @item bt2020ncl
  13171. BT.2020 with non-constant luminance
  13172. @end table
  13173. @item cscheme
  13174. Set spectrogram color scheme. This is list of floating point values with format
  13175. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13176. The default is @code{1|0.5|0|0|0.5|1}.
  13177. @end table
  13178. @subsection Examples
  13179. @itemize
  13180. @item
  13181. Playing audio while showing the spectrum:
  13182. @example
  13183. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13184. @end example
  13185. @item
  13186. Same as above, but with frame rate 30 fps:
  13187. @example
  13188. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13189. @end example
  13190. @item
  13191. Playing at 1280x720:
  13192. @example
  13193. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13194. @end example
  13195. @item
  13196. Disable sonogram display:
  13197. @example
  13198. sono_h=0
  13199. @end example
  13200. @item
  13201. A1 and its harmonics: A1, A2, (near)E3, A3:
  13202. @example
  13203. 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),
  13204. asplit[a][out1]; [a] showcqt [out0]'
  13205. @end example
  13206. @item
  13207. Same as above, but with more accuracy in frequency domain:
  13208. @example
  13209. 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),
  13210. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13211. @end example
  13212. @item
  13213. Custom volume:
  13214. @example
  13215. bar_v=10:sono_v=bar_v*a_weighting(f)
  13216. @end example
  13217. @item
  13218. Custom gamma, now spectrum is linear to the amplitude.
  13219. @example
  13220. bar_g=2:sono_g=2
  13221. @end example
  13222. @item
  13223. Custom tlength equation:
  13224. @example
  13225. 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)))'
  13226. @end example
  13227. @item
  13228. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13229. @example
  13230. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13231. @end example
  13232. @item
  13233. Custom font using fontconfig:
  13234. @example
  13235. font='Courier New,Monospace,mono|bold'
  13236. @end example
  13237. @item
  13238. Custom frequency range with custom axis using image file:
  13239. @example
  13240. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13241. @end example
  13242. @end itemize
  13243. @section showfreqs
  13244. Convert input audio to video output representing the audio power spectrum.
  13245. Audio amplitude is on Y-axis while frequency is on X-axis.
  13246. The filter accepts the following options:
  13247. @table @option
  13248. @item size, s
  13249. Specify size of video. For the syntax of this option, check the
  13250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13251. Default is @code{1024x512}.
  13252. @item mode
  13253. Set display mode.
  13254. This set how each frequency bin will be represented.
  13255. It accepts the following values:
  13256. @table @samp
  13257. @item line
  13258. @item bar
  13259. @item dot
  13260. @end table
  13261. Default is @code{bar}.
  13262. @item ascale
  13263. Set amplitude scale.
  13264. It accepts the following values:
  13265. @table @samp
  13266. @item lin
  13267. Linear scale.
  13268. @item sqrt
  13269. Square root scale.
  13270. @item cbrt
  13271. Cubic root scale.
  13272. @item log
  13273. Logarithmic scale.
  13274. @end table
  13275. Default is @code{log}.
  13276. @item fscale
  13277. Set frequency scale.
  13278. It accepts the following values:
  13279. @table @samp
  13280. @item lin
  13281. Linear scale.
  13282. @item log
  13283. Logarithmic scale.
  13284. @item rlog
  13285. Reverse logarithmic scale.
  13286. @end table
  13287. Default is @code{lin}.
  13288. @item win_size
  13289. Set window size.
  13290. It accepts the following values:
  13291. @table @samp
  13292. @item w16
  13293. @item w32
  13294. @item w64
  13295. @item w128
  13296. @item w256
  13297. @item w512
  13298. @item w1024
  13299. @item w2048
  13300. @item w4096
  13301. @item w8192
  13302. @item w16384
  13303. @item w32768
  13304. @item w65536
  13305. @end table
  13306. Default is @code{w2048}
  13307. @item win_func
  13308. Set windowing function.
  13309. It accepts the following values:
  13310. @table @samp
  13311. @item rect
  13312. @item bartlett
  13313. @item hanning
  13314. @item hamming
  13315. @item blackman
  13316. @item welch
  13317. @item flattop
  13318. @item bharris
  13319. @item bnuttall
  13320. @item bhann
  13321. @item sine
  13322. @item nuttall
  13323. @item lanczos
  13324. @item gauss
  13325. @item tukey
  13326. @item dolph
  13327. @item cauchy
  13328. @item parzen
  13329. @item poisson
  13330. @end table
  13331. Default is @code{hanning}.
  13332. @item overlap
  13333. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13334. which means optimal overlap for selected window function will be picked.
  13335. @item averaging
  13336. Set time averaging. Setting this to 0 will display current maximal peaks.
  13337. Default is @code{1}, which means time averaging is disabled.
  13338. @item colors
  13339. Specify list of colors separated by space or by '|' which will be used to
  13340. draw channel frequencies. Unrecognized or missing colors will be replaced
  13341. by white color.
  13342. @item cmode
  13343. Set channel display mode.
  13344. It accepts the following values:
  13345. @table @samp
  13346. @item combined
  13347. @item separate
  13348. @end table
  13349. Default is @code{combined}.
  13350. @item minamp
  13351. Set minimum amplitude used in @code{log} amplitude scaler.
  13352. @end table
  13353. @anchor{showspectrum}
  13354. @section showspectrum
  13355. Convert input audio to a video output, representing the audio frequency
  13356. spectrum.
  13357. The filter accepts the following options:
  13358. @table @option
  13359. @item size, s
  13360. Specify the video size for the output. For the syntax of this option, check the
  13361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13362. Default value is @code{640x512}.
  13363. @item slide
  13364. Specify how the spectrum should slide along the window.
  13365. It accepts the following values:
  13366. @table @samp
  13367. @item replace
  13368. the samples start again on the left when they reach the right
  13369. @item scroll
  13370. the samples scroll from right to left
  13371. @item fullframe
  13372. frames are only produced when the samples reach the right
  13373. @item rscroll
  13374. the samples scroll from left to right
  13375. @end table
  13376. Default value is @code{replace}.
  13377. @item mode
  13378. Specify display mode.
  13379. It accepts the following values:
  13380. @table @samp
  13381. @item combined
  13382. all channels are displayed in the same row
  13383. @item separate
  13384. all channels are displayed in separate rows
  13385. @end table
  13386. Default value is @samp{combined}.
  13387. @item color
  13388. Specify display color mode.
  13389. It accepts the following values:
  13390. @table @samp
  13391. @item channel
  13392. each channel is displayed in a separate color
  13393. @item intensity
  13394. each channel is displayed using the same color scheme
  13395. @item rainbow
  13396. each channel is displayed using the rainbow color scheme
  13397. @item moreland
  13398. each channel is displayed using the moreland color scheme
  13399. @item nebulae
  13400. each channel is displayed using the nebulae color scheme
  13401. @item fire
  13402. each channel is displayed using the fire color scheme
  13403. @item fiery
  13404. each channel is displayed using the fiery color scheme
  13405. @item fruit
  13406. each channel is displayed using the fruit color scheme
  13407. @item cool
  13408. each channel is displayed using the cool color scheme
  13409. @end table
  13410. Default value is @samp{channel}.
  13411. @item scale
  13412. Specify scale used for calculating intensity color values.
  13413. It accepts the following values:
  13414. @table @samp
  13415. @item lin
  13416. linear
  13417. @item sqrt
  13418. square root, default
  13419. @item cbrt
  13420. cubic root
  13421. @item log
  13422. logarithmic
  13423. @item 4thrt
  13424. 4th root
  13425. @item 5thrt
  13426. 5th root
  13427. @end table
  13428. Default value is @samp{sqrt}.
  13429. @item saturation
  13430. Set saturation modifier for displayed colors. Negative values provide
  13431. alternative color scheme. @code{0} is no saturation at all.
  13432. Saturation must be in [-10.0, 10.0] range.
  13433. Default value is @code{1}.
  13434. @item win_func
  13435. Set window function.
  13436. It accepts the following values:
  13437. @table @samp
  13438. @item rect
  13439. @item bartlett
  13440. @item hann
  13441. @item hanning
  13442. @item hamming
  13443. @item blackman
  13444. @item welch
  13445. @item flattop
  13446. @item bharris
  13447. @item bnuttall
  13448. @item bhann
  13449. @item sine
  13450. @item nuttall
  13451. @item lanczos
  13452. @item gauss
  13453. @item tukey
  13454. @item dolph
  13455. @item cauchy
  13456. @item parzen
  13457. @item poisson
  13458. @end table
  13459. Default value is @code{hann}.
  13460. @item orientation
  13461. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13462. @code{horizontal}. Default is @code{vertical}.
  13463. @item overlap
  13464. Set ratio of overlap window. Default value is @code{0}.
  13465. When value is @code{1} overlap is set to recommended size for specific
  13466. window function currently used.
  13467. @item gain
  13468. Set scale gain for calculating intensity color values.
  13469. Default value is @code{1}.
  13470. @item data
  13471. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13472. @item rotation
  13473. Set color rotation, must be in [-1.0, 1.0] range.
  13474. Default value is @code{0}.
  13475. @end table
  13476. The usage is very similar to the showwaves filter; see the examples in that
  13477. section.
  13478. @subsection Examples
  13479. @itemize
  13480. @item
  13481. Large window with logarithmic color scaling:
  13482. @example
  13483. showspectrum=s=1280x480:scale=log
  13484. @end example
  13485. @item
  13486. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13487. @example
  13488. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13489. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13490. @end example
  13491. @end itemize
  13492. @section showspectrumpic
  13493. Convert input audio to a single video frame, representing the audio frequency
  13494. spectrum.
  13495. The filter accepts the following options:
  13496. @table @option
  13497. @item size, s
  13498. Specify the video size for the output. For the syntax of this option, check the
  13499. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13500. Default value is @code{4096x2048}.
  13501. @item mode
  13502. Specify display mode.
  13503. It accepts the following values:
  13504. @table @samp
  13505. @item combined
  13506. all channels are displayed in the same row
  13507. @item separate
  13508. all channels are displayed in separate rows
  13509. @end table
  13510. Default value is @samp{combined}.
  13511. @item color
  13512. Specify display color mode.
  13513. It accepts the following values:
  13514. @table @samp
  13515. @item channel
  13516. each channel is displayed in a separate color
  13517. @item intensity
  13518. each channel is displayed using the same color scheme
  13519. @item rainbow
  13520. each channel is displayed using the rainbow color scheme
  13521. @item moreland
  13522. each channel is displayed using the moreland color scheme
  13523. @item nebulae
  13524. each channel is displayed using the nebulae color scheme
  13525. @item fire
  13526. each channel is displayed using the fire color scheme
  13527. @item fiery
  13528. each channel is displayed using the fiery color scheme
  13529. @item fruit
  13530. each channel is displayed using the fruit color scheme
  13531. @item cool
  13532. each channel is displayed using the cool color scheme
  13533. @end table
  13534. Default value is @samp{intensity}.
  13535. @item scale
  13536. Specify scale used for calculating intensity color values.
  13537. It accepts the following values:
  13538. @table @samp
  13539. @item lin
  13540. linear
  13541. @item sqrt
  13542. square root, default
  13543. @item cbrt
  13544. cubic root
  13545. @item log
  13546. logarithmic
  13547. @item 4thrt
  13548. 4th root
  13549. @item 5thrt
  13550. 5th root
  13551. @end table
  13552. Default value is @samp{log}.
  13553. @item saturation
  13554. Set saturation modifier for displayed colors. Negative values provide
  13555. alternative color scheme. @code{0} is no saturation at all.
  13556. Saturation must be in [-10.0, 10.0] range.
  13557. Default value is @code{1}.
  13558. @item win_func
  13559. Set window function.
  13560. It accepts the following values:
  13561. @table @samp
  13562. @item rect
  13563. @item bartlett
  13564. @item hann
  13565. @item hanning
  13566. @item hamming
  13567. @item blackman
  13568. @item welch
  13569. @item flattop
  13570. @item bharris
  13571. @item bnuttall
  13572. @item bhann
  13573. @item sine
  13574. @item nuttall
  13575. @item lanczos
  13576. @item gauss
  13577. @item tukey
  13578. @item dolph
  13579. @item cauchy
  13580. @item parzen
  13581. @item poisson
  13582. @end table
  13583. Default value is @code{hann}.
  13584. @item orientation
  13585. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13586. @code{horizontal}. Default is @code{vertical}.
  13587. @item gain
  13588. Set scale gain for calculating intensity color values.
  13589. Default value is @code{1}.
  13590. @item legend
  13591. Draw time and frequency axes and legends. Default is enabled.
  13592. @item rotation
  13593. Set color rotation, must be in [-1.0, 1.0] range.
  13594. Default value is @code{0}.
  13595. @end table
  13596. @subsection Examples
  13597. @itemize
  13598. @item
  13599. Extract an audio spectrogram of a whole audio track
  13600. in a 1024x1024 picture using @command{ffmpeg}:
  13601. @example
  13602. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13603. @end example
  13604. @end itemize
  13605. @section showvolume
  13606. Convert input audio volume to a video output.
  13607. The filter accepts the following options:
  13608. @table @option
  13609. @item rate, r
  13610. Set video rate.
  13611. @item b
  13612. Set border width, allowed range is [0, 5]. Default is 1.
  13613. @item w
  13614. Set channel width, allowed range is [80, 8192]. Default is 400.
  13615. @item h
  13616. Set channel height, allowed range is [1, 900]. Default is 20.
  13617. @item f
  13618. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13619. @item c
  13620. Set volume color expression.
  13621. The expression can use the following variables:
  13622. @table @option
  13623. @item VOLUME
  13624. Current max volume of channel in dB.
  13625. @item PEAK
  13626. Current peak.
  13627. @item CHANNEL
  13628. Current channel number, starting from 0.
  13629. @end table
  13630. @item t
  13631. If set, displays channel names. Default is enabled.
  13632. @item v
  13633. If set, displays volume values. Default is enabled.
  13634. @item o
  13635. Set orientation, can be @code{horizontal} or @code{vertical},
  13636. default is @code{horizontal}.
  13637. @item s
  13638. Set step size, allowed range s [0, 5]. Default is 0, which means
  13639. step is disabled.
  13640. @end table
  13641. @section showwaves
  13642. Convert input audio to a video output, representing the samples waves.
  13643. The filter accepts the following options:
  13644. @table @option
  13645. @item size, s
  13646. Specify the video size for the output. For the syntax of this option, check the
  13647. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13648. Default value is @code{600x240}.
  13649. @item mode
  13650. Set display mode.
  13651. Available values are:
  13652. @table @samp
  13653. @item point
  13654. Draw a point for each sample.
  13655. @item line
  13656. Draw a vertical line for each sample.
  13657. @item p2p
  13658. Draw a point for each sample and a line between them.
  13659. @item cline
  13660. Draw a centered vertical line for each sample.
  13661. @end table
  13662. Default value is @code{point}.
  13663. @item n
  13664. Set the number of samples which are printed on the same column. A
  13665. larger value will decrease the frame rate. Must be a positive
  13666. integer. This option can be set only if the value for @var{rate}
  13667. is not explicitly specified.
  13668. @item rate, r
  13669. Set the (approximate) output frame rate. This is done by setting the
  13670. option @var{n}. Default value is "25".
  13671. @item split_channels
  13672. Set if channels should be drawn separately or overlap. Default value is 0.
  13673. @item colors
  13674. Set colors separated by '|' which are going to be used for drawing of each channel.
  13675. @item scale
  13676. Set amplitude scale.
  13677. Available values are:
  13678. @table @samp
  13679. @item lin
  13680. Linear.
  13681. @item log
  13682. Logarithmic.
  13683. @item sqrt
  13684. Square root.
  13685. @item cbrt
  13686. Cubic root.
  13687. @end table
  13688. Default is linear.
  13689. @end table
  13690. @subsection Examples
  13691. @itemize
  13692. @item
  13693. Output the input file audio and the corresponding video representation
  13694. at the same time:
  13695. @example
  13696. amovie=a.mp3,asplit[out0],showwaves[out1]
  13697. @end example
  13698. @item
  13699. Create a synthetic signal and show it with showwaves, forcing a
  13700. frame rate of 30 frames per second:
  13701. @example
  13702. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13703. @end example
  13704. @end itemize
  13705. @section showwavespic
  13706. Convert input audio to a single video frame, representing the samples waves.
  13707. The filter accepts the following options:
  13708. @table @option
  13709. @item size, s
  13710. Specify the video size for the output. For the syntax of this option, check the
  13711. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13712. Default value is @code{600x240}.
  13713. @item split_channels
  13714. Set if channels should be drawn separately or overlap. Default value is 0.
  13715. @item colors
  13716. Set colors separated by '|' which are going to be used for drawing of each channel.
  13717. @item scale
  13718. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13719. Default is linear.
  13720. @end table
  13721. @subsection Examples
  13722. @itemize
  13723. @item
  13724. Extract a channel split representation of the wave form of a whole audio track
  13725. in a 1024x800 picture using @command{ffmpeg}:
  13726. @example
  13727. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13728. @end example
  13729. @end itemize
  13730. @section sidedata, asidedata
  13731. Delete frame side data, or select frames based on it.
  13732. This filter accepts the following options:
  13733. @table @option
  13734. @item mode
  13735. Set mode of operation of the filter.
  13736. Can be one of the following:
  13737. @table @samp
  13738. @item select
  13739. Select every frame with side data of @code{type}.
  13740. @item delete
  13741. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13742. data in the frame.
  13743. @end table
  13744. @item type
  13745. Set side data type used with all modes. Must be set for @code{select} mode. For
  13746. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13747. in @file{libavutil/frame.h}. For example, to choose
  13748. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13749. @end table
  13750. @section spectrumsynth
  13751. Sythesize audio from 2 input video spectrums, first input stream represents
  13752. magnitude across time and second represents phase across time.
  13753. The filter will transform from frequency domain as displayed in videos back
  13754. to time domain as presented in audio output.
  13755. This filter is primarily created for reversing processed @ref{showspectrum}
  13756. filter outputs, but can synthesize sound from other spectrograms too.
  13757. But in such case results are going to be poor if the phase data is not
  13758. available, because in such cases phase data need to be recreated, usually
  13759. its just recreated from random noise.
  13760. For best results use gray only output (@code{channel} color mode in
  13761. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13762. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13763. @code{data} option. Inputs videos should generally use @code{fullframe}
  13764. slide mode as that saves resources needed for decoding video.
  13765. The filter accepts the following options:
  13766. @table @option
  13767. @item sample_rate
  13768. Specify sample rate of output audio, the sample rate of audio from which
  13769. spectrum was generated may differ.
  13770. @item channels
  13771. Set number of channels represented in input video spectrums.
  13772. @item scale
  13773. Set scale which was used when generating magnitude input spectrum.
  13774. Can be @code{lin} or @code{log}. Default is @code{log}.
  13775. @item slide
  13776. Set slide which was used when generating inputs spectrums.
  13777. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13778. Default is @code{fullframe}.
  13779. @item win_func
  13780. Set window function used for resynthesis.
  13781. @item overlap
  13782. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13783. which means optimal overlap for selected window function will be picked.
  13784. @item orientation
  13785. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13786. Default is @code{vertical}.
  13787. @end table
  13788. @subsection Examples
  13789. @itemize
  13790. @item
  13791. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13792. then resynthesize videos back to audio with spectrumsynth:
  13793. @example
  13794. 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
  13795. 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
  13796. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13797. @end example
  13798. @end itemize
  13799. @section split, asplit
  13800. Split input into several identical outputs.
  13801. @code{asplit} works with audio input, @code{split} with video.
  13802. The filter accepts a single parameter which specifies the number of outputs. If
  13803. unspecified, it defaults to 2.
  13804. @subsection Examples
  13805. @itemize
  13806. @item
  13807. Create two separate outputs from the same input:
  13808. @example
  13809. [in] split [out0][out1]
  13810. @end example
  13811. @item
  13812. To create 3 or more outputs, you need to specify the number of
  13813. outputs, like in:
  13814. @example
  13815. [in] asplit=3 [out0][out1][out2]
  13816. @end example
  13817. @item
  13818. Create two separate outputs from the same input, one cropped and
  13819. one padded:
  13820. @example
  13821. [in] split [splitout1][splitout2];
  13822. [splitout1] crop=100:100:0:0 [cropout];
  13823. [splitout2] pad=200:200:100:100 [padout];
  13824. @end example
  13825. @item
  13826. Create 5 copies of the input audio with @command{ffmpeg}:
  13827. @example
  13828. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13829. @end example
  13830. @end itemize
  13831. @section zmq, azmq
  13832. Receive commands sent through a libzmq client, and forward them to
  13833. filters in the filtergraph.
  13834. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13835. must be inserted between two video filters, @code{azmq} between two
  13836. audio filters.
  13837. To enable these filters you need to install the libzmq library and
  13838. headers and configure FFmpeg with @code{--enable-libzmq}.
  13839. For more information about libzmq see:
  13840. @url{http://www.zeromq.org/}
  13841. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13842. receives messages sent through a network interface defined by the
  13843. @option{bind_address} option.
  13844. The received message must be in the form:
  13845. @example
  13846. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13847. @end example
  13848. @var{TARGET} specifies the target of the command, usually the name of
  13849. the filter class or a specific filter instance name.
  13850. @var{COMMAND} specifies the name of the command for the target filter.
  13851. @var{ARG} is optional and specifies the optional argument list for the
  13852. given @var{COMMAND}.
  13853. Upon reception, the message is processed and the corresponding command
  13854. is injected into the filtergraph. Depending on the result, the filter
  13855. will send a reply to the client, adopting the format:
  13856. @example
  13857. @var{ERROR_CODE} @var{ERROR_REASON}
  13858. @var{MESSAGE}
  13859. @end example
  13860. @var{MESSAGE} is optional.
  13861. @subsection Examples
  13862. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13863. be used to send commands processed by these filters.
  13864. Consider the following filtergraph generated by @command{ffplay}
  13865. @example
  13866. ffplay -dumpgraph 1 -f lavfi "
  13867. color=s=100x100:c=red [l];
  13868. color=s=100x100:c=blue [r];
  13869. nullsrc=s=200x100, zmq [bg];
  13870. [bg][l] overlay [bg+l];
  13871. [bg+l][r] overlay=x=100 "
  13872. @end example
  13873. To change the color of the left side of the video, the following
  13874. command can be used:
  13875. @example
  13876. echo Parsed_color_0 c yellow | tools/zmqsend
  13877. @end example
  13878. To change the right side:
  13879. @example
  13880. echo Parsed_color_1 c pink | tools/zmqsend
  13881. @end example
  13882. @c man end MULTIMEDIA FILTERS
  13883. @chapter Multimedia Sources
  13884. @c man begin MULTIMEDIA SOURCES
  13885. Below is a description of the currently available multimedia sources.
  13886. @section amovie
  13887. This is the same as @ref{movie} source, except it selects an audio
  13888. stream by default.
  13889. @anchor{movie}
  13890. @section movie
  13891. Read audio and/or video stream(s) from a movie container.
  13892. It accepts the following parameters:
  13893. @table @option
  13894. @item filename
  13895. The name of the resource to read (not necessarily a file; it can also be a
  13896. device or a stream accessed through some protocol).
  13897. @item format_name, f
  13898. Specifies the format assumed for the movie to read, and can be either
  13899. the name of a container or an input device. If not specified, the
  13900. format is guessed from @var{movie_name} or by probing.
  13901. @item seek_point, sp
  13902. Specifies the seek point in seconds. The frames will be output
  13903. starting from this seek point. The parameter is evaluated with
  13904. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13905. postfix. The default value is "0".
  13906. @item streams, s
  13907. Specifies the streams to read. Several streams can be specified,
  13908. separated by "+". The source will then have as many outputs, in the
  13909. same order. The syntax is explained in the ``Stream specifiers''
  13910. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13911. respectively the default (best suited) video and audio stream. Default
  13912. is "dv", or "da" if the filter is called as "amovie".
  13913. @item stream_index, si
  13914. Specifies the index of the video stream to read. If the value is -1,
  13915. the most suitable video stream will be automatically selected. The default
  13916. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13917. audio instead of video.
  13918. @item loop
  13919. Specifies how many times to read the stream in sequence.
  13920. If the value is 0, the stream will be looped infinitely.
  13921. Default value is "1".
  13922. Note that when the movie is looped the source timestamps are not
  13923. changed, so it will generate non monotonically increasing timestamps.
  13924. @item discontinuity
  13925. Specifies the time difference between frames above which the point is
  13926. considered a timestamp discontinuity which is removed by adjusting the later
  13927. timestamps.
  13928. @end table
  13929. It allows overlaying a second video on top of the main input of
  13930. a filtergraph, as shown in this graph:
  13931. @example
  13932. input -----------> deltapts0 --> overlay --> output
  13933. ^
  13934. |
  13935. movie --> scale--> deltapts1 -------+
  13936. @end example
  13937. @subsection Examples
  13938. @itemize
  13939. @item
  13940. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13941. on top of the input labelled "in":
  13942. @example
  13943. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13944. [in] setpts=PTS-STARTPTS [main];
  13945. [main][over] overlay=16:16 [out]
  13946. @end example
  13947. @item
  13948. Read from a video4linux2 device, and overlay it on top of the input
  13949. labelled "in":
  13950. @example
  13951. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13952. [in] setpts=PTS-STARTPTS [main];
  13953. [main][over] overlay=16:16 [out]
  13954. @end example
  13955. @item
  13956. Read the first video stream and the audio stream with id 0x81 from
  13957. dvd.vob; the video is connected to the pad named "video" and the audio is
  13958. connected to the pad named "audio":
  13959. @example
  13960. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13961. @end example
  13962. @end itemize
  13963. @subsection Commands
  13964. Both movie and amovie support the following commands:
  13965. @table @option
  13966. @item seek
  13967. Perform seek using "av_seek_frame".
  13968. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13969. @itemize
  13970. @item
  13971. @var{stream_index}: If stream_index is -1, a default
  13972. stream is selected, and @var{timestamp} is automatically converted
  13973. from AV_TIME_BASE units to the stream specific time_base.
  13974. @item
  13975. @var{timestamp}: Timestamp in AVStream.time_base units
  13976. or, if no stream is specified, in AV_TIME_BASE units.
  13977. @item
  13978. @var{flags}: Flags which select direction and seeking mode.
  13979. @end itemize
  13980. @item get_duration
  13981. Get movie duration in AV_TIME_BASE units.
  13982. @end table
  13983. @c man end MULTIMEDIA SOURCES