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.

18267 lines
487KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. See @code{ffmpeg -filters} to view which filters have timeline support.
  248. @c man end FILTERGRAPH DESCRIPTION
  249. @chapter Audio Filters
  250. @c man begin AUDIO FILTERS
  251. When you configure your FFmpeg build, you can disable any of the
  252. existing filters using @code{--disable-filters}.
  253. The configure output will show the audio filters included in your
  254. build.
  255. Below is a description of the currently available audio filters.
  256. @section acompressor
  257. A compressor is mainly used to reduce the dynamic range of a signal.
  258. Especially modern music is mostly compressed at a high ratio to
  259. improve the overall loudness. It's done to get the highest attention
  260. of a listener, "fatten" the sound and bring more "power" to the track.
  261. If a signal is compressed too much it may sound dull or "dead"
  262. afterwards or it may start to "pump" (which could be a powerful effect
  263. but can also destroy a track completely).
  264. The right compression is the key to reach a professional sound and is
  265. the high art of mixing and mastering. Because of its complex settings
  266. it may take a long time to get the right feeling for this kind of effect.
  267. Compression is done by detecting the volume above a chosen level
  268. @code{threshold} and dividing it by the factor set with @code{ratio}.
  269. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  270. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  271. the signal would cause distortion of the waveform the reduction can be
  272. levelled over the time. This is done by setting "Attack" and "Release".
  273. @code{attack} determines how long the signal has to rise above the threshold
  274. before any reduction will occur and @code{release} sets the time the signal
  275. has to fall below the threshold to reduce the reduction again. Shorter signals
  276. than the chosen attack time will be left untouched.
  277. The overall reduction of the signal can be made up afterwards with the
  278. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  279. raising the makeup to this level results in a signal twice as loud than the
  280. source. To gain a softer entry in the compression the @code{knee} flattens the
  281. hard edge at the threshold in the range of the chosen decibels.
  282. The filter accepts the following options:
  283. @table @option
  284. @item level_in
  285. Set input gain. Default is 1. Range is between 0.015625 and 64.
  286. @item threshold
  287. If a signal of second stream rises above this level it will affect the gain
  288. reduction of the first stream.
  289. By default it is 0.125. Range is between 0.00097563 and 1.
  290. @item ratio
  291. Set a ratio by which the signal is reduced. 1:2 means that if the level
  292. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  293. Default is 2. Range is between 1 and 20.
  294. @item attack
  295. Amount of milliseconds the signal has to rise above the threshold before gain
  296. reduction starts. Default is 20. Range is between 0.01 and 2000.
  297. @item release
  298. Amount of milliseconds the signal has to fall below the threshold before
  299. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  300. @item makeup
  301. Set the amount by how much signal will be amplified after processing.
  302. Default is 2. Range is from 1 and 64.
  303. @item knee
  304. Curve the sharp knee around the threshold to enter gain reduction more softly.
  305. Default is 2.82843. Range is between 1 and 8.
  306. @item link
  307. Choose if the @code{average} level between all channels of input stream
  308. or the louder(@code{maximum}) channel of input stream affects the
  309. reduction. Default is @code{average}.
  310. @item detection
  311. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  312. of @code{rms}. Default is @code{rms} which is mostly smoother.
  313. @item mix
  314. How much to use compressed signal in output. Default is 1.
  315. Range is between 0 and 1.
  316. @end table
  317. @section acrossfade
  318. Apply cross fade from one input audio stream to another input audio stream.
  319. The cross fade is applied for specified duration near the end of first stream.
  320. The filter accepts the following options:
  321. @table @option
  322. @item nb_samples, ns
  323. Specify the number of samples for which the cross fade effect has to last.
  324. At the end of the cross fade effect the first input audio will be completely
  325. silent. Default is 44100.
  326. @item duration, d
  327. Specify the duration of the cross fade effect. See
  328. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  329. for the accepted syntax.
  330. By default the duration is determined by @var{nb_samples}.
  331. If set this option is used instead of @var{nb_samples}.
  332. @item overlap, o
  333. Should first stream end overlap with second stream start. Default is enabled.
  334. @item curve1
  335. Set curve for cross fade transition for first stream.
  336. @item curve2
  337. Set curve for cross fade transition for second stream.
  338. For description of available curve types see @ref{afade} filter description.
  339. @end table
  340. @subsection Examples
  341. @itemize
  342. @item
  343. Cross fade from one input to another:
  344. @example
  345. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  346. @end example
  347. @item
  348. Cross fade from one input to another but without overlapping:
  349. @example
  350. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  351. @end example
  352. @end itemize
  353. @section acrusher
  354. Reduce audio bit resolution.
  355. This filter is bit crusher with enhanced functionality. A bit crusher
  356. is used to audibly reduce number of bits an audio signal is sampled
  357. with. This doesn't change the bit depth at all, it just produces the
  358. effect. Material reduced in bit depth sounds more harsh and "digital".
  359. This filter is able to even round to continuous values instead of discrete
  360. bit depths.
  361. Additionally it has a D/C offset which results in different crushing of
  362. the lower and the upper half of the signal.
  363. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  364. Another feature of this filter is the logarithmic mode.
  365. This setting switches from linear distances between bits to logarithmic ones.
  366. The result is a much more "natural" sounding crusher which doesn't gate low
  367. signals for example. The human ear has a logarithmic perception, too
  368. so this kind of crushing is much more pleasant.
  369. Logarithmic crushing is also able to get anti-aliased.
  370. The filter accepts the following options:
  371. @table @option
  372. @item level_in
  373. Set level in.
  374. @item level_out
  375. Set level out.
  376. @item bits
  377. Set bit reduction.
  378. @item mix
  379. Set mixing amount.
  380. @item mode
  381. Can be linear: @code{lin} or logarithmic: @code{log}.
  382. @item dc
  383. Set DC.
  384. @item aa
  385. Set anti-aliasing.
  386. @item samples
  387. Set sample reduction.
  388. @item lfo
  389. Enable LFO. By default disabled.
  390. @item lforange
  391. Set LFO range.
  392. @item lforate
  393. Set LFO rate.
  394. @end table
  395. @section adelay
  396. Delay one or more audio channels.
  397. Samples in delayed channel are filled with silence.
  398. The filter accepts the following option:
  399. @table @option
  400. @item delays
  401. Set list of delays in milliseconds for each channel separated by '|'.
  402. At least one delay greater than 0 should be provided.
  403. Unused delays will be silently ignored. If number of given delays is
  404. smaller than number of channels all remaining channels will not be delayed.
  405. If you want to delay exact number of samples, append 'S' to number.
  406. @end table
  407. @subsection Examples
  408. @itemize
  409. @item
  410. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  411. the second channel (and any other channels that may be present) unchanged.
  412. @example
  413. adelay=1500|0|500
  414. @end example
  415. @item
  416. Delay second channel by 500 samples, the third channel by 700 samples and leave
  417. the first channel (and any other channels that may be present) unchanged.
  418. @example
  419. adelay=0|500S|700S
  420. @end example
  421. @end itemize
  422. @section aecho
  423. Apply echoing to the input audio.
  424. Echoes are reflected sound and can occur naturally amongst mountains
  425. (and sometimes large buildings) when talking or shouting; digital echo
  426. effects emulate this behaviour and are often used to help fill out the
  427. sound of a single instrument or vocal. The time difference between the
  428. original signal and the reflection is the @code{delay}, and the
  429. loudness of the reflected signal is the @code{decay}.
  430. Multiple echoes can have different delays and decays.
  431. A description of the accepted parameters follows.
  432. @table @option
  433. @item in_gain
  434. Set input gain of reflected signal. Default is @code{0.6}.
  435. @item out_gain
  436. Set output gain of reflected signal. Default is @code{0.3}.
  437. @item delays
  438. Set list of time intervals in milliseconds between original signal and reflections
  439. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  440. Default is @code{1000}.
  441. @item decays
  442. Set list of loudnesses of reflected signals separated by '|'.
  443. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  444. Default is @code{0.5}.
  445. @end table
  446. @subsection Examples
  447. @itemize
  448. @item
  449. Make it sound as if there are twice as many instruments as are actually playing:
  450. @example
  451. aecho=0.8:0.88:60:0.4
  452. @end example
  453. @item
  454. If delay is very short, then it sound like a (metallic) robot playing music:
  455. @example
  456. aecho=0.8:0.88:6:0.4
  457. @end example
  458. @item
  459. A longer delay will sound like an open air concert in the mountains:
  460. @example
  461. aecho=0.8:0.9:1000:0.3
  462. @end example
  463. @item
  464. Same as above but with one more mountain:
  465. @example
  466. aecho=0.8:0.9:1000|1800:0.3|0.25
  467. @end example
  468. @end itemize
  469. @section aemphasis
  470. Audio emphasis filter creates or restores material directly taken from LPs or
  471. emphased CDs with different filter curves. E.g. to store music on vinyl the
  472. signal has to be altered by a filter first to even out the disadvantages of
  473. this recording medium.
  474. Once the material is played back the inverse filter has to be applied to
  475. restore the distortion of the frequency response.
  476. The filter accepts the following options:
  477. @table @option
  478. @item level_in
  479. Set input gain.
  480. @item level_out
  481. Set output gain.
  482. @item mode
  483. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  484. use @code{production} mode. Default is @code{reproduction} mode.
  485. @item type
  486. Set filter type. Selects medium. Can be one of the following:
  487. @table @option
  488. @item col
  489. select Columbia.
  490. @item emi
  491. select EMI.
  492. @item bsi
  493. select BSI (78RPM).
  494. @item riaa
  495. select RIAA.
  496. @item cd
  497. select Compact Disc (CD).
  498. @item 50fm
  499. select 50µs (FM).
  500. @item 75fm
  501. select 75µs (FM).
  502. @item 50kf
  503. select 50µs (FM-KF).
  504. @item 75kf
  505. select 75µs (FM-KF).
  506. @end table
  507. @end table
  508. @section aeval
  509. Modify an audio signal according to the specified expressions.
  510. This filter accepts one or more expressions (one for each channel),
  511. which are evaluated and used to modify a corresponding audio signal.
  512. It accepts the following parameters:
  513. @table @option
  514. @item exprs
  515. Set the '|'-separated expressions list for each separate channel. If
  516. the number of input channels is greater than the number of
  517. expressions, the last specified expression is used for the remaining
  518. output channels.
  519. @item channel_layout, c
  520. Set output channel layout. If not specified, the channel layout is
  521. specified by the number of expressions. If set to @samp{same}, it will
  522. use by default the same input channel layout.
  523. @end table
  524. Each expression in @var{exprs} can contain the following constants and functions:
  525. @table @option
  526. @item ch
  527. channel number of the current expression
  528. @item n
  529. number of the evaluated sample, starting from 0
  530. @item s
  531. sample rate
  532. @item t
  533. time of the evaluated sample expressed in seconds
  534. @item nb_in_channels
  535. @item nb_out_channels
  536. input and output number of channels
  537. @item val(CH)
  538. the value of input channel with number @var{CH}
  539. @end table
  540. Note: this filter is slow. For faster processing you should use a
  541. dedicated filter.
  542. @subsection Examples
  543. @itemize
  544. @item
  545. Half volume:
  546. @example
  547. aeval=val(ch)/2:c=same
  548. @end example
  549. @item
  550. Invert phase of the second channel:
  551. @example
  552. aeval=val(0)|-val(1)
  553. @end example
  554. @end itemize
  555. @anchor{afade}
  556. @section afade
  557. Apply fade-in/out effect to input audio.
  558. A description of the accepted parameters follows.
  559. @table @option
  560. @item type, t
  561. Specify the effect type, can be either @code{in} for fade-in, or
  562. @code{out} for a fade-out effect. Default is @code{in}.
  563. @item start_sample, ss
  564. Specify the number of the start sample for starting to apply the fade
  565. effect. Default is 0.
  566. @item nb_samples, ns
  567. Specify the number of samples for which the fade effect has to last. At
  568. the end of the fade-in effect the output audio will have the same
  569. volume as the input audio, at the end of the fade-out transition
  570. the output audio will be silence. Default is 44100.
  571. @item start_time, st
  572. Specify the start time of the fade effect. Default is 0.
  573. The value must be specified as a time duration; see
  574. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  575. for the accepted syntax.
  576. If set this option is used instead of @var{start_sample}.
  577. @item duration, d
  578. Specify the duration of the fade effect. See
  579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  580. for the accepted syntax.
  581. At the end of the fade-in effect the output audio will have the same
  582. volume as the input audio, at the end of the fade-out transition
  583. the output audio will be silence.
  584. By default the duration is determined by @var{nb_samples}.
  585. If set this option is used instead of @var{nb_samples}.
  586. @item curve
  587. Set curve for fade transition.
  588. It accepts the following values:
  589. @table @option
  590. @item tri
  591. select triangular, linear slope (default)
  592. @item qsin
  593. select quarter of sine wave
  594. @item hsin
  595. select half of sine wave
  596. @item esin
  597. select exponential sine wave
  598. @item log
  599. select logarithmic
  600. @item ipar
  601. select inverted parabola
  602. @item qua
  603. select quadratic
  604. @item cub
  605. select cubic
  606. @item squ
  607. select square root
  608. @item cbr
  609. select cubic root
  610. @item par
  611. select parabola
  612. @item exp
  613. select exponential
  614. @item iqsin
  615. select inverted quarter of sine wave
  616. @item ihsin
  617. select inverted half of sine wave
  618. @item dese
  619. select double-exponential seat
  620. @item desi
  621. select double-exponential sigmoid
  622. @end table
  623. @end table
  624. @subsection Examples
  625. @itemize
  626. @item
  627. Fade in first 15 seconds of audio:
  628. @example
  629. afade=t=in:ss=0:d=15
  630. @end example
  631. @item
  632. Fade out last 25 seconds of a 900 seconds audio:
  633. @example
  634. afade=t=out:st=875:d=25
  635. @end example
  636. @end itemize
  637. @section afftfilt
  638. Apply arbitrary expressions to samples in frequency domain.
  639. @table @option
  640. @item real
  641. Set frequency domain real expression for each separate channel separated
  642. by '|'. Default is "1".
  643. If the number of input channels is greater than the number of
  644. expressions, the last specified expression is used for the remaining
  645. output channels.
  646. @item imag
  647. Set frequency domain imaginary expression for each separate channel
  648. separated by '|'. If not set, @var{real} option is used.
  649. Each expression in @var{real} and @var{imag} can contain the following
  650. constants:
  651. @table @option
  652. @item sr
  653. sample rate
  654. @item b
  655. current frequency bin number
  656. @item nb
  657. number of available bins
  658. @item ch
  659. channel number of the current expression
  660. @item chs
  661. number of channels
  662. @item pts
  663. current frame pts
  664. @end table
  665. @item win_size
  666. Set window size.
  667. It accepts the following values:
  668. @table @samp
  669. @item w16
  670. @item w32
  671. @item w64
  672. @item w128
  673. @item w256
  674. @item w512
  675. @item w1024
  676. @item w2048
  677. @item w4096
  678. @item w8192
  679. @item w16384
  680. @item w32768
  681. @item w65536
  682. @end table
  683. Default is @code{w4096}
  684. @item win_func
  685. Set window function. Default is @code{hann}.
  686. @item overlap
  687. Set window overlap. If set to 1, the recommended overlap for selected
  688. window function will be picked. Default is @code{0.75}.
  689. @end table
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Leave almost only low frequencies in audio:
  694. @example
  695. afftfilt="1-clip((b/nb)*b,0,1)"
  696. @end example
  697. @end itemize
  698. @anchor{aformat}
  699. @section aformat
  700. Set output format constraints for the input audio. The framework will
  701. negotiate the most appropriate format to minimize conversions.
  702. It accepts the following parameters:
  703. @table @option
  704. @item sample_fmts
  705. A '|'-separated list of requested sample formats.
  706. @item sample_rates
  707. A '|'-separated list of requested sample rates.
  708. @item channel_layouts
  709. A '|'-separated list of requested channel layouts.
  710. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  711. for the required syntax.
  712. @end table
  713. If a parameter is omitted, all values are allowed.
  714. Force the output to either unsigned 8-bit or signed 16-bit stereo
  715. @example
  716. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  717. @end example
  718. @section agate
  719. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  720. processing reduces disturbing noise between useful signals.
  721. Gating is done by detecting the volume below a chosen level @var{threshold}
  722. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  723. floor is set via @var{range}. Because an exact manipulation of the signal
  724. would cause distortion of the waveform the reduction can be levelled over
  725. time. This is done by setting @var{attack} and @var{release}.
  726. @var{attack} determines how long the signal has to fall below the threshold
  727. before any reduction will occur and @var{release} sets the time the signal
  728. has to rise above the threshold to reduce the reduction again.
  729. Shorter signals than the chosen attack time will be left untouched.
  730. @table @option
  731. @item level_in
  732. Set input level before filtering.
  733. Default is 1. Allowed range is from 0.015625 to 64.
  734. @item range
  735. Set the level of gain reduction when the signal is below the threshold.
  736. Default is 0.06125. Allowed range is from 0 to 1.
  737. @item threshold
  738. If a signal rises above this level the gain reduction is released.
  739. Default is 0.125. Allowed range is from 0 to 1.
  740. @item ratio
  741. Set a ratio by which the signal is reduced.
  742. Default is 2. Allowed range is from 1 to 9000.
  743. @item attack
  744. Amount of milliseconds the signal has to rise above the threshold before gain
  745. reduction stops.
  746. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  747. @item release
  748. Amount of milliseconds the signal has to fall below the threshold before the
  749. reduction is increased again. Default is 250 milliseconds.
  750. Allowed range is from 0.01 to 9000.
  751. @item makeup
  752. Set amount of amplification of signal after processing.
  753. Default is 1. Allowed range is from 1 to 64.
  754. @item knee
  755. Curve the sharp knee around the threshold to enter gain reduction more softly.
  756. Default is 2.828427125. Allowed range is from 1 to 8.
  757. @item detection
  758. Choose if exact signal should be taken for detection or an RMS like one.
  759. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  760. @item link
  761. Choose if the average level between all channels or the louder channel affects
  762. the reduction.
  763. Default is @code{average}. Can be @code{average} or @code{maximum}.
  764. @end table
  765. @section alimiter
  766. The limiter prevents an input signal from rising over a desired threshold.
  767. This limiter uses lookahead technology to prevent your signal from distorting.
  768. It means that there is a small delay after the signal is processed. Keep in mind
  769. that the delay it produces is the attack time you set.
  770. The filter accepts the following options:
  771. @table @option
  772. @item level_in
  773. Set input gain. Default is 1.
  774. @item level_out
  775. Set output gain. Default is 1.
  776. @item limit
  777. Don't let signals above this level pass the limiter. Default is 1.
  778. @item attack
  779. The limiter will reach its attenuation level in this amount of time in
  780. milliseconds. Default is 5 milliseconds.
  781. @item release
  782. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  783. Default is 50 milliseconds.
  784. @item asc
  785. When gain reduction is always needed ASC takes care of releasing to an
  786. average reduction level rather than reaching a reduction of 0 in the release
  787. time.
  788. @item asc_level
  789. Select how much the release time is affected by ASC, 0 means nearly no changes
  790. in release time while 1 produces higher release times.
  791. @item level
  792. Auto level output signal. Default is enabled.
  793. This normalizes audio back to 0dB if enabled.
  794. @end table
  795. Depending on picked setting it is recommended to upsample input 2x or 4x times
  796. with @ref{aresample} before applying this filter.
  797. @section allpass
  798. Apply a two-pole all-pass filter with central frequency (in Hz)
  799. @var{frequency}, and filter-width @var{width}.
  800. An all-pass filter changes the audio's frequency to phase relationship
  801. without changing its frequency to amplitude relationship.
  802. The filter accepts the following options:
  803. @table @option
  804. @item frequency, f
  805. Set frequency in Hz.
  806. @item width_type
  807. Set method to specify band-width of filter.
  808. @table @option
  809. @item h
  810. Hz
  811. @item q
  812. Q-Factor
  813. @item o
  814. octave
  815. @item s
  816. slope
  817. @end table
  818. @item width, w
  819. Specify the band-width of a filter in width_type units.
  820. @end table
  821. @section aloop
  822. Loop audio samples.
  823. The filter accepts the following options:
  824. @table @option
  825. @item loop
  826. Set the number of loops.
  827. @item size
  828. Set maximal number of samples.
  829. @item start
  830. Set first sample of loop.
  831. @end table
  832. @anchor{amerge}
  833. @section amerge
  834. Merge two or more audio streams into a single multi-channel stream.
  835. The filter accepts the following options:
  836. @table @option
  837. @item inputs
  838. Set the number of inputs. Default is 2.
  839. @end table
  840. If the channel layouts of the inputs are disjoint, and therefore compatible,
  841. the channel layout of the output will be set accordingly and the channels
  842. will be reordered as necessary. If the channel layouts of the inputs are not
  843. disjoint, the output will have all the channels of the first input then all
  844. the channels of the second input, in that order, and the channel layout of
  845. the output will be the default value corresponding to the total number of
  846. channels.
  847. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  848. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  849. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  850. first input, b1 is the first channel of the second input).
  851. On the other hand, if both input are in stereo, the output channels will be
  852. in the default order: a1, a2, b1, b2, and the channel layout will be
  853. arbitrarily set to 4.0, which may or may not be the expected value.
  854. All inputs must have the same sample rate, and format.
  855. If inputs do not have the same duration, the output will stop with the
  856. shortest.
  857. @subsection Examples
  858. @itemize
  859. @item
  860. Merge two mono files into a stereo stream:
  861. @example
  862. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  863. @end example
  864. @item
  865. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  866. @example
  867. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  868. @end example
  869. @end itemize
  870. @section amix
  871. Mixes multiple audio inputs into a single output.
  872. Note that this filter only supports float samples (the @var{amerge}
  873. and @var{pan} audio filters support many formats). If the @var{amix}
  874. input has integer samples then @ref{aresample} will be automatically
  875. inserted to perform the conversion to float samples.
  876. For example
  877. @example
  878. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  879. @end example
  880. will mix 3 input audio streams to a single output with the same duration as the
  881. first input and a dropout transition time of 3 seconds.
  882. It accepts the following parameters:
  883. @table @option
  884. @item inputs
  885. The number of inputs. If unspecified, it defaults to 2.
  886. @item duration
  887. How to determine the end-of-stream.
  888. @table @option
  889. @item longest
  890. The duration of the longest input. (default)
  891. @item shortest
  892. The duration of the shortest input.
  893. @item first
  894. The duration of the first input.
  895. @end table
  896. @item dropout_transition
  897. The transition time, in seconds, for volume renormalization when an input
  898. stream ends. The default value is 2 seconds.
  899. @end table
  900. @section anequalizer
  901. High-order parametric multiband equalizer for each channel.
  902. It accepts the following parameters:
  903. @table @option
  904. @item params
  905. This option string is in format:
  906. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  907. Each equalizer band is separated by '|'.
  908. @table @option
  909. @item chn
  910. Set channel number to which equalization will be applied.
  911. If input doesn't have that channel the entry is ignored.
  912. @item f
  913. Set central frequency for band.
  914. If input doesn't have that frequency the entry is ignored.
  915. @item w
  916. Set band width in hertz.
  917. @item g
  918. Set band gain in dB.
  919. @item t
  920. Set filter type for band, optional, can be:
  921. @table @samp
  922. @item 0
  923. Butterworth, this is default.
  924. @item 1
  925. Chebyshev type 1.
  926. @item 2
  927. Chebyshev type 2.
  928. @end table
  929. @end table
  930. @item curves
  931. With this option activated frequency response of anequalizer is displayed
  932. in video stream.
  933. @item size
  934. Set video stream size. Only useful if curves option is activated.
  935. @item mgain
  936. Set max gain that will be displayed. Only useful if curves option is activated.
  937. Setting this to a reasonable value makes it possible to display gain which is derived from
  938. neighbour bands which are too close to each other and thus produce higher gain
  939. when both are activated.
  940. @item fscale
  941. Set frequency scale used to draw frequency response in video output.
  942. Can be linear or logarithmic. Default is logarithmic.
  943. @item colors
  944. Set color for each channel curve which is going to be displayed in video stream.
  945. This is list of color names separated by space or by '|'.
  946. Unrecognised or missing colors will be replaced by white color.
  947. @end table
  948. @subsection Examples
  949. @itemize
  950. @item
  951. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  952. for first 2 channels using Chebyshev type 1 filter:
  953. @example
  954. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  955. @end example
  956. @end itemize
  957. @subsection Commands
  958. This filter supports the following commands:
  959. @table @option
  960. @item change
  961. Alter existing filter parameters.
  962. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  963. @var{fN} is existing filter number, starting from 0, if no such filter is available
  964. error is returned.
  965. @var{freq} set new frequency parameter.
  966. @var{width} set new width parameter in herz.
  967. @var{gain} set new gain parameter in dB.
  968. Full filter invocation with asendcmd may look like this:
  969. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  970. @end table
  971. @section anull
  972. Pass the audio source unchanged to the output.
  973. @section apad
  974. Pad the end of an audio stream with silence.
  975. This can be used together with @command{ffmpeg} @option{-shortest} to
  976. extend audio streams to the same length as the video stream.
  977. A description of the accepted options follows.
  978. @table @option
  979. @item packet_size
  980. Set silence packet size. Default value is 4096.
  981. @item pad_len
  982. Set the number of samples of silence to add to the end. After the
  983. value is reached, the stream is terminated. This option is mutually
  984. exclusive with @option{whole_len}.
  985. @item whole_len
  986. Set the minimum total number of samples in the output audio stream. If
  987. the value is longer than the input audio length, silence is added to
  988. the end, until the value is reached. This option is mutually exclusive
  989. with @option{pad_len}.
  990. @end table
  991. If neither the @option{pad_len} nor the @option{whole_len} option is
  992. set, the filter will add silence to the end of the input stream
  993. indefinitely.
  994. @subsection Examples
  995. @itemize
  996. @item
  997. Add 1024 samples of silence to the end of the input:
  998. @example
  999. apad=pad_len=1024
  1000. @end example
  1001. @item
  1002. Make sure the audio output will contain at least 10000 samples, pad
  1003. the input with silence if required:
  1004. @example
  1005. apad=whole_len=10000
  1006. @end example
  1007. @item
  1008. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1009. video stream will always result the shortest and will be converted
  1010. until the end in the output file when using the @option{shortest}
  1011. option:
  1012. @example
  1013. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1014. @end example
  1015. @end itemize
  1016. @section aphaser
  1017. Add a phasing effect to the input audio.
  1018. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1019. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1020. A description of the accepted parameters follows.
  1021. @table @option
  1022. @item in_gain
  1023. Set input gain. Default is 0.4.
  1024. @item out_gain
  1025. Set output gain. Default is 0.74
  1026. @item delay
  1027. Set delay in milliseconds. Default is 3.0.
  1028. @item decay
  1029. Set decay. Default is 0.4.
  1030. @item speed
  1031. Set modulation speed in Hz. Default is 0.5.
  1032. @item type
  1033. Set modulation type. Default is triangular.
  1034. It accepts the following values:
  1035. @table @samp
  1036. @item triangular, t
  1037. @item sinusoidal, s
  1038. @end table
  1039. @end table
  1040. @section apulsator
  1041. Audio pulsator is something between an autopanner and a tremolo.
  1042. But it can produce funny stereo effects as well. Pulsator changes the volume
  1043. of the left and right channel based on a LFO (low frequency oscillator) with
  1044. different waveforms and shifted phases.
  1045. This filter have the ability to define an offset between left and right
  1046. channel. An offset of 0 means that both LFO shapes match each other.
  1047. The left and right channel are altered equally - a conventional tremolo.
  1048. An offset of 50% means that the shape of the right channel is exactly shifted
  1049. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1050. an autopanner. At 1 both curves match again. Every setting in between moves the
  1051. phase shift gapless between all stages and produces some "bypassing" sounds with
  1052. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1053. the 0.5) the faster the signal passes from the left to the right speaker.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item level_in
  1057. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1058. @item level_out
  1059. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1060. @item mode
  1061. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1062. sawup or sawdown. Default is sine.
  1063. @item amount
  1064. Set modulation. Define how much of original signal is affected by the LFO.
  1065. @item offset_l
  1066. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1067. @item offset_r
  1068. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1069. @item width
  1070. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1071. @item timing
  1072. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1073. @item bpm
  1074. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1075. is set to bpm.
  1076. @item ms
  1077. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1078. is set to ms.
  1079. @item hz
  1080. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1081. if timing is set to hz.
  1082. @end table
  1083. @anchor{aresample}
  1084. @section aresample
  1085. Resample the input audio to the specified parameters, using the
  1086. libswresample library. If none are specified then the filter will
  1087. automatically convert between its input and output.
  1088. This filter is also able to stretch/squeeze the audio data to make it match
  1089. the timestamps or to inject silence / cut out audio to make it match the
  1090. timestamps, do a combination of both or do neither.
  1091. The filter accepts the syntax
  1092. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1093. expresses a sample rate and @var{resampler_options} is a list of
  1094. @var{key}=@var{value} pairs, separated by ":". See the
  1095. @ref{Resampler Options,,the "Resampler Options" section in the
  1096. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1097. for the complete list of supported options.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Resample the input audio to 44100Hz:
  1102. @example
  1103. aresample=44100
  1104. @end example
  1105. @item
  1106. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1107. samples per second compensation:
  1108. @example
  1109. aresample=async=1000
  1110. @end example
  1111. @end itemize
  1112. @section areverse
  1113. Reverse an audio clip.
  1114. Warning: This filter requires memory to buffer the entire clip, so trimming
  1115. is suggested.
  1116. @subsection Examples
  1117. @itemize
  1118. @item
  1119. Take the first 5 seconds of a clip, and reverse it.
  1120. @example
  1121. atrim=end=5,areverse
  1122. @end example
  1123. @end itemize
  1124. @section asetnsamples
  1125. Set the number of samples per each output audio frame.
  1126. The last output packet may contain a different number of samples, as
  1127. the filter will flush all the remaining samples when the input audio
  1128. signals its end.
  1129. The filter accepts the following options:
  1130. @table @option
  1131. @item nb_out_samples, n
  1132. Set the number of frames per each output audio frame. The number is
  1133. intended as the number of samples @emph{per each channel}.
  1134. Default value is 1024.
  1135. @item pad, p
  1136. If set to 1, the filter will pad the last audio frame with zeroes, so
  1137. that the last frame will contain the same number of samples as the
  1138. previous ones. Default value is 1.
  1139. @end table
  1140. For example, to set the number of per-frame samples to 1234 and
  1141. disable padding for the last frame, use:
  1142. @example
  1143. asetnsamples=n=1234:p=0
  1144. @end example
  1145. @section asetrate
  1146. Set the sample rate without altering the PCM data.
  1147. This will result in a change of speed and pitch.
  1148. The filter accepts the following options:
  1149. @table @option
  1150. @item sample_rate, r
  1151. Set the output sample rate. Default is 44100 Hz.
  1152. @end table
  1153. @section ashowinfo
  1154. Show a line containing various information for each input audio frame.
  1155. The input audio is not modified.
  1156. The shown line contains a sequence of key/value pairs of the form
  1157. @var{key}:@var{value}.
  1158. The following values are shown in the output:
  1159. @table @option
  1160. @item n
  1161. The (sequential) number of the input frame, starting from 0.
  1162. @item pts
  1163. The presentation timestamp of the input frame, in time base units; the time base
  1164. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1165. @item pts_time
  1166. The presentation timestamp of the input frame in seconds.
  1167. @item pos
  1168. position of the frame in the input stream, -1 if this information in
  1169. unavailable and/or meaningless (for example in case of synthetic audio)
  1170. @item fmt
  1171. The sample format.
  1172. @item chlayout
  1173. The channel layout.
  1174. @item rate
  1175. The sample rate for the audio frame.
  1176. @item nb_samples
  1177. The number of samples (per channel) in the frame.
  1178. @item checksum
  1179. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1180. audio, the data is treated as if all the planes were concatenated.
  1181. @item plane_checksums
  1182. A list of Adler-32 checksums for each data plane.
  1183. @end table
  1184. @anchor{astats}
  1185. @section astats
  1186. Display time domain statistical information about the audio channels.
  1187. Statistics are calculated and displayed for each audio channel and,
  1188. where applicable, an overall figure is also given.
  1189. It accepts the following option:
  1190. @table @option
  1191. @item length
  1192. Short window length in seconds, used for peak and trough RMS measurement.
  1193. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1194. @item metadata
  1195. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1196. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1197. disabled.
  1198. Available keys for each channel are:
  1199. DC_offset
  1200. Min_level
  1201. Max_level
  1202. Min_difference
  1203. Max_difference
  1204. Mean_difference
  1205. Peak_level
  1206. RMS_peak
  1207. RMS_trough
  1208. Crest_factor
  1209. Flat_factor
  1210. Peak_count
  1211. Bit_depth
  1212. and for Overall:
  1213. DC_offset
  1214. Min_level
  1215. Max_level
  1216. Min_difference
  1217. Max_difference
  1218. Mean_difference
  1219. Peak_level
  1220. RMS_level
  1221. RMS_peak
  1222. RMS_trough
  1223. Flat_factor
  1224. Peak_count
  1225. Bit_depth
  1226. Number_of_samples
  1227. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1228. this @code{lavfi.astats.Overall.Peak_count}.
  1229. For description what each key means read below.
  1230. @item reset
  1231. Set number of frame after which stats are going to be recalculated.
  1232. Default is disabled.
  1233. @end table
  1234. A description of each shown parameter follows:
  1235. @table @option
  1236. @item DC offset
  1237. Mean amplitude displacement from zero.
  1238. @item Min level
  1239. Minimal sample level.
  1240. @item Max level
  1241. Maximal sample level.
  1242. @item Min difference
  1243. Minimal difference between two consecutive samples.
  1244. @item Max difference
  1245. Maximal difference between two consecutive samples.
  1246. @item Mean difference
  1247. Mean difference between two consecutive samples.
  1248. The average of each difference between two consecutive samples.
  1249. @item Peak level dB
  1250. @item RMS level dB
  1251. Standard peak and RMS level measured in dBFS.
  1252. @item RMS peak dB
  1253. @item RMS trough dB
  1254. Peak and trough values for RMS level measured over a short window.
  1255. @item Crest factor
  1256. Standard ratio of peak to RMS level (note: not in dB).
  1257. @item Flat factor
  1258. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1259. (i.e. either @var{Min level} or @var{Max level}).
  1260. @item Peak count
  1261. Number of occasions (not the number of samples) that the signal attained either
  1262. @var{Min level} or @var{Max level}.
  1263. @item Bit depth
  1264. Overall bit depth of audio. Number of bits used for each sample.
  1265. @end table
  1266. @section asyncts
  1267. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1268. dropping samples/adding silence when needed.
  1269. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1270. It accepts the following parameters:
  1271. @table @option
  1272. @item compensate
  1273. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1274. by default. When disabled, time gaps are covered with silence.
  1275. @item min_delta
  1276. The minimum difference between timestamps and audio data (in seconds) to trigger
  1277. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1278. sync with this filter, try setting this parameter to 0.
  1279. @item max_comp
  1280. The maximum compensation in samples per second. Only relevant with compensate=1.
  1281. The default value is 500.
  1282. @item first_pts
  1283. Assume that the first PTS should be this value. The time base is 1 / sample
  1284. rate. This allows for padding/trimming at the start of the stream. By default,
  1285. no assumption is made about the first frame's expected PTS, so no padding or
  1286. trimming is done. For example, this could be set to 0 to pad the beginning with
  1287. silence if an audio stream starts after the video stream or to trim any samples
  1288. with a negative PTS due to encoder delay.
  1289. @end table
  1290. @section atempo
  1291. Adjust audio tempo.
  1292. The filter accepts exactly one parameter, the audio tempo. If not
  1293. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1294. be in the [0.5, 2.0] range.
  1295. @subsection Examples
  1296. @itemize
  1297. @item
  1298. Slow down audio to 80% tempo:
  1299. @example
  1300. atempo=0.8
  1301. @end example
  1302. @item
  1303. To speed up audio to 125% tempo:
  1304. @example
  1305. atempo=1.25
  1306. @end example
  1307. @end itemize
  1308. @section atrim
  1309. Trim the input so that the output contains one continuous subpart of the input.
  1310. It accepts the following parameters:
  1311. @table @option
  1312. @item start
  1313. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1314. sample with the timestamp @var{start} will be the first sample in the output.
  1315. @item end
  1316. Specify time of the first audio sample that will be dropped, i.e. the
  1317. audio sample immediately preceding the one with the timestamp @var{end} will be
  1318. the last sample in the output.
  1319. @item start_pts
  1320. Same as @var{start}, except this option sets the start timestamp in samples
  1321. instead of seconds.
  1322. @item end_pts
  1323. Same as @var{end}, except this option sets the end timestamp in samples instead
  1324. of seconds.
  1325. @item duration
  1326. The maximum duration of the output in seconds.
  1327. @item start_sample
  1328. The number of the first sample that should be output.
  1329. @item end_sample
  1330. The number of the first sample that should be dropped.
  1331. @end table
  1332. @option{start}, @option{end}, and @option{duration} are expressed as time
  1333. duration specifications; see
  1334. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1335. Note that the first two sets of the start/end options and the @option{duration}
  1336. option look at the frame timestamp, while the _sample options simply count the
  1337. samples that pass through the filter. So start/end_pts and start/end_sample will
  1338. give different results when the timestamps are wrong, inexact or do not start at
  1339. zero. Also note that this filter does not modify the timestamps. If you wish
  1340. to have the output timestamps start at zero, insert the asetpts filter after the
  1341. atrim filter.
  1342. If multiple start or end options are set, this filter tries to be greedy and
  1343. keep all samples that match at least one of the specified constraints. To keep
  1344. only the part that matches all the constraints at once, chain multiple atrim
  1345. filters.
  1346. The defaults are such that all the input is kept. So it is possible to set e.g.
  1347. just the end values to keep everything before the specified time.
  1348. Examples:
  1349. @itemize
  1350. @item
  1351. Drop everything except the second minute of input:
  1352. @example
  1353. ffmpeg -i INPUT -af atrim=60:120
  1354. @end example
  1355. @item
  1356. Keep only the first 1000 samples:
  1357. @example
  1358. ffmpeg -i INPUT -af atrim=end_sample=1000
  1359. @end example
  1360. @end itemize
  1361. @section bandpass
  1362. Apply a two-pole Butterworth band-pass filter with central
  1363. frequency @var{frequency}, and (3dB-point) band-width width.
  1364. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1365. instead of the default: constant 0dB peak gain.
  1366. The filter roll off at 6dB per octave (20dB per decade).
  1367. The filter accepts the following options:
  1368. @table @option
  1369. @item frequency, f
  1370. Set the filter's central frequency. Default is @code{3000}.
  1371. @item csg
  1372. Constant skirt gain if set to 1. Defaults to 0.
  1373. @item width_type
  1374. Set method to specify band-width of filter.
  1375. @table @option
  1376. @item h
  1377. Hz
  1378. @item q
  1379. Q-Factor
  1380. @item o
  1381. octave
  1382. @item s
  1383. slope
  1384. @end table
  1385. @item width, w
  1386. Specify the band-width of a filter in width_type units.
  1387. @end table
  1388. @section bandreject
  1389. Apply a two-pole Butterworth band-reject filter with central
  1390. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1391. The filter roll off at 6dB per octave (20dB per decade).
  1392. The filter accepts the following options:
  1393. @table @option
  1394. @item frequency, f
  1395. Set the filter's central frequency. Default is @code{3000}.
  1396. @item width_type
  1397. Set method to specify band-width of filter.
  1398. @table @option
  1399. @item h
  1400. Hz
  1401. @item q
  1402. Q-Factor
  1403. @item o
  1404. octave
  1405. @item s
  1406. slope
  1407. @end table
  1408. @item width, w
  1409. Specify the band-width of a filter in width_type units.
  1410. @end table
  1411. @section bass
  1412. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1413. shelving filter with a response similar to that of a standard
  1414. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1415. The filter accepts the following options:
  1416. @table @option
  1417. @item gain, g
  1418. Give the gain at 0 Hz. Its useful range is about -20
  1419. (for a large cut) to +20 (for a large boost).
  1420. Beware of clipping when using a positive gain.
  1421. @item frequency, f
  1422. Set the filter's central frequency and so can be used
  1423. to extend or reduce the frequency range to be boosted or cut.
  1424. The default value is @code{100} Hz.
  1425. @item width_type
  1426. Set method to specify band-width of filter.
  1427. @table @option
  1428. @item h
  1429. Hz
  1430. @item q
  1431. Q-Factor
  1432. @item o
  1433. octave
  1434. @item s
  1435. slope
  1436. @end table
  1437. @item width, w
  1438. Determine how steep is the filter's shelf transition.
  1439. @end table
  1440. @section biquad
  1441. Apply a biquad IIR filter with the given coefficients.
  1442. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1443. are the numerator and denominator coefficients respectively.
  1444. @section bs2b
  1445. Bauer stereo to binaural transformation, which improves headphone listening of
  1446. stereo audio records.
  1447. It accepts the following parameters:
  1448. @table @option
  1449. @item profile
  1450. Pre-defined crossfeed level.
  1451. @table @option
  1452. @item default
  1453. Default level (fcut=700, feed=50).
  1454. @item cmoy
  1455. Chu Moy circuit (fcut=700, feed=60).
  1456. @item jmeier
  1457. Jan Meier circuit (fcut=650, feed=95).
  1458. @end table
  1459. @item fcut
  1460. Cut frequency (in Hz).
  1461. @item feed
  1462. Feed level (in Hz).
  1463. @end table
  1464. @section channelmap
  1465. Remap input channels to new locations.
  1466. It accepts the following parameters:
  1467. @table @option
  1468. @item map
  1469. Map channels from input to output. The argument is a '|'-separated list of
  1470. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1471. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1472. channel (e.g. FL for front left) or its index in the input channel layout.
  1473. @var{out_channel} is the name of the output channel or its index in the output
  1474. channel layout. If @var{out_channel} is not given then it is implicitly an
  1475. index, starting with zero and increasing by one for each mapping.
  1476. @item channel_layout
  1477. The channel layout of the output stream.
  1478. @end table
  1479. If no mapping is present, the filter will implicitly map input channels to
  1480. output channels, preserving indices.
  1481. For example, assuming a 5.1+downmix input MOV file,
  1482. @example
  1483. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1484. @end example
  1485. will create an output WAV file tagged as stereo from the downmix channels of
  1486. the input.
  1487. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1488. @example
  1489. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1490. @end example
  1491. @section channelsplit
  1492. Split each channel from an input audio stream into a separate output stream.
  1493. It accepts the following parameters:
  1494. @table @option
  1495. @item channel_layout
  1496. The channel layout of the input stream. The default is "stereo".
  1497. @end table
  1498. For example, assuming a stereo input MP3 file,
  1499. @example
  1500. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1501. @end example
  1502. will create an output Matroska file with two audio streams, one containing only
  1503. the left channel and the other the right channel.
  1504. Split a 5.1 WAV file into per-channel files:
  1505. @example
  1506. ffmpeg -i in.wav -filter_complex
  1507. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1508. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1509. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1510. side_right.wav
  1511. @end example
  1512. @section chorus
  1513. Add a chorus effect to the audio.
  1514. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1515. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1516. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1517. The modulation depth defines the range the modulated delay is played before or after
  1518. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1519. sound tuned around the original one, like in a chorus where some vocals are slightly
  1520. off key.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item in_gain
  1524. Set input gain. Default is 0.4.
  1525. @item out_gain
  1526. Set output gain. Default is 0.4.
  1527. @item delays
  1528. Set delays. A typical delay is around 40ms to 60ms.
  1529. @item decays
  1530. Set decays.
  1531. @item speeds
  1532. Set speeds.
  1533. @item depths
  1534. Set depths.
  1535. @end table
  1536. @subsection Examples
  1537. @itemize
  1538. @item
  1539. A single delay:
  1540. @example
  1541. chorus=0.7:0.9:55:0.4:0.25:2
  1542. @end example
  1543. @item
  1544. Two delays:
  1545. @example
  1546. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1547. @end example
  1548. @item
  1549. Fuller sounding chorus with three delays:
  1550. @example
  1551. 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
  1552. @end example
  1553. @end itemize
  1554. @section compand
  1555. Compress or expand the audio's dynamic range.
  1556. It accepts the following parameters:
  1557. @table @option
  1558. @item attacks
  1559. @item decays
  1560. A list of times in seconds for each channel over which the instantaneous level
  1561. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1562. increase of volume and @var{decays} refers to decrease of volume. For most
  1563. situations, the attack time (response to the audio getting louder) should be
  1564. shorter than the decay time, because the human ear is more sensitive to sudden
  1565. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1566. a typical value for decay is 0.8 seconds.
  1567. If specified number of attacks & decays is lower than number of channels, the last
  1568. set attack/decay will be used for all remaining channels.
  1569. @item points
  1570. A list of points for the transfer function, specified in dB relative to the
  1571. maximum possible signal amplitude. Each key points list must be defined using
  1572. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1573. @code{x0/y0 x1/y1 x2/y2 ....}
  1574. The input values must be in strictly increasing order but the transfer function
  1575. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1576. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1577. function are @code{-70/-70|-60/-20}.
  1578. @item soft-knee
  1579. Set the curve radius in dB for all joints. It defaults to 0.01.
  1580. @item gain
  1581. Set the additional gain in dB to be applied at all points on the transfer
  1582. function. This allows for easy adjustment of the overall gain.
  1583. It defaults to 0.
  1584. @item volume
  1585. Set an initial volume, in dB, to be assumed for each channel when filtering
  1586. starts. This permits the user to supply a nominal level initially, so that, for
  1587. example, a very large gain is not applied to initial signal levels before the
  1588. companding has begun to operate. A typical value for audio which is initially
  1589. quiet is -90 dB. It defaults to 0.
  1590. @item delay
  1591. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1592. delayed before being fed to the volume adjuster. Specifying a delay
  1593. approximately equal to the attack/decay times allows the filter to effectively
  1594. operate in predictive rather than reactive mode. It defaults to 0.
  1595. @end table
  1596. @subsection Examples
  1597. @itemize
  1598. @item
  1599. Make music with both quiet and loud passages suitable for listening to in a
  1600. noisy environment:
  1601. @example
  1602. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1603. @end example
  1604. Another example for audio with whisper and explosion parts:
  1605. @example
  1606. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1607. @end example
  1608. @item
  1609. A noise gate for when the noise is at a lower level than the signal:
  1610. @example
  1611. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1612. @end example
  1613. @item
  1614. Here is another noise gate, this time for when the noise is at a higher level
  1615. than the signal (making it, in some ways, similar to squelch):
  1616. @example
  1617. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1618. @end example
  1619. @item
  1620. 2:1 compression starting at -6dB:
  1621. @example
  1622. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1623. @end example
  1624. @item
  1625. 2:1 compression starting at -9dB:
  1626. @example
  1627. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1628. @end example
  1629. @item
  1630. 2:1 compression starting at -12dB:
  1631. @example
  1632. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1633. @end example
  1634. @item
  1635. 2:1 compression starting at -18dB:
  1636. @example
  1637. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1638. @end example
  1639. @item
  1640. 3:1 compression starting at -15dB:
  1641. @example
  1642. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1643. @end example
  1644. @item
  1645. Compressor/Gate:
  1646. @example
  1647. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1648. @end example
  1649. @item
  1650. Expander:
  1651. @example
  1652. 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
  1653. @end example
  1654. @item
  1655. Hard limiter at -6dB:
  1656. @example
  1657. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1658. @end example
  1659. @item
  1660. Hard limiter at -12dB:
  1661. @example
  1662. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1663. @end example
  1664. @item
  1665. Hard noise gate at -35 dB:
  1666. @example
  1667. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1668. @end example
  1669. @item
  1670. Soft limiter:
  1671. @example
  1672. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1673. @end example
  1674. @end itemize
  1675. @section compensationdelay
  1676. Compensation Delay Line is a metric based delay to compensate differing
  1677. positions of microphones or speakers.
  1678. For example, you have recorded guitar with two microphones placed in
  1679. different location. Because the front of sound wave has fixed speed in
  1680. normal conditions, the phasing of microphones can vary and depends on
  1681. their location and interposition. The best sound mix can be achieved when
  1682. these microphones are in phase (synchronized). Note that distance of
  1683. ~30 cm between microphones makes one microphone to capture signal in
  1684. antiphase to another microphone. That makes the final mix sounding moody.
  1685. This filter helps to solve phasing problems by adding different delays
  1686. to each microphone track and make them synchronized.
  1687. The best result can be reached when you take one track as base and
  1688. synchronize other tracks one by one with it.
  1689. Remember that synchronization/delay tolerance depends on sample rate, too.
  1690. Higher sample rates will give more tolerance.
  1691. It accepts the following parameters:
  1692. @table @option
  1693. @item mm
  1694. Set millimeters distance. This is compensation distance for fine tuning.
  1695. Default is 0.
  1696. @item cm
  1697. Set cm distance. This is compensation distance for tightening distance setup.
  1698. Default is 0.
  1699. @item m
  1700. Set meters distance. This is compensation distance for hard distance setup.
  1701. Default is 0.
  1702. @item dry
  1703. Set dry amount. Amount of unprocessed (dry) signal.
  1704. Default is 0.
  1705. @item wet
  1706. Set wet amount. Amount of processed (wet) signal.
  1707. Default is 1.
  1708. @item temp
  1709. Set temperature degree in Celsius. This is the temperature of the environment.
  1710. Default is 20.
  1711. @end table
  1712. @section crystalizer
  1713. Simple algorithm to expand audio dynamic range.
  1714. The filter accepts the following options:
  1715. @table @option
  1716. @item i
  1717. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1718. (unchanged sound) to 10.0 (maximum effect).
  1719. @item c
  1720. Enable clipping. By default is enabled.
  1721. @end table
  1722. @section dcshift
  1723. Apply a DC shift to the audio.
  1724. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1725. in the recording chain) from the audio. The effect of a DC offset is reduced
  1726. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1727. a signal has a DC offset.
  1728. @table @option
  1729. @item shift
  1730. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1731. the audio.
  1732. @item limitergain
  1733. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1734. used to prevent clipping.
  1735. @end table
  1736. @section dynaudnorm
  1737. Dynamic Audio Normalizer.
  1738. This filter applies a certain amount of gain to the input audio in order
  1739. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1740. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1741. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1742. This allows for applying extra gain to the "quiet" sections of the audio
  1743. while avoiding distortions or clipping the "loud" sections. In other words:
  1744. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1745. sections, in the sense that the volume of each section is brought to the
  1746. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1747. this goal *without* applying "dynamic range compressing". It will retain 100%
  1748. of the dynamic range *within* each section of the audio file.
  1749. @table @option
  1750. @item f
  1751. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1752. Default is 500 milliseconds.
  1753. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1754. referred to as frames. This is required, because a peak magnitude has no
  1755. meaning for just a single sample value. Instead, we need to determine the
  1756. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1757. normalizer would simply use the peak magnitude of the complete file, the
  1758. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1759. frame. The length of a frame is specified in milliseconds. By default, the
  1760. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1761. been found to give good results with most files.
  1762. Note that the exact frame length, in number of samples, will be determined
  1763. automatically, based on the sampling rate of the individual input audio file.
  1764. @item g
  1765. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1766. number. Default is 31.
  1767. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1768. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1769. is specified in frames, centered around the current frame. For the sake of
  1770. simplicity, this must be an odd number. Consequently, the default value of 31
  1771. takes into account the current frame, as well as the 15 preceding frames and
  1772. the 15 subsequent frames. Using a larger window results in a stronger
  1773. smoothing effect and thus in less gain variation, i.e. slower gain
  1774. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1775. effect and thus in more gain variation, i.e. faster gain adaptation.
  1776. In other words, the more you increase this value, the more the Dynamic Audio
  1777. Normalizer will behave like a "traditional" normalization filter. On the
  1778. contrary, the more you decrease this value, the more the Dynamic Audio
  1779. Normalizer will behave like a dynamic range compressor.
  1780. @item p
  1781. Set the target peak value. This specifies the highest permissible magnitude
  1782. level for the normalized audio input. This filter will try to approach the
  1783. target peak magnitude as closely as possible, but at the same time it also
  1784. makes sure that the normalized signal will never exceed the peak magnitude.
  1785. A frame's maximum local gain factor is imposed directly by the target peak
  1786. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1787. It is not recommended to go above this value.
  1788. @item m
  1789. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1790. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1791. factor for each input frame, i.e. the maximum gain factor that does not
  1792. result in clipping or distortion. The maximum gain factor is determined by
  1793. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1794. additionally bounds the frame's maximum gain factor by a predetermined
  1795. (global) maximum gain factor. This is done in order to avoid excessive gain
  1796. factors in "silent" or almost silent frames. By default, the maximum gain
  1797. factor is 10.0, For most inputs the default value should be sufficient and
  1798. it usually is not recommended to increase this value. Though, for input
  1799. with an extremely low overall volume level, it may be necessary to allow even
  1800. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1801. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1802. Instead, a "sigmoid" threshold function will be applied. This way, the
  1803. gain factors will smoothly approach the threshold value, but never exceed that
  1804. value.
  1805. @item r
  1806. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1807. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1808. This means that the maximum local gain factor for each frame is defined
  1809. (only) by the frame's highest magnitude sample. This way, the samples can
  1810. be amplified as much as possible without exceeding the maximum signal
  1811. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1812. Normalizer can also take into account the frame's root mean square,
  1813. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1814. determine the power of a time-varying signal. It is therefore considered
  1815. that the RMS is a better approximation of the "perceived loudness" than
  1816. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1817. frames to a constant RMS value, a uniform "perceived loudness" can be
  1818. established. If a target RMS value has been specified, a frame's local gain
  1819. factor is defined as the factor that would result in exactly that RMS value.
  1820. Note, however, that the maximum local gain factor is still restricted by the
  1821. frame's highest magnitude sample, in order to prevent clipping.
  1822. @item n
  1823. Enable channels coupling. By default is enabled.
  1824. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1825. amount. This means the same gain factor will be applied to all channels, i.e.
  1826. the maximum possible gain factor is determined by the "loudest" channel.
  1827. However, in some recordings, it may happen that the volume of the different
  1828. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1829. In this case, this option can be used to disable the channel coupling. This way,
  1830. the gain factor will be determined independently for each channel, depending
  1831. only on the individual channel's highest magnitude sample. This allows for
  1832. harmonizing the volume of the different channels.
  1833. @item c
  1834. Enable DC bias correction. By default is disabled.
  1835. An audio signal (in the time domain) is a sequence of sample values.
  1836. In the Dynamic Audio Normalizer these sample values are represented in the
  1837. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1838. audio signal, or "waveform", should be centered around the zero point.
  1839. That means if we calculate the mean value of all samples in a file, or in a
  1840. single frame, then the result should be 0.0 or at least very close to that
  1841. value. If, however, there is a significant deviation of the mean value from
  1842. 0.0, in either positive or negative direction, this is referred to as a
  1843. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1844. Audio Normalizer provides optional DC bias correction.
  1845. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1846. the mean value, or "DC correction" offset, of each input frame and subtract
  1847. that value from all of the frame's sample values which ensures those samples
  1848. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1849. boundaries, the DC correction offset values will be interpolated smoothly
  1850. between neighbouring frames.
  1851. @item b
  1852. Enable alternative boundary mode. By default is disabled.
  1853. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1854. around each frame. This includes the preceding frames as well as the
  1855. subsequent frames. However, for the "boundary" frames, located at the very
  1856. beginning and at the very end of the audio file, not all neighbouring
  1857. frames are available. In particular, for the first few frames in the audio
  1858. file, the preceding frames are not known. And, similarly, for the last few
  1859. frames in the audio file, the subsequent frames are not known. Thus, the
  1860. question arises which gain factors should be assumed for the missing frames
  1861. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1862. to deal with this situation. The default boundary mode assumes a gain factor
  1863. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1864. "fade out" at the beginning and at the end of the input, respectively.
  1865. @item s
  1866. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1867. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1868. compression. This means that signal peaks will not be pruned and thus the
  1869. full dynamic range will be retained within each local neighbourhood. However,
  1870. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1871. normalization algorithm with a more "traditional" compression.
  1872. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1873. (thresholding) function. If (and only if) the compression feature is enabled,
  1874. all input frames will be processed by a soft knee thresholding function prior
  1875. to the actual normalization process. Put simply, the thresholding function is
  1876. going to prune all samples whose magnitude exceeds a certain threshold value.
  1877. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1878. value. Instead, the threshold value will be adjusted for each individual
  1879. frame.
  1880. In general, smaller parameters result in stronger compression, and vice versa.
  1881. Values below 3.0 are not recommended, because audible distortion may appear.
  1882. @end table
  1883. @section earwax
  1884. Make audio easier to listen to on headphones.
  1885. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1886. so that when listened to on headphones the stereo image is moved from
  1887. inside your head (standard for headphones) to outside and in front of
  1888. the listener (standard for speakers).
  1889. Ported from SoX.
  1890. @section equalizer
  1891. Apply a two-pole peaking equalisation (EQ) filter. With this
  1892. filter, the signal-level at and around a selected frequency can
  1893. be increased or decreased, whilst (unlike bandpass and bandreject
  1894. filters) that at all other frequencies is unchanged.
  1895. In order to produce complex equalisation curves, this filter can
  1896. be given several times, each with a different central frequency.
  1897. The filter accepts the following options:
  1898. @table @option
  1899. @item frequency, f
  1900. Set the filter's central frequency in Hz.
  1901. @item width_type
  1902. Set method to specify band-width of filter.
  1903. @table @option
  1904. @item h
  1905. Hz
  1906. @item q
  1907. Q-Factor
  1908. @item o
  1909. octave
  1910. @item s
  1911. slope
  1912. @end table
  1913. @item width, w
  1914. Specify the band-width of a filter in width_type units.
  1915. @item gain, g
  1916. Set the required gain or attenuation in dB.
  1917. Beware of clipping when using a positive gain.
  1918. @end table
  1919. @subsection Examples
  1920. @itemize
  1921. @item
  1922. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1923. @example
  1924. equalizer=f=1000:width_type=h:width=200:g=-10
  1925. @end example
  1926. @item
  1927. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1928. @example
  1929. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1930. @end example
  1931. @end itemize
  1932. @section extrastereo
  1933. Linearly increases the difference between left and right channels which
  1934. adds some sort of "live" effect to playback.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item m
  1938. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1939. (average of both channels), with 1.0 sound will be unchanged, with
  1940. -1.0 left and right channels will be swapped.
  1941. @item c
  1942. Enable clipping. By default is enabled.
  1943. @end table
  1944. @section firequalizer
  1945. Apply FIR Equalization using arbitrary frequency response.
  1946. The filter accepts the following option:
  1947. @table @option
  1948. @item gain
  1949. Set gain curve equation (in dB). The expression can contain variables:
  1950. @table @option
  1951. @item f
  1952. the evaluated frequency
  1953. @item sr
  1954. sample rate
  1955. @item ch
  1956. channel number, set to 0 when multichannels evaluation is disabled
  1957. @item chid
  1958. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1959. multichannels evaluation is disabled
  1960. @item chs
  1961. number of channels
  1962. @item chlayout
  1963. channel_layout, see libavutil/channel_layout.h
  1964. @end table
  1965. and functions:
  1966. @table @option
  1967. @item gain_interpolate(f)
  1968. interpolate gain on frequency f based on gain_entry
  1969. @item cubic_interpolate(f)
  1970. same as gain_interpolate, but smoother
  1971. @end table
  1972. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1973. @item gain_entry
  1974. Set gain entry for gain_interpolate function. The expression can
  1975. contain functions:
  1976. @table @option
  1977. @item entry(f, g)
  1978. store gain entry at frequency f with value g
  1979. @end table
  1980. This option is also available as command.
  1981. @item delay
  1982. Set filter delay in seconds. Higher value means more accurate.
  1983. Default is @code{0.01}.
  1984. @item accuracy
  1985. Set filter accuracy in Hz. Lower value means more accurate.
  1986. Default is @code{5}.
  1987. @item wfunc
  1988. Set window function. Acceptable values are:
  1989. @table @option
  1990. @item rectangular
  1991. rectangular window, useful when gain curve is already smooth
  1992. @item hann
  1993. hann window (default)
  1994. @item hamming
  1995. hamming window
  1996. @item blackman
  1997. blackman window
  1998. @item nuttall3
  1999. 3-terms continuous 1st derivative nuttall window
  2000. @item mnuttall3
  2001. minimum 3-terms discontinuous nuttall window
  2002. @item nuttall
  2003. 4-terms continuous 1st derivative nuttall window
  2004. @item bnuttall
  2005. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2006. @item bharris
  2007. blackman-harris window
  2008. @item tukey
  2009. tukey window
  2010. @end table
  2011. @item fixed
  2012. If enabled, use fixed number of audio samples. This improves speed when
  2013. filtering with large delay. Default is disabled.
  2014. @item multi
  2015. Enable multichannels evaluation on gain. Default is disabled.
  2016. @item zero_phase
  2017. Enable zero phase mode by subtracting timestamp to compensate delay.
  2018. Default is disabled.
  2019. @item scale
  2020. Set scale used by gain. Acceptable values are:
  2021. @table @option
  2022. @item linlin
  2023. linear frequency, linear gain
  2024. @item linlog
  2025. linear frequency, logarithmic (in dB) gain (default)
  2026. @item loglin
  2027. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2028. @item loglog
  2029. logarithmic frequency, logarithmic gain
  2030. @end table
  2031. @item dumpfile
  2032. Set file for dumping, suitable for gnuplot.
  2033. @item dumpscale
  2034. Set scale for dumpfile. Acceptable values are same with scale option.
  2035. Default is linlog.
  2036. @item fft2
  2037. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2038. Default is disabled.
  2039. @end table
  2040. @subsection Examples
  2041. @itemize
  2042. @item
  2043. lowpass at 1000 Hz:
  2044. @example
  2045. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2046. @end example
  2047. @item
  2048. lowpass at 1000 Hz with gain_entry:
  2049. @example
  2050. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2051. @end example
  2052. @item
  2053. custom equalization:
  2054. @example
  2055. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2056. @end example
  2057. @item
  2058. higher delay with zero phase to compensate delay:
  2059. @example
  2060. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2061. @end example
  2062. @item
  2063. lowpass on left channel, highpass on right channel:
  2064. @example
  2065. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2066. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2067. @end example
  2068. @end itemize
  2069. @section flanger
  2070. Apply a flanging effect to the audio.
  2071. The filter accepts the following options:
  2072. @table @option
  2073. @item delay
  2074. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2075. @item depth
  2076. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2077. @item regen
  2078. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2079. Default value is 0.
  2080. @item width
  2081. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2082. Default value is 71.
  2083. @item speed
  2084. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2085. @item shape
  2086. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2087. Default value is @var{sinusoidal}.
  2088. @item phase
  2089. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2090. Default value is 25.
  2091. @item interp
  2092. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2093. Default is @var{linear}.
  2094. @end table
  2095. @section hdcd
  2096. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2097. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2098. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2099. of HDCD, and detects the Transient Filter flag.
  2100. @example
  2101. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2102. @end example
  2103. When using the filter with wav, note the default encoding for wav is 16-bit,
  2104. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2105. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2106. @example
  2107. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2108. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2109. @end example
  2110. The filter accepts the following options:
  2111. @table @option
  2112. @item disable_autoconvert
  2113. Disable any automatic format conversion or resampling in the filter graph.
  2114. @item process_stereo
  2115. Process the stereo channels together. If target_gain does not match between
  2116. channels, consider it invalid and use the last valid target_gain.
  2117. @item cdt_ms
  2118. Set the code detect timer period in ms.
  2119. @item force_pe
  2120. Always extend peaks above -3dBFS even if PE isn't signaled.
  2121. @item analyze_mode
  2122. Replace audio with a solid tone and adjust the amplitude to signal some
  2123. specific aspect of the decoding process. The output file can be loaded in
  2124. an audio editor alongside the original to aid analysis.
  2125. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2126. Modes are:
  2127. @table @samp
  2128. @item 0, off
  2129. Disabled
  2130. @item 1, lle
  2131. Gain adjustment level at each sample
  2132. @item 2, pe
  2133. Samples where peak extend occurs
  2134. @item 3, cdt
  2135. Samples where the code detect timer is active
  2136. @item 4, tgm
  2137. Samples where the target gain does not match between channels
  2138. @end table
  2139. @end table
  2140. @section highpass
  2141. Apply a high-pass filter with 3dB point frequency.
  2142. The filter can be either single-pole, or double-pole (the default).
  2143. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2144. The filter accepts the following options:
  2145. @table @option
  2146. @item frequency, f
  2147. Set frequency in Hz. Default is 3000.
  2148. @item poles, p
  2149. Set number of poles. Default is 2.
  2150. @item width_type
  2151. Set method to specify band-width of filter.
  2152. @table @option
  2153. @item h
  2154. Hz
  2155. @item q
  2156. Q-Factor
  2157. @item o
  2158. octave
  2159. @item s
  2160. slope
  2161. @end table
  2162. @item width, w
  2163. Specify the band-width of a filter in width_type units.
  2164. Applies only to double-pole filter.
  2165. The default is 0.707q and gives a Butterworth response.
  2166. @end table
  2167. @section join
  2168. Join multiple input streams into one multi-channel stream.
  2169. It accepts the following parameters:
  2170. @table @option
  2171. @item inputs
  2172. The number of input streams. It defaults to 2.
  2173. @item channel_layout
  2174. The desired output channel layout. It defaults to stereo.
  2175. @item map
  2176. Map channels from inputs to output. The argument is a '|'-separated list of
  2177. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2178. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2179. can be either the name of the input channel (e.g. FL for front left) or its
  2180. index in the specified input stream. @var{out_channel} is the name of the output
  2181. channel.
  2182. @end table
  2183. The filter will attempt to guess the mappings when they are not specified
  2184. explicitly. It does so by first trying to find an unused matching input channel
  2185. and if that fails it picks the first unused input channel.
  2186. Join 3 inputs (with properly set channel layouts):
  2187. @example
  2188. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2189. @end example
  2190. Build a 5.1 output from 6 single-channel streams:
  2191. @example
  2192. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2193. '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'
  2194. out
  2195. @end example
  2196. @section ladspa
  2197. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2198. To enable compilation of this filter you need to configure FFmpeg with
  2199. @code{--enable-ladspa}.
  2200. @table @option
  2201. @item file, f
  2202. Specifies the name of LADSPA plugin library to load. If the environment
  2203. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2204. each one of the directories specified by the colon separated list in
  2205. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2206. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2207. @file{/usr/lib/ladspa/}.
  2208. @item plugin, p
  2209. Specifies the plugin within the library. Some libraries contain only
  2210. one plugin, but others contain many of them. If this is not set filter
  2211. will list all available plugins within the specified library.
  2212. @item controls, c
  2213. Set the '|' separated list of controls which are zero or more floating point
  2214. values that determine the behavior of the loaded plugin (for example delay,
  2215. threshold or gain).
  2216. Controls need to be defined using the following syntax:
  2217. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2218. @var{valuei} is the value set on the @var{i}-th control.
  2219. Alternatively they can be also defined using the following syntax:
  2220. @var{value0}|@var{value1}|@var{value2}|..., where
  2221. @var{valuei} is the value set on the @var{i}-th control.
  2222. If @option{controls} is set to @code{help}, all available controls and
  2223. their valid ranges are printed.
  2224. @item sample_rate, s
  2225. Specify the sample rate, default to 44100. Only used if plugin have
  2226. zero inputs.
  2227. @item nb_samples, n
  2228. Set the number of samples per channel per each output frame, default
  2229. is 1024. Only used if plugin have zero inputs.
  2230. @item duration, d
  2231. Set the minimum duration of the sourced audio. See
  2232. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2233. for the accepted syntax.
  2234. Note that the resulting duration may be greater than the specified duration,
  2235. as the generated audio is always cut at the end of a complete frame.
  2236. If not specified, or the expressed duration is negative, the audio is
  2237. supposed to be generated forever.
  2238. Only used if plugin have zero inputs.
  2239. @end table
  2240. @subsection Examples
  2241. @itemize
  2242. @item
  2243. List all available plugins within amp (LADSPA example plugin) library:
  2244. @example
  2245. ladspa=file=amp
  2246. @end example
  2247. @item
  2248. List all available controls and their valid ranges for @code{vcf_notch}
  2249. plugin from @code{VCF} library:
  2250. @example
  2251. ladspa=f=vcf:p=vcf_notch:c=help
  2252. @end example
  2253. @item
  2254. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2255. plugin library:
  2256. @example
  2257. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2258. @end example
  2259. @item
  2260. Add reverberation to the audio using TAP-plugins
  2261. (Tom's Audio Processing plugins):
  2262. @example
  2263. ladspa=file=tap_reverb:tap_reverb
  2264. @end example
  2265. @item
  2266. Generate white noise, with 0.2 amplitude:
  2267. @example
  2268. ladspa=file=cmt:noise_source_white:c=c0=.2
  2269. @end example
  2270. @item
  2271. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2272. @code{C* Audio Plugin Suite} (CAPS) library:
  2273. @example
  2274. ladspa=file=caps:Click:c=c1=20'
  2275. @end example
  2276. @item
  2277. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2278. @example
  2279. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2280. @end example
  2281. @item
  2282. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2283. @code{SWH Plugins} collection:
  2284. @example
  2285. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2286. @end example
  2287. @item
  2288. Attenuate low frequencies using Multiband EQ from Steve Harris
  2289. @code{SWH Plugins} collection:
  2290. @example
  2291. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2292. @end example
  2293. @end itemize
  2294. @subsection Commands
  2295. This filter supports the following commands:
  2296. @table @option
  2297. @item cN
  2298. Modify the @var{N}-th control value.
  2299. If the specified value is not valid, it is ignored and prior one is kept.
  2300. @end table
  2301. @section loudnorm
  2302. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2303. Support for both single pass (livestreams, files) and double pass (files) modes.
  2304. This algorithm can target IL, LRA, and maximum true peak.
  2305. The filter accepts the following options:
  2306. @table @option
  2307. @item I, i
  2308. Set integrated loudness target.
  2309. Range is -70.0 - -5.0. Default value is -24.0.
  2310. @item LRA, lra
  2311. Set loudness range target.
  2312. Range is 1.0 - 20.0. Default value is 7.0.
  2313. @item TP, tp
  2314. Set maximum true peak.
  2315. Range is -9.0 - +0.0. Default value is -2.0.
  2316. @item measured_I, measured_i
  2317. Measured IL of input file.
  2318. Range is -99.0 - +0.0.
  2319. @item measured_LRA, measured_lra
  2320. Measured LRA of input file.
  2321. Range is 0.0 - 99.0.
  2322. @item measured_TP, measured_tp
  2323. Measured true peak of input file.
  2324. Range is -99.0 - +99.0.
  2325. @item measured_thresh
  2326. Measured threshold of input file.
  2327. Range is -99.0 - +0.0.
  2328. @item offset
  2329. Set offset gain. Gain is applied before the true-peak limiter.
  2330. Range is -99.0 - +99.0. Default is +0.0.
  2331. @item linear
  2332. Normalize linearly if possible.
  2333. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2334. to be specified in order to use this mode.
  2335. Options are true or false. Default is true.
  2336. @item dual_mono
  2337. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2338. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2339. If set to @code{true}, this option will compensate for this effect.
  2340. Multi-channel input files are not affected by this option.
  2341. Options are true or false. Default is false.
  2342. @item print_format
  2343. Set print format for stats. Options are summary, json, or none.
  2344. Default value is none.
  2345. @end table
  2346. @section lowpass
  2347. Apply a low-pass filter with 3dB point frequency.
  2348. The filter can be either single-pole or double-pole (the default).
  2349. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2350. The filter accepts the following options:
  2351. @table @option
  2352. @item frequency, f
  2353. Set frequency in Hz. Default is 500.
  2354. @item poles, p
  2355. Set number of poles. Default is 2.
  2356. @item width_type
  2357. Set method to specify band-width of filter.
  2358. @table @option
  2359. @item h
  2360. Hz
  2361. @item q
  2362. Q-Factor
  2363. @item o
  2364. octave
  2365. @item s
  2366. slope
  2367. @end table
  2368. @item width, w
  2369. Specify the band-width of a filter in width_type units.
  2370. Applies only to double-pole filter.
  2371. The default is 0.707q and gives a Butterworth response.
  2372. @end table
  2373. @anchor{pan}
  2374. @section pan
  2375. Mix channels with specific gain levels. The filter accepts the output
  2376. channel layout followed by a set of channels definitions.
  2377. This filter is also designed to efficiently remap the channels of an audio
  2378. stream.
  2379. The filter accepts parameters of the form:
  2380. "@var{l}|@var{outdef}|@var{outdef}|..."
  2381. @table @option
  2382. @item l
  2383. output channel layout or number of channels
  2384. @item outdef
  2385. output channel specification, of the form:
  2386. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2387. @item out_name
  2388. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2389. number (c0, c1, etc.)
  2390. @item gain
  2391. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2392. @item in_name
  2393. input channel to use, see out_name for details; it is not possible to mix
  2394. named and numbered input channels
  2395. @end table
  2396. If the `=' in a channel specification is replaced by `<', then the gains for
  2397. that specification will be renormalized so that the total is 1, thus
  2398. avoiding clipping noise.
  2399. @subsection Mixing examples
  2400. For example, if you want to down-mix from stereo to mono, but with a bigger
  2401. factor for the left channel:
  2402. @example
  2403. pan=1c|c0=0.9*c0+0.1*c1
  2404. @end example
  2405. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2406. 7-channels surround:
  2407. @example
  2408. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2409. @end example
  2410. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2411. that should be preferred (see "-ac" option) unless you have very specific
  2412. needs.
  2413. @subsection Remapping examples
  2414. The channel remapping will be effective if, and only if:
  2415. @itemize
  2416. @item gain coefficients are zeroes or ones,
  2417. @item only one input per channel output,
  2418. @end itemize
  2419. If all these conditions are satisfied, the filter will notify the user ("Pure
  2420. channel mapping detected"), and use an optimized and lossless method to do the
  2421. remapping.
  2422. For example, if you have a 5.1 source and want a stereo audio stream by
  2423. dropping the extra channels:
  2424. @example
  2425. pan="stereo| c0=FL | c1=FR"
  2426. @end example
  2427. Given the same source, you can also switch front left and front right channels
  2428. and keep the input channel layout:
  2429. @example
  2430. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2431. @end example
  2432. If the input is a stereo audio stream, you can mute the front left channel (and
  2433. still keep the stereo channel layout) with:
  2434. @example
  2435. pan="stereo|c1=c1"
  2436. @end example
  2437. Still with a stereo audio stream input, you can copy the right channel in both
  2438. front left and right:
  2439. @example
  2440. pan="stereo| c0=FR | c1=FR"
  2441. @end example
  2442. @section replaygain
  2443. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2444. outputs it unchanged.
  2445. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2446. @section resample
  2447. Convert the audio sample format, sample rate and channel layout. It is
  2448. not meant to be used directly.
  2449. @section rubberband
  2450. Apply time-stretching and pitch-shifting with librubberband.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item tempo
  2454. Set tempo scale factor.
  2455. @item pitch
  2456. Set pitch scale factor.
  2457. @item transients
  2458. Set transients detector.
  2459. Possible values are:
  2460. @table @var
  2461. @item crisp
  2462. @item mixed
  2463. @item smooth
  2464. @end table
  2465. @item detector
  2466. Set detector.
  2467. Possible values are:
  2468. @table @var
  2469. @item compound
  2470. @item percussive
  2471. @item soft
  2472. @end table
  2473. @item phase
  2474. Set phase.
  2475. Possible values are:
  2476. @table @var
  2477. @item laminar
  2478. @item independent
  2479. @end table
  2480. @item window
  2481. Set processing window size.
  2482. Possible values are:
  2483. @table @var
  2484. @item standard
  2485. @item short
  2486. @item long
  2487. @end table
  2488. @item smoothing
  2489. Set smoothing.
  2490. Possible values are:
  2491. @table @var
  2492. @item off
  2493. @item on
  2494. @end table
  2495. @item formant
  2496. Enable formant preservation when shift pitching.
  2497. Possible values are:
  2498. @table @var
  2499. @item shifted
  2500. @item preserved
  2501. @end table
  2502. @item pitchq
  2503. Set pitch quality.
  2504. Possible values are:
  2505. @table @var
  2506. @item quality
  2507. @item speed
  2508. @item consistency
  2509. @end table
  2510. @item channels
  2511. Set channels.
  2512. Possible values are:
  2513. @table @var
  2514. @item apart
  2515. @item together
  2516. @end table
  2517. @end table
  2518. @section sidechaincompress
  2519. This filter acts like normal compressor but has the ability to compress
  2520. detected signal using second input signal.
  2521. It needs two input streams and returns one output stream.
  2522. First input stream will be processed depending on second stream signal.
  2523. The filtered signal then can be filtered with other filters in later stages of
  2524. processing. See @ref{pan} and @ref{amerge} filter.
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item level_in
  2528. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2529. @item threshold
  2530. If a signal of second stream raises above this level it will affect the gain
  2531. reduction of first stream.
  2532. By default is 0.125. Range is between 0.00097563 and 1.
  2533. @item ratio
  2534. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2535. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2536. Default is 2. Range is between 1 and 20.
  2537. @item attack
  2538. Amount of milliseconds the signal has to rise above the threshold before gain
  2539. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2540. @item release
  2541. Amount of milliseconds the signal has to fall below the threshold before
  2542. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2543. @item makeup
  2544. Set the amount by how much signal will be amplified after processing.
  2545. Default is 2. Range is from 1 and 64.
  2546. @item knee
  2547. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2548. Default is 2.82843. Range is between 1 and 8.
  2549. @item link
  2550. Choose if the @code{average} level between all channels of side-chain stream
  2551. or the louder(@code{maximum}) channel of side-chain stream affects the
  2552. reduction. Default is @code{average}.
  2553. @item detection
  2554. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2555. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2556. @item level_sc
  2557. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2558. @item mix
  2559. How much to use compressed signal in output. Default is 1.
  2560. Range is between 0 and 1.
  2561. @end table
  2562. @subsection Examples
  2563. @itemize
  2564. @item
  2565. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2566. depending on the signal of 2nd input and later compressed signal to be
  2567. merged with 2nd input:
  2568. @example
  2569. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2570. @end example
  2571. @end itemize
  2572. @section sidechaingate
  2573. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2574. filter the detected signal before sending it to the gain reduction stage.
  2575. Normally a gate uses the full range signal to detect a level above the
  2576. threshold.
  2577. For example: If you cut all lower frequencies from your sidechain signal
  2578. the gate will decrease the volume of your track only if not enough highs
  2579. appear. With this technique you are able to reduce the resonation of a
  2580. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2581. guitar.
  2582. It needs two input streams and returns one output stream.
  2583. First input stream will be processed depending on second stream signal.
  2584. The filter accepts the following options:
  2585. @table @option
  2586. @item level_in
  2587. Set input level before filtering.
  2588. Default is 1. Allowed range is from 0.015625 to 64.
  2589. @item range
  2590. Set the level of gain reduction when the signal is below the threshold.
  2591. Default is 0.06125. Allowed range is from 0 to 1.
  2592. @item threshold
  2593. If a signal rises above this level the gain reduction is released.
  2594. Default is 0.125. Allowed range is from 0 to 1.
  2595. @item ratio
  2596. Set a ratio about which the signal is reduced.
  2597. Default is 2. Allowed range is from 1 to 9000.
  2598. @item attack
  2599. Amount of milliseconds the signal has to rise above the threshold before gain
  2600. reduction stops.
  2601. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2602. @item release
  2603. Amount of milliseconds the signal has to fall below the threshold before the
  2604. reduction is increased again. Default is 250 milliseconds.
  2605. Allowed range is from 0.01 to 9000.
  2606. @item makeup
  2607. Set amount of amplification of signal after processing.
  2608. Default is 1. Allowed range is from 1 to 64.
  2609. @item knee
  2610. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2611. Default is 2.828427125. Allowed range is from 1 to 8.
  2612. @item detection
  2613. Choose if exact signal should be taken for detection or an RMS like one.
  2614. Default is rms. Can be peak or rms.
  2615. @item link
  2616. Choose if the average level between all channels or the louder channel affects
  2617. the reduction.
  2618. Default is average. Can be average or maximum.
  2619. @item level_sc
  2620. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2621. @end table
  2622. @section silencedetect
  2623. Detect silence in an audio stream.
  2624. This filter logs a message when it detects that the input audio volume is less
  2625. or equal to a noise tolerance value for a duration greater or equal to the
  2626. minimum detected noise duration.
  2627. The printed times and duration are expressed in seconds.
  2628. The filter accepts the following options:
  2629. @table @option
  2630. @item duration, d
  2631. Set silence duration until notification (default is 2 seconds).
  2632. @item noise, n
  2633. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2634. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2635. @end table
  2636. @subsection Examples
  2637. @itemize
  2638. @item
  2639. Detect 5 seconds of silence with -50dB noise tolerance:
  2640. @example
  2641. silencedetect=n=-50dB:d=5
  2642. @end example
  2643. @item
  2644. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2645. tolerance in @file{silence.mp3}:
  2646. @example
  2647. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2648. @end example
  2649. @end itemize
  2650. @section silenceremove
  2651. Remove silence from the beginning, middle or end of the audio.
  2652. The filter accepts the following options:
  2653. @table @option
  2654. @item start_periods
  2655. This value is used to indicate if audio should be trimmed at beginning of
  2656. the audio. A value of zero indicates no silence should be trimmed from the
  2657. beginning. When specifying a non-zero value, it trims audio up until it
  2658. finds non-silence. Normally, when trimming silence from beginning of audio
  2659. the @var{start_periods} will be @code{1} but it can be increased to higher
  2660. values to trim all audio up to specific count of non-silence periods.
  2661. Default value is @code{0}.
  2662. @item start_duration
  2663. Specify the amount of time that non-silence must be detected before it stops
  2664. trimming audio. By increasing the duration, bursts of noises can be treated
  2665. as silence and trimmed off. Default value is @code{0}.
  2666. @item start_threshold
  2667. This indicates what sample value should be treated as silence. For digital
  2668. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2669. you may wish to increase the value to account for background noise.
  2670. Can be specified in dB (in case "dB" is appended to the specified value)
  2671. or amplitude ratio. Default value is @code{0}.
  2672. @item stop_periods
  2673. Set the count for trimming silence from the end of audio.
  2674. To remove silence from the middle of a file, specify a @var{stop_periods}
  2675. that is negative. This value is then treated as a positive value and is
  2676. used to indicate the effect should restart processing as specified by
  2677. @var{start_periods}, making it suitable for removing periods of silence
  2678. in the middle of the audio.
  2679. Default value is @code{0}.
  2680. @item stop_duration
  2681. Specify a duration of silence that must exist before audio is not copied any
  2682. more. By specifying a higher duration, silence that is wanted can be left in
  2683. the audio.
  2684. Default value is @code{0}.
  2685. @item stop_threshold
  2686. This is the same as @option{start_threshold} but for trimming silence from
  2687. the end of audio.
  2688. Can be specified in dB (in case "dB" is appended to the specified value)
  2689. or amplitude ratio. Default value is @code{0}.
  2690. @item leave_silence
  2691. This indicates that @var{stop_duration} length of audio should be left intact
  2692. at the beginning of each period of silence.
  2693. For example, if you want to remove long pauses between words but do not want
  2694. to remove the pauses completely. Default value is @code{0}.
  2695. @item detection
  2696. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2697. and works better with digital silence which is exactly 0.
  2698. Default value is @code{rms}.
  2699. @item window
  2700. Set ratio used to calculate size of window for detecting silence.
  2701. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2702. @end table
  2703. @subsection Examples
  2704. @itemize
  2705. @item
  2706. The following example shows how this filter can be used to start a recording
  2707. that does not contain the delay at the start which usually occurs between
  2708. pressing the record button and the start of the performance:
  2709. @example
  2710. silenceremove=1:5:0.02
  2711. @end example
  2712. @item
  2713. Trim all silence encountered from beginning to end where there is more than 1
  2714. second of silence in audio:
  2715. @example
  2716. silenceremove=0:0:0:-1:1:-90dB
  2717. @end example
  2718. @end itemize
  2719. @section sofalizer
  2720. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2721. loudspeakers around the user for binaural listening via headphones (audio
  2722. formats up to 9 channels supported).
  2723. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2724. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2725. Austrian Academy of Sciences.
  2726. To enable compilation of this filter you need to configure FFmpeg with
  2727. @code{--enable-netcdf}.
  2728. The filter accepts the following options:
  2729. @table @option
  2730. @item sofa
  2731. Set the SOFA file used for rendering.
  2732. @item gain
  2733. Set gain applied to audio. Value is in dB. Default is 0.
  2734. @item rotation
  2735. Set rotation of virtual loudspeakers in deg. Default is 0.
  2736. @item elevation
  2737. Set elevation of virtual speakers in deg. Default is 0.
  2738. @item radius
  2739. Set distance in meters between loudspeakers and the listener with near-field
  2740. HRTFs. Default is 1.
  2741. @item type
  2742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2743. processing audio in time domain which is slow.
  2744. @var{freq} is processing audio in frequency domain which is fast.
  2745. Default is @var{freq}.
  2746. @item speakers
  2747. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2748. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2749. Each virtual loudspeaker is described with short channel name following with
  2750. azimuth and elevation in degreees.
  2751. Each virtual loudspeaker description is separated by '|'.
  2752. For example to override front left and front right channel positions use:
  2753. 'speakers=FL 45 15|FR 345 15'.
  2754. Descriptions with unrecognised channel names are ignored.
  2755. @end table
  2756. @subsection Examples
  2757. @itemize
  2758. @item
  2759. Using ClubFritz6 sofa file:
  2760. @example
  2761. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2762. @end example
  2763. @item
  2764. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2765. @example
  2766. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2767. @end example
  2768. @item
  2769. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2770. and also with custom gain:
  2771. @example
  2772. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2773. @end example
  2774. @end itemize
  2775. @section stereotools
  2776. This filter has some handy utilities to manage stereo signals, for converting
  2777. M/S stereo recordings to L/R signal while having control over the parameters
  2778. or spreading the stereo image of master track.
  2779. The filter accepts the following options:
  2780. @table @option
  2781. @item level_in
  2782. Set input level before filtering for both channels. Defaults is 1.
  2783. Allowed range is from 0.015625 to 64.
  2784. @item level_out
  2785. Set output level after filtering for both channels. Defaults is 1.
  2786. Allowed range is from 0.015625 to 64.
  2787. @item balance_in
  2788. Set input balance between both channels. Default is 0.
  2789. Allowed range is from -1 to 1.
  2790. @item balance_out
  2791. Set output balance between both channels. Default is 0.
  2792. Allowed range is from -1 to 1.
  2793. @item softclip
  2794. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2795. clipping. Disabled by default.
  2796. @item mutel
  2797. Mute the left channel. Disabled by default.
  2798. @item muter
  2799. Mute the right channel. Disabled by default.
  2800. @item phasel
  2801. Change the phase of the left channel. Disabled by default.
  2802. @item phaser
  2803. Change the phase of the right channel. Disabled by default.
  2804. @item mode
  2805. Set stereo mode. Available values are:
  2806. @table @samp
  2807. @item lr>lr
  2808. Left/Right to Left/Right, this is default.
  2809. @item lr>ms
  2810. Left/Right to Mid/Side.
  2811. @item ms>lr
  2812. Mid/Side to Left/Right.
  2813. @item lr>ll
  2814. Left/Right to Left/Left.
  2815. @item lr>rr
  2816. Left/Right to Right/Right.
  2817. @item lr>l+r
  2818. Left/Right to Left + Right.
  2819. @item lr>rl
  2820. Left/Right to Right/Left.
  2821. @end table
  2822. @item slev
  2823. Set level of side signal. Default is 1.
  2824. Allowed range is from 0.015625 to 64.
  2825. @item sbal
  2826. Set balance of side signal. Default is 0.
  2827. Allowed range is from -1 to 1.
  2828. @item mlev
  2829. Set level of the middle signal. Default is 1.
  2830. Allowed range is from 0.015625 to 64.
  2831. @item mpan
  2832. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2833. @item base
  2834. Set stereo base between mono and inversed channels. Default is 0.
  2835. Allowed range is from -1 to 1.
  2836. @item delay
  2837. Set delay in milliseconds how much to delay left from right channel and
  2838. vice versa. Default is 0. Allowed range is from -20 to 20.
  2839. @item sclevel
  2840. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2841. @item phase
  2842. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2843. @end table
  2844. @subsection Examples
  2845. @itemize
  2846. @item
  2847. Apply karaoke like effect:
  2848. @example
  2849. stereotools=mlev=0.015625
  2850. @end example
  2851. @item
  2852. Convert M/S signal to L/R:
  2853. @example
  2854. "stereotools=mode=ms>lr"
  2855. @end example
  2856. @end itemize
  2857. @section stereowiden
  2858. This filter enhance the stereo effect by suppressing signal common to both
  2859. channels and by delaying the signal of left into right and vice versa,
  2860. thereby widening the stereo effect.
  2861. The filter accepts the following options:
  2862. @table @option
  2863. @item delay
  2864. Time in milliseconds of the delay of left signal into right and vice versa.
  2865. Default is 20 milliseconds.
  2866. @item feedback
  2867. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2868. effect of left signal in right output and vice versa which gives widening
  2869. effect. Default is 0.3.
  2870. @item crossfeed
  2871. Cross feed of left into right with inverted phase. This helps in suppressing
  2872. the mono. If the value is 1 it will cancel all the signal common to both
  2873. channels. Default is 0.3.
  2874. @item drymix
  2875. Set level of input signal of original channel. Default is 0.8.
  2876. @end table
  2877. @section treble
  2878. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2879. shelving filter with a response similar to that of a standard
  2880. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2881. The filter accepts the following options:
  2882. @table @option
  2883. @item gain, g
  2884. Give the gain at whichever is the lower of ~22 kHz and the
  2885. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2886. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2887. @item frequency, f
  2888. Set the filter's central frequency and so can be used
  2889. to extend or reduce the frequency range to be boosted or cut.
  2890. The default value is @code{3000} Hz.
  2891. @item width_type
  2892. Set method to specify band-width of filter.
  2893. @table @option
  2894. @item h
  2895. Hz
  2896. @item q
  2897. Q-Factor
  2898. @item o
  2899. octave
  2900. @item s
  2901. slope
  2902. @end table
  2903. @item width, w
  2904. Determine how steep is the filter's shelf transition.
  2905. @end table
  2906. @section tremolo
  2907. Sinusoidal amplitude modulation.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item f
  2911. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2912. (20 Hz or lower) will result in a tremolo effect.
  2913. This filter may also be used as a ring modulator by specifying
  2914. a modulation frequency higher than 20 Hz.
  2915. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2916. @item d
  2917. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2918. Default value is 0.5.
  2919. @end table
  2920. @section vibrato
  2921. Sinusoidal phase modulation.
  2922. The filter accepts the following options:
  2923. @table @option
  2924. @item f
  2925. Modulation frequency in Hertz.
  2926. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2927. @item d
  2928. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2929. Default value is 0.5.
  2930. @end table
  2931. @section volume
  2932. Adjust the input audio volume.
  2933. It accepts the following parameters:
  2934. @table @option
  2935. @item volume
  2936. Set audio volume expression.
  2937. Output values are clipped to the maximum value.
  2938. The output audio volume is given by the relation:
  2939. @example
  2940. @var{output_volume} = @var{volume} * @var{input_volume}
  2941. @end example
  2942. The default value for @var{volume} is "1.0".
  2943. @item precision
  2944. This parameter represents the mathematical precision.
  2945. It determines which input sample formats will be allowed, which affects the
  2946. precision of the volume scaling.
  2947. @table @option
  2948. @item fixed
  2949. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2950. @item float
  2951. 32-bit floating-point; this limits input sample format to FLT. (default)
  2952. @item double
  2953. 64-bit floating-point; this limits input sample format to DBL.
  2954. @end table
  2955. @item replaygain
  2956. Choose the behaviour on encountering ReplayGain side data in input frames.
  2957. @table @option
  2958. @item drop
  2959. Remove ReplayGain side data, ignoring its contents (the default).
  2960. @item ignore
  2961. Ignore ReplayGain side data, but leave it in the frame.
  2962. @item track
  2963. Prefer the track gain, if present.
  2964. @item album
  2965. Prefer the album gain, if present.
  2966. @end table
  2967. @item replaygain_preamp
  2968. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2969. Default value for @var{replaygain_preamp} is 0.0.
  2970. @item eval
  2971. Set when the volume expression is evaluated.
  2972. It accepts the following values:
  2973. @table @samp
  2974. @item once
  2975. only evaluate expression once during the filter initialization, or
  2976. when the @samp{volume} command is sent
  2977. @item frame
  2978. evaluate expression for each incoming frame
  2979. @end table
  2980. Default value is @samp{once}.
  2981. @end table
  2982. The volume expression can contain the following parameters.
  2983. @table @option
  2984. @item n
  2985. frame number (starting at zero)
  2986. @item nb_channels
  2987. number of channels
  2988. @item nb_consumed_samples
  2989. number of samples consumed by the filter
  2990. @item nb_samples
  2991. number of samples in the current frame
  2992. @item pos
  2993. original frame position in the file
  2994. @item pts
  2995. frame PTS
  2996. @item sample_rate
  2997. sample rate
  2998. @item startpts
  2999. PTS at start of stream
  3000. @item startt
  3001. time at start of stream
  3002. @item t
  3003. frame time
  3004. @item tb
  3005. timestamp timebase
  3006. @item volume
  3007. last set volume value
  3008. @end table
  3009. Note that when @option{eval} is set to @samp{once} only the
  3010. @var{sample_rate} and @var{tb} variables are available, all other
  3011. variables will evaluate to NAN.
  3012. @subsection Commands
  3013. This filter supports the following commands:
  3014. @table @option
  3015. @item volume
  3016. Modify the volume expression.
  3017. The command accepts the same syntax of the corresponding option.
  3018. If the specified expression is not valid, it is kept at its current
  3019. value.
  3020. @item replaygain_noclip
  3021. Prevent clipping by limiting the gain applied.
  3022. Default value for @var{replaygain_noclip} is 1.
  3023. @end table
  3024. @subsection Examples
  3025. @itemize
  3026. @item
  3027. Halve the input audio volume:
  3028. @example
  3029. volume=volume=0.5
  3030. volume=volume=1/2
  3031. volume=volume=-6.0206dB
  3032. @end example
  3033. In all the above example the named key for @option{volume} can be
  3034. omitted, for example like in:
  3035. @example
  3036. volume=0.5
  3037. @end example
  3038. @item
  3039. Increase input audio power by 6 decibels using fixed-point precision:
  3040. @example
  3041. volume=volume=6dB:precision=fixed
  3042. @end example
  3043. @item
  3044. Fade volume after time 10 with an annihilation period of 5 seconds:
  3045. @example
  3046. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3047. @end example
  3048. @end itemize
  3049. @section volumedetect
  3050. Detect the volume of the input video.
  3051. The filter has no parameters. The input is not modified. Statistics about
  3052. the volume will be printed in the log when the input stream end is reached.
  3053. In particular it will show the mean volume (root mean square), maximum
  3054. volume (on a per-sample basis), and the beginning of a histogram of the
  3055. registered volume values (from the maximum value to a cumulated 1/1000 of
  3056. the samples).
  3057. All volumes are in decibels relative to the maximum PCM value.
  3058. @subsection Examples
  3059. Here is an excerpt of the output:
  3060. @example
  3061. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3062. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3067. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3068. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3069. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3070. @end example
  3071. It means that:
  3072. @itemize
  3073. @item
  3074. The mean square energy is approximately -27 dB, or 10^-2.7.
  3075. @item
  3076. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3077. @item
  3078. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3079. @end itemize
  3080. In other words, raising the volume by +4 dB does not cause any clipping,
  3081. raising it by +5 dB causes clipping for 6 samples, etc.
  3082. @c man end AUDIO FILTERS
  3083. @chapter Audio Sources
  3084. @c man begin AUDIO SOURCES
  3085. Below is a description of the currently available audio sources.
  3086. @section abuffer
  3087. Buffer audio frames, and make them available to the filter chain.
  3088. This source is mainly intended for a programmatic use, in particular
  3089. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3090. It accepts the following parameters:
  3091. @table @option
  3092. @item time_base
  3093. The timebase which will be used for timestamps of submitted frames. It must be
  3094. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3095. @item sample_rate
  3096. The sample rate of the incoming audio buffers.
  3097. @item sample_fmt
  3098. The sample format of the incoming audio buffers.
  3099. Either a sample format name or its corresponding integer representation from
  3100. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3101. @item channel_layout
  3102. The channel layout of the incoming audio buffers.
  3103. Either a channel layout name from channel_layout_map in
  3104. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3105. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3106. @item channels
  3107. The number of channels of the incoming audio buffers.
  3108. If both @var{channels} and @var{channel_layout} are specified, then they
  3109. must be consistent.
  3110. @end table
  3111. @subsection Examples
  3112. @example
  3113. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3114. @end example
  3115. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3116. Since the sample format with name "s16p" corresponds to the number
  3117. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3118. equivalent to:
  3119. @example
  3120. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3121. @end example
  3122. @section aevalsrc
  3123. Generate an audio signal specified by an expression.
  3124. This source accepts in input one or more expressions (one for each
  3125. channel), which are evaluated and used to generate a corresponding
  3126. audio signal.
  3127. This source accepts the following options:
  3128. @table @option
  3129. @item exprs
  3130. Set the '|'-separated expressions list for each separate channel. In case the
  3131. @option{channel_layout} option is not specified, the selected channel layout
  3132. depends on the number of provided expressions. Otherwise the last
  3133. specified expression is applied to the remaining output channels.
  3134. @item channel_layout, c
  3135. Set the channel layout. The number of channels in the specified layout
  3136. must be equal to the number of specified expressions.
  3137. @item duration, d
  3138. Set the minimum duration of the sourced audio. See
  3139. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3140. for the accepted syntax.
  3141. Note that the resulting duration may be greater than the specified
  3142. duration, as the generated audio is always cut at the end of a
  3143. complete frame.
  3144. If not specified, or the expressed duration is negative, the audio is
  3145. supposed to be generated forever.
  3146. @item nb_samples, n
  3147. Set the number of samples per channel per each output frame,
  3148. default to 1024.
  3149. @item sample_rate, s
  3150. Specify the sample rate, default to 44100.
  3151. @end table
  3152. Each expression in @var{exprs} can contain the following constants:
  3153. @table @option
  3154. @item n
  3155. number of the evaluated sample, starting from 0
  3156. @item t
  3157. time of the evaluated sample expressed in seconds, starting from 0
  3158. @item s
  3159. sample rate
  3160. @end table
  3161. @subsection Examples
  3162. @itemize
  3163. @item
  3164. Generate silence:
  3165. @example
  3166. aevalsrc=0
  3167. @end example
  3168. @item
  3169. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3170. 8000 Hz:
  3171. @example
  3172. aevalsrc="sin(440*2*PI*t):s=8000"
  3173. @end example
  3174. @item
  3175. Generate a two channels signal, specify the channel layout (Front
  3176. Center + Back Center) explicitly:
  3177. @example
  3178. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3179. @end example
  3180. @item
  3181. Generate white noise:
  3182. @example
  3183. aevalsrc="-2+random(0)"
  3184. @end example
  3185. @item
  3186. Generate an amplitude modulated signal:
  3187. @example
  3188. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3189. @end example
  3190. @item
  3191. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3192. @example
  3193. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3194. @end example
  3195. @end itemize
  3196. @section anullsrc
  3197. The null audio source, return unprocessed audio frames. It is mainly useful
  3198. as a template and to be employed in analysis / debugging tools, or as
  3199. the source for filters which ignore the input data (for example the sox
  3200. synth filter).
  3201. This source accepts the following options:
  3202. @table @option
  3203. @item channel_layout, cl
  3204. Specifies the channel layout, and can be either an integer or a string
  3205. representing a channel layout. The default value of @var{channel_layout}
  3206. is "stereo".
  3207. Check the channel_layout_map definition in
  3208. @file{libavutil/channel_layout.c} for the mapping between strings and
  3209. channel layout values.
  3210. @item sample_rate, r
  3211. Specifies the sample rate, and defaults to 44100.
  3212. @item nb_samples, n
  3213. Set the number of samples per requested frames.
  3214. @end table
  3215. @subsection Examples
  3216. @itemize
  3217. @item
  3218. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3219. @example
  3220. anullsrc=r=48000:cl=4
  3221. @end example
  3222. @item
  3223. Do the same operation with a more obvious syntax:
  3224. @example
  3225. anullsrc=r=48000:cl=mono
  3226. @end example
  3227. @end itemize
  3228. All the parameters need to be explicitly defined.
  3229. @section flite
  3230. Synthesize a voice utterance using the libflite library.
  3231. To enable compilation of this filter you need to configure FFmpeg with
  3232. @code{--enable-libflite}.
  3233. Note that the flite library is not thread-safe.
  3234. The filter accepts the following options:
  3235. @table @option
  3236. @item list_voices
  3237. If set to 1, list the names of the available voices and exit
  3238. immediately. Default value is 0.
  3239. @item nb_samples, n
  3240. Set the maximum number of samples per frame. Default value is 512.
  3241. @item textfile
  3242. Set the filename containing the text to speak.
  3243. @item text
  3244. Set the text to speak.
  3245. @item voice, v
  3246. Set the voice to use for the speech synthesis. Default value is
  3247. @code{kal}. See also the @var{list_voices} option.
  3248. @end table
  3249. @subsection Examples
  3250. @itemize
  3251. @item
  3252. Read from file @file{speech.txt}, and synthesize the text using the
  3253. standard flite voice:
  3254. @example
  3255. flite=textfile=speech.txt
  3256. @end example
  3257. @item
  3258. Read the specified text selecting the @code{slt} voice:
  3259. @example
  3260. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3261. @end example
  3262. @item
  3263. Input text to ffmpeg:
  3264. @example
  3265. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3266. @end example
  3267. @item
  3268. Make @file{ffplay} speak the specified text, using @code{flite} and
  3269. the @code{lavfi} device:
  3270. @example
  3271. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3272. @end example
  3273. @end itemize
  3274. For more information about libflite, check:
  3275. @url{http://www.speech.cs.cmu.edu/flite/}
  3276. @section anoisesrc
  3277. Generate a noise audio signal.
  3278. The filter accepts the following options:
  3279. @table @option
  3280. @item sample_rate, r
  3281. Specify the sample rate. Default value is 48000 Hz.
  3282. @item amplitude, a
  3283. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3284. is 1.0.
  3285. @item duration, d
  3286. Specify the duration of the generated audio stream. Not specifying this option
  3287. results in noise with an infinite length.
  3288. @item color, colour, c
  3289. Specify the color of noise. Available noise colors are white, pink, and brown.
  3290. Default color is white.
  3291. @item seed, s
  3292. Specify a value used to seed the PRNG.
  3293. @item nb_samples, n
  3294. Set the number of samples per each output frame, default is 1024.
  3295. @end table
  3296. @subsection Examples
  3297. @itemize
  3298. @item
  3299. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3300. @example
  3301. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3302. @end example
  3303. @end itemize
  3304. @section sine
  3305. Generate an audio signal made of a sine wave with amplitude 1/8.
  3306. The audio signal is bit-exact.
  3307. The filter accepts the following options:
  3308. @table @option
  3309. @item frequency, f
  3310. Set the carrier frequency. Default is 440 Hz.
  3311. @item beep_factor, b
  3312. Enable a periodic beep every second with frequency @var{beep_factor} times
  3313. the carrier frequency. Default is 0, meaning the beep is disabled.
  3314. @item sample_rate, r
  3315. Specify the sample rate, default is 44100.
  3316. @item duration, d
  3317. Specify the duration of the generated audio stream.
  3318. @item samples_per_frame
  3319. Set the number of samples per output frame.
  3320. The expression can contain the following constants:
  3321. @table @option
  3322. @item n
  3323. The (sequential) number of the output audio frame, starting from 0.
  3324. @item pts
  3325. The PTS (Presentation TimeStamp) of the output audio frame,
  3326. expressed in @var{TB} units.
  3327. @item t
  3328. The PTS of the output audio frame, expressed in seconds.
  3329. @item TB
  3330. The timebase of the output audio frames.
  3331. @end table
  3332. Default is @code{1024}.
  3333. @end table
  3334. @subsection Examples
  3335. @itemize
  3336. @item
  3337. Generate a simple 440 Hz sine wave:
  3338. @example
  3339. sine
  3340. @end example
  3341. @item
  3342. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3343. @example
  3344. sine=220:4:d=5
  3345. sine=f=220:b=4:d=5
  3346. sine=frequency=220:beep_factor=4:duration=5
  3347. @end example
  3348. @item
  3349. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3350. pattern:
  3351. @example
  3352. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3353. @end example
  3354. @end itemize
  3355. @c man end AUDIO SOURCES
  3356. @chapter Audio Sinks
  3357. @c man begin AUDIO SINKS
  3358. Below is a description of the currently available audio sinks.
  3359. @section abuffersink
  3360. Buffer audio frames, and make them available to the end of filter chain.
  3361. This sink is mainly intended for programmatic use, in particular
  3362. through the interface defined in @file{libavfilter/buffersink.h}
  3363. or the options system.
  3364. It accepts a pointer to an AVABufferSinkContext structure, which
  3365. defines the incoming buffers' formats, to be passed as the opaque
  3366. parameter to @code{avfilter_init_filter} for initialization.
  3367. @section anullsink
  3368. Null audio sink; do absolutely nothing with the input audio. It is
  3369. mainly useful as a template and for use in analysis / debugging
  3370. tools.
  3371. @c man end AUDIO SINKS
  3372. @chapter Video Filters
  3373. @c man begin VIDEO FILTERS
  3374. When you configure your FFmpeg build, you can disable any of the
  3375. existing filters using @code{--disable-filters}.
  3376. The configure output will show the video filters included in your
  3377. build.
  3378. Below is a description of the currently available video filters.
  3379. @section alphaextract
  3380. Extract the alpha component from the input as a grayscale video. This
  3381. is especially useful with the @var{alphamerge} filter.
  3382. @section alphamerge
  3383. Add or replace the alpha component of the primary input with the
  3384. grayscale value of a second input. This is intended for use with
  3385. @var{alphaextract} to allow the transmission or storage of frame
  3386. sequences that have alpha in a format that doesn't support an alpha
  3387. channel.
  3388. For example, to reconstruct full frames from a normal YUV-encoded video
  3389. and a separate video created with @var{alphaextract}, you might use:
  3390. @example
  3391. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3392. @end example
  3393. Since this filter is designed for reconstruction, it operates on frame
  3394. sequences without considering timestamps, and terminates when either
  3395. input reaches end of stream. This will cause problems if your encoding
  3396. pipeline drops frames. If you're trying to apply an image as an
  3397. overlay to a video stream, consider the @var{overlay} filter instead.
  3398. @section ass
  3399. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3400. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3401. Substation Alpha) subtitles files.
  3402. This filter accepts the following option in addition to the common options from
  3403. the @ref{subtitles} filter:
  3404. @table @option
  3405. @item shaping
  3406. Set the shaping engine
  3407. Available values are:
  3408. @table @samp
  3409. @item auto
  3410. The default libass shaping engine, which is the best available.
  3411. @item simple
  3412. Fast, font-agnostic shaper that can do only substitutions
  3413. @item complex
  3414. Slower shaper using OpenType for substitutions and positioning
  3415. @end table
  3416. The default is @code{auto}.
  3417. @end table
  3418. @section atadenoise
  3419. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3420. The filter accepts the following options:
  3421. @table @option
  3422. @item 0a
  3423. Set threshold A for 1st plane. Default is 0.02.
  3424. Valid range is 0 to 0.3.
  3425. @item 0b
  3426. Set threshold B for 1st plane. Default is 0.04.
  3427. Valid range is 0 to 5.
  3428. @item 1a
  3429. Set threshold A for 2nd plane. Default is 0.02.
  3430. Valid range is 0 to 0.3.
  3431. @item 1b
  3432. Set threshold B for 2nd plane. Default is 0.04.
  3433. Valid range is 0 to 5.
  3434. @item 2a
  3435. Set threshold A for 3rd plane. Default is 0.02.
  3436. Valid range is 0 to 0.3.
  3437. @item 2b
  3438. Set threshold B for 3rd plane. Default is 0.04.
  3439. Valid range is 0 to 5.
  3440. Threshold A is designed to react on abrupt changes in the input signal and
  3441. threshold B is designed to react on continuous changes in the input signal.
  3442. @item s
  3443. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3444. number in range [5, 129].
  3445. @item p
  3446. Set what planes of frame filter will use for averaging. Default is all.
  3447. @end table
  3448. @section avgblur
  3449. Apply average blur filter.
  3450. The filter accepts the following options:
  3451. @table @option
  3452. @item sizeX
  3453. Set horizontal kernel size.
  3454. @item planes
  3455. Set which planes to filter. By default all planes are filtered.
  3456. @item sizeY
  3457. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3458. Default is @code{0}.
  3459. @end table
  3460. @section bbox
  3461. Compute the bounding box for the non-black pixels in the input frame
  3462. luminance plane.
  3463. This filter computes the bounding box containing all the pixels with a
  3464. luminance value greater than the minimum allowed value.
  3465. The parameters describing the bounding box are printed on the filter
  3466. log.
  3467. The filter accepts the following option:
  3468. @table @option
  3469. @item min_val
  3470. Set the minimal luminance value. Default is @code{16}.
  3471. @end table
  3472. @section bitplanenoise
  3473. Show and measure bit plane noise.
  3474. The filter accepts the following options:
  3475. @table @option
  3476. @item bitplane
  3477. Set which plane to analyze. Default is @code{1}.
  3478. @item filter
  3479. Filter out noisy pixels from @code{bitplane} set above.
  3480. Default is disabled.
  3481. @end table
  3482. @section blackdetect
  3483. Detect video intervals that are (almost) completely black. Can be
  3484. useful to detect chapter transitions, commercials, or invalid
  3485. recordings. Output lines contains the time for the start, end and
  3486. duration of the detected black interval expressed in seconds.
  3487. In order to display the output lines, you need to set the loglevel at
  3488. least to the AV_LOG_INFO value.
  3489. The filter accepts the following options:
  3490. @table @option
  3491. @item black_min_duration, d
  3492. Set the minimum detected black duration expressed in seconds. It must
  3493. be a non-negative floating point number.
  3494. Default value is 2.0.
  3495. @item picture_black_ratio_th, pic_th
  3496. Set the threshold for considering a picture "black".
  3497. Express the minimum value for the ratio:
  3498. @example
  3499. @var{nb_black_pixels} / @var{nb_pixels}
  3500. @end example
  3501. for which a picture is considered black.
  3502. Default value is 0.98.
  3503. @item pixel_black_th, pix_th
  3504. Set the threshold for considering a pixel "black".
  3505. The threshold expresses the maximum pixel luminance value for which a
  3506. pixel is considered "black". The provided value is scaled according to
  3507. the following equation:
  3508. @example
  3509. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3510. @end example
  3511. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3512. the input video format, the range is [0-255] for YUV full-range
  3513. formats and [16-235] for YUV non full-range formats.
  3514. Default value is 0.10.
  3515. @end table
  3516. The following example sets the maximum pixel threshold to the minimum
  3517. value, and detects only black intervals of 2 or more seconds:
  3518. @example
  3519. blackdetect=d=2:pix_th=0.00
  3520. @end example
  3521. @section blackframe
  3522. Detect frames that are (almost) completely black. Can be useful to
  3523. detect chapter transitions or commercials. Output lines consist of
  3524. the frame number of the detected frame, the percentage of blackness,
  3525. the position in the file if known or -1 and the timestamp in seconds.
  3526. In order to display the output lines, you need to set the loglevel at
  3527. least to the AV_LOG_INFO value.
  3528. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3529. The value represents the percentage of pixels in the picture that
  3530. are below the threshold value.
  3531. It accepts the following parameters:
  3532. @table @option
  3533. @item amount
  3534. The percentage of the pixels that have to be below the threshold; it defaults to
  3535. @code{98}.
  3536. @item threshold, thresh
  3537. The threshold below which a pixel value is considered black; it defaults to
  3538. @code{32}.
  3539. @end table
  3540. @section blend, tblend
  3541. Blend two video frames into each other.
  3542. The @code{blend} filter takes two input streams and outputs one
  3543. stream, the first input is the "top" layer and second input is
  3544. "bottom" layer. By default, the output terminates when the longest input terminates.
  3545. The @code{tblend} (time blend) filter takes two consecutive frames
  3546. from one single stream, and outputs the result obtained by blending
  3547. the new frame on top of the old frame.
  3548. A description of the accepted options follows.
  3549. @table @option
  3550. @item c0_mode
  3551. @item c1_mode
  3552. @item c2_mode
  3553. @item c3_mode
  3554. @item all_mode
  3555. Set blend mode for specific pixel component or all pixel components in case
  3556. of @var{all_mode}. Default value is @code{normal}.
  3557. Available values for component modes are:
  3558. @table @samp
  3559. @item addition
  3560. @item addition128
  3561. @item and
  3562. @item average
  3563. @item burn
  3564. @item darken
  3565. @item difference
  3566. @item difference128
  3567. @item divide
  3568. @item dodge
  3569. @item freeze
  3570. @item exclusion
  3571. @item glow
  3572. @item hardlight
  3573. @item hardmix
  3574. @item heat
  3575. @item lighten
  3576. @item linearlight
  3577. @item multiply
  3578. @item multiply128
  3579. @item negation
  3580. @item normal
  3581. @item or
  3582. @item overlay
  3583. @item phoenix
  3584. @item pinlight
  3585. @item reflect
  3586. @item screen
  3587. @item softlight
  3588. @item subtract
  3589. @item vividlight
  3590. @item xor
  3591. @end table
  3592. @item c0_opacity
  3593. @item c1_opacity
  3594. @item c2_opacity
  3595. @item c3_opacity
  3596. @item all_opacity
  3597. Set blend opacity for specific pixel component or all pixel components in case
  3598. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3599. @item c0_expr
  3600. @item c1_expr
  3601. @item c2_expr
  3602. @item c3_expr
  3603. @item all_expr
  3604. Set blend expression for specific pixel component or all pixel components in case
  3605. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3606. The expressions can use the following variables:
  3607. @table @option
  3608. @item N
  3609. The sequential number of the filtered frame, starting from @code{0}.
  3610. @item X
  3611. @item Y
  3612. the coordinates of the current sample
  3613. @item W
  3614. @item H
  3615. the width and height of currently filtered plane
  3616. @item SW
  3617. @item SH
  3618. Width and height scale depending on the currently filtered plane. It is the
  3619. ratio between the corresponding luma plane number of pixels and the current
  3620. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3621. @code{0.5,0.5} for chroma planes.
  3622. @item T
  3623. Time of the current frame, expressed in seconds.
  3624. @item TOP, A
  3625. Value of pixel component at current location for first video frame (top layer).
  3626. @item BOTTOM, B
  3627. Value of pixel component at current location for second video frame (bottom layer).
  3628. @end table
  3629. @item shortest
  3630. Force termination when the shortest input terminates. Default is
  3631. @code{0}. This option is only defined for the @code{blend} filter.
  3632. @item repeatlast
  3633. Continue applying the last bottom frame after the end of the stream. A value of
  3634. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3635. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3636. @end table
  3637. @subsection Examples
  3638. @itemize
  3639. @item
  3640. Apply transition from bottom layer to top layer in first 10 seconds:
  3641. @example
  3642. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3643. @end example
  3644. @item
  3645. Apply 1x1 checkerboard effect:
  3646. @example
  3647. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3648. @end example
  3649. @item
  3650. Apply uncover left effect:
  3651. @example
  3652. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3653. @end example
  3654. @item
  3655. Apply uncover down effect:
  3656. @example
  3657. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3658. @end example
  3659. @item
  3660. Apply uncover up-left effect:
  3661. @example
  3662. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3663. @end example
  3664. @item
  3665. Split diagonally video and shows top and bottom layer on each side:
  3666. @example
  3667. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3668. @end example
  3669. @item
  3670. Display differences between the current and the previous frame:
  3671. @example
  3672. tblend=all_mode=difference128
  3673. @end example
  3674. @end itemize
  3675. @section boxblur
  3676. Apply a boxblur algorithm to the input video.
  3677. It accepts the following parameters:
  3678. @table @option
  3679. @item luma_radius, lr
  3680. @item luma_power, lp
  3681. @item chroma_radius, cr
  3682. @item chroma_power, cp
  3683. @item alpha_radius, ar
  3684. @item alpha_power, ap
  3685. @end table
  3686. A description of the accepted options follows.
  3687. @table @option
  3688. @item luma_radius, lr
  3689. @item chroma_radius, cr
  3690. @item alpha_radius, ar
  3691. Set an expression for the box radius in pixels used for blurring the
  3692. corresponding input plane.
  3693. The radius value must be a non-negative number, and must not be
  3694. greater than the value of the expression @code{min(w,h)/2} for the
  3695. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3696. planes.
  3697. Default value for @option{luma_radius} is "2". If not specified,
  3698. @option{chroma_radius} and @option{alpha_radius} default to the
  3699. corresponding value set for @option{luma_radius}.
  3700. The expressions can contain the following constants:
  3701. @table @option
  3702. @item w
  3703. @item h
  3704. The input width and height in pixels.
  3705. @item cw
  3706. @item ch
  3707. The input chroma image width and height in pixels.
  3708. @item hsub
  3709. @item vsub
  3710. The horizontal and vertical chroma subsample values. For example, for the
  3711. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3712. @end table
  3713. @item luma_power, lp
  3714. @item chroma_power, cp
  3715. @item alpha_power, ap
  3716. Specify how many times the boxblur filter is applied to the
  3717. corresponding plane.
  3718. Default value for @option{luma_power} is 2. If not specified,
  3719. @option{chroma_power} and @option{alpha_power} default to the
  3720. corresponding value set for @option{luma_power}.
  3721. A value of 0 will disable the effect.
  3722. @end table
  3723. @subsection Examples
  3724. @itemize
  3725. @item
  3726. Apply a boxblur filter with the luma, chroma, and alpha radii
  3727. set to 2:
  3728. @example
  3729. boxblur=luma_radius=2:luma_power=1
  3730. boxblur=2:1
  3731. @end example
  3732. @item
  3733. Set the luma radius to 2, and alpha and chroma radius to 0:
  3734. @example
  3735. boxblur=2:1:cr=0:ar=0
  3736. @end example
  3737. @item
  3738. Set the luma and chroma radii to a fraction of the video dimension:
  3739. @example
  3740. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3741. @end example
  3742. @end itemize
  3743. @section bwdif
  3744. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3745. Deinterlacing Filter").
  3746. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3747. interpolation algorithms.
  3748. It accepts the following parameters:
  3749. @table @option
  3750. @item mode
  3751. The interlacing mode to adopt. It accepts one of the following values:
  3752. @table @option
  3753. @item 0, send_frame
  3754. Output one frame for each frame.
  3755. @item 1, send_field
  3756. Output one frame for each field.
  3757. @end table
  3758. The default value is @code{send_field}.
  3759. @item parity
  3760. The picture field parity assumed for the input interlaced video. It accepts one
  3761. of the following values:
  3762. @table @option
  3763. @item 0, tff
  3764. Assume the top field is first.
  3765. @item 1, bff
  3766. Assume the bottom field is first.
  3767. @item -1, auto
  3768. Enable automatic detection of field parity.
  3769. @end table
  3770. The default value is @code{auto}.
  3771. If the interlacing is unknown or the decoder does not export this information,
  3772. top field first will be assumed.
  3773. @item deint
  3774. Specify which frames to deinterlace. Accept one of the following
  3775. values:
  3776. @table @option
  3777. @item 0, all
  3778. Deinterlace all frames.
  3779. @item 1, interlaced
  3780. Only deinterlace frames marked as interlaced.
  3781. @end table
  3782. The default value is @code{all}.
  3783. @end table
  3784. @section chromakey
  3785. YUV colorspace color/chroma keying.
  3786. The filter accepts the following options:
  3787. @table @option
  3788. @item color
  3789. The color which will be replaced with transparency.
  3790. @item similarity
  3791. Similarity percentage with the key color.
  3792. 0.01 matches only the exact key color, while 1.0 matches everything.
  3793. @item blend
  3794. Blend percentage.
  3795. 0.0 makes pixels either fully transparent, or not transparent at all.
  3796. Higher values result in semi-transparent pixels, with a higher transparency
  3797. the more similar the pixels color is to the key color.
  3798. @item yuv
  3799. Signals that the color passed is already in YUV instead of RGB.
  3800. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3801. This can be used to pass exact YUV values as hexadecimal numbers.
  3802. @end table
  3803. @subsection Examples
  3804. @itemize
  3805. @item
  3806. Make every green pixel in the input image transparent:
  3807. @example
  3808. ffmpeg -i input.png -vf chromakey=green out.png
  3809. @end example
  3810. @item
  3811. Overlay a greenscreen-video on top of a static black background.
  3812. @example
  3813. 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
  3814. @end example
  3815. @end itemize
  3816. @section ciescope
  3817. Display CIE color diagram with pixels overlaid onto it.
  3818. The filter accepts the following options:
  3819. @table @option
  3820. @item system
  3821. Set color system.
  3822. @table @samp
  3823. @item ntsc, 470m
  3824. @item ebu, 470bg
  3825. @item smpte
  3826. @item 240m
  3827. @item apple
  3828. @item widergb
  3829. @item cie1931
  3830. @item rec709, hdtv
  3831. @item uhdtv, rec2020
  3832. @end table
  3833. @item cie
  3834. Set CIE system.
  3835. @table @samp
  3836. @item xyy
  3837. @item ucs
  3838. @item luv
  3839. @end table
  3840. @item gamuts
  3841. Set what gamuts to draw.
  3842. See @code{system} option for available values.
  3843. @item size, s
  3844. Set ciescope size, by default set to 512.
  3845. @item intensity, i
  3846. Set intensity used to map input pixel values to CIE diagram.
  3847. @item contrast
  3848. Set contrast used to draw tongue colors that are out of active color system gamut.
  3849. @item corrgamma
  3850. Correct gamma displayed on scope, by default enabled.
  3851. @item showwhite
  3852. Show white point on CIE diagram, by default disabled.
  3853. @item gamma
  3854. Set input gamma. Used only with XYZ input color space.
  3855. @end table
  3856. @section codecview
  3857. Visualize information exported by some codecs.
  3858. Some codecs can export information through frames using side-data or other
  3859. means. For example, some MPEG based codecs export motion vectors through the
  3860. @var{export_mvs} flag in the codec @option{flags2} option.
  3861. The filter accepts the following option:
  3862. @table @option
  3863. @item mv
  3864. Set motion vectors to visualize.
  3865. Available flags for @var{mv} are:
  3866. @table @samp
  3867. @item pf
  3868. forward predicted MVs of P-frames
  3869. @item bf
  3870. forward predicted MVs of B-frames
  3871. @item bb
  3872. backward predicted MVs of B-frames
  3873. @end table
  3874. @item qp
  3875. Display quantization parameters using the chroma planes.
  3876. @item mv_type, mvt
  3877. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3878. Available flags for @var{mv_type} are:
  3879. @table @samp
  3880. @item fp
  3881. forward predicted MVs
  3882. @item bp
  3883. backward predicted MVs
  3884. @end table
  3885. @item frame_type, ft
  3886. Set frame type to visualize motion vectors of.
  3887. Available flags for @var{frame_type} are:
  3888. @table @samp
  3889. @item if
  3890. intra-coded frames (I-frames)
  3891. @item pf
  3892. predicted frames (P-frames)
  3893. @item bf
  3894. bi-directionally predicted frames (B-frames)
  3895. @end table
  3896. @end table
  3897. @subsection Examples
  3898. @itemize
  3899. @item
  3900. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3901. @example
  3902. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3903. @end example
  3904. @item
  3905. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3906. @example
  3907. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3908. @end example
  3909. @end itemize
  3910. @section colorbalance
  3911. Modify intensity of primary colors (red, green and blue) of input frames.
  3912. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3913. regions for the red-cyan, green-magenta or blue-yellow balance.
  3914. A positive adjustment value shifts the balance towards the primary color, a negative
  3915. value towards the complementary color.
  3916. The filter accepts the following options:
  3917. @table @option
  3918. @item rs
  3919. @item gs
  3920. @item bs
  3921. Adjust red, green and blue shadows (darkest pixels).
  3922. @item rm
  3923. @item gm
  3924. @item bm
  3925. Adjust red, green and blue midtones (medium pixels).
  3926. @item rh
  3927. @item gh
  3928. @item bh
  3929. Adjust red, green and blue highlights (brightest pixels).
  3930. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3931. @end table
  3932. @subsection Examples
  3933. @itemize
  3934. @item
  3935. Add red color cast to shadows:
  3936. @example
  3937. colorbalance=rs=.3
  3938. @end example
  3939. @end itemize
  3940. @section colorkey
  3941. RGB colorspace color keying.
  3942. The filter accepts the following options:
  3943. @table @option
  3944. @item color
  3945. The color which will be replaced with transparency.
  3946. @item similarity
  3947. Similarity percentage with the key color.
  3948. 0.01 matches only the exact key color, while 1.0 matches everything.
  3949. @item blend
  3950. Blend percentage.
  3951. 0.0 makes pixels either fully transparent, or not transparent at all.
  3952. Higher values result in semi-transparent pixels, with a higher transparency
  3953. the more similar the pixels color is to the key color.
  3954. @end table
  3955. @subsection Examples
  3956. @itemize
  3957. @item
  3958. Make every green pixel in the input image transparent:
  3959. @example
  3960. ffmpeg -i input.png -vf colorkey=green out.png
  3961. @end example
  3962. @item
  3963. Overlay a greenscreen-video on top of a static background image.
  3964. @example
  3965. 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
  3966. @end example
  3967. @end itemize
  3968. @section colorlevels
  3969. Adjust video input frames using levels.
  3970. The filter accepts the following options:
  3971. @table @option
  3972. @item rimin
  3973. @item gimin
  3974. @item bimin
  3975. @item aimin
  3976. Adjust red, green, blue and alpha input black point.
  3977. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3978. @item rimax
  3979. @item gimax
  3980. @item bimax
  3981. @item aimax
  3982. Adjust red, green, blue and alpha input white point.
  3983. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3984. Input levels are used to lighten highlights (bright tones), darken shadows
  3985. (dark tones), change the balance of bright and dark tones.
  3986. @item romin
  3987. @item gomin
  3988. @item bomin
  3989. @item aomin
  3990. Adjust red, green, blue and alpha output black point.
  3991. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3992. @item romax
  3993. @item gomax
  3994. @item bomax
  3995. @item aomax
  3996. Adjust red, green, blue and alpha output white point.
  3997. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3998. Output levels allows manual selection of a constrained output level range.
  3999. @end table
  4000. @subsection Examples
  4001. @itemize
  4002. @item
  4003. Make video output darker:
  4004. @example
  4005. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4006. @end example
  4007. @item
  4008. Increase contrast:
  4009. @example
  4010. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4011. @end example
  4012. @item
  4013. Make video output lighter:
  4014. @example
  4015. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4016. @end example
  4017. @item
  4018. Increase brightness:
  4019. @example
  4020. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4021. @end example
  4022. @end itemize
  4023. @section colorchannelmixer
  4024. Adjust video input frames by re-mixing color channels.
  4025. This filter modifies a color channel by adding the values associated to
  4026. the other channels of the same pixels. For example if the value to
  4027. modify is red, the output value will be:
  4028. @example
  4029. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4030. @end example
  4031. The filter accepts the following options:
  4032. @table @option
  4033. @item rr
  4034. @item rg
  4035. @item rb
  4036. @item ra
  4037. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4038. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4039. @item gr
  4040. @item gg
  4041. @item gb
  4042. @item ga
  4043. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4044. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4045. @item br
  4046. @item bg
  4047. @item bb
  4048. @item ba
  4049. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4050. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4051. @item ar
  4052. @item ag
  4053. @item ab
  4054. @item aa
  4055. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4056. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4057. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4058. @end table
  4059. @subsection Examples
  4060. @itemize
  4061. @item
  4062. Convert source to grayscale:
  4063. @example
  4064. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4065. @end example
  4066. @item
  4067. Simulate sepia tones:
  4068. @example
  4069. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4070. @end example
  4071. @end itemize
  4072. @section colormatrix
  4073. Convert color matrix.
  4074. The filter accepts the following options:
  4075. @table @option
  4076. @item src
  4077. @item dst
  4078. Specify the source and destination color matrix. Both values must be
  4079. specified.
  4080. The accepted values are:
  4081. @table @samp
  4082. @item bt709
  4083. BT.709
  4084. @item fcc
  4085. FCC
  4086. @item bt601
  4087. BT.601
  4088. @item bt470
  4089. BT.470
  4090. @item bt470bg
  4091. BT.470BG
  4092. @item smpte170m
  4093. SMPTE-170M
  4094. @item smpte240m
  4095. SMPTE-240M
  4096. @item bt2020
  4097. BT.2020
  4098. @end table
  4099. @end table
  4100. For example to convert from BT.601 to SMPTE-240M, use the command:
  4101. @example
  4102. colormatrix=bt601:smpte240m
  4103. @end example
  4104. @section colorspace
  4105. Convert colorspace, transfer characteristics or color primaries.
  4106. Input video needs to have an even size.
  4107. The filter accepts the following options:
  4108. @table @option
  4109. @anchor{all}
  4110. @item all
  4111. Specify all color properties at once.
  4112. The accepted values are:
  4113. @table @samp
  4114. @item bt470m
  4115. BT.470M
  4116. @item bt470bg
  4117. BT.470BG
  4118. @item bt601-6-525
  4119. BT.601-6 525
  4120. @item bt601-6-625
  4121. BT.601-6 625
  4122. @item bt709
  4123. BT.709
  4124. @item smpte170m
  4125. SMPTE-170M
  4126. @item smpte240m
  4127. SMPTE-240M
  4128. @item bt2020
  4129. BT.2020
  4130. @end table
  4131. @anchor{space}
  4132. @item space
  4133. Specify output colorspace.
  4134. The accepted values are:
  4135. @table @samp
  4136. @item bt709
  4137. BT.709
  4138. @item fcc
  4139. FCC
  4140. @item bt470bg
  4141. BT.470BG or BT.601-6 625
  4142. @item smpte170m
  4143. SMPTE-170M or BT.601-6 525
  4144. @item smpte240m
  4145. SMPTE-240M
  4146. @item ycgco
  4147. YCgCo
  4148. @item bt2020ncl
  4149. BT.2020 with non-constant luminance
  4150. @end table
  4151. @anchor{trc}
  4152. @item trc
  4153. Specify output transfer characteristics.
  4154. The accepted values are:
  4155. @table @samp
  4156. @item bt709
  4157. BT.709
  4158. @item bt470m
  4159. BT.470M
  4160. @item bt470bg
  4161. BT.470BG
  4162. @item gamma22
  4163. Constant gamma of 2.2
  4164. @item gamma28
  4165. Constant gamma of 2.8
  4166. @item smpte170m
  4167. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4168. @item smpte240m
  4169. SMPTE-240M
  4170. @item srgb
  4171. SRGB
  4172. @item iec61966-2-1
  4173. iec61966-2-1
  4174. @item iec61966-2-4
  4175. iec61966-2-4
  4176. @item xvycc
  4177. xvycc
  4178. @item bt2020-10
  4179. BT.2020 for 10-bits content
  4180. @item bt2020-12
  4181. BT.2020 for 12-bits content
  4182. @end table
  4183. @anchor{primaries}
  4184. @item primaries
  4185. Specify output color primaries.
  4186. The accepted values are:
  4187. @table @samp
  4188. @item bt709
  4189. BT.709
  4190. @item bt470m
  4191. BT.470M
  4192. @item bt470bg
  4193. BT.470BG or BT.601-6 625
  4194. @item smpte170m
  4195. SMPTE-170M or BT.601-6 525
  4196. @item smpte240m
  4197. SMPTE-240M
  4198. @item film
  4199. film
  4200. @item smpte431
  4201. SMPTE-431
  4202. @item smpte432
  4203. SMPTE-432
  4204. @item bt2020
  4205. BT.2020
  4206. @end table
  4207. @anchor{range}
  4208. @item range
  4209. Specify output color range.
  4210. The accepted values are:
  4211. @table @samp
  4212. @item tv
  4213. TV (restricted) range
  4214. @item mpeg
  4215. MPEG (restricted) range
  4216. @item pc
  4217. PC (full) range
  4218. @item jpeg
  4219. JPEG (full) range
  4220. @end table
  4221. @item format
  4222. Specify output color format.
  4223. The accepted values are:
  4224. @table @samp
  4225. @item yuv420p
  4226. YUV 4:2:0 planar 8-bits
  4227. @item yuv420p10
  4228. YUV 4:2:0 planar 10-bits
  4229. @item yuv420p12
  4230. YUV 4:2:0 planar 12-bits
  4231. @item yuv422p
  4232. YUV 4:2:2 planar 8-bits
  4233. @item yuv422p10
  4234. YUV 4:2:2 planar 10-bits
  4235. @item yuv422p12
  4236. YUV 4:2:2 planar 12-bits
  4237. @item yuv444p
  4238. YUV 4:4:4 planar 8-bits
  4239. @item yuv444p10
  4240. YUV 4:4:4 planar 10-bits
  4241. @item yuv444p12
  4242. YUV 4:4:4 planar 12-bits
  4243. @end table
  4244. @item fast
  4245. Do a fast conversion, which skips gamma/primary correction. This will take
  4246. significantly less CPU, but will be mathematically incorrect. To get output
  4247. compatible with that produced by the colormatrix filter, use fast=1.
  4248. @item dither
  4249. Specify dithering mode.
  4250. The accepted values are:
  4251. @table @samp
  4252. @item none
  4253. No dithering
  4254. @item fsb
  4255. Floyd-Steinberg dithering
  4256. @end table
  4257. @item wpadapt
  4258. Whitepoint adaptation mode.
  4259. The accepted values are:
  4260. @table @samp
  4261. @item bradford
  4262. Bradford whitepoint adaptation
  4263. @item vonkries
  4264. von Kries whitepoint adaptation
  4265. @item identity
  4266. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4267. @end table
  4268. @item iall
  4269. Override all input properties at once. Same accepted values as @ref{all}.
  4270. @item ispace
  4271. Override input colorspace. Same accepted values as @ref{space}.
  4272. @item iprimaries
  4273. Override input color primaries. Same accepted values as @ref{primaries}.
  4274. @item itrc
  4275. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4276. @item irange
  4277. Override input color range. Same accepted values as @ref{range}.
  4278. @end table
  4279. The filter converts the transfer characteristics, color space and color
  4280. primaries to the specified user values. The output value, if not specified,
  4281. is set to a default value based on the "all" property. If that property is
  4282. also not specified, the filter will log an error. The output color range and
  4283. format default to the same value as the input color range and format. The
  4284. input transfer characteristics, color space, color primaries and color range
  4285. should be set on the input data. If any of these are missing, the filter will
  4286. log an error and no conversion will take place.
  4287. For example to convert the input to SMPTE-240M, use the command:
  4288. @example
  4289. colorspace=smpte240m
  4290. @end example
  4291. @section convolution
  4292. Apply convolution 3x3 or 5x5 filter.
  4293. The filter accepts the following options:
  4294. @table @option
  4295. @item 0m
  4296. @item 1m
  4297. @item 2m
  4298. @item 3m
  4299. Set matrix for each plane.
  4300. Matrix is sequence of 9 or 25 signed integers.
  4301. @item 0rdiv
  4302. @item 1rdiv
  4303. @item 2rdiv
  4304. @item 3rdiv
  4305. Set multiplier for calculated value for each plane.
  4306. @item 0bias
  4307. @item 1bias
  4308. @item 2bias
  4309. @item 3bias
  4310. Set bias for each plane. This value is added to the result of the multiplication.
  4311. Useful for making the overall image brighter or darker. Default is 0.0.
  4312. @end table
  4313. @subsection Examples
  4314. @itemize
  4315. @item
  4316. Apply sharpen:
  4317. @example
  4318. 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"
  4319. @end example
  4320. @item
  4321. Apply blur:
  4322. @example
  4323. 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"
  4324. @end example
  4325. @item
  4326. Apply edge enhance:
  4327. @example
  4328. 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"
  4329. @end example
  4330. @item
  4331. Apply edge detect:
  4332. @example
  4333. 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"
  4334. @end example
  4335. @item
  4336. Apply emboss:
  4337. @example
  4338. 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"
  4339. @end example
  4340. @end itemize
  4341. @section copy
  4342. Copy the input source unchanged to the output. This is mainly useful for
  4343. testing purposes.
  4344. @anchor{coreimage}
  4345. @section coreimage
  4346. Video filtering on GPU using Apple's CoreImage API on OSX.
  4347. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4348. processed by video hardware. However, software-based OpenGL implementations
  4349. exist which means there is no guarantee for hardware processing. It depends on
  4350. the respective OSX.
  4351. There are many filters and image generators provided by Apple that come with a
  4352. large variety of options. The filter has to be referenced by its name along
  4353. with its options.
  4354. The coreimage filter accepts the following options:
  4355. @table @option
  4356. @item list_filters
  4357. List all available filters and generators along with all their respective
  4358. options as well as possible minimum and maximum values along with the default
  4359. values.
  4360. @example
  4361. list_filters=true
  4362. @end example
  4363. @item filter
  4364. Specify all filters by their respective name and options.
  4365. Use @var{list_filters} to determine all valid filter names and options.
  4366. Numerical options are specified by a float value and are automatically clamped
  4367. to their respective value range. Vector and color options have to be specified
  4368. by a list of space separated float values. Character escaping has to be done.
  4369. A special option name @code{default} is available to use default options for a
  4370. filter.
  4371. It is required to specify either @code{default} or at least one of the filter options.
  4372. All omitted options are used with their default values.
  4373. The syntax of the filter string is as follows:
  4374. @example
  4375. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4376. @end example
  4377. @item output_rect
  4378. Specify a rectangle where the output of the filter chain is copied into the
  4379. input image. It is given by a list of space separated float values:
  4380. @example
  4381. output_rect=x\ y\ width\ height
  4382. @end example
  4383. If not given, the output rectangle equals the dimensions of the input image.
  4384. The output rectangle is automatically cropped at the borders of the input
  4385. image. Negative values are valid for each component.
  4386. @example
  4387. output_rect=25\ 25\ 100\ 100
  4388. @end example
  4389. @end table
  4390. Several filters can be chained for successive processing without GPU-HOST
  4391. transfers allowing for fast processing of complex filter chains.
  4392. Currently, only filters with zero (generators) or exactly one (filters) input
  4393. image and one output image are supported. Also, transition filters are not yet
  4394. usable as intended.
  4395. Some filters generate output images with additional padding depending on the
  4396. respective filter kernel. The padding is automatically removed to ensure the
  4397. filter output has the same size as the input image.
  4398. For image generators, the size of the output image is determined by the
  4399. previous output image of the filter chain or the input image of the whole
  4400. filterchain, respectively. The generators do not use the pixel information of
  4401. this image to generate their output. However, the generated output is
  4402. blended onto this image, resulting in partial or complete coverage of the
  4403. output image.
  4404. The @ref{coreimagesrc} video source can be used for generating input images
  4405. which are directly fed into the filter chain. By using it, providing input
  4406. images by another video source or an input video is not required.
  4407. @subsection Examples
  4408. @itemize
  4409. @item
  4410. List all filters available:
  4411. @example
  4412. coreimage=list_filters=true
  4413. @end example
  4414. @item
  4415. Use the CIBoxBlur filter with default options to blur an image:
  4416. @example
  4417. coreimage=filter=CIBoxBlur@@default
  4418. @end example
  4419. @item
  4420. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4421. its center at 100x100 and a radius of 50 pixels:
  4422. @example
  4423. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4424. @end example
  4425. @item
  4426. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4427. given as complete and escaped command-line for Apple's standard bash shell:
  4428. @example
  4429. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4430. @end example
  4431. @end itemize
  4432. @section crop
  4433. Crop the input video to given dimensions.
  4434. It accepts the following parameters:
  4435. @table @option
  4436. @item w, out_w
  4437. The width of the output video. It defaults to @code{iw}.
  4438. This expression is evaluated only once during the filter
  4439. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4440. @item h, out_h
  4441. The height of the output video. It defaults to @code{ih}.
  4442. This expression is evaluated only once during the filter
  4443. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4444. @item x
  4445. The horizontal position, in the input video, of the left edge of the output
  4446. video. It defaults to @code{(in_w-out_w)/2}.
  4447. This expression is evaluated per-frame.
  4448. @item y
  4449. The vertical position, in the input video, of the top edge of the output video.
  4450. It defaults to @code{(in_h-out_h)/2}.
  4451. This expression is evaluated per-frame.
  4452. @item keep_aspect
  4453. If set to 1 will force the output display aspect ratio
  4454. to be the same of the input, by changing the output sample aspect
  4455. ratio. It defaults to 0.
  4456. @item exact
  4457. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4458. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4459. It defaults to 0.
  4460. @end table
  4461. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4462. expressions containing the following constants:
  4463. @table @option
  4464. @item x
  4465. @item y
  4466. The computed values for @var{x} and @var{y}. They are evaluated for
  4467. each new frame.
  4468. @item in_w
  4469. @item in_h
  4470. The input width and height.
  4471. @item iw
  4472. @item ih
  4473. These are the same as @var{in_w} and @var{in_h}.
  4474. @item out_w
  4475. @item out_h
  4476. The output (cropped) width and height.
  4477. @item ow
  4478. @item oh
  4479. These are the same as @var{out_w} and @var{out_h}.
  4480. @item a
  4481. same as @var{iw} / @var{ih}
  4482. @item sar
  4483. input sample aspect ratio
  4484. @item dar
  4485. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4486. @item hsub
  4487. @item vsub
  4488. horizontal and vertical chroma subsample values. For example for the
  4489. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4490. @item n
  4491. The number of the input frame, starting from 0.
  4492. @item pos
  4493. the position in the file of the input frame, NAN if unknown
  4494. @item t
  4495. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4496. @end table
  4497. The expression for @var{out_w} may depend on the value of @var{out_h},
  4498. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4499. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4500. evaluated after @var{out_w} and @var{out_h}.
  4501. The @var{x} and @var{y} parameters specify the expressions for the
  4502. position of the top-left corner of the output (non-cropped) area. They
  4503. are evaluated for each frame. If the evaluated value is not valid, it
  4504. is approximated to the nearest valid value.
  4505. The expression for @var{x} may depend on @var{y}, and the expression
  4506. for @var{y} may depend on @var{x}.
  4507. @subsection Examples
  4508. @itemize
  4509. @item
  4510. Crop area with size 100x100 at position (12,34).
  4511. @example
  4512. crop=100:100:12:34
  4513. @end example
  4514. Using named options, the example above becomes:
  4515. @example
  4516. crop=w=100:h=100:x=12:y=34
  4517. @end example
  4518. @item
  4519. Crop the central input area with size 100x100:
  4520. @example
  4521. crop=100:100
  4522. @end example
  4523. @item
  4524. Crop the central input area with size 2/3 of the input video:
  4525. @example
  4526. crop=2/3*in_w:2/3*in_h
  4527. @end example
  4528. @item
  4529. Crop the input video central square:
  4530. @example
  4531. crop=out_w=in_h
  4532. crop=in_h
  4533. @end example
  4534. @item
  4535. Delimit the rectangle with the top-left corner placed at position
  4536. 100:100 and the right-bottom corner corresponding to the right-bottom
  4537. corner of the input image.
  4538. @example
  4539. crop=in_w-100:in_h-100:100:100
  4540. @end example
  4541. @item
  4542. Crop 10 pixels from the left and right borders, and 20 pixels from
  4543. the top and bottom borders
  4544. @example
  4545. crop=in_w-2*10:in_h-2*20
  4546. @end example
  4547. @item
  4548. Keep only the bottom right quarter of the input image:
  4549. @example
  4550. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4551. @end example
  4552. @item
  4553. Crop height for getting Greek harmony:
  4554. @example
  4555. crop=in_w:1/PHI*in_w
  4556. @end example
  4557. @item
  4558. Apply trembling effect:
  4559. @example
  4560. 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)
  4561. @end example
  4562. @item
  4563. Apply erratic camera effect depending on timestamp:
  4564. @example
  4565. 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)"
  4566. @end example
  4567. @item
  4568. Set x depending on the value of y:
  4569. @example
  4570. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4571. @end example
  4572. @end itemize
  4573. @subsection Commands
  4574. This filter supports the following commands:
  4575. @table @option
  4576. @item w, out_w
  4577. @item h, out_h
  4578. @item x
  4579. @item y
  4580. Set width/height of the output video and the horizontal/vertical position
  4581. in the input video.
  4582. The command accepts the same syntax of the corresponding option.
  4583. If the specified expression is not valid, it is kept at its current
  4584. value.
  4585. @end table
  4586. @section cropdetect
  4587. Auto-detect the crop size.
  4588. It calculates the necessary cropping parameters and prints the
  4589. recommended parameters via the logging system. The detected dimensions
  4590. correspond to the non-black area of the input video.
  4591. It accepts the following parameters:
  4592. @table @option
  4593. @item limit
  4594. Set higher black value threshold, which can be optionally specified
  4595. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4596. value greater to the set value is considered non-black. It defaults to 24.
  4597. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4598. on the bitdepth of the pixel format.
  4599. @item round
  4600. The value which the width/height should be divisible by. It defaults to
  4601. 16. The offset is automatically adjusted to center the video. Use 2 to
  4602. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4603. encoding to most video codecs.
  4604. @item reset_count, reset
  4605. Set the counter that determines after how many frames cropdetect will
  4606. reset the previously detected largest video area and start over to
  4607. detect the current optimal crop area. Default value is 0.
  4608. This can be useful when channel logos distort the video area. 0
  4609. indicates 'never reset', and returns the largest area encountered during
  4610. playback.
  4611. @end table
  4612. @anchor{curves}
  4613. @section curves
  4614. Apply color adjustments using curves.
  4615. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4616. component (red, green and blue) has its values defined by @var{N} key points
  4617. tied from each other using a smooth curve. The x-axis represents the pixel
  4618. values from the input frame, and the y-axis the new pixel values to be set for
  4619. the output frame.
  4620. By default, a component curve is defined by the two points @var{(0;0)} and
  4621. @var{(1;1)}. This creates a straight line where each original pixel value is
  4622. "adjusted" to its own value, which means no change to the image.
  4623. The filter allows you to redefine these two points and add some more. A new
  4624. curve (using a natural cubic spline interpolation) will be define to pass
  4625. smoothly through all these new coordinates. The new defined points needs to be
  4626. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4627. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4628. the vector spaces, the values will be clipped accordingly.
  4629. The filter accepts the following options:
  4630. @table @option
  4631. @item preset
  4632. Select one of the available color presets. This option can be used in addition
  4633. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4634. options takes priority on the preset values.
  4635. Available presets are:
  4636. @table @samp
  4637. @item none
  4638. @item color_negative
  4639. @item cross_process
  4640. @item darker
  4641. @item increase_contrast
  4642. @item lighter
  4643. @item linear_contrast
  4644. @item medium_contrast
  4645. @item negative
  4646. @item strong_contrast
  4647. @item vintage
  4648. @end table
  4649. Default is @code{none}.
  4650. @item master, m
  4651. Set the master key points. These points will define a second pass mapping. It
  4652. is sometimes called a "luminance" or "value" mapping. It can be used with
  4653. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4654. post-processing LUT.
  4655. @item red, r
  4656. Set the key points for the red component.
  4657. @item green, g
  4658. Set the key points for the green component.
  4659. @item blue, b
  4660. Set the key points for the blue component.
  4661. @item all
  4662. Set the key points for all components (not including master).
  4663. Can be used in addition to the other key points component
  4664. options. In this case, the unset component(s) will fallback on this
  4665. @option{all} setting.
  4666. @item psfile
  4667. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4668. @item plot
  4669. Save Gnuplot script of the curves in specified file.
  4670. @end table
  4671. To avoid some filtergraph syntax conflicts, each key points list need to be
  4672. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4673. @subsection Examples
  4674. @itemize
  4675. @item
  4676. Increase slightly the middle level of blue:
  4677. @example
  4678. curves=blue='0/0 0.5/0.58 1/1'
  4679. @end example
  4680. @item
  4681. Vintage effect:
  4682. @example
  4683. 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'
  4684. @end example
  4685. Here we obtain the following coordinates for each components:
  4686. @table @var
  4687. @item red
  4688. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4689. @item green
  4690. @code{(0;0) (0.50;0.48) (1;1)}
  4691. @item blue
  4692. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4693. @end table
  4694. @item
  4695. The previous example can also be achieved with the associated built-in preset:
  4696. @example
  4697. curves=preset=vintage
  4698. @end example
  4699. @item
  4700. Or simply:
  4701. @example
  4702. curves=vintage
  4703. @end example
  4704. @item
  4705. Use a Photoshop preset and redefine the points of the green component:
  4706. @example
  4707. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4708. @end example
  4709. @item
  4710. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4711. and @command{gnuplot}:
  4712. @example
  4713. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4714. gnuplot -p /tmp/curves.plt
  4715. @end example
  4716. @end itemize
  4717. @section datascope
  4718. Video data analysis filter.
  4719. This filter shows hexadecimal pixel values of part of video.
  4720. The filter accepts the following options:
  4721. @table @option
  4722. @item size, s
  4723. Set output video size.
  4724. @item x
  4725. Set x offset from where to pick pixels.
  4726. @item y
  4727. Set y offset from where to pick pixels.
  4728. @item mode
  4729. Set scope mode, can be one of the following:
  4730. @table @samp
  4731. @item mono
  4732. Draw hexadecimal pixel values with white color on black background.
  4733. @item color
  4734. Draw hexadecimal pixel values with input video pixel color on black
  4735. background.
  4736. @item color2
  4737. Draw hexadecimal pixel values on color background picked from input video,
  4738. the text color is picked in such way so its always visible.
  4739. @end table
  4740. @item axis
  4741. Draw rows and columns numbers on left and top of video.
  4742. @item opacity
  4743. Set background opacity.
  4744. @end table
  4745. @section dctdnoiz
  4746. Denoise frames using 2D DCT (frequency domain filtering).
  4747. This filter is not designed for real time.
  4748. The filter accepts the following options:
  4749. @table @option
  4750. @item sigma, s
  4751. Set the noise sigma constant.
  4752. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4753. coefficient (absolute value) below this threshold with be dropped.
  4754. If you need a more advanced filtering, see @option{expr}.
  4755. Default is @code{0}.
  4756. @item overlap
  4757. Set number overlapping pixels for each block. Since the filter can be slow, you
  4758. may want to reduce this value, at the cost of a less effective filter and the
  4759. risk of various artefacts.
  4760. If the overlapping value doesn't permit processing the whole input width or
  4761. height, a warning will be displayed and according borders won't be denoised.
  4762. Default value is @var{blocksize}-1, which is the best possible setting.
  4763. @item expr, e
  4764. Set the coefficient factor expression.
  4765. For each coefficient of a DCT block, this expression will be evaluated as a
  4766. multiplier value for the coefficient.
  4767. If this is option is set, the @option{sigma} option will be ignored.
  4768. The absolute value of the coefficient can be accessed through the @var{c}
  4769. variable.
  4770. @item n
  4771. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4772. @var{blocksize}, which is the width and height of the processed blocks.
  4773. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4774. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4775. on the speed processing. Also, a larger block size does not necessarily means a
  4776. better de-noising.
  4777. @end table
  4778. @subsection Examples
  4779. Apply a denoise with a @option{sigma} of @code{4.5}:
  4780. @example
  4781. dctdnoiz=4.5
  4782. @end example
  4783. The same operation can be achieved using the expression system:
  4784. @example
  4785. dctdnoiz=e='gte(c, 4.5*3)'
  4786. @end example
  4787. Violent denoise using a block size of @code{16x16}:
  4788. @example
  4789. dctdnoiz=15:n=4
  4790. @end example
  4791. @section deband
  4792. Remove banding artifacts from input video.
  4793. It works by replacing banded pixels with average value of referenced pixels.
  4794. The filter accepts the following options:
  4795. @table @option
  4796. @item 1thr
  4797. @item 2thr
  4798. @item 3thr
  4799. @item 4thr
  4800. Set banding detection threshold for each plane. Default is 0.02.
  4801. Valid range is 0.00003 to 0.5.
  4802. If difference between current pixel and reference pixel is less than threshold,
  4803. it will be considered as banded.
  4804. @item range, r
  4805. Banding detection range in pixels. Default is 16. If positive, random number
  4806. in range 0 to set value will be used. If negative, exact absolute value
  4807. will be used.
  4808. The range defines square of four pixels around current pixel.
  4809. @item direction, d
  4810. Set direction in radians from which four pixel will be compared. If positive,
  4811. random direction from 0 to set direction will be picked. If negative, exact of
  4812. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4813. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4814. column.
  4815. @item blur, b
  4816. If enabled, current pixel is compared with average value of all four
  4817. surrounding pixels. The default is enabled. If disabled current pixel is
  4818. compared with all four surrounding pixels. The pixel is considered banded
  4819. if only all four differences with surrounding pixels are less than threshold.
  4820. @item coupling, c
  4821. If enabled, current pixel is changed if and only if all pixel components are banded,
  4822. e.g. banding detection threshold is triggered for all color components.
  4823. The default is disabled.
  4824. @end table
  4825. @anchor{decimate}
  4826. @section decimate
  4827. Drop duplicated frames at regular intervals.
  4828. The filter accepts the following options:
  4829. @table @option
  4830. @item cycle
  4831. Set the number of frames from which one will be dropped. Setting this to
  4832. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4833. Default is @code{5}.
  4834. @item dupthresh
  4835. Set the threshold for duplicate detection. If the difference metric for a frame
  4836. is less than or equal to this value, then it is declared as duplicate. Default
  4837. is @code{1.1}
  4838. @item scthresh
  4839. Set scene change threshold. Default is @code{15}.
  4840. @item blockx
  4841. @item blocky
  4842. Set the size of the x and y-axis blocks used during metric calculations.
  4843. Larger blocks give better noise suppression, but also give worse detection of
  4844. small movements. Must be a power of two. Default is @code{32}.
  4845. @item ppsrc
  4846. Mark main input as a pre-processed input and activate clean source input
  4847. stream. This allows the input to be pre-processed with various filters to help
  4848. the metrics calculation while keeping the frame selection lossless. When set to
  4849. @code{1}, the first stream is for the pre-processed input, and the second
  4850. stream is the clean source from where the kept frames are chosen. Default is
  4851. @code{0}.
  4852. @item chroma
  4853. Set whether or not chroma is considered in the metric calculations. Default is
  4854. @code{1}.
  4855. @end table
  4856. @section deflate
  4857. Apply deflate effect to the video.
  4858. This filter replaces the pixel by the local(3x3) average by taking into account
  4859. only values lower than the pixel.
  4860. It accepts the following options:
  4861. @table @option
  4862. @item threshold0
  4863. @item threshold1
  4864. @item threshold2
  4865. @item threshold3
  4866. Limit the maximum change for each plane, default is 65535.
  4867. If 0, plane will remain unchanged.
  4868. @end table
  4869. @section dejudder
  4870. Remove judder produced by partially interlaced telecined content.
  4871. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4872. source was partially telecined content then the output of @code{pullup,dejudder}
  4873. will have a variable frame rate. May change the recorded frame rate of the
  4874. container. Aside from that change, this filter will not affect constant frame
  4875. rate video.
  4876. The option available in this filter is:
  4877. @table @option
  4878. @item cycle
  4879. Specify the length of the window over which the judder repeats.
  4880. Accepts any integer greater than 1. Useful values are:
  4881. @table @samp
  4882. @item 4
  4883. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4884. @item 5
  4885. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4886. @item 20
  4887. If a mixture of the two.
  4888. @end table
  4889. The default is @samp{4}.
  4890. @end table
  4891. @section delogo
  4892. Suppress a TV station logo by a simple interpolation of the surrounding
  4893. pixels. Just set a rectangle covering the logo and watch it disappear
  4894. (and sometimes something even uglier appear - your mileage may vary).
  4895. It accepts the following parameters:
  4896. @table @option
  4897. @item x
  4898. @item y
  4899. Specify the top left corner coordinates of the logo. They must be
  4900. specified.
  4901. @item w
  4902. @item h
  4903. Specify the width and height of the logo to clear. They must be
  4904. specified.
  4905. @item band, t
  4906. Specify the thickness of the fuzzy edge of the rectangle (added to
  4907. @var{w} and @var{h}). The default value is 1. This option is
  4908. deprecated, setting higher values should no longer be necessary and
  4909. is not recommended.
  4910. @item show
  4911. When set to 1, a green rectangle is drawn on the screen to simplify
  4912. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4913. The default value is 0.
  4914. The rectangle is drawn on the outermost pixels which will be (partly)
  4915. replaced with interpolated values. The values of the next pixels
  4916. immediately outside this rectangle in each direction will be used to
  4917. compute the interpolated pixel values inside the rectangle.
  4918. @end table
  4919. @subsection Examples
  4920. @itemize
  4921. @item
  4922. Set a rectangle covering the area with top left corner coordinates 0,0
  4923. and size 100x77, and a band of size 10:
  4924. @example
  4925. delogo=x=0:y=0:w=100:h=77:band=10
  4926. @end example
  4927. @end itemize
  4928. @section deshake
  4929. Attempt to fix small changes in horizontal and/or vertical shift. This
  4930. filter helps remove camera shake from hand-holding a camera, bumping a
  4931. tripod, moving on a vehicle, etc.
  4932. The filter accepts the following options:
  4933. @table @option
  4934. @item x
  4935. @item y
  4936. @item w
  4937. @item h
  4938. Specify a rectangular area where to limit the search for motion
  4939. vectors.
  4940. If desired the search for motion vectors can be limited to a
  4941. rectangular area of the frame defined by its top left corner, width
  4942. and height. These parameters have the same meaning as the drawbox
  4943. filter which can be used to visualise the position of the bounding
  4944. box.
  4945. This is useful when simultaneous movement of subjects within the frame
  4946. might be confused for camera motion by the motion vector search.
  4947. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4948. then the full frame is used. This allows later options to be set
  4949. without specifying the bounding box for the motion vector search.
  4950. Default - search the whole frame.
  4951. @item rx
  4952. @item ry
  4953. Specify the maximum extent of movement in x and y directions in the
  4954. range 0-64 pixels. Default 16.
  4955. @item edge
  4956. Specify how to generate pixels to fill blanks at the edge of the
  4957. frame. Available values are:
  4958. @table @samp
  4959. @item blank, 0
  4960. Fill zeroes at blank locations
  4961. @item original, 1
  4962. Original image at blank locations
  4963. @item clamp, 2
  4964. Extruded edge value at blank locations
  4965. @item mirror, 3
  4966. Mirrored edge at blank locations
  4967. @end table
  4968. Default value is @samp{mirror}.
  4969. @item blocksize
  4970. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4971. default 8.
  4972. @item contrast
  4973. Specify the contrast threshold for blocks. Only blocks with more than
  4974. the specified contrast (difference between darkest and lightest
  4975. pixels) will be considered. Range 1-255, default 125.
  4976. @item search
  4977. Specify the search strategy. Available values are:
  4978. @table @samp
  4979. @item exhaustive, 0
  4980. Set exhaustive search
  4981. @item less, 1
  4982. Set less exhaustive search.
  4983. @end table
  4984. Default value is @samp{exhaustive}.
  4985. @item filename
  4986. If set then a detailed log of the motion search is written to the
  4987. specified file.
  4988. @item opencl
  4989. If set to 1, specify using OpenCL capabilities, only available if
  4990. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4991. @end table
  4992. @section detelecine
  4993. Apply an exact inverse of the telecine operation. It requires a predefined
  4994. pattern specified using the pattern option which must be the same as that passed
  4995. to the telecine filter.
  4996. This filter accepts the following options:
  4997. @table @option
  4998. @item first_field
  4999. @table @samp
  5000. @item top, t
  5001. top field first
  5002. @item bottom, b
  5003. bottom field first
  5004. The default value is @code{top}.
  5005. @end table
  5006. @item pattern
  5007. A string of numbers representing the pulldown pattern you wish to apply.
  5008. The default value is @code{23}.
  5009. @item start_frame
  5010. A number representing position of the first frame with respect to the telecine
  5011. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5012. @end table
  5013. @section dilation
  5014. Apply dilation effect to the video.
  5015. This filter replaces the pixel by the local(3x3) maximum.
  5016. It accepts the following options:
  5017. @table @option
  5018. @item threshold0
  5019. @item threshold1
  5020. @item threshold2
  5021. @item threshold3
  5022. Limit the maximum change for each plane, default is 65535.
  5023. If 0, plane will remain unchanged.
  5024. @item coordinates
  5025. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5026. pixels are used.
  5027. Flags to local 3x3 coordinates maps like this:
  5028. 1 2 3
  5029. 4 5
  5030. 6 7 8
  5031. @end table
  5032. @section displace
  5033. Displace pixels as indicated by second and third input stream.
  5034. It takes three input streams and outputs one stream, the first input is the
  5035. source, and second and third input are displacement maps.
  5036. The second input specifies how much to displace pixels along the
  5037. x-axis, while the third input specifies how much to displace pixels
  5038. along the y-axis.
  5039. If one of displacement map streams terminates, last frame from that
  5040. displacement map will be used.
  5041. Note that once generated, displacements maps can be reused over and over again.
  5042. A description of the accepted options follows.
  5043. @table @option
  5044. @item edge
  5045. Set displace behavior for pixels that are out of range.
  5046. Available values are:
  5047. @table @samp
  5048. @item blank
  5049. Missing pixels are replaced by black pixels.
  5050. @item smear
  5051. Adjacent pixels will spread out to replace missing pixels.
  5052. @item wrap
  5053. Out of range pixels are wrapped so they point to pixels of other side.
  5054. @end table
  5055. Default is @samp{smear}.
  5056. @end table
  5057. @subsection Examples
  5058. @itemize
  5059. @item
  5060. Add ripple effect to rgb input of video size hd720:
  5061. @example
  5062. 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
  5063. @end example
  5064. @item
  5065. Add wave effect to rgb input of video size hd720:
  5066. @example
  5067. 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
  5068. @end example
  5069. @end itemize
  5070. @section drawbox
  5071. Draw a colored box on the input image.
  5072. It accepts the following parameters:
  5073. @table @option
  5074. @item x
  5075. @item y
  5076. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5077. @item width, w
  5078. @item height, h
  5079. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5080. the input width and height. It defaults to 0.
  5081. @item color, c
  5082. Specify the color of the box to write. For the general syntax of this option,
  5083. check the "Color" section in the ffmpeg-utils manual. If the special
  5084. value @code{invert} is used, the box edge color is the same as the
  5085. video with inverted luma.
  5086. @item thickness, t
  5087. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5088. See below for the list of accepted constants.
  5089. @end table
  5090. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5091. following constants:
  5092. @table @option
  5093. @item dar
  5094. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5095. @item hsub
  5096. @item vsub
  5097. horizontal and vertical chroma subsample values. For example for the
  5098. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5099. @item in_h, ih
  5100. @item in_w, iw
  5101. The input width and height.
  5102. @item sar
  5103. The input sample aspect ratio.
  5104. @item x
  5105. @item y
  5106. The x and y offset coordinates where the box is drawn.
  5107. @item w
  5108. @item h
  5109. The width and height of the drawn box.
  5110. @item t
  5111. The thickness of the drawn box.
  5112. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5113. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5114. @end table
  5115. @subsection Examples
  5116. @itemize
  5117. @item
  5118. Draw a black box around the edge of the input image:
  5119. @example
  5120. drawbox
  5121. @end example
  5122. @item
  5123. Draw a box with color red and an opacity of 50%:
  5124. @example
  5125. drawbox=10:20:200:60:red@@0.5
  5126. @end example
  5127. The previous example can be specified as:
  5128. @example
  5129. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5130. @end example
  5131. @item
  5132. Fill the box with pink color:
  5133. @example
  5134. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5135. @end example
  5136. @item
  5137. Draw a 2-pixel red 2.40:1 mask:
  5138. @example
  5139. 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
  5140. @end example
  5141. @end itemize
  5142. @section drawgrid
  5143. Draw a grid on the input image.
  5144. It accepts the following parameters:
  5145. @table @option
  5146. @item x
  5147. @item y
  5148. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5149. @item width, w
  5150. @item height, h
  5151. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5152. input width and height, respectively, minus @code{thickness}, so image gets
  5153. framed. Default to 0.
  5154. @item color, c
  5155. Specify the color of the grid. For the general syntax of this option,
  5156. check the "Color" section in the ffmpeg-utils manual. If the special
  5157. value @code{invert} is used, the grid color is the same as the
  5158. video with inverted luma.
  5159. @item thickness, t
  5160. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5161. See below for the list of accepted constants.
  5162. @end table
  5163. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5164. following constants:
  5165. @table @option
  5166. @item dar
  5167. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5168. @item hsub
  5169. @item vsub
  5170. horizontal and vertical chroma subsample values. For example for the
  5171. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5172. @item in_h, ih
  5173. @item in_w, iw
  5174. The input grid cell width and height.
  5175. @item sar
  5176. The input sample aspect ratio.
  5177. @item x
  5178. @item y
  5179. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5180. @item w
  5181. @item h
  5182. The width and height of the drawn cell.
  5183. @item t
  5184. The thickness of the drawn cell.
  5185. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5186. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5187. @end table
  5188. @subsection Examples
  5189. @itemize
  5190. @item
  5191. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5192. @example
  5193. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5194. @end example
  5195. @item
  5196. Draw a white 3x3 grid with an opacity of 50%:
  5197. @example
  5198. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5199. @end example
  5200. @end itemize
  5201. @anchor{drawtext}
  5202. @section drawtext
  5203. Draw a text string or text from a specified file on top of a video, using the
  5204. libfreetype library.
  5205. To enable compilation of this filter, you need to configure FFmpeg with
  5206. @code{--enable-libfreetype}.
  5207. To enable default font fallback and the @var{font} option you need to
  5208. configure FFmpeg with @code{--enable-libfontconfig}.
  5209. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5210. @code{--enable-libfribidi}.
  5211. @subsection Syntax
  5212. It accepts the following parameters:
  5213. @table @option
  5214. @item box
  5215. Used to draw a box around text using the background color.
  5216. The value must be either 1 (enable) or 0 (disable).
  5217. The default value of @var{box} is 0.
  5218. @item boxborderw
  5219. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5220. The default value of @var{boxborderw} is 0.
  5221. @item boxcolor
  5222. The color to be used for drawing box around text. For the syntax of this
  5223. option, check the "Color" section in the ffmpeg-utils manual.
  5224. The default value of @var{boxcolor} is "white".
  5225. @item line_spacing
  5226. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5227. The default value of @var{line_spacing} is 0.
  5228. @item borderw
  5229. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5230. The default value of @var{borderw} is 0.
  5231. @item bordercolor
  5232. Set the color to be used for drawing border around text. For the syntax of this
  5233. option, check the "Color" section in the ffmpeg-utils manual.
  5234. The default value of @var{bordercolor} is "black".
  5235. @item expansion
  5236. Select how the @var{text} is expanded. Can be either @code{none},
  5237. @code{strftime} (deprecated) or
  5238. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5239. below for details.
  5240. @item basetime
  5241. Set a start time for the count. Value is in microseconds. Only applied
  5242. in the deprecated strftime expansion mode. To emulate in normal expansion
  5243. mode use the @code{pts} function, supplying the start time (in seconds)
  5244. as the second argument.
  5245. @item fix_bounds
  5246. If true, check and fix text coords to avoid clipping.
  5247. @item fontcolor
  5248. The color to be used for drawing fonts. For the syntax of this option, check
  5249. the "Color" section in the ffmpeg-utils manual.
  5250. The default value of @var{fontcolor} is "black".
  5251. @item fontcolor_expr
  5252. String which is expanded the same way as @var{text} to obtain dynamic
  5253. @var{fontcolor} value. By default this option has empty value and is not
  5254. processed. When this option is set, it overrides @var{fontcolor} option.
  5255. @item font
  5256. The font family to be used for drawing text. By default Sans.
  5257. @item fontfile
  5258. The font file to be used for drawing text. The path must be included.
  5259. This parameter is mandatory if the fontconfig support is disabled.
  5260. @item alpha
  5261. Draw the text applying alpha blending. The value can
  5262. be a number between 0.0 and 1.0.
  5263. The expression accepts the same variables @var{x, y} as well.
  5264. The default value is 1.
  5265. Please see @var{fontcolor_expr}.
  5266. @item fontsize
  5267. The font size to be used for drawing text.
  5268. The default value of @var{fontsize} is 16.
  5269. @item text_shaping
  5270. If set to 1, attempt to shape the text (for example, reverse the order of
  5271. right-to-left text and join Arabic characters) before drawing it.
  5272. Otherwise, just draw the text exactly as given.
  5273. By default 1 (if supported).
  5274. @item ft_load_flags
  5275. The flags to be used for loading the fonts.
  5276. The flags map the corresponding flags supported by libfreetype, and are
  5277. a combination of the following values:
  5278. @table @var
  5279. @item default
  5280. @item no_scale
  5281. @item no_hinting
  5282. @item render
  5283. @item no_bitmap
  5284. @item vertical_layout
  5285. @item force_autohint
  5286. @item crop_bitmap
  5287. @item pedantic
  5288. @item ignore_global_advance_width
  5289. @item no_recurse
  5290. @item ignore_transform
  5291. @item monochrome
  5292. @item linear_design
  5293. @item no_autohint
  5294. @end table
  5295. Default value is "default".
  5296. For more information consult the documentation for the FT_LOAD_*
  5297. libfreetype flags.
  5298. @item shadowcolor
  5299. The color to be used for drawing a shadow behind the drawn text. For the
  5300. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5301. The default value of @var{shadowcolor} is "black".
  5302. @item shadowx
  5303. @item shadowy
  5304. The x and y offsets for the text shadow position with respect to the
  5305. position of the text. They can be either positive or negative
  5306. values. The default value for both is "0".
  5307. @item start_number
  5308. The starting frame number for the n/frame_num variable. The default value
  5309. is "0".
  5310. @item tabsize
  5311. The size in number of spaces to use for rendering the tab.
  5312. Default value is 4.
  5313. @item timecode
  5314. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5315. format. It can be used with or without text parameter. @var{timecode_rate}
  5316. option must be specified.
  5317. @item timecode_rate, rate, r
  5318. Set the timecode frame rate (timecode only).
  5319. @item tc24hmax
  5320. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5321. Default is 0 (disabled).
  5322. @item text
  5323. The text string to be drawn. The text must be a sequence of UTF-8
  5324. encoded characters.
  5325. This parameter is mandatory if no file is specified with the parameter
  5326. @var{textfile}.
  5327. @item textfile
  5328. A text file containing text to be drawn. The text must be a sequence
  5329. of UTF-8 encoded characters.
  5330. This parameter is mandatory if no text string is specified with the
  5331. parameter @var{text}.
  5332. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5333. @item reload
  5334. If set to 1, the @var{textfile} will be reloaded before each frame.
  5335. Be sure to update it atomically, or it may be read partially, or even fail.
  5336. @item x
  5337. @item y
  5338. The expressions which specify the offsets where text will be drawn
  5339. within the video frame. They are relative to the top/left border of the
  5340. output image.
  5341. The default value of @var{x} and @var{y} is "0".
  5342. See below for the list of accepted constants and functions.
  5343. @end table
  5344. The parameters for @var{x} and @var{y} are expressions containing the
  5345. following constants and functions:
  5346. @table @option
  5347. @item dar
  5348. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5349. @item hsub
  5350. @item vsub
  5351. horizontal and vertical chroma subsample values. For example for the
  5352. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5353. @item line_h, lh
  5354. the height of each text line
  5355. @item main_h, h, H
  5356. the input height
  5357. @item main_w, w, W
  5358. the input width
  5359. @item max_glyph_a, ascent
  5360. the maximum distance from the baseline to the highest/upper grid
  5361. coordinate used to place a glyph outline point, for all the rendered
  5362. glyphs.
  5363. It is a positive value, due to the grid's orientation with the Y axis
  5364. upwards.
  5365. @item max_glyph_d, descent
  5366. the maximum distance from the baseline to the lowest grid coordinate
  5367. used to place a glyph outline point, for all the rendered glyphs.
  5368. This is a negative value, due to the grid's orientation, with the Y axis
  5369. upwards.
  5370. @item max_glyph_h
  5371. maximum glyph height, that is the maximum height for all the glyphs
  5372. contained in the rendered text, it is equivalent to @var{ascent} -
  5373. @var{descent}.
  5374. @item max_glyph_w
  5375. maximum glyph width, that is the maximum width for all the glyphs
  5376. contained in the rendered text
  5377. @item n
  5378. the number of input frame, starting from 0
  5379. @item rand(min, max)
  5380. return a random number included between @var{min} and @var{max}
  5381. @item sar
  5382. The input sample aspect ratio.
  5383. @item t
  5384. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5385. @item text_h, th
  5386. the height of the rendered text
  5387. @item text_w, tw
  5388. the width of the rendered text
  5389. @item x
  5390. @item y
  5391. the x and y offset coordinates where the text is drawn.
  5392. These parameters allow the @var{x} and @var{y} expressions to refer
  5393. each other, so you can for example specify @code{y=x/dar}.
  5394. @end table
  5395. @anchor{drawtext_expansion}
  5396. @subsection Text expansion
  5397. If @option{expansion} is set to @code{strftime},
  5398. the filter recognizes strftime() sequences in the provided text and
  5399. expands them accordingly. Check the documentation of strftime(). This
  5400. feature is deprecated.
  5401. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5402. If @option{expansion} is set to @code{normal} (which is the default),
  5403. the following expansion mechanism is used.
  5404. The backslash character @samp{\}, followed by any character, always expands to
  5405. the second character.
  5406. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5407. braces is a function name, possibly followed by arguments separated by ':'.
  5408. If the arguments contain special characters or delimiters (':' or '@}'),
  5409. they should be escaped.
  5410. Note that they probably must also be escaped as the value for the
  5411. @option{text} option in the filter argument string and as the filter
  5412. argument in the filtergraph description, and possibly also for the shell,
  5413. that makes up to four levels of escaping; using a text file avoids these
  5414. problems.
  5415. The following functions are available:
  5416. @table @command
  5417. @item expr, e
  5418. The expression evaluation result.
  5419. It must take one argument specifying the expression to be evaluated,
  5420. which accepts the same constants and functions as the @var{x} and
  5421. @var{y} values. Note that not all constants should be used, for
  5422. example the text size is not known when evaluating the expression, so
  5423. the constants @var{text_w} and @var{text_h} will have an undefined
  5424. value.
  5425. @item expr_int_format, eif
  5426. Evaluate the expression's value and output as formatted integer.
  5427. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5428. The second argument specifies the output format. Allowed values are @samp{x},
  5429. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5430. @code{printf} function.
  5431. The third parameter is optional and sets the number of positions taken by the output.
  5432. It can be used to add padding with zeros from the left.
  5433. @item gmtime
  5434. The time at which the filter is running, expressed in UTC.
  5435. It can accept an argument: a strftime() format string.
  5436. @item localtime
  5437. The time at which the filter is running, expressed in the local time zone.
  5438. It can accept an argument: a strftime() format string.
  5439. @item metadata
  5440. Frame metadata. Takes one or two arguments.
  5441. The first argument is mandatory and specifies the metadata key.
  5442. The second argument is optional and specifies a default value, used when the
  5443. metadata key is not found or empty.
  5444. @item n, frame_num
  5445. The frame number, starting from 0.
  5446. @item pict_type
  5447. A 1 character description of the current picture type.
  5448. @item pts
  5449. The timestamp of the current frame.
  5450. It can take up to three arguments.
  5451. The first argument is the format of the timestamp; it defaults to @code{flt}
  5452. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5453. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5454. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5455. @code{localtime} stands for the timestamp of the frame formatted as
  5456. local time zone time.
  5457. The second argument is an offset added to the timestamp.
  5458. If the format is set to @code{localtime} or @code{gmtime},
  5459. a third argument may be supplied: a strftime() format string.
  5460. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5461. @end table
  5462. @subsection Examples
  5463. @itemize
  5464. @item
  5465. Draw "Test Text" with font FreeSerif, using the default values for the
  5466. optional parameters.
  5467. @example
  5468. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5469. @end example
  5470. @item
  5471. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5472. and y=50 (counting from the top-left corner of the screen), text is
  5473. yellow with a red box around it. Both the text and the box have an
  5474. opacity of 20%.
  5475. @example
  5476. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5477. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5478. @end example
  5479. Note that the double quotes are not necessary if spaces are not used
  5480. within the parameter list.
  5481. @item
  5482. Show the text at the center of the video frame:
  5483. @example
  5484. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5485. @end example
  5486. @item
  5487. Show the text at a random position, switching to a new position every 30 seconds:
  5488. @example
  5489. 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)"
  5490. @end example
  5491. @item
  5492. Show a text line sliding from right to left in the last row of the video
  5493. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5494. with no newlines.
  5495. @example
  5496. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5497. @end example
  5498. @item
  5499. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5500. @example
  5501. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5502. @end example
  5503. @item
  5504. Draw a single green letter "g", at the center of the input video.
  5505. The glyph baseline is placed at half screen height.
  5506. @example
  5507. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5508. @end example
  5509. @item
  5510. Show text for 1 second every 3 seconds:
  5511. @example
  5512. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5513. @end example
  5514. @item
  5515. Use fontconfig to set the font. Note that the colons need to be escaped.
  5516. @example
  5517. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5518. @end example
  5519. @item
  5520. Print the date of a real-time encoding (see strftime(3)):
  5521. @example
  5522. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5523. @end example
  5524. @item
  5525. Show text fading in and out (appearing/disappearing):
  5526. @example
  5527. #!/bin/sh
  5528. DS=1.0 # display start
  5529. DE=10.0 # display end
  5530. FID=1.5 # fade in duration
  5531. FOD=5 # fade out duration
  5532. 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 @}"
  5533. @end example
  5534. @item
  5535. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5536. and the @option{fontsize} value are included in the @option{y} offset.
  5537. @example
  5538. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5539. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5540. @end example
  5541. @end itemize
  5542. For more information about libfreetype, check:
  5543. @url{http://www.freetype.org/}.
  5544. For more information about fontconfig, check:
  5545. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5546. For more information about libfribidi, check:
  5547. @url{http://fribidi.org/}.
  5548. @section edgedetect
  5549. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5550. The filter accepts the following options:
  5551. @table @option
  5552. @item low
  5553. @item high
  5554. Set low and high threshold values used by the Canny thresholding
  5555. algorithm.
  5556. The high threshold selects the "strong" edge pixels, which are then
  5557. connected through 8-connectivity with the "weak" edge pixels selected
  5558. by the low threshold.
  5559. @var{low} and @var{high} threshold values must be chosen in the range
  5560. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5561. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5562. is @code{50/255}.
  5563. @item mode
  5564. Define the drawing mode.
  5565. @table @samp
  5566. @item wires
  5567. Draw white/gray wires on black background.
  5568. @item colormix
  5569. Mix the colors to create a paint/cartoon effect.
  5570. @end table
  5571. Default value is @var{wires}.
  5572. @end table
  5573. @subsection Examples
  5574. @itemize
  5575. @item
  5576. Standard edge detection with custom values for the hysteresis thresholding:
  5577. @example
  5578. edgedetect=low=0.1:high=0.4
  5579. @end example
  5580. @item
  5581. Painting effect without thresholding:
  5582. @example
  5583. edgedetect=mode=colormix:high=0
  5584. @end example
  5585. @end itemize
  5586. @section eq
  5587. Set brightness, contrast, saturation and approximate gamma adjustment.
  5588. The filter accepts the following options:
  5589. @table @option
  5590. @item contrast
  5591. Set the contrast expression. The value must be a float value in range
  5592. @code{-2.0} to @code{2.0}. The default value is "1".
  5593. @item brightness
  5594. Set the brightness expression. The value must be a float value in
  5595. range @code{-1.0} to @code{1.0}. The default value is "0".
  5596. @item saturation
  5597. Set the saturation expression. The value must be a float in
  5598. range @code{0.0} to @code{3.0}. The default value is "1".
  5599. @item gamma
  5600. Set the gamma expression. The value must be a float in range
  5601. @code{0.1} to @code{10.0}. The default value is "1".
  5602. @item gamma_r
  5603. Set the gamma expression for red. The value must be a float in
  5604. range @code{0.1} to @code{10.0}. The default value is "1".
  5605. @item gamma_g
  5606. Set the gamma expression for green. The value must be a float in range
  5607. @code{0.1} to @code{10.0}. The default value is "1".
  5608. @item gamma_b
  5609. Set the gamma expression for blue. The value must be a float in range
  5610. @code{0.1} to @code{10.0}. The default value is "1".
  5611. @item gamma_weight
  5612. Set the gamma weight expression. It can be used to reduce the effect
  5613. of a high gamma value on bright image areas, e.g. keep them from
  5614. getting overamplified and just plain white. The value must be a float
  5615. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5616. gamma correction all the way down while @code{1.0} leaves it at its
  5617. full strength. Default is "1".
  5618. @item eval
  5619. Set when the expressions for brightness, contrast, saturation and
  5620. gamma expressions are evaluated.
  5621. It accepts the following values:
  5622. @table @samp
  5623. @item init
  5624. only evaluate expressions once during the filter initialization or
  5625. when a command is processed
  5626. @item frame
  5627. evaluate expressions for each incoming frame
  5628. @end table
  5629. Default value is @samp{init}.
  5630. @end table
  5631. The expressions accept the following parameters:
  5632. @table @option
  5633. @item n
  5634. frame count of the input frame starting from 0
  5635. @item pos
  5636. byte position of the corresponding packet in the input file, NAN if
  5637. unspecified
  5638. @item r
  5639. frame rate of the input video, NAN if the input frame rate is unknown
  5640. @item t
  5641. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5642. @end table
  5643. @subsection Commands
  5644. The filter supports the following commands:
  5645. @table @option
  5646. @item contrast
  5647. Set the contrast expression.
  5648. @item brightness
  5649. Set the brightness expression.
  5650. @item saturation
  5651. Set the saturation expression.
  5652. @item gamma
  5653. Set the gamma expression.
  5654. @item gamma_r
  5655. Set the gamma_r expression.
  5656. @item gamma_g
  5657. Set gamma_g expression.
  5658. @item gamma_b
  5659. Set gamma_b expression.
  5660. @item gamma_weight
  5661. Set gamma_weight expression.
  5662. The command accepts the same syntax of the corresponding option.
  5663. If the specified expression is not valid, it is kept at its current
  5664. value.
  5665. @end table
  5666. @section erosion
  5667. Apply erosion effect to the video.
  5668. This filter replaces the pixel by the local(3x3) minimum.
  5669. It accepts the following options:
  5670. @table @option
  5671. @item threshold0
  5672. @item threshold1
  5673. @item threshold2
  5674. @item threshold3
  5675. Limit the maximum change for each plane, default is 65535.
  5676. If 0, plane will remain unchanged.
  5677. @item coordinates
  5678. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5679. pixels are used.
  5680. Flags to local 3x3 coordinates maps like this:
  5681. 1 2 3
  5682. 4 5
  5683. 6 7 8
  5684. @end table
  5685. @section extractplanes
  5686. Extract color channel components from input video stream into
  5687. separate grayscale video streams.
  5688. The filter accepts the following option:
  5689. @table @option
  5690. @item planes
  5691. Set plane(s) to extract.
  5692. Available values for planes are:
  5693. @table @samp
  5694. @item y
  5695. @item u
  5696. @item v
  5697. @item a
  5698. @item r
  5699. @item g
  5700. @item b
  5701. @end table
  5702. Choosing planes not available in the input will result in an error.
  5703. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5704. with @code{y}, @code{u}, @code{v} planes at same time.
  5705. @end table
  5706. @subsection Examples
  5707. @itemize
  5708. @item
  5709. Extract luma, u and v color channel component from input video frame
  5710. into 3 grayscale outputs:
  5711. @example
  5712. 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
  5713. @end example
  5714. @end itemize
  5715. @section elbg
  5716. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5717. For each input image, the filter will compute the optimal mapping from
  5718. the input to the output given the codebook length, that is the number
  5719. of distinct output colors.
  5720. This filter accepts the following options.
  5721. @table @option
  5722. @item codebook_length, l
  5723. Set codebook length. The value must be a positive integer, and
  5724. represents the number of distinct output colors. Default value is 256.
  5725. @item nb_steps, n
  5726. Set the maximum number of iterations to apply for computing the optimal
  5727. mapping. The higher the value the better the result and the higher the
  5728. computation time. Default value is 1.
  5729. @item seed, s
  5730. Set a random seed, must be an integer included between 0 and
  5731. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5732. will try to use a good random seed on a best effort basis.
  5733. @item pal8
  5734. Set pal8 output pixel format. This option does not work with codebook
  5735. length greater than 256.
  5736. @end table
  5737. @section fade
  5738. Apply a fade-in/out effect to the input video.
  5739. It accepts the following parameters:
  5740. @table @option
  5741. @item type, t
  5742. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5743. effect.
  5744. Default is @code{in}.
  5745. @item start_frame, s
  5746. Specify the number of the frame to start applying the fade
  5747. effect at. Default is 0.
  5748. @item nb_frames, n
  5749. The number of frames that the fade effect lasts. At the end of the
  5750. fade-in effect, the output video will have the same intensity as the input video.
  5751. At the end of the fade-out transition, the output video will be filled with the
  5752. selected @option{color}.
  5753. Default is 25.
  5754. @item alpha
  5755. If set to 1, fade only alpha channel, if one exists on the input.
  5756. Default value is 0.
  5757. @item start_time, st
  5758. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5759. effect. If both start_frame and start_time are specified, the fade will start at
  5760. whichever comes last. Default is 0.
  5761. @item duration, d
  5762. The number of seconds for which the fade effect has to last. At the end of the
  5763. fade-in effect the output video will have the same intensity as the input video,
  5764. at the end of the fade-out transition the output video will be filled with the
  5765. selected @option{color}.
  5766. If both duration and nb_frames are specified, duration is used. Default is 0
  5767. (nb_frames is used by default).
  5768. @item color, c
  5769. Specify the color of the fade. Default is "black".
  5770. @end table
  5771. @subsection Examples
  5772. @itemize
  5773. @item
  5774. Fade in the first 30 frames of video:
  5775. @example
  5776. fade=in:0:30
  5777. @end example
  5778. The command above is equivalent to:
  5779. @example
  5780. fade=t=in:s=0:n=30
  5781. @end example
  5782. @item
  5783. Fade out the last 45 frames of a 200-frame video:
  5784. @example
  5785. fade=out:155:45
  5786. fade=type=out:start_frame=155:nb_frames=45
  5787. @end example
  5788. @item
  5789. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5790. @example
  5791. fade=in:0:25, fade=out:975:25
  5792. @end example
  5793. @item
  5794. Make the first 5 frames yellow, then fade in from frame 5-24:
  5795. @example
  5796. fade=in:5:20:color=yellow
  5797. @end example
  5798. @item
  5799. Fade in alpha over first 25 frames of video:
  5800. @example
  5801. fade=in:0:25:alpha=1
  5802. @end example
  5803. @item
  5804. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5805. @example
  5806. fade=t=in:st=5.5:d=0.5
  5807. @end example
  5808. @end itemize
  5809. @section fftfilt
  5810. Apply arbitrary expressions to samples in frequency domain
  5811. @table @option
  5812. @item dc_Y
  5813. Adjust the dc value (gain) of the luma plane of the image. The filter
  5814. accepts an integer value in range @code{0} to @code{1000}. The default
  5815. value is set to @code{0}.
  5816. @item dc_U
  5817. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5818. filter accepts an integer value in range @code{0} to @code{1000}. The
  5819. default value is set to @code{0}.
  5820. @item dc_V
  5821. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5822. filter accepts an integer value in range @code{0} to @code{1000}. The
  5823. default value is set to @code{0}.
  5824. @item weight_Y
  5825. Set the frequency domain weight expression for the luma plane.
  5826. @item weight_U
  5827. Set the frequency domain weight expression for the 1st chroma plane.
  5828. @item weight_V
  5829. Set the frequency domain weight expression for the 2nd chroma plane.
  5830. The filter accepts the following variables:
  5831. @item X
  5832. @item Y
  5833. The coordinates of the current sample.
  5834. @item W
  5835. @item H
  5836. The width and height of the image.
  5837. @end table
  5838. @subsection Examples
  5839. @itemize
  5840. @item
  5841. High-pass:
  5842. @example
  5843. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5844. @end example
  5845. @item
  5846. Low-pass:
  5847. @example
  5848. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5849. @end example
  5850. @item
  5851. Sharpen:
  5852. @example
  5853. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5854. @end example
  5855. @item
  5856. Blur:
  5857. @example
  5858. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5859. @end example
  5860. @end itemize
  5861. @section field
  5862. Extract a single field from an interlaced image using stride
  5863. arithmetic to avoid wasting CPU time. The output frames are marked as
  5864. non-interlaced.
  5865. The filter accepts the following options:
  5866. @table @option
  5867. @item type
  5868. Specify whether to extract the top (if the value is @code{0} or
  5869. @code{top}) or the bottom field (if the value is @code{1} or
  5870. @code{bottom}).
  5871. @end table
  5872. @section fieldhint
  5873. Create new frames by copying the top and bottom fields from surrounding frames
  5874. supplied as numbers by the hint file.
  5875. @table @option
  5876. @item hint
  5877. Set file containing hints: absolute/relative frame numbers.
  5878. There must be one line for each frame in a clip. Each line must contain two
  5879. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5880. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5881. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5882. for @code{relative} mode. First number tells from which frame to pick up top
  5883. field and second number tells from which frame to pick up bottom field.
  5884. If optionally followed by @code{+} output frame will be marked as interlaced,
  5885. else if followed by @code{-} output frame will be marked as progressive, else
  5886. it will be marked same as input frame.
  5887. If line starts with @code{#} or @code{;} that line is skipped.
  5888. @item mode
  5889. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5890. @end table
  5891. Example of first several lines of @code{hint} file for @code{relative} mode:
  5892. @example
  5893. 0,0 - # first frame
  5894. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5895. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5896. 1,0 -
  5897. 0,0 -
  5898. 0,0 -
  5899. 1,0 -
  5900. 1,0 -
  5901. 1,0 -
  5902. 0,0 -
  5903. 0,0 -
  5904. 1,0 -
  5905. 1,0 -
  5906. 1,0 -
  5907. 0,0 -
  5908. @end example
  5909. @section fieldmatch
  5910. Field matching filter for inverse telecine. It is meant to reconstruct the
  5911. progressive frames from a telecined stream. The filter does not drop duplicated
  5912. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5913. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5914. The separation of the field matching and the decimation is notably motivated by
  5915. the possibility of inserting a de-interlacing filter fallback between the two.
  5916. If the source has mixed telecined and real interlaced content,
  5917. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5918. But these remaining combed frames will be marked as interlaced, and thus can be
  5919. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5920. In addition to the various configuration options, @code{fieldmatch} can take an
  5921. optional second stream, activated through the @option{ppsrc} option. If
  5922. enabled, the frames reconstruction will be based on the fields and frames from
  5923. this second stream. This allows the first input to be pre-processed in order to
  5924. help the various algorithms of the filter, while keeping the output lossless
  5925. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5926. or brightness/contrast adjustments can help.
  5927. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5928. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5929. which @code{fieldmatch} is based on. While the semantic and usage are very
  5930. close, some behaviour and options names can differ.
  5931. The @ref{decimate} filter currently only works for constant frame rate input.
  5932. If your input has mixed telecined (30fps) and progressive content with a lower
  5933. framerate like 24fps use the following filterchain to produce the necessary cfr
  5934. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5935. The filter accepts the following options:
  5936. @table @option
  5937. @item order
  5938. Specify the assumed field order of the input stream. Available values are:
  5939. @table @samp
  5940. @item auto
  5941. Auto detect parity (use FFmpeg's internal parity value).
  5942. @item bff
  5943. Assume bottom field first.
  5944. @item tff
  5945. Assume top field first.
  5946. @end table
  5947. Note that it is sometimes recommended not to trust the parity announced by the
  5948. stream.
  5949. Default value is @var{auto}.
  5950. @item mode
  5951. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5952. sense that it won't risk creating jerkiness due to duplicate frames when
  5953. possible, but if there are bad edits or blended fields it will end up
  5954. outputting combed frames when a good match might actually exist. On the other
  5955. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5956. but will almost always find a good frame if there is one. The other values are
  5957. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5958. jerkiness and creating duplicate frames versus finding good matches in sections
  5959. with bad edits, orphaned fields, blended fields, etc.
  5960. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5961. Available values are:
  5962. @table @samp
  5963. @item pc
  5964. 2-way matching (p/c)
  5965. @item pc_n
  5966. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5967. @item pc_u
  5968. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5969. @item pc_n_ub
  5970. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5971. still combed (p/c + n + u/b)
  5972. @item pcn
  5973. 3-way matching (p/c/n)
  5974. @item pcn_ub
  5975. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5976. detected as combed (p/c/n + u/b)
  5977. @end table
  5978. The parenthesis at the end indicate the matches that would be used for that
  5979. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5980. @var{top}).
  5981. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5982. the slowest.
  5983. Default value is @var{pc_n}.
  5984. @item ppsrc
  5985. Mark the main input stream as a pre-processed input, and enable the secondary
  5986. input stream as the clean source to pick the fields from. See the filter
  5987. introduction for more details. It is similar to the @option{clip2} feature from
  5988. VFM/TFM.
  5989. Default value is @code{0} (disabled).
  5990. @item field
  5991. Set the field to match from. It is recommended to set this to the same value as
  5992. @option{order} unless you experience matching failures with that setting. In
  5993. certain circumstances changing the field that is used to match from can have a
  5994. large impact on matching performance. Available values are:
  5995. @table @samp
  5996. @item auto
  5997. Automatic (same value as @option{order}).
  5998. @item bottom
  5999. Match from the bottom field.
  6000. @item top
  6001. Match from the top field.
  6002. @end table
  6003. Default value is @var{auto}.
  6004. @item mchroma
  6005. Set whether or not chroma is included during the match comparisons. In most
  6006. cases it is recommended to leave this enabled. You should set this to @code{0}
  6007. only if your clip has bad chroma problems such as heavy rainbowing or other
  6008. artifacts. Setting this to @code{0} could also be used to speed things up at
  6009. the cost of some accuracy.
  6010. Default value is @code{1}.
  6011. @item y0
  6012. @item y1
  6013. These define an exclusion band which excludes the lines between @option{y0} and
  6014. @option{y1} from being included in the field matching decision. An exclusion
  6015. band can be used to ignore subtitles, a logo, or other things that may
  6016. interfere with the matching. @option{y0} sets the starting scan line and
  6017. @option{y1} sets the ending line; all lines in between @option{y0} and
  6018. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6019. @option{y0} and @option{y1} to the same value will disable the feature.
  6020. @option{y0} and @option{y1} defaults to @code{0}.
  6021. @item scthresh
  6022. Set the scene change detection threshold as a percentage of maximum change on
  6023. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6024. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6025. @option{scthresh} is @code{[0.0, 100.0]}.
  6026. Default value is @code{12.0}.
  6027. @item combmatch
  6028. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6029. account the combed scores of matches when deciding what match to use as the
  6030. final match. Available values are:
  6031. @table @samp
  6032. @item none
  6033. No final matching based on combed scores.
  6034. @item sc
  6035. Combed scores are only used when a scene change is detected.
  6036. @item full
  6037. Use combed scores all the time.
  6038. @end table
  6039. Default is @var{sc}.
  6040. @item combdbg
  6041. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6042. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6043. Available values are:
  6044. @table @samp
  6045. @item none
  6046. No forced calculation.
  6047. @item pcn
  6048. Force p/c/n calculations.
  6049. @item pcnub
  6050. Force p/c/n/u/b calculations.
  6051. @end table
  6052. Default value is @var{none}.
  6053. @item cthresh
  6054. This is the area combing threshold used for combed frame detection. This
  6055. essentially controls how "strong" or "visible" combing must be to be detected.
  6056. Larger values mean combing must be more visible and smaller values mean combing
  6057. can be less visible or strong and still be detected. Valid settings are from
  6058. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6059. be detected as combed). This is basically a pixel difference value. A good
  6060. range is @code{[8, 12]}.
  6061. Default value is @code{9}.
  6062. @item chroma
  6063. Sets whether or not chroma is considered in the combed frame decision. Only
  6064. disable this if your source has chroma problems (rainbowing, etc.) that are
  6065. causing problems for the combed frame detection with chroma enabled. Actually,
  6066. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6067. where there is chroma only combing in the source.
  6068. Default value is @code{0}.
  6069. @item blockx
  6070. @item blocky
  6071. Respectively set the x-axis and y-axis size of the window used during combed
  6072. frame detection. This has to do with the size of the area in which
  6073. @option{combpel} pixels are required to be detected as combed for a frame to be
  6074. declared combed. See the @option{combpel} parameter description for more info.
  6075. Possible values are any number that is a power of 2 starting at 4 and going up
  6076. to 512.
  6077. Default value is @code{16}.
  6078. @item combpel
  6079. The number of combed pixels inside any of the @option{blocky} by
  6080. @option{blockx} size blocks on the frame for the frame to be detected as
  6081. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6082. setting controls "how much" combing there must be in any localized area (a
  6083. window defined by the @option{blockx} and @option{blocky} settings) on the
  6084. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6085. which point no frames will ever be detected as combed). This setting is known
  6086. as @option{MI} in TFM/VFM vocabulary.
  6087. Default value is @code{80}.
  6088. @end table
  6089. @anchor{p/c/n/u/b meaning}
  6090. @subsection p/c/n/u/b meaning
  6091. @subsubsection p/c/n
  6092. We assume the following telecined stream:
  6093. @example
  6094. Top fields: 1 2 2 3 4
  6095. Bottom fields: 1 2 3 4 4
  6096. @end example
  6097. The numbers correspond to the progressive frame the fields relate to. Here, the
  6098. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6099. When @code{fieldmatch} is configured to run a matching from bottom
  6100. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6101. @example
  6102. Input stream:
  6103. T 1 2 2 3 4
  6104. B 1 2 3 4 4 <-- matching reference
  6105. Matches: c c n n c
  6106. Output stream:
  6107. T 1 2 3 4 4
  6108. B 1 2 3 4 4
  6109. @end example
  6110. As a result of the field matching, we can see that some frames get duplicated.
  6111. To perform a complete inverse telecine, you need to rely on a decimation filter
  6112. after this operation. See for instance the @ref{decimate} filter.
  6113. The same operation now matching from top fields (@option{field}=@var{top})
  6114. looks like this:
  6115. @example
  6116. Input stream:
  6117. T 1 2 2 3 4 <-- matching reference
  6118. B 1 2 3 4 4
  6119. Matches: c c p p c
  6120. Output stream:
  6121. T 1 2 2 3 4
  6122. B 1 2 2 3 4
  6123. @end example
  6124. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6125. basically, they refer to the frame and field of the opposite parity:
  6126. @itemize
  6127. @item @var{p} matches the field of the opposite parity in the previous frame
  6128. @item @var{c} matches the field of the opposite parity in the current frame
  6129. @item @var{n} matches the field of the opposite parity in the next frame
  6130. @end itemize
  6131. @subsubsection u/b
  6132. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6133. from the opposite parity flag. In the following examples, we assume that we are
  6134. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6135. 'x' is placed above and below each matched fields.
  6136. With bottom matching (@option{field}=@var{bottom}):
  6137. @example
  6138. Match: c p n b u
  6139. x x x x x
  6140. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6141. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6142. x x x x x
  6143. Output frames:
  6144. 2 1 2 2 2
  6145. 2 2 2 1 3
  6146. @end example
  6147. With top matching (@option{field}=@var{top}):
  6148. @example
  6149. Match: c p n b u
  6150. x x x x x
  6151. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6152. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6153. x x x x x
  6154. Output frames:
  6155. 2 2 2 1 2
  6156. 2 1 3 2 2
  6157. @end example
  6158. @subsection Examples
  6159. Simple IVTC of a top field first telecined stream:
  6160. @example
  6161. fieldmatch=order=tff:combmatch=none, decimate
  6162. @end example
  6163. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6164. @example
  6165. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6166. @end example
  6167. @section fieldorder
  6168. Transform the field order of the input video.
  6169. It accepts the following parameters:
  6170. @table @option
  6171. @item order
  6172. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6173. for bottom field first.
  6174. @end table
  6175. The default value is @samp{tff}.
  6176. The transformation is done by shifting the picture content up or down
  6177. by one line, and filling the remaining line with appropriate picture content.
  6178. This method is consistent with most broadcast field order converters.
  6179. If the input video is not flagged as being interlaced, or it is already
  6180. flagged as being of the required output field order, then this filter does
  6181. not alter the incoming video.
  6182. It is very useful when converting to or from PAL DV material,
  6183. which is bottom field first.
  6184. For example:
  6185. @example
  6186. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6187. @end example
  6188. @section fifo, afifo
  6189. Buffer input images and send them when they are requested.
  6190. It is mainly useful when auto-inserted by the libavfilter
  6191. framework.
  6192. It does not take parameters.
  6193. @section find_rect
  6194. Find a rectangular object
  6195. It accepts the following options:
  6196. @table @option
  6197. @item object
  6198. Filepath of the object image, needs to be in gray8.
  6199. @item threshold
  6200. Detection threshold, default is 0.5.
  6201. @item mipmaps
  6202. Number of mipmaps, default is 3.
  6203. @item xmin, ymin, xmax, ymax
  6204. Specifies the rectangle in which to search.
  6205. @end table
  6206. @subsection Examples
  6207. @itemize
  6208. @item
  6209. Generate a representative palette of a given video using @command{ffmpeg}:
  6210. @example
  6211. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6212. @end example
  6213. @end itemize
  6214. @section cover_rect
  6215. Cover a rectangular object
  6216. It accepts the following options:
  6217. @table @option
  6218. @item cover
  6219. Filepath of the optional cover image, needs to be in yuv420.
  6220. @item mode
  6221. Set covering mode.
  6222. It accepts the following values:
  6223. @table @samp
  6224. @item cover
  6225. cover it by the supplied image
  6226. @item blur
  6227. cover it by interpolating the surrounding pixels
  6228. @end table
  6229. Default value is @var{blur}.
  6230. @end table
  6231. @subsection Examples
  6232. @itemize
  6233. @item
  6234. Generate a representative palette of a given video using @command{ffmpeg}:
  6235. @example
  6236. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6237. @end example
  6238. @end itemize
  6239. @anchor{format}
  6240. @section format
  6241. Convert the input video to one of the specified pixel formats.
  6242. Libavfilter will try to pick one that is suitable as input to
  6243. the next filter.
  6244. It accepts the following parameters:
  6245. @table @option
  6246. @item pix_fmts
  6247. A '|'-separated list of pixel format names, such as
  6248. "pix_fmts=yuv420p|monow|rgb24".
  6249. @end table
  6250. @subsection Examples
  6251. @itemize
  6252. @item
  6253. Convert the input video to the @var{yuv420p} format
  6254. @example
  6255. format=pix_fmts=yuv420p
  6256. @end example
  6257. Convert the input video to any of the formats in the list
  6258. @example
  6259. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6260. @end example
  6261. @end itemize
  6262. @anchor{fps}
  6263. @section fps
  6264. Convert the video to specified constant frame rate by duplicating or dropping
  6265. frames as necessary.
  6266. It accepts the following parameters:
  6267. @table @option
  6268. @item fps
  6269. The desired output frame rate. The default is @code{25}.
  6270. @item round
  6271. Rounding method.
  6272. Possible values are:
  6273. @table @option
  6274. @item zero
  6275. zero round towards 0
  6276. @item inf
  6277. round away from 0
  6278. @item down
  6279. round towards -infinity
  6280. @item up
  6281. round towards +infinity
  6282. @item near
  6283. round to nearest
  6284. @end table
  6285. The default is @code{near}.
  6286. @item start_time
  6287. Assume the first PTS should be the given value, in seconds. This allows for
  6288. padding/trimming at the start of stream. By default, no assumption is made
  6289. about the first frame's expected PTS, so no padding or trimming is done.
  6290. For example, this could be set to 0 to pad the beginning with duplicates of
  6291. the first frame if a video stream starts after the audio stream or to trim any
  6292. frames with a negative PTS.
  6293. @end table
  6294. Alternatively, the options can be specified as a flat string:
  6295. @var{fps}[:@var{round}].
  6296. See also the @ref{setpts} filter.
  6297. @subsection Examples
  6298. @itemize
  6299. @item
  6300. A typical usage in order to set the fps to 25:
  6301. @example
  6302. fps=fps=25
  6303. @end example
  6304. @item
  6305. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6306. @example
  6307. fps=fps=film:round=near
  6308. @end example
  6309. @end itemize
  6310. @section framepack
  6311. Pack two different video streams into a stereoscopic video, setting proper
  6312. metadata on supported codecs. The two views should have the same size and
  6313. framerate and processing will stop when the shorter video ends. Please note
  6314. that you may conveniently adjust view properties with the @ref{scale} and
  6315. @ref{fps} filters.
  6316. It accepts the following parameters:
  6317. @table @option
  6318. @item format
  6319. The desired packing format. Supported values are:
  6320. @table @option
  6321. @item sbs
  6322. The views are next to each other (default).
  6323. @item tab
  6324. The views are on top of each other.
  6325. @item lines
  6326. The views are packed by line.
  6327. @item columns
  6328. The views are packed by column.
  6329. @item frameseq
  6330. The views are temporally interleaved.
  6331. @end table
  6332. @end table
  6333. Some examples:
  6334. @example
  6335. # Convert left and right views into a frame-sequential video
  6336. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6337. # Convert views into a side-by-side video with the same output resolution as the input
  6338. 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
  6339. @end example
  6340. @section framerate
  6341. Change the frame rate by interpolating new video output frames from the source
  6342. frames.
  6343. This filter is not designed to function correctly with interlaced media. If
  6344. you wish to change the frame rate of interlaced media then you are required
  6345. to deinterlace before this filter and re-interlace after this filter.
  6346. A description of the accepted options follows.
  6347. @table @option
  6348. @item fps
  6349. Specify the output frames per second. This option can also be specified
  6350. as a value alone. The default is @code{50}.
  6351. @item interp_start
  6352. Specify the start of a range where the output frame will be created as a
  6353. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6354. the default is @code{15}.
  6355. @item interp_end
  6356. Specify the end of a range where the output frame will be created as a
  6357. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6358. the default is @code{240}.
  6359. @item scene
  6360. Specify the level at which a scene change is detected as a value between
  6361. 0 and 100 to indicate a new scene; a low value reflects a low
  6362. probability for the current frame to introduce a new scene, while a higher
  6363. value means the current frame is more likely to be one.
  6364. The default is @code{7}.
  6365. @item flags
  6366. Specify flags influencing the filter process.
  6367. Available value for @var{flags} is:
  6368. @table @option
  6369. @item scene_change_detect, scd
  6370. Enable scene change detection using the value of the option @var{scene}.
  6371. This flag is enabled by default.
  6372. @end table
  6373. @end table
  6374. @section framestep
  6375. Select one frame every N-th frame.
  6376. This filter accepts the following option:
  6377. @table @option
  6378. @item step
  6379. Select frame after every @code{step} frames.
  6380. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6381. @end table
  6382. @anchor{frei0r}
  6383. @section frei0r
  6384. Apply a frei0r effect to the input video.
  6385. To enable the compilation of this filter, you need to install the frei0r
  6386. header and configure FFmpeg with @code{--enable-frei0r}.
  6387. It accepts the following parameters:
  6388. @table @option
  6389. @item filter_name
  6390. The name of the frei0r effect to load. If the environment variable
  6391. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6392. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6393. Otherwise, the standard frei0r paths are searched, in this order:
  6394. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6395. @file{/usr/lib/frei0r-1/}.
  6396. @item filter_params
  6397. A '|'-separated list of parameters to pass to the frei0r effect.
  6398. @end table
  6399. A frei0r effect parameter can be a boolean (its value is either
  6400. "y" or "n"), a double, a color (specified as
  6401. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6402. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6403. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6404. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6405. The number and types of parameters depend on the loaded effect. If an
  6406. effect parameter is not specified, the default value is set.
  6407. @subsection Examples
  6408. @itemize
  6409. @item
  6410. Apply the distort0r effect, setting the first two double parameters:
  6411. @example
  6412. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6413. @end example
  6414. @item
  6415. Apply the colordistance effect, taking a color as the first parameter:
  6416. @example
  6417. frei0r=colordistance:0.2/0.3/0.4
  6418. frei0r=colordistance:violet
  6419. frei0r=colordistance:0x112233
  6420. @end example
  6421. @item
  6422. Apply the perspective effect, specifying the top left and top right image
  6423. positions:
  6424. @example
  6425. frei0r=perspective:0.2/0.2|0.8/0.2
  6426. @end example
  6427. @end itemize
  6428. For more information, see
  6429. @url{http://frei0r.dyne.org}
  6430. @section fspp
  6431. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6432. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6433. processing filter, one of them is performed once per block, not per pixel.
  6434. This allows for much higher speed.
  6435. The filter accepts the following options:
  6436. @table @option
  6437. @item quality
  6438. Set quality. This option defines the number of levels for averaging. It accepts
  6439. an integer in the range 4-5. Default value is @code{4}.
  6440. @item qp
  6441. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6442. If not set, the filter will use the QP from the video stream (if available).
  6443. @item strength
  6444. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6445. more details but also more artifacts, while higher values make the image smoother
  6446. but also blurrier. Default value is @code{0} − PSNR optimal.
  6447. @item use_bframe_qp
  6448. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6449. option may cause flicker since the B-Frames have often larger QP. Default is
  6450. @code{0} (not enabled).
  6451. @end table
  6452. @section gblur
  6453. Apply Gaussian blur filter.
  6454. The filter accepts the following options:
  6455. @table @option
  6456. @item sigma
  6457. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6458. @item steps
  6459. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6460. @item planes
  6461. Set which planes to filter. By default all planes are filtered.
  6462. @item sigmaV
  6463. Set vertical sigma, if negative it will be same as @code{sigma}.
  6464. Default is @code{-1}.
  6465. @end table
  6466. @section geq
  6467. The filter accepts the following options:
  6468. @table @option
  6469. @item lum_expr, lum
  6470. Set the luminance expression.
  6471. @item cb_expr, cb
  6472. Set the chrominance blue expression.
  6473. @item cr_expr, cr
  6474. Set the chrominance red expression.
  6475. @item alpha_expr, a
  6476. Set the alpha expression.
  6477. @item red_expr, r
  6478. Set the red expression.
  6479. @item green_expr, g
  6480. Set the green expression.
  6481. @item blue_expr, b
  6482. Set the blue expression.
  6483. @end table
  6484. The colorspace is selected according to the specified options. If one
  6485. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6486. options is specified, the filter will automatically select a YCbCr
  6487. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6488. @option{blue_expr} options is specified, it will select an RGB
  6489. colorspace.
  6490. If one of the chrominance expression is not defined, it falls back on the other
  6491. one. If no alpha expression is specified it will evaluate to opaque value.
  6492. If none of chrominance expressions are specified, they will evaluate
  6493. to the luminance expression.
  6494. The expressions can use the following variables and functions:
  6495. @table @option
  6496. @item N
  6497. The sequential number of the filtered frame, starting from @code{0}.
  6498. @item X
  6499. @item Y
  6500. The coordinates of the current sample.
  6501. @item W
  6502. @item H
  6503. The width and height of the image.
  6504. @item SW
  6505. @item SH
  6506. Width and height scale depending on the currently filtered plane. It is the
  6507. ratio between the corresponding luma plane number of pixels and the current
  6508. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6509. @code{0.5,0.5} for chroma planes.
  6510. @item T
  6511. Time of the current frame, expressed in seconds.
  6512. @item p(x, y)
  6513. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6514. plane.
  6515. @item lum(x, y)
  6516. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6517. plane.
  6518. @item cb(x, y)
  6519. Return the value of the pixel at location (@var{x},@var{y}) of the
  6520. blue-difference chroma plane. Return 0 if there is no such plane.
  6521. @item cr(x, y)
  6522. Return the value of the pixel at location (@var{x},@var{y}) of the
  6523. red-difference chroma plane. Return 0 if there is no such plane.
  6524. @item r(x, y)
  6525. @item g(x, y)
  6526. @item b(x, y)
  6527. Return the value of the pixel at location (@var{x},@var{y}) of the
  6528. red/green/blue component. Return 0 if there is no such component.
  6529. @item alpha(x, y)
  6530. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6531. plane. Return 0 if there is no such plane.
  6532. @end table
  6533. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6534. automatically clipped to the closer edge.
  6535. @subsection Examples
  6536. @itemize
  6537. @item
  6538. Flip the image horizontally:
  6539. @example
  6540. geq=p(W-X\,Y)
  6541. @end example
  6542. @item
  6543. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6544. wavelength of 100 pixels:
  6545. @example
  6546. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6547. @end example
  6548. @item
  6549. Generate a fancy enigmatic moving light:
  6550. @example
  6551. 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
  6552. @end example
  6553. @item
  6554. Generate a quick emboss effect:
  6555. @example
  6556. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6557. @end example
  6558. @item
  6559. Modify RGB components depending on pixel position:
  6560. @example
  6561. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6562. @end example
  6563. @item
  6564. Create a radial gradient that is the same size as the input (also see
  6565. the @ref{vignette} filter):
  6566. @example
  6567. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6568. @end example
  6569. @end itemize
  6570. @section gradfun
  6571. Fix the banding artifacts that are sometimes introduced into nearly flat
  6572. regions by truncation to 8-bit color depth.
  6573. Interpolate the gradients that should go where the bands are, and
  6574. dither them.
  6575. It is designed for playback only. Do not use it prior to
  6576. lossy compression, because compression tends to lose the dither and
  6577. bring back the bands.
  6578. It accepts the following parameters:
  6579. @table @option
  6580. @item strength
  6581. The maximum amount by which the filter will change any one pixel. This is also
  6582. the threshold for detecting nearly flat regions. Acceptable values range from
  6583. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6584. valid range.
  6585. @item radius
  6586. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6587. gradients, but also prevents the filter from modifying the pixels near detailed
  6588. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6589. values will be clipped to the valid range.
  6590. @end table
  6591. Alternatively, the options can be specified as a flat string:
  6592. @var{strength}[:@var{radius}]
  6593. @subsection Examples
  6594. @itemize
  6595. @item
  6596. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6597. @example
  6598. gradfun=3.5:8
  6599. @end example
  6600. @item
  6601. Specify radius, omitting the strength (which will fall-back to the default
  6602. value):
  6603. @example
  6604. gradfun=radius=8
  6605. @end example
  6606. @end itemize
  6607. @anchor{haldclut}
  6608. @section haldclut
  6609. Apply a Hald CLUT to a video stream.
  6610. First input is the video stream to process, and second one is the Hald CLUT.
  6611. The Hald CLUT input can be a simple picture or a complete video stream.
  6612. The filter accepts the following options:
  6613. @table @option
  6614. @item shortest
  6615. Force termination when the shortest input terminates. Default is @code{0}.
  6616. @item repeatlast
  6617. Continue applying the last CLUT after the end of the stream. A value of
  6618. @code{0} disable the filter after the last frame of the CLUT is reached.
  6619. Default is @code{1}.
  6620. @end table
  6621. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6622. filters share the same internals).
  6623. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6624. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6625. @subsection Workflow examples
  6626. @subsubsection Hald CLUT video stream
  6627. Generate an identity Hald CLUT stream altered with various effects:
  6628. @example
  6629. 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
  6630. @end example
  6631. Note: make sure you use a lossless codec.
  6632. Then use it with @code{haldclut} to apply it on some random stream:
  6633. @example
  6634. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6635. @end example
  6636. The Hald CLUT will be applied to the 10 first seconds (duration of
  6637. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6638. to the remaining frames of the @code{mandelbrot} stream.
  6639. @subsubsection Hald CLUT with preview
  6640. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6641. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6642. biggest possible square starting at the top left of the picture. The remaining
  6643. padding pixels (bottom or right) will be ignored. This area can be used to add
  6644. a preview of the Hald CLUT.
  6645. Typically, the following generated Hald CLUT will be supported by the
  6646. @code{haldclut} filter:
  6647. @example
  6648. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6649. pad=iw+320 [padded_clut];
  6650. smptebars=s=320x256, split [a][b];
  6651. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6652. [main][b] overlay=W-320" -frames:v 1 clut.png
  6653. @end example
  6654. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6655. bars are displayed on the right-top, and below the same color bars processed by
  6656. the color changes.
  6657. Then, the effect of this Hald CLUT can be visualized with:
  6658. @example
  6659. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6660. @end example
  6661. @section hflip
  6662. Flip the input video horizontally.
  6663. For example, to horizontally flip the input video with @command{ffmpeg}:
  6664. @example
  6665. ffmpeg -i in.avi -vf "hflip" out.avi
  6666. @end example
  6667. @section histeq
  6668. This filter applies a global color histogram equalization on a
  6669. per-frame basis.
  6670. It can be used to correct video that has a compressed range of pixel
  6671. intensities. The filter redistributes the pixel intensities to
  6672. equalize their distribution across the intensity range. It may be
  6673. viewed as an "automatically adjusting contrast filter". This filter is
  6674. useful only for correcting degraded or poorly captured source
  6675. video.
  6676. The filter accepts the following options:
  6677. @table @option
  6678. @item strength
  6679. Determine the amount of equalization to be applied. As the strength
  6680. is reduced, the distribution of pixel intensities more-and-more
  6681. approaches that of the input frame. The value must be a float number
  6682. in the range [0,1] and defaults to 0.200.
  6683. @item intensity
  6684. Set the maximum intensity that can generated and scale the output
  6685. values appropriately. The strength should be set as desired and then
  6686. the intensity can be limited if needed to avoid washing-out. The value
  6687. must be a float number in the range [0,1] and defaults to 0.210.
  6688. @item antibanding
  6689. Set the antibanding level. If enabled the filter will randomly vary
  6690. the luminance of output pixels by a small amount to avoid banding of
  6691. the histogram. Possible values are @code{none}, @code{weak} or
  6692. @code{strong}. It defaults to @code{none}.
  6693. @end table
  6694. @section histogram
  6695. Compute and draw a color distribution histogram for the input video.
  6696. The computed histogram is a representation of the color component
  6697. distribution in an image.
  6698. Standard histogram displays the color components distribution in an image.
  6699. Displays color graph for each color component. Shows distribution of
  6700. the Y, U, V, A or R, G, B components, depending on input format, in the
  6701. current frame. Below each graph a color component scale meter is shown.
  6702. The filter accepts the following options:
  6703. @table @option
  6704. @item level_height
  6705. Set height of level. Default value is @code{200}.
  6706. Allowed range is [50, 2048].
  6707. @item scale_height
  6708. Set height of color scale. Default value is @code{12}.
  6709. Allowed range is [0, 40].
  6710. @item display_mode
  6711. Set display mode.
  6712. It accepts the following values:
  6713. @table @samp
  6714. @item parade
  6715. Per color component graphs are placed below each other.
  6716. @item overlay
  6717. Presents information identical to that in the @code{parade}, except
  6718. that the graphs representing color components are superimposed directly
  6719. over one another.
  6720. @end table
  6721. Default is @code{parade}.
  6722. @item levels_mode
  6723. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6724. Default is @code{linear}.
  6725. @item components
  6726. Set what color components to display.
  6727. Default is @code{7}.
  6728. @item fgopacity
  6729. Set foreground opacity. Default is @code{0.7}.
  6730. @item bgopacity
  6731. Set background opacity. Default is @code{0.5}.
  6732. @end table
  6733. @subsection Examples
  6734. @itemize
  6735. @item
  6736. Calculate and draw histogram:
  6737. @example
  6738. ffplay -i input -vf histogram
  6739. @end example
  6740. @end itemize
  6741. @anchor{hqdn3d}
  6742. @section hqdn3d
  6743. This is a high precision/quality 3d denoise filter. It aims to reduce
  6744. image noise, producing smooth images and making still images really
  6745. still. It should enhance compressibility.
  6746. It accepts the following optional parameters:
  6747. @table @option
  6748. @item luma_spatial
  6749. A non-negative floating point number which specifies spatial luma strength.
  6750. It defaults to 4.0.
  6751. @item chroma_spatial
  6752. A non-negative floating point number which specifies spatial chroma strength.
  6753. It defaults to 3.0*@var{luma_spatial}/4.0.
  6754. @item luma_tmp
  6755. A floating point number which specifies luma temporal strength. It defaults to
  6756. 6.0*@var{luma_spatial}/4.0.
  6757. @item chroma_tmp
  6758. A floating point number which specifies chroma temporal strength. It defaults to
  6759. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6760. @end table
  6761. @anchor{hwupload_cuda}
  6762. @section hwupload_cuda
  6763. Upload system memory frames to a CUDA device.
  6764. It accepts the following optional parameters:
  6765. @table @option
  6766. @item device
  6767. The number of the CUDA device to use
  6768. @end table
  6769. @section hqx
  6770. Apply a high-quality magnification filter designed for pixel art. This filter
  6771. was originally created by Maxim Stepin.
  6772. It accepts the following option:
  6773. @table @option
  6774. @item n
  6775. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6776. @code{hq3x} and @code{4} for @code{hq4x}.
  6777. Default is @code{3}.
  6778. @end table
  6779. @section hstack
  6780. Stack input videos horizontally.
  6781. All streams must be of same pixel format and of same height.
  6782. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6783. to create same output.
  6784. The filter accept the following option:
  6785. @table @option
  6786. @item inputs
  6787. Set number of input streams. Default is 2.
  6788. @item shortest
  6789. If set to 1, force the output to terminate when the shortest input
  6790. terminates. Default value is 0.
  6791. @end table
  6792. @section hue
  6793. Modify the hue and/or the saturation of the input.
  6794. It accepts the following parameters:
  6795. @table @option
  6796. @item h
  6797. Specify the hue angle as a number of degrees. It accepts an expression,
  6798. and defaults to "0".
  6799. @item s
  6800. Specify the saturation in the [-10,10] range. It accepts an expression and
  6801. defaults to "1".
  6802. @item H
  6803. Specify the hue angle as a number of radians. It accepts an
  6804. expression, and defaults to "0".
  6805. @item b
  6806. Specify the brightness in the [-10,10] range. It accepts an expression and
  6807. defaults to "0".
  6808. @end table
  6809. @option{h} and @option{H} are mutually exclusive, and can't be
  6810. specified at the same time.
  6811. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6812. expressions containing the following constants:
  6813. @table @option
  6814. @item n
  6815. frame count of the input frame starting from 0
  6816. @item pts
  6817. presentation timestamp of the input frame expressed in time base units
  6818. @item r
  6819. frame rate of the input video, NAN if the input frame rate is unknown
  6820. @item t
  6821. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6822. @item tb
  6823. time base of the input video
  6824. @end table
  6825. @subsection Examples
  6826. @itemize
  6827. @item
  6828. Set the hue to 90 degrees and the saturation to 1.0:
  6829. @example
  6830. hue=h=90:s=1
  6831. @end example
  6832. @item
  6833. Same command but expressing the hue in radians:
  6834. @example
  6835. hue=H=PI/2:s=1
  6836. @end example
  6837. @item
  6838. Rotate hue and make the saturation swing between 0
  6839. and 2 over a period of 1 second:
  6840. @example
  6841. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6842. @end example
  6843. @item
  6844. Apply a 3 seconds saturation fade-in effect starting at 0:
  6845. @example
  6846. hue="s=min(t/3\,1)"
  6847. @end example
  6848. The general fade-in expression can be written as:
  6849. @example
  6850. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6851. @end example
  6852. @item
  6853. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6854. @example
  6855. hue="s=max(0\, min(1\, (8-t)/3))"
  6856. @end example
  6857. The general fade-out expression can be written as:
  6858. @example
  6859. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6860. @end example
  6861. @end itemize
  6862. @subsection Commands
  6863. This filter supports the following commands:
  6864. @table @option
  6865. @item b
  6866. @item s
  6867. @item h
  6868. @item H
  6869. Modify the hue and/or the saturation and/or brightness of the input video.
  6870. The command accepts the same syntax of the corresponding option.
  6871. If the specified expression is not valid, it is kept at its current
  6872. value.
  6873. @end table
  6874. @section hysteresis
  6875. Grow first stream into second stream by connecting components.
  6876. This makes it possible to build more robust edge masks.
  6877. This filter accepts the following options:
  6878. @table @option
  6879. @item planes
  6880. Set which planes will be processed as bitmap, unprocessed planes will be
  6881. copied from first stream.
  6882. By default value 0xf, all planes will be processed.
  6883. @item threshold
  6884. Set threshold which is used in filtering. If pixel component value is higher than
  6885. this value filter algorithm for connecting components is activated.
  6886. By default value is 0.
  6887. @end table
  6888. @section idet
  6889. Detect video interlacing type.
  6890. This filter tries to detect if the input frames are interlaced, progressive,
  6891. top or bottom field first. It will also try to detect fields that are
  6892. repeated between adjacent frames (a sign of telecine).
  6893. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6894. Multiple frame detection incorporates the classification history of previous frames.
  6895. The filter will log these metadata values:
  6896. @table @option
  6897. @item single.current_frame
  6898. Detected type of current frame using single-frame detection. One of:
  6899. ``tff'' (top field first), ``bff'' (bottom field first),
  6900. ``progressive'', or ``undetermined''
  6901. @item single.tff
  6902. Cumulative number of frames detected as top field first using single-frame detection.
  6903. @item multiple.tff
  6904. Cumulative number of frames detected as top field first using multiple-frame detection.
  6905. @item single.bff
  6906. Cumulative number of frames detected as bottom field first using single-frame detection.
  6907. @item multiple.current_frame
  6908. Detected type of current frame using multiple-frame detection. One of:
  6909. ``tff'' (top field first), ``bff'' (bottom field first),
  6910. ``progressive'', or ``undetermined''
  6911. @item multiple.bff
  6912. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6913. @item single.progressive
  6914. Cumulative number of frames detected as progressive using single-frame detection.
  6915. @item multiple.progressive
  6916. Cumulative number of frames detected as progressive using multiple-frame detection.
  6917. @item single.undetermined
  6918. Cumulative number of frames that could not be classified using single-frame detection.
  6919. @item multiple.undetermined
  6920. Cumulative number of frames that could not be classified using multiple-frame detection.
  6921. @item repeated.current_frame
  6922. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6923. @item repeated.neither
  6924. Cumulative number of frames with no repeated field.
  6925. @item repeated.top
  6926. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6927. @item repeated.bottom
  6928. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6929. @end table
  6930. The filter accepts the following options:
  6931. @table @option
  6932. @item intl_thres
  6933. Set interlacing threshold.
  6934. @item prog_thres
  6935. Set progressive threshold.
  6936. @item rep_thres
  6937. Threshold for repeated field detection.
  6938. @item half_life
  6939. Number of frames after which a given frame's contribution to the
  6940. statistics is halved (i.e., it contributes only 0.5 to its
  6941. classification). The default of 0 means that all frames seen are given
  6942. full weight of 1.0 forever.
  6943. @item analyze_interlaced_flag
  6944. When this is not 0 then idet will use the specified number of frames to determine
  6945. if the interlaced flag is accurate, it will not count undetermined frames.
  6946. If the flag is found to be accurate it will be used without any further
  6947. computations, if it is found to be inaccurate it will be cleared without any
  6948. further computations. This allows inserting the idet filter as a low computational
  6949. method to clean up the interlaced flag
  6950. @end table
  6951. @section il
  6952. Deinterleave or interleave fields.
  6953. This filter allows one to process interlaced images fields without
  6954. deinterlacing them. Deinterleaving splits the input frame into 2
  6955. fields (so called half pictures). Odd lines are moved to the top
  6956. half of the output image, even lines to the bottom half.
  6957. You can process (filter) them independently and then re-interleave them.
  6958. The filter accepts the following options:
  6959. @table @option
  6960. @item luma_mode, l
  6961. @item chroma_mode, c
  6962. @item alpha_mode, a
  6963. Available values for @var{luma_mode}, @var{chroma_mode} and
  6964. @var{alpha_mode} are:
  6965. @table @samp
  6966. @item none
  6967. Do nothing.
  6968. @item deinterleave, d
  6969. Deinterleave fields, placing one above the other.
  6970. @item interleave, i
  6971. Interleave fields. Reverse the effect of deinterleaving.
  6972. @end table
  6973. Default value is @code{none}.
  6974. @item luma_swap, ls
  6975. @item chroma_swap, cs
  6976. @item alpha_swap, as
  6977. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6978. @end table
  6979. @section inflate
  6980. Apply inflate effect to the video.
  6981. This filter replaces the pixel by the local(3x3) average by taking into account
  6982. only values higher than the pixel.
  6983. It accepts the following options:
  6984. @table @option
  6985. @item threshold0
  6986. @item threshold1
  6987. @item threshold2
  6988. @item threshold3
  6989. Limit the maximum change for each plane, default is 65535.
  6990. If 0, plane will remain unchanged.
  6991. @end table
  6992. @section interlace
  6993. Simple interlacing filter from progressive contents. This interleaves upper (or
  6994. lower) lines from odd frames with lower (or upper) lines from even frames,
  6995. halving the frame rate and preserving image height.
  6996. @example
  6997. Original Original New Frame
  6998. Frame 'j' Frame 'j+1' (tff)
  6999. ========== =========== ==================
  7000. Line 0 --------------------> Frame 'j' Line 0
  7001. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7002. Line 2 ---------------------> Frame 'j' Line 2
  7003. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7004. ... ... ...
  7005. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7006. @end example
  7007. It accepts the following optional parameters:
  7008. @table @option
  7009. @item scan
  7010. This determines whether the interlaced frame is taken from the even
  7011. (tff - default) or odd (bff) lines of the progressive frame.
  7012. @item lowpass
  7013. Enable (default) or disable the vertical lowpass filter to avoid twitter
  7014. interlacing and reduce moire patterns.
  7015. @end table
  7016. @section kerndeint
  7017. Deinterlace input video by applying Donald Graft's adaptive kernel
  7018. deinterling. Work on interlaced parts of a video to produce
  7019. progressive frames.
  7020. The description of the accepted parameters follows.
  7021. @table @option
  7022. @item thresh
  7023. Set the threshold which affects the filter's tolerance when
  7024. determining if a pixel line must be processed. It must be an integer
  7025. in the range [0,255] and defaults to 10. A value of 0 will result in
  7026. applying the process on every pixels.
  7027. @item map
  7028. Paint pixels exceeding the threshold value to white if set to 1.
  7029. Default is 0.
  7030. @item order
  7031. Set the fields order. Swap fields if set to 1, leave fields alone if
  7032. 0. Default is 0.
  7033. @item sharp
  7034. Enable additional sharpening if set to 1. Default is 0.
  7035. @item twoway
  7036. Enable twoway sharpening if set to 1. Default is 0.
  7037. @end table
  7038. @subsection Examples
  7039. @itemize
  7040. @item
  7041. Apply default values:
  7042. @example
  7043. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7044. @end example
  7045. @item
  7046. Enable additional sharpening:
  7047. @example
  7048. kerndeint=sharp=1
  7049. @end example
  7050. @item
  7051. Paint processed pixels in white:
  7052. @example
  7053. kerndeint=map=1
  7054. @end example
  7055. @end itemize
  7056. @section lenscorrection
  7057. Correct radial lens distortion
  7058. This filter can be used to correct for radial distortion as can result from the use
  7059. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7060. one can use tools available for example as part of opencv or simply trial-and-error.
  7061. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7062. and extract the k1 and k2 coefficients from the resulting matrix.
  7063. Note that effectively the same filter is available in the open-source tools Krita and
  7064. Digikam from the KDE project.
  7065. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7066. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7067. brightness distribution, so you may want to use both filters together in certain
  7068. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7069. be applied before or after lens correction.
  7070. @subsection Options
  7071. The filter accepts the following options:
  7072. @table @option
  7073. @item cx
  7074. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7075. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7076. width.
  7077. @item cy
  7078. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7079. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7080. height.
  7081. @item k1
  7082. Coefficient of the quadratic correction term. 0.5 means no correction.
  7083. @item k2
  7084. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7085. @end table
  7086. The formula that generates the correction is:
  7087. @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)
  7088. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7089. distances from the focal point in the source and target images, respectively.
  7090. @section loop
  7091. Loop video frames.
  7092. The filter accepts the following options:
  7093. @table @option
  7094. @item loop
  7095. Set the number of loops.
  7096. @item size
  7097. Set maximal size in number of frames.
  7098. @item start
  7099. Set first frame of loop.
  7100. @end table
  7101. @anchor{lut3d}
  7102. @section lut3d
  7103. Apply a 3D LUT to an input video.
  7104. The filter accepts the following options:
  7105. @table @option
  7106. @item file
  7107. Set the 3D LUT file name.
  7108. Currently supported formats:
  7109. @table @samp
  7110. @item 3dl
  7111. AfterEffects
  7112. @item cube
  7113. Iridas
  7114. @item dat
  7115. DaVinci
  7116. @item m3d
  7117. Pandora
  7118. @end table
  7119. @item interp
  7120. Select interpolation mode.
  7121. Available values are:
  7122. @table @samp
  7123. @item nearest
  7124. Use values from the nearest defined point.
  7125. @item trilinear
  7126. Interpolate values using the 8 points defining a cube.
  7127. @item tetrahedral
  7128. Interpolate values using a tetrahedron.
  7129. @end table
  7130. @end table
  7131. @section lut, lutrgb, lutyuv
  7132. Compute a look-up table for binding each pixel component input value
  7133. to an output value, and apply it to the input video.
  7134. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7135. to an RGB input video.
  7136. These filters accept the following parameters:
  7137. @table @option
  7138. @item c0
  7139. set first pixel component expression
  7140. @item c1
  7141. set second pixel component expression
  7142. @item c2
  7143. set third pixel component expression
  7144. @item c3
  7145. set fourth pixel component expression, corresponds to the alpha component
  7146. @item r
  7147. set red component expression
  7148. @item g
  7149. set green component expression
  7150. @item b
  7151. set blue component expression
  7152. @item a
  7153. alpha component expression
  7154. @item y
  7155. set Y/luminance component expression
  7156. @item u
  7157. set U/Cb component expression
  7158. @item v
  7159. set V/Cr component expression
  7160. @end table
  7161. Each of them specifies the expression to use for computing the lookup table for
  7162. the corresponding pixel component values.
  7163. The exact component associated to each of the @var{c*} options depends on the
  7164. format in input.
  7165. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7166. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7167. The expressions can contain the following constants and functions:
  7168. @table @option
  7169. @item w
  7170. @item h
  7171. The input width and height.
  7172. @item val
  7173. The input value for the pixel component.
  7174. @item clipval
  7175. The input value, clipped to the @var{minval}-@var{maxval} range.
  7176. @item maxval
  7177. The maximum value for the pixel component.
  7178. @item minval
  7179. The minimum value for the pixel component.
  7180. @item negval
  7181. The negated value for the pixel component value, clipped to the
  7182. @var{minval}-@var{maxval} range; it corresponds to the expression
  7183. "maxval-clipval+minval".
  7184. @item clip(val)
  7185. The computed value in @var{val}, clipped to the
  7186. @var{minval}-@var{maxval} range.
  7187. @item gammaval(gamma)
  7188. The computed gamma correction value of the pixel component value,
  7189. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7190. expression
  7191. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7192. @end table
  7193. All expressions default to "val".
  7194. @subsection Examples
  7195. @itemize
  7196. @item
  7197. Negate input video:
  7198. @example
  7199. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7200. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7201. @end example
  7202. The above is the same as:
  7203. @example
  7204. lutrgb="r=negval:g=negval:b=negval"
  7205. lutyuv="y=negval:u=negval:v=negval"
  7206. @end example
  7207. @item
  7208. Negate luminance:
  7209. @example
  7210. lutyuv=y=negval
  7211. @end example
  7212. @item
  7213. Remove chroma components, turning the video into a graytone image:
  7214. @example
  7215. lutyuv="u=128:v=128"
  7216. @end example
  7217. @item
  7218. Apply a luma burning effect:
  7219. @example
  7220. lutyuv="y=2*val"
  7221. @end example
  7222. @item
  7223. Remove green and blue components:
  7224. @example
  7225. lutrgb="g=0:b=0"
  7226. @end example
  7227. @item
  7228. Set a constant alpha channel value on input:
  7229. @example
  7230. format=rgba,lutrgb=a="maxval-minval/2"
  7231. @end example
  7232. @item
  7233. Correct luminance gamma by a factor of 0.5:
  7234. @example
  7235. lutyuv=y=gammaval(0.5)
  7236. @end example
  7237. @item
  7238. Discard least significant bits of luma:
  7239. @example
  7240. lutyuv=y='bitand(val, 128+64+32)'
  7241. @end example
  7242. @item
  7243. Technicolor like effect:
  7244. @example
  7245. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7246. @end example
  7247. @end itemize
  7248. @section lut2
  7249. Compute and apply a lookup table from two video inputs.
  7250. This filter accepts the following parameters:
  7251. @table @option
  7252. @item c0
  7253. set first pixel component expression
  7254. @item c1
  7255. set second pixel component expression
  7256. @item c2
  7257. set third pixel component expression
  7258. @item c3
  7259. set fourth pixel component expression, corresponds to the alpha component
  7260. @end table
  7261. Each of them specifies the expression to use for computing the lookup table for
  7262. the corresponding pixel component values.
  7263. The exact component associated to each of the @var{c*} options depends on the
  7264. format in inputs.
  7265. The expressions can contain the following constants:
  7266. @table @option
  7267. @item w
  7268. @item h
  7269. The input width and height.
  7270. @item x
  7271. The first input value for the pixel component.
  7272. @item y
  7273. The second input value for the pixel component.
  7274. @item bdx
  7275. The first input video bit depth.
  7276. @item bdy
  7277. The second input video bit depth.
  7278. @end table
  7279. All expressions default to "x".
  7280. @subsection Examples
  7281. @itemize
  7282. @item
  7283. Highlight differences between two RGB video streams:
  7284. @example
  7285. 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)'
  7286. @end example
  7287. @item
  7288. Highlight differences between two YUV video streams:
  7289. @example
  7290. 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)'
  7291. @end example
  7292. @end itemize
  7293. @section maskedclamp
  7294. Clamp the first input stream with the second input and third input stream.
  7295. Returns the value of first stream to be between second input
  7296. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7297. This filter accepts the following options:
  7298. @table @option
  7299. @item undershoot
  7300. Default value is @code{0}.
  7301. @item overshoot
  7302. Default value is @code{0}.
  7303. @item planes
  7304. Set which planes will be processed as bitmap, unprocessed planes will be
  7305. copied from first stream.
  7306. By default value 0xf, all planes will be processed.
  7307. @end table
  7308. @section maskedmerge
  7309. Merge the first input stream with the second input stream using per pixel
  7310. weights in the third input stream.
  7311. A value of 0 in the third stream pixel component means that pixel component
  7312. from first stream is returned unchanged, while maximum value (eg. 255 for
  7313. 8-bit videos) means that pixel component from second stream is returned
  7314. unchanged. Intermediate values define the amount of merging between both
  7315. input stream's pixel components.
  7316. This filter accepts the following options:
  7317. @table @option
  7318. @item planes
  7319. Set which planes will be processed as bitmap, unprocessed planes will be
  7320. copied from first stream.
  7321. By default value 0xf, all planes will be processed.
  7322. @end table
  7323. @section mcdeint
  7324. Apply motion-compensation deinterlacing.
  7325. It needs one field per frame as input and must thus be used together
  7326. with yadif=1/3 or equivalent.
  7327. This filter accepts the following options:
  7328. @table @option
  7329. @item mode
  7330. Set the deinterlacing mode.
  7331. It accepts one of the following values:
  7332. @table @samp
  7333. @item fast
  7334. @item medium
  7335. @item slow
  7336. use iterative motion estimation
  7337. @item extra_slow
  7338. like @samp{slow}, but use multiple reference frames.
  7339. @end table
  7340. Default value is @samp{fast}.
  7341. @item parity
  7342. Set the picture field parity assumed for the input video. It must be
  7343. one of the following values:
  7344. @table @samp
  7345. @item 0, tff
  7346. assume top field first
  7347. @item 1, bff
  7348. assume bottom field first
  7349. @end table
  7350. Default value is @samp{bff}.
  7351. @item qp
  7352. Set per-block quantization parameter (QP) used by the internal
  7353. encoder.
  7354. Higher values should result in a smoother motion vector field but less
  7355. optimal individual vectors. Default value is 1.
  7356. @end table
  7357. @section mergeplanes
  7358. Merge color channel components from several video streams.
  7359. The filter accepts up to 4 input streams, and merge selected input
  7360. planes to the output video.
  7361. This filter accepts the following options:
  7362. @table @option
  7363. @item mapping
  7364. Set input to output plane mapping. Default is @code{0}.
  7365. The mappings is specified as a bitmap. It should be specified as a
  7366. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7367. mapping for the first plane of the output stream. 'A' sets the number of
  7368. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7369. corresponding input to use (from 0 to 3). The rest of the mappings is
  7370. similar, 'Bb' describes the mapping for the output stream second
  7371. plane, 'Cc' describes the mapping for the output stream third plane and
  7372. 'Dd' describes the mapping for the output stream fourth plane.
  7373. @item format
  7374. Set output pixel format. Default is @code{yuva444p}.
  7375. @end table
  7376. @subsection Examples
  7377. @itemize
  7378. @item
  7379. Merge three gray video streams of same width and height into single video stream:
  7380. @example
  7381. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7382. @end example
  7383. @item
  7384. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7385. @example
  7386. [a0][a1]mergeplanes=0x00010210:yuva444p
  7387. @end example
  7388. @item
  7389. Swap Y and A plane in yuva444p stream:
  7390. @example
  7391. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7392. @end example
  7393. @item
  7394. Swap U and V plane in yuv420p stream:
  7395. @example
  7396. format=yuv420p,mergeplanes=0x000201:yuv420p
  7397. @end example
  7398. @item
  7399. Cast a rgb24 clip to yuv444p:
  7400. @example
  7401. format=rgb24,mergeplanes=0x000102:yuv444p
  7402. @end example
  7403. @end itemize
  7404. @section mestimate
  7405. Estimate and export motion vectors using block matching algorithms.
  7406. Motion vectors are stored in frame side data to be used by other filters.
  7407. This filter accepts the following options:
  7408. @table @option
  7409. @item method
  7410. Specify the motion estimation method. Accepts one of the following values:
  7411. @table @samp
  7412. @item esa
  7413. Exhaustive search algorithm.
  7414. @item tss
  7415. Three step search algorithm.
  7416. @item tdls
  7417. Two dimensional logarithmic search algorithm.
  7418. @item ntss
  7419. New three step search algorithm.
  7420. @item fss
  7421. Four step search algorithm.
  7422. @item ds
  7423. Diamond search algorithm.
  7424. @item hexbs
  7425. Hexagon-based search algorithm.
  7426. @item epzs
  7427. Enhanced predictive zonal search algorithm.
  7428. @item umh
  7429. Uneven multi-hexagon search algorithm.
  7430. @end table
  7431. Default value is @samp{esa}.
  7432. @item mb_size
  7433. Macroblock size. Default @code{16}.
  7434. @item search_param
  7435. Search parameter. Default @code{7}.
  7436. @end table
  7437. @section midequalizer
  7438. Apply Midway Image Equalization effect using two video streams.
  7439. Midway Image Equalization adjusts a pair of images to have the same
  7440. histogram, while maintaining their dynamics as much as possible. It's
  7441. useful for e.g. matching exposures from a pair of stereo cameras.
  7442. This filter has two inputs and one output, which must be of same pixel format, but
  7443. may be of different sizes. The output of filter is first input adjusted with
  7444. midway histogram of both inputs.
  7445. This filter accepts the following option:
  7446. @table @option
  7447. @item planes
  7448. Set which planes to process. Default is @code{15}, which is all available planes.
  7449. @end table
  7450. @section minterpolate
  7451. Convert the video to specified frame rate using motion interpolation.
  7452. This filter accepts the following options:
  7453. @table @option
  7454. @item fps
  7455. 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}.
  7456. @item mi_mode
  7457. Motion interpolation mode. Following values are accepted:
  7458. @table @samp
  7459. @item dup
  7460. Duplicate previous or next frame for interpolating new ones.
  7461. @item blend
  7462. Blend source frames. Interpolated frame is mean of previous and next frames.
  7463. @item mci
  7464. Motion compensated interpolation. Following options are effective when this mode is selected:
  7465. @table @samp
  7466. @item mc_mode
  7467. Motion compensation mode. Following values are accepted:
  7468. @table @samp
  7469. @item obmc
  7470. Overlapped block motion compensation.
  7471. @item aobmc
  7472. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7473. @end table
  7474. Default mode is @samp{obmc}.
  7475. @item me_mode
  7476. Motion estimation mode. Following values are accepted:
  7477. @table @samp
  7478. @item bidir
  7479. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7480. @item bilat
  7481. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7482. @end table
  7483. Default mode is @samp{bilat}.
  7484. @item me
  7485. The algorithm to be used for motion estimation. Following values are accepted:
  7486. @table @samp
  7487. @item esa
  7488. Exhaustive search algorithm.
  7489. @item tss
  7490. Three step search algorithm.
  7491. @item tdls
  7492. Two dimensional logarithmic search algorithm.
  7493. @item ntss
  7494. New three step search algorithm.
  7495. @item fss
  7496. Four step search algorithm.
  7497. @item ds
  7498. Diamond search algorithm.
  7499. @item hexbs
  7500. Hexagon-based search algorithm.
  7501. @item epzs
  7502. Enhanced predictive zonal search algorithm.
  7503. @item umh
  7504. Uneven multi-hexagon search algorithm.
  7505. @end table
  7506. Default algorithm is @samp{epzs}.
  7507. @item mb_size
  7508. Macroblock size. Default @code{16}.
  7509. @item search_param
  7510. Motion estimation search parameter. Default @code{32}.
  7511. @item vsbmc
  7512. 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).
  7513. @end table
  7514. @end table
  7515. @item scd
  7516. 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:
  7517. @table @samp
  7518. @item none
  7519. Disable scene change detection.
  7520. @item fdiff
  7521. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7522. @end table
  7523. Default method is @samp{fdiff}.
  7524. @item scd_threshold
  7525. Scene change detection threshold. Default is @code{5.0}.
  7526. @end table
  7527. @section mpdecimate
  7528. Drop frames that do not differ greatly from the previous frame in
  7529. order to reduce frame rate.
  7530. The main use of this filter is for very-low-bitrate encoding
  7531. (e.g. streaming over dialup modem), but it could in theory be used for
  7532. fixing movies that were inverse-telecined incorrectly.
  7533. A description of the accepted options follows.
  7534. @table @option
  7535. @item max
  7536. Set the maximum number of consecutive frames which can be dropped (if
  7537. positive), or the minimum interval between dropped frames (if
  7538. negative). If the value is 0, the frame is dropped unregarding the
  7539. number of previous sequentially dropped frames.
  7540. Default value is 0.
  7541. @item hi
  7542. @item lo
  7543. @item frac
  7544. Set the dropping threshold values.
  7545. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7546. represent actual pixel value differences, so a threshold of 64
  7547. corresponds to 1 unit of difference for each pixel, or the same spread
  7548. out differently over the block.
  7549. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7550. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7551. meaning the whole image) differ by more than a threshold of @option{lo}.
  7552. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7553. 64*5, and default value for @option{frac} is 0.33.
  7554. @end table
  7555. @section negate
  7556. Negate input video.
  7557. It accepts an integer in input; if non-zero it negates the
  7558. alpha component (if available). The default value in input is 0.
  7559. @section nlmeans
  7560. Denoise frames using Non-Local Means algorithm.
  7561. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7562. context similarity is defined by comparing their surrounding patches of size
  7563. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7564. around the pixel.
  7565. Note that the research area defines centers for patches, which means some
  7566. patches will be made of pixels outside that research area.
  7567. The filter accepts the following options.
  7568. @table @option
  7569. @item s
  7570. Set denoising strength.
  7571. @item p
  7572. Set patch size.
  7573. @item pc
  7574. Same as @option{p} but for chroma planes.
  7575. The default value is @var{0} and means automatic.
  7576. @item r
  7577. Set research size.
  7578. @item rc
  7579. Same as @option{r} but for chroma planes.
  7580. The default value is @var{0} and means automatic.
  7581. @end table
  7582. @section nnedi
  7583. Deinterlace video using neural network edge directed interpolation.
  7584. This filter accepts the following options:
  7585. @table @option
  7586. @item weights
  7587. Mandatory option, without binary file filter can not work.
  7588. Currently file can be found here:
  7589. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7590. @item deint
  7591. Set which frames to deinterlace, by default it is @code{all}.
  7592. Can be @code{all} or @code{interlaced}.
  7593. @item field
  7594. Set mode of operation.
  7595. Can be one of the following:
  7596. @table @samp
  7597. @item af
  7598. Use frame flags, both fields.
  7599. @item a
  7600. Use frame flags, single field.
  7601. @item t
  7602. Use top field only.
  7603. @item b
  7604. Use bottom field only.
  7605. @item tf
  7606. Use both fields, top first.
  7607. @item bf
  7608. Use both fields, bottom first.
  7609. @end table
  7610. @item planes
  7611. Set which planes to process, by default filter process all frames.
  7612. @item nsize
  7613. Set size of local neighborhood around each pixel, used by the predictor neural
  7614. network.
  7615. Can be one of the following:
  7616. @table @samp
  7617. @item s8x6
  7618. @item s16x6
  7619. @item s32x6
  7620. @item s48x6
  7621. @item s8x4
  7622. @item s16x4
  7623. @item s32x4
  7624. @end table
  7625. @item nns
  7626. Set the number of neurons in predicctor neural network.
  7627. Can be one of the following:
  7628. @table @samp
  7629. @item n16
  7630. @item n32
  7631. @item n64
  7632. @item n128
  7633. @item n256
  7634. @end table
  7635. @item qual
  7636. Controls the number of different neural network predictions that are blended
  7637. together to compute the final output value. Can be @code{fast}, default or
  7638. @code{slow}.
  7639. @item etype
  7640. Set which set of weights to use in the predictor.
  7641. Can be one of the following:
  7642. @table @samp
  7643. @item a
  7644. weights trained to minimize absolute error
  7645. @item s
  7646. weights trained to minimize squared error
  7647. @end table
  7648. @item pscrn
  7649. Controls whether or not the prescreener neural network is used to decide
  7650. which pixels should be processed by the predictor neural network and which
  7651. can be handled by simple cubic interpolation.
  7652. The prescreener is trained to know whether cubic interpolation will be
  7653. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7654. The computational complexity of the prescreener nn is much less than that of
  7655. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7656. using the prescreener generally results in much faster processing.
  7657. The prescreener is pretty accurate, so the difference between using it and not
  7658. using it is almost always unnoticeable.
  7659. Can be one of the following:
  7660. @table @samp
  7661. @item none
  7662. @item original
  7663. @item new
  7664. @end table
  7665. Default is @code{new}.
  7666. @item fapprox
  7667. Set various debugging flags.
  7668. @end table
  7669. @section noformat
  7670. Force libavfilter not to use any of the specified pixel formats for the
  7671. input to the next filter.
  7672. It accepts the following parameters:
  7673. @table @option
  7674. @item pix_fmts
  7675. A '|'-separated list of pixel format names, such as
  7676. apix_fmts=yuv420p|monow|rgb24".
  7677. @end table
  7678. @subsection Examples
  7679. @itemize
  7680. @item
  7681. Force libavfilter to use a format different from @var{yuv420p} for the
  7682. input to the vflip filter:
  7683. @example
  7684. noformat=pix_fmts=yuv420p,vflip
  7685. @end example
  7686. @item
  7687. Convert the input video to any of the formats not contained in the list:
  7688. @example
  7689. noformat=yuv420p|yuv444p|yuv410p
  7690. @end example
  7691. @end itemize
  7692. @section noise
  7693. Add noise on video input frame.
  7694. The filter accepts the following options:
  7695. @table @option
  7696. @item all_seed
  7697. @item c0_seed
  7698. @item c1_seed
  7699. @item c2_seed
  7700. @item c3_seed
  7701. Set noise seed for specific pixel component or all pixel components in case
  7702. of @var{all_seed}. Default value is @code{123457}.
  7703. @item all_strength, alls
  7704. @item c0_strength, c0s
  7705. @item c1_strength, c1s
  7706. @item c2_strength, c2s
  7707. @item c3_strength, c3s
  7708. Set noise strength for specific pixel component or all pixel components in case
  7709. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7710. @item all_flags, allf
  7711. @item c0_flags, c0f
  7712. @item c1_flags, c1f
  7713. @item c2_flags, c2f
  7714. @item c3_flags, c3f
  7715. Set pixel component flags or set flags for all components if @var{all_flags}.
  7716. Available values for component flags are:
  7717. @table @samp
  7718. @item a
  7719. averaged temporal noise (smoother)
  7720. @item p
  7721. mix random noise with a (semi)regular pattern
  7722. @item t
  7723. temporal noise (noise pattern changes between frames)
  7724. @item u
  7725. uniform noise (gaussian otherwise)
  7726. @end table
  7727. @end table
  7728. @subsection Examples
  7729. Add temporal and uniform noise to input video:
  7730. @example
  7731. noise=alls=20:allf=t+u
  7732. @end example
  7733. @section null
  7734. Pass the video source unchanged to the output.
  7735. @section ocr
  7736. Optical Character Recognition
  7737. This filter uses Tesseract for optical character recognition.
  7738. It accepts the following options:
  7739. @table @option
  7740. @item datapath
  7741. Set datapath to tesseract data. Default is to use whatever was
  7742. set at installation.
  7743. @item language
  7744. Set language, default is "eng".
  7745. @item whitelist
  7746. Set character whitelist.
  7747. @item blacklist
  7748. Set character blacklist.
  7749. @end table
  7750. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7751. @section ocv
  7752. Apply a video transform using libopencv.
  7753. To enable this filter, install the libopencv library and headers and
  7754. configure FFmpeg with @code{--enable-libopencv}.
  7755. It accepts the following parameters:
  7756. @table @option
  7757. @item filter_name
  7758. The name of the libopencv filter to apply.
  7759. @item filter_params
  7760. The parameters to pass to the libopencv filter. If not specified, the default
  7761. values are assumed.
  7762. @end table
  7763. Refer to the official libopencv documentation for more precise
  7764. information:
  7765. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7766. Several libopencv filters are supported; see the following subsections.
  7767. @anchor{dilate}
  7768. @subsection dilate
  7769. Dilate an image by using a specific structuring element.
  7770. It corresponds to the libopencv function @code{cvDilate}.
  7771. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7772. @var{struct_el} represents a structuring element, and has the syntax:
  7773. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7774. @var{cols} and @var{rows} represent the number of columns and rows of
  7775. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7776. point, and @var{shape} the shape for the structuring element. @var{shape}
  7777. must be "rect", "cross", "ellipse", or "custom".
  7778. If the value for @var{shape} is "custom", it must be followed by a
  7779. string of the form "=@var{filename}". The file with name
  7780. @var{filename} is assumed to represent a binary image, with each
  7781. printable character corresponding to a bright pixel. When a custom
  7782. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7783. or columns and rows of the read file are assumed instead.
  7784. The default value for @var{struct_el} is "3x3+0x0/rect".
  7785. @var{nb_iterations} specifies the number of times the transform is
  7786. applied to the image, and defaults to 1.
  7787. Some examples:
  7788. @example
  7789. # Use the default values
  7790. ocv=dilate
  7791. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7792. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7793. # Read the shape from the file diamond.shape, iterating two times.
  7794. # The file diamond.shape may contain a pattern of characters like this
  7795. # *
  7796. # ***
  7797. # *****
  7798. # ***
  7799. # *
  7800. # The specified columns and rows are ignored
  7801. # but the anchor point coordinates are not
  7802. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7803. @end example
  7804. @subsection erode
  7805. Erode an image by using a specific structuring element.
  7806. It corresponds to the libopencv function @code{cvErode}.
  7807. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7808. with the same syntax and semantics as the @ref{dilate} filter.
  7809. @subsection smooth
  7810. Smooth the input video.
  7811. The filter takes the following parameters:
  7812. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7813. @var{type} is the type of smooth filter to apply, and must be one of
  7814. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7815. or "bilateral". The default value is "gaussian".
  7816. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7817. depend on the smooth type. @var{param1} and
  7818. @var{param2} accept integer positive values or 0. @var{param3} and
  7819. @var{param4} accept floating point values.
  7820. The default value for @var{param1} is 3. The default value for the
  7821. other parameters is 0.
  7822. These parameters correspond to the parameters assigned to the
  7823. libopencv function @code{cvSmooth}.
  7824. @anchor{overlay}
  7825. @section overlay
  7826. Overlay one video on top of another.
  7827. It takes two inputs and has one output. The first input is the "main"
  7828. video on which the second input is overlaid.
  7829. It accepts the following parameters:
  7830. A description of the accepted options follows.
  7831. @table @option
  7832. @item x
  7833. @item y
  7834. Set the expression for the x and y coordinates of the overlaid video
  7835. on the main video. Default value is "0" for both expressions. In case
  7836. the expression is invalid, it is set to a huge value (meaning that the
  7837. overlay will not be displayed within the output visible area).
  7838. @item eof_action
  7839. The action to take when EOF is encountered on the secondary input; it accepts
  7840. one of the following values:
  7841. @table @option
  7842. @item repeat
  7843. Repeat the last frame (the default).
  7844. @item endall
  7845. End both streams.
  7846. @item pass
  7847. Pass the main input through.
  7848. @end table
  7849. @item eval
  7850. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7851. It accepts the following values:
  7852. @table @samp
  7853. @item init
  7854. only evaluate expressions once during the filter initialization or
  7855. when a command is processed
  7856. @item frame
  7857. evaluate expressions for each incoming frame
  7858. @end table
  7859. Default value is @samp{frame}.
  7860. @item shortest
  7861. If set to 1, force the output to terminate when the shortest input
  7862. terminates. Default value is 0.
  7863. @item format
  7864. Set the format for the output video.
  7865. It accepts the following values:
  7866. @table @samp
  7867. @item yuv420
  7868. force YUV420 output
  7869. @item yuv422
  7870. force YUV422 output
  7871. @item yuv444
  7872. force YUV444 output
  7873. @item rgb
  7874. force packed RGB output
  7875. @item gbrp
  7876. force planar RGB output
  7877. @end table
  7878. Default value is @samp{yuv420}.
  7879. @item rgb @emph{(deprecated)}
  7880. If set to 1, force the filter to accept inputs in the RGB
  7881. color space. Default value is 0. This option is deprecated, use
  7882. @option{format} instead.
  7883. @item repeatlast
  7884. If set to 1, force the filter to draw the last overlay frame over the
  7885. main input until the end of the stream. A value of 0 disables this
  7886. behavior. Default value is 1.
  7887. @end table
  7888. The @option{x}, and @option{y} expressions can contain the following
  7889. parameters.
  7890. @table @option
  7891. @item main_w, W
  7892. @item main_h, H
  7893. The main input width and height.
  7894. @item overlay_w, w
  7895. @item overlay_h, h
  7896. The overlay input width and height.
  7897. @item x
  7898. @item y
  7899. The computed values for @var{x} and @var{y}. They are evaluated for
  7900. each new frame.
  7901. @item hsub
  7902. @item vsub
  7903. horizontal and vertical chroma subsample values of the output
  7904. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7905. @var{vsub} is 1.
  7906. @item n
  7907. the number of input frame, starting from 0
  7908. @item pos
  7909. the position in the file of the input frame, NAN if unknown
  7910. @item t
  7911. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7912. @end table
  7913. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7914. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7915. when @option{eval} is set to @samp{init}.
  7916. Be aware that frames are taken from each input video in timestamp
  7917. order, hence, if their initial timestamps differ, it is a good idea
  7918. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7919. have them begin in the same zero timestamp, as the example for
  7920. the @var{movie} filter does.
  7921. You can chain together more overlays but you should test the
  7922. efficiency of such approach.
  7923. @subsection Commands
  7924. This filter supports the following commands:
  7925. @table @option
  7926. @item x
  7927. @item y
  7928. Modify the x and y of the overlay input.
  7929. The command accepts the same syntax of the corresponding option.
  7930. If the specified expression is not valid, it is kept at its current
  7931. value.
  7932. @end table
  7933. @subsection Examples
  7934. @itemize
  7935. @item
  7936. Draw the overlay at 10 pixels from the bottom right corner of the main
  7937. video:
  7938. @example
  7939. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7940. @end example
  7941. Using named options the example above becomes:
  7942. @example
  7943. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7944. @end example
  7945. @item
  7946. Insert a transparent PNG logo in the bottom left corner of the input,
  7947. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7948. @example
  7949. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7950. @end example
  7951. @item
  7952. Insert 2 different transparent PNG logos (second logo on bottom
  7953. right corner) using the @command{ffmpeg} tool:
  7954. @example
  7955. 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
  7956. @end example
  7957. @item
  7958. Add a transparent color layer on top of the main video; @code{WxH}
  7959. must specify the size of the main input to the overlay filter:
  7960. @example
  7961. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7962. @end example
  7963. @item
  7964. Play an original video and a filtered version (here with the deshake
  7965. filter) side by side using the @command{ffplay} tool:
  7966. @example
  7967. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7968. @end example
  7969. The above command is the same as:
  7970. @example
  7971. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7972. @end example
  7973. @item
  7974. Make a sliding overlay appearing from the left to the right top part of the
  7975. screen starting since time 2:
  7976. @example
  7977. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7978. @end example
  7979. @item
  7980. Compose output by putting two input videos side to side:
  7981. @example
  7982. ffmpeg -i left.avi -i right.avi -filter_complex "
  7983. nullsrc=size=200x100 [background];
  7984. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7985. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7986. [background][left] overlay=shortest=1 [background+left];
  7987. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7988. "
  7989. @end example
  7990. @item
  7991. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7992. @example
  7993. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7994. -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]'
  7995. masked.avi
  7996. @end example
  7997. @item
  7998. Chain several overlays in cascade:
  7999. @example
  8000. nullsrc=s=200x200 [bg];
  8001. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8002. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8003. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8004. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8005. [in3] null, [mid2] overlay=100:100 [out0]
  8006. @end example
  8007. @end itemize
  8008. @section owdenoise
  8009. Apply Overcomplete Wavelet denoiser.
  8010. The filter accepts the following options:
  8011. @table @option
  8012. @item depth
  8013. Set depth.
  8014. Larger depth values will denoise lower frequency components more, but
  8015. slow down filtering.
  8016. Must be an int in the range 8-16, default is @code{8}.
  8017. @item luma_strength, ls
  8018. Set luma strength.
  8019. Must be a double value in the range 0-1000, default is @code{1.0}.
  8020. @item chroma_strength, cs
  8021. Set chroma strength.
  8022. Must be a double value in the range 0-1000, default is @code{1.0}.
  8023. @end table
  8024. @anchor{pad}
  8025. @section pad
  8026. Add paddings to the input image, and place the original input at the
  8027. provided @var{x}, @var{y} coordinates.
  8028. It accepts the following parameters:
  8029. @table @option
  8030. @item width, w
  8031. @item height, h
  8032. Specify an expression for the size of the output image with the
  8033. paddings added. If the value for @var{width} or @var{height} is 0, the
  8034. corresponding input size is used for the output.
  8035. The @var{width} expression can reference the value set by the
  8036. @var{height} expression, and vice versa.
  8037. The default value of @var{width} and @var{height} is 0.
  8038. @item x
  8039. @item y
  8040. Specify the offsets to place the input image at within the padded area,
  8041. with respect to the top/left border of the output image.
  8042. The @var{x} expression can reference the value set by the @var{y}
  8043. expression, and vice versa.
  8044. The default value of @var{x} and @var{y} is 0.
  8045. @item color
  8046. Specify the color of the padded area. For the syntax of this option,
  8047. check the "Color" section in the ffmpeg-utils manual.
  8048. The default value of @var{color} is "black".
  8049. @item eval
  8050. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8051. It accepts the following values:
  8052. @table @samp
  8053. @item init
  8054. Only evaluate expressions once during the filter initialization or when
  8055. a command is processed.
  8056. @item frame
  8057. Evaluate expressions for each incoming frame.
  8058. @end table
  8059. Default value is @samp{init}.
  8060. @end table
  8061. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8062. options are expressions containing the following constants:
  8063. @table @option
  8064. @item in_w
  8065. @item in_h
  8066. The input video width and height.
  8067. @item iw
  8068. @item ih
  8069. These are the same as @var{in_w} and @var{in_h}.
  8070. @item out_w
  8071. @item out_h
  8072. The output width and height (the size of the padded area), as
  8073. specified by the @var{width} and @var{height} expressions.
  8074. @item ow
  8075. @item oh
  8076. These are the same as @var{out_w} and @var{out_h}.
  8077. @item x
  8078. @item y
  8079. The x and y offsets as specified by the @var{x} and @var{y}
  8080. expressions, or NAN if not yet specified.
  8081. @item a
  8082. same as @var{iw} / @var{ih}
  8083. @item sar
  8084. input sample aspect ratio
  8085. @item dar
  8086. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8087. @item hsub
  8088. @item vsub
  8089. The horizontal and vertical chroma subsample values. For example for the
  8090. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8091. @end table
  8092. @subsection Examples
  8093. @itemize
  8094. @item
  8095. Add paddings with the color "violet" to the input video. The output video
  8096. size is 640x480, and the top-left corner of the input video is placed at
  8097. column 0, row 40
  8098. @example
  8099. pad=640:480:0:40:violet
  8100. @end example
  8101. The example above is equivalent to the following command:
  8102. @example
  8103. pad=width=640:height=480:x=0:y=40:color=violet
  8104. @end example
  8105. @item
  8106. Pad the input to get an output with dimensions increased by 3/2,
  8107. and put the input video at the center of the padded area:
  8108. @example
  8109. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8110. @end example
  8111. @item
  8112. Pad the input to get a squared output with size equal to the maximum
  8113. value between the input width and height, and put the input video at
  8114. the center of the padded area:
  8115. @example
  8116. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8117. @end example
  8118. @item
  8119. Pad the input to get a final w/h ratio of 16:9:
  8120. @example
  8121. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8122. @end example
  8123. @item
  8124. In case of anamorphic video, in order to set the output display aspect
  8125. correctly, it is necessary to use @var{sar} in the expression,
  8126. according to the relation:
  8127. @example
  8128. (ih * X / ih) * sar = output_dar
  8129. X = output_dar / sar
  8130. @end example
  8131. Thus the previous example needs to be modified to:
  8132. @example
  8133. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8134. @end example
  8135. @item
  8136. Double the output size and put the input video in the bottom-right
  8137. corner of the output padded area:
  8138. @example
  8139. pad="2*iw:2*ih:ow-iw:oh-ih"
  8140. @end example
  8141. @end itemize
  8142. @anchor{palettegen}
  8143. @section palettegen
  8144. Generate one palette for a whole video stream.
  8145. It accepts the following options:
  8146. @table @option
  8147. @item max_colors
  8148. Set the maximum number of colors to quantize in the palette.
  8149. Note: the palette will still contain 256 colors; the unused palette entries
  8150. will be black.
  8151. @item reserve_transparent
  8152. Create a palette of 255 colors maximum and reserve the last one for
  8153. transparency. Reserving the transparency color is useful for GIF optimization.
  8154. If not set, the maximum of colors in the palette will be 256. You probably want
  8155. to disable this option for a standalone image.
  8156. Set by default.
  8157. @item stats_mode
  8158. Set statistics mode.
  8159. It accepts the following values:
  8160. @table @samp
  8161. @item full
  8162. Compute full frame histograms.
  8163. @item diff
  8164. Compute histograms only for the part that differs from previous frame. This
  8165. might be relevant to give more importance to the moving part of your input if
  8166. the background is static.
  8167. @item single
  8168. Compute new histogram for each frame.
  8169. @end table
  8170. Default value is @var{full}.
  8171. @end table
  8172. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8173. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8174. color quantization of the palette. This information is also visible at
  8175. @var{info} logging level.
  8176. @subsection Examples
  8177. @itemize
  8178. @item
  8179. Generate a representative palette of a given video using @command{ffmpeg}:
  8180. @example
  8181. ffmpeg -i input.mkv -vf palettegen palette.png
  8182. @end example
  8183. @end itemize
  8184. @section paletteuse
  8185. Use a palette to downsample an input video stream.
  8186. The filter takes two inputs: one video stream and a palette. The palette must
  8187. be a 256 pixels image.
  8188. It accepts the following options:
  8189. @table @option
  8190. @item dither
  8191. Select dithering mode. Available algorithms are:
  8192. @table @samp
  8193. @item bayer
  8194. Ordered 8x8 bayer dithering (deterministic)
  8195. @item heckbert
  8196. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8197. Note: this dithering is sometimes considered "wrong" and is included as a
  8198. reference.
  8199. @item floyd_steinberg
  8200. Floyd and Steingberg dithering (error diffusion)
  8201. @item sierra2
  8202. Frankie Sierra dithering v2 (error diffusion)
  8203. @item sierra2_4a
  8204. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8205. @end table
  8206. Default is @var{sierra2_4a}.
  8207. @item bayer_scale
  8208. When @var{bayer} dithering is selected, this option defines the scale of the
  8209. pattern (how much the crosshatch pattern is visible). A low value means more
  8210. visible pattern for less banding, and higher value means less visible pattern
  8211. at the cost of more banding.
  8212. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8213. @item diff_mode
  8214. If set, define the zone to process
  8215. @table @samp
  8216. @item rectangle
  8217. Only the changing rectangle will be reprocessed. This is similar to GIF
  8218. cropping/offsetting compression mechanism. This option can be useful for speed
  8219. if only a part of the image is changing, and has use cases such as limiting the
  8220. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8221. moving scene (it leads to more deterministic output if the scene doesn't change
  8222. much, and as a result less moving noise and better GIF compression).
  8223. @end table
  8224. Default is @var{none}.
  8225. @item new
  8226. Take new palette for each output frame.
  8227. @end table
  8228. @subsection Examples
  8229. @itemize
  8230. @item
  8231. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8232. using @command{ffmpeg}:
  8233. @example
  8234. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8235. @end example
  8236. @end itemize
  8237. @section perspective
  8238. Correct perspective of video not recorded perpendicular to the screen.
  8239. A description of the accepted parameters follows.
  8240. @table @option
  8241. @item x0
  8242. @item y0
  8243. @item x1
  8244. @item y1
  8245. @item x2
  8246. @item y2
  8247. @item x3
  8248. @item y3
  8249. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8250. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8251. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8252. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8253. then the corners of the source will be sent to the specified coordinates.
  8254. The expressions can use the following variables:
  8255. @table @option
  8256. @item W
  8257. @item H
  8258. the width and height of video frame.
  8259. @item in
  8260. Input frame count.
  8261. @item on
  8262. Output frame count.
  8263. @end table
  8264. @item interpolation
  8265. Set interpolation for perspective correction.
  8266. It accepts the following values:
  8267. @table @samp
  8268. @item linear
  8269. @item cubic
  8270. @end table
  8271. Default value is @samp{linear}.
  8272. @item sense
  8273. Set interpretation of coordinate options.
  8274. It accepts the following values:
  8275. @table @samp
  8276. @item 0, source
  8277. Send point in the source specified by the given coordinates to
  8278. the corners of the destination.
  8279. @item 1, destination
  8280. Send the corners of the source to the point in the destination specified
  8281. by the given coordinates.
  8282. Default value is @samp{source}.
  8283. @end table
  8284. @item eval
  8285. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8286. It accepts the following values:
  8287. @table @samp
  8288. @item init
  8289. only evaluate expressions once during the filter initialization or
  8290. when a command is processed
  8291. @item frame
  8292. evaluate expressions for each incoming frame
  8293. @end table
  8294. Default value is @samp{init}.
  8295. @end table
  8296. @section phase
  8297. Delay interlaced video by one field time so that the field order changes.
  8298. The intended use is to fix PAL movies that have been captured with the
  8299. opposite field order to the film-to-video transfer.
  8300. A description of the accepted parameters follows.
  8301. @table @option
  8302. @item mode
  8303. Set phase mode.
  8304. It accepts the following values:
  8305. @table @samp
  8306. @item t
  8307. Capture field order top-first, transfer bottom-first.
  8308. Filter will delay the bottom field.
  8309. @item b
  8310. Capture field order bottom-first, transfer top-first.
  8311. Filter will delay the top field.
  8312. @item p
  8313. Capture and transfer with the same field order. This mode only exists
  8314. for the documentation of the other options to refer to, but if you
  8315. actually select it, the filter will faithfully do nothing.
  8316. @item a
  8317. Capture field order determined automatically by field flags, transfer
  8318. opposite.
  8319. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8320. basis using field flags. If no field information is available,
  8321. then this works just like @samp{u}.
  8322. @item u
  8323. Capture unknown or varying, transfer opposite.
  8324. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8325. analyzing the images and selecting the alternative that produces best
  8326. match between the fields.
  8327. @item T
  8328. Capture top-first, transfer unknown or varying.
  8329. Filter selects among @samp{t} and @samp{p} using image analysis.
  8330. @item B
  8331. Capture bottom-first, transfer unknown or varying.
  8332. Filter selects among @samp{b} and @samp{p} using image analysis.
  8333. @item A
  8334. Capture determined by field flags, transfer unknown or varying.
  8335. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8336. image analysis. If no field information is available, then this works just
  8337. like @samp{U}. This is the default mode.
  8338. @item U
  8339. Both capture and transfer unknown or varying.
  8340. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8341. @end table
  8342. @end table
  8343. @section pixdesctest
  8344. Pixel format descriptor test filter, mainly useful for internal
  8345. testing. The output video should be equal to the input video.
  8346. For example:
  8347. @example
  8348. format=monow, pixdesctest
  8349. @end example
  8350. can be used to test the monowhite pixel format descriptor definition.
  8351. @section pp
  8352. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8353. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8354. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8355. Each subfilter and some options have a short and a long name that can be used
  8356. interchangeably, i.e. dr/dering are the same.
  8357. The filters accept the following options:
  8358. @table @option
  8359. @item subfilters
  8360. Set postprocessing subfilters string.
  8361. @end table
  8362. All subfilters share common options to determine their scope:
  8363. @table @option
  8364. @item a/autoq
  8365. Honor the quality commands for this subfilter.
  8366. @item c/chrom
  8367. Do chrominance filtering, too (default).
  8368. @item y/nochrom
  8369. Do luminance filtering only (no chrominance).
  8370. @item n/noluma
  8371. Do chrominance filtering only (no luminance).
  8372. @end table
  8373. These options can be appended after the subfilter name, separated by a '|'.
  8374. Available subfilters are:
  8375. @table @option
  8376. @item hb/hdeblock[|difference[|flatness]]
  8377. Horizontal 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 vb/vdeblock[|difference[|flatness]]
  8385. Vertical 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 ha/hadeblock[|difference[|flatness]]
  8393. Accurate horizontal 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. @item va/vadeblock[|difference[|flatness]]
  8401. Accurate vertical deblocking filter
  8402. @table @option
  8403. @item difference
  8404. Difference factor where higher values mean more deblocking (default: @code{32}).
  8405. @item flatness
  8406. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8407. @end table
  8408. @end table
  8409. The horizontal and vertical deblocking filters share the difference and
  8410. flatness values so you cannot set different horizontal and vertical
  8411. thresholds.
  8412. @table @option
  8413. @item h1/x1hdeblock
  8414. Experimental horizontal deblocking filter
  8415. @item v1/x1vdeblock
  8416. Experimental vertical deblocking filter
  8417. @item dr/dering
  8418. Deringing filter
  8419. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8420. @table @option
  8421. @item threshold1
  8422. larger -> stronger filtering
  8423. @item threshold2
  8424. larger -> stronger filtering
  8425. @item threshold3
  8426. larger -> stronger filtering
  8427. @end table
  8428. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8429. @table @option
  8430. @item f/fullyrange
  8431. Stretch luminance to @code{0-255}.
  8432. @end table
  8433. @item lb/linblenddeint
  8434. Linear blend deinterlacing filter that deinterlaces the given block by
  8435. filtering all lines with a @code{(1 2 1)} filter.
  8436. @item li/linipoldeint
  8437. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8438. linearly interpolating every second line.
  8439. @item ci/cubicipoldeint
  8440. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8441. cubically interpolating every second line.
  8442. @item md/mediandeint
  8443. Median deinterlacing filter that deinterlaces the given block by applying a
  8444. median filter to every second line.
  8445. @item fd/ffmpegdeint
  8446. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8447. second line with a @code{(-1 4 2 4 -1)} filter.
  8448. @item l5/lowpass5
  8449. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8450. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8451. @item fq/forceQuant[|quantizer]
  8452. Overrides the quantizer table from the input with the constant quantizer you
  8453. specify.
  8454. @table @option
  8455. @item quantizer
  8456. Quantizer to use
  8457. @end table
  8458. @item de/default
  8459. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8460. @item fa/fast
  8461. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8462. @item ac
  8463. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8464. @end table
  8465. @subsection Examples
  8466. @itemize
  8467. @item
  8468. Apply horizontal and vertical deblocking, deringing and automatic
  8469. brightness/contrast:
  8470. @example
  8471. pp=hb/vb/dr/al
  8472. @end example
  8473. @item
  8474. Apply default filters without brightness/contrast correction:
  8475. @example
  8476. pp=de/-al
  8477. @end example
  8478. @item
  8479. Apply default filters and temporal denoiser:
  8480. @example
  8481. pp=default/tmpnoise|1|2|3
  8482. @end example
  8483. @item
  8484. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8485. automatically depending on available CPU time:
  8486. @example
  8487. pp=hb|y/vb|a
  8488. @end example
  8489. @end itemize
  8490. @section pp7
  8491. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8492. similar to spp = 6 with 7 point DCT, where only the center sample is
  8493. used after IDCT.
  8494. The filter accepts the following options:
  8495. @table @option
  8496. @item qp
  8497. Force a constant quantization parameter. It accepts an integer in range
  8498. 0 to 63. If not set, the filter will use the QP from the video stream
  8499. (if available).
  8500. @item mode
  8501. Set thresholding mode. Available modes are:
  8502. @table @samp
  8503. @item hard
  8504. Set hard thresholding.
  8505. @item soft
  8506. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8507. @item medium
  8508. Set medium thresholding (good results, default).
  8509. @end table
  8510. @end table
  8511. @section premultiply
  8512. Apply alpha premultiply effect to input video stream using first plane
  8513. of second stream as alpha.
  8514. Both streams must have same dimensions and same pixel format.
  8515. @section prewitt
  8516. Apply prewitt operator to input video stream.
  8517. The filter accepts the following option:
  8518. @table @option
  8519. @item planes
  8520. Set which planes will be processed, unprocessed planes will be copied.
  8521. By default value 0xf, all planes will be processed.
  8522. @item scale
  8523. Set value which will be multiplied with filtered result.
  8524. @item delta
  8525. Set value which will be added to filtered result.
  8526. @end table
  8527. @section psnr
  8528. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8529. Ratio) between two input videos.
  8530. This filter takes in input two input videos, the first input is
  8531. considered the "main" source and is passed unchanged to the
  8532. output. The second input is used as a "reference" video for computing
  8533. the PSNR.
  8534. Both video inputs must have the same resolution and pixel format for
  8535. this filter to work correctly. Also it assumes that both inputs
  8536. have the same number of frames, which are compared one by one.
  8537. The obtained average PSNR is printed through the logging system.
  8538. The filter stores the accumulated MSE (mean squared error) of each
  8539. frame, and at the end of the processing it is averaged across all frames
  8540. equally, and the following formula is applied to obtain the PSNR:
  8541. @example
  8542. PSNR = 10*log10(MAX^2/MSE)
  8543. @end example
  8544. Where MAX is the average of the maximum values of each component of the
  8545. image.
  8546. The description of the accepted parameters follows.
  8547. @table @option
  8548. @item stats_file, f
  8549. If specified the filter will use the named file to save the PSNR of
  8550. each individual frame. When filename equals "-" the data is sent to
  8551. standard output.
  8552. @item stats_version
  8553. Specifies which version of the stats file format to use. Details of
  8554. each format are written below.
  8555. Default value is 1.
  8556. @item stats_add_max
  8557. Determines whether the max value is output to the stats log.
  8558. Default value is 0.
  8559. Requires stats_version >= 2. If this is set and stats_version < 2,
  8560. the filter will return an error.
  8561. @end table
  8562. The file printed if @var{stats_file} is selected, contains a sequence of
  8563. key/value pairs of the form @var{key}:@var{value} for each compared
  8564. couple of frames.
  8565. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8566. the list of per-frame-pair stats, with key value pairs following the frame
  8567. format with the following parameters:
  8568. @table @option
  8569. @item psnr_log_version
  8570. The version of the log file format. Will match @var{stats_version}.
  8571. @item fields
  8572. A comma separated list of the per-frame-pair parameters included in
  8573. the log.
  8574. @end table
  8575. A description of each shown per-frame-pair parameter follows:
  8576. @table @option
  8577. @item n
  8578. sequential number of the input frame, starting from 1
  8579. @item mse_avg
  8580. Mean Square Error pixel-by-pixel average difference of the compared
  8581. frames, averaged over all the image components.
  8582. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8583. Mean Square Error pixel-by-pixel average difference of the compared
  8584. frames for the component specified by the suffix.
  8585. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8586. Peak Signal to Noise ratio of the compared frames for the component
  8587. specified by the suffix.
  8588. @item max_avg, max_y, max_u, max_v
  8589. Maximum allowed value for each channel, and average over all
  8590. channels.
  8591. @end table
  8592. For example:
  8593. @example
  8594. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8595. [main][ref] psnr="stats_file=stats.log" [out]
  8596. @end example
  8597. On this example the input file being processed is compared with the
  8598. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8599. is stored in @file{stats.log}.
  8600. @anchor{pullup}
  8601. @section pullup
  8602. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8603. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8604. content.
  8605. The pullup filter is designed to take advantage of future context in making
  8606. its decisions. This filter is stateless in the sense that it does not lock
  8607. onto a pattern to follow, but it instead looks forward to the following
  8608. fields in order to identify matches and rebuild progressive frames.
  8609. To produce content with an even framerate, insert the fps filter after
  8610. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8611. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8612. The filter accepts the following options:
  8613. @table @option
  8614. @item jl
  8615. @item jr
  8616. @item jt
  8617. @item jb
  8618. These options set the amount of "junk" to ignore at the left, right, top, and
  8619. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8620. while top and bottom are in units of 2 lines.
  8621. The default is 8 pixels on each side.
  8622. @item sb
  8623. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8624. filter generating an occasional mismatched frame, but it may also cause an
  8625. excessive number of frames to be dropped during high motion sequences.
  8626. Conversely, setting it to -1 will make filter match fields more easily.
  8627. This may help processing of video where there is slight blurring between
  8628. the fields, but may also cause there to be interlaced frames in the output.
  8629. Default value is @code{0}.
  8630. @item mp
  8631. Set the metric plane to use. It accepts the following values:
  8632. @table @samp
  8633. @item l
  8634. Use luma plane.
  8635. @item u
  8636. Use chroma blue plane.
  8637. @item v
  8638. Use chroma red plane.
  8639. @end table
  8640. This option may be set to use chroma plane instead of the default luma plane
  8641. for doing filter's computations. This may improve accuracy on very clean
  8642. source material, but more likely will decrease accuracy, especially if there
  8643. is chroma noise (rainbow effect) or any grayscale video.
  8644. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8645. load and make pullup usable in realtime on slow machines.
  8646. @end table
  8647. For best results (without duplicated frames in the output file) it is
  8648. necessary to change the output frame rate. For example, to inverse
  8649. telecine NTSC input:
  8650. @example
  8651. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8652. @end example
  8653. @section qp
  8654. Change video quantization parameters (QP).
  8655. The filter accepts the following option:
  8656. @table @option
  8657. @item qp
  8658. Set expression for quantization parameter.
  8659. @end table
  8660. The expression is evaluated through the eval API and can contain, among others,
  8661. the following constants:
  8662. @table @var
  8663. @item known
  8664. 1 if index is not 129, 0 otherwise.
  8665. @item qp
  8666. Sequentional index starting from -129 to 128.
  8667. @end table
  8668. @subsection Examples
  8669. @itemize
  8670. @item
  8671. Some equation like:
  8672. @example
  8673. qp=2+2*sin(PI*qp)
  8674. @end example
  8675. @end itemize
  8676. @section random
  8677. Flush video frames from internal cache of frames into a random order.
  8678. No frame is discarded.
  8679. Inspired by @ref{frei0r} nervous filter.
  8680. @table @option
  8681. @item frames
  8682. Set size in number of frames of internal cache, in range from @code{2} to
  8683. @code{512}. Default is @code{30}.
  8684. @item seed
  8685. Set seed for random number generator, must be an integer included between
  8686. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8687. less than @code{0}, the filter will try to use a good random seed on a
  8688. best effort basis.
  8689. @end table
  8690. @section readeia608
  8691. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8692. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8693. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8694. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8695. @table @option
  8696. @item lavfi.readeia608.X.cc
  8697. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8698. @item lavfi.readeia608.X.line
  8699. The number of the line on which the EIA-608 data was identified and read.
  8700. @end table
  8701. This filter accepts the following options:
  8702. @table @option
  8703. @item scan_min
  8704. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8705. @item scan_max
  8706. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8707. @item mac
  8708. Set minimal acceptable amplitude change for sync codes detection.
  8709. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8710. @item spw
  8711. Set the ratio of width reserved for sync code detection.
  8712. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8713. @item mhd
  8714. Set the max peaks height difference for sync code detection.
  8715. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8716. @item mpd
  8717. Set max peaks period difference for sync code detection.
  8718. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8719. @item msd
  8720. Set the first two max start code bits differences.
  8721. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8722. @item bhd
  8723. Set the minimum ratio of bits height compared to 3rd start code bit.
  8724. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8725. @item th_w
  8726. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8727. @item th_b
  8728. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8729. @item chp
  8730. Enable checking the parity bit. In the event of a parity error, the filter will output
  8731. @code{0x00} for that character. Default is false.
  8732. @end table
  8733. @subsection Examples
  8734. @itemize
  8735. @item
  8736. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8737. @example
  8738. 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
  8739. @end example
  8740. @end itemize
  8741. @section readvitc
  8742. Read vertical interval timecode (VITC) information from the top lines of a
  8743. video frame.
  8744. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8745. timecode value, if a valid timecode has been detected. Further metadata key
  8746. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8747. timecode data has been found or not.
  8748. This filter accepts the following options:
  8749. @table @option
  8750. @item scan_max
  8751. Set the maximum number of lines to scan for VITC data. If the value is set to
  8752. @code{-1} the full video frame is scanned. Default is @code{45}.
  8753. @item thr_b
  8754. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8755. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8756. @item thr_w
  8757. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8758. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8759. @end table
  8760. @subsection Examples
  8761. @itemize
  8762. @item
  8763. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8764. draw @code{--:--:--:--} as a placeholder:
  8765. @example
  8766. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8767. @end example
  8768. @end itemize
  8769. @section remap
  8770. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8771. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8772. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8773. value for pixel will be used for destination pixel.
  8774. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8775. will have Xmap/Ymap video stream dimensions.
  8776. Xmap and Ymap input video streams are 16bit depth, single channel.
  8777. @section removegrain
  8778. The removegrain filter is a spatial denoiser for progressive video.
  8779. @table @option
  8780. @item m0
  8781. Set mode for the first plane.
  8782. @item m1
  8783. Set mode for the second plane.
  8784. @item m2
  8785. Set mode for the third plane.
  8786. @item m3
  8787. Set mode for the fourth plane.
  8788. @end table
  8789. Range of mode is from 0 to 24. Description of each mode follows:
  8790. @table @var
  8791. @item 0
  8792. Leave input plane unchanged. Default.
  8793. @item 1
  8794. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8795. @item 2
  8796. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8797. @item 3
  8798. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8799. @item 4
  8800. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8801. This is equivalent to a median filter.
  8802. @item 5
  8803. Line-sensitive clipping giving the minimal change.
  8804. @item 6
  8805. Line-sensitive clipping, intermediate.
  8806. @item 7
  8807. Line-sensitive clipping, intermediate.
  8808. @item 8
  8809. Line-sensitive clipping, intermediate.
  8810. @item 9
  8811. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8812. @item 10
  8813. Replaces the target pixel with the closest neighbour.
  8814. @item 11
  8815. [1 2 1] horizontal and vertical kernel blur.
  8816. @item 12
  8817. Same as mode 11.
  8818. @item 13
  8819. Bob mode, interpolates top field from the line where the neighbours
  8820. pixels are the closest.
  8821. @item 14
  8822. Bob mode, interpolates bottom field from the line where the neighbours
  8823. pixels are the closest.
  8824. @item 15
  8825. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8826. interpolation formula.
  8827. @item 16
  8828. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8829. interpolation formula.
  8830. @item 17
  8831. Clips the pixel with the minimum and maximum of respectively the maximum and
  8832. minimum of each pair of opposite neighbour pixels.
  8833. @item 18
  8834. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8835. the current pixel is minimal.
  8836. @item 19
  8837. Replaces the pixel with the average of its 8 neighbours.
  8838. @item 20
  8839. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8840. @item 21
  8841. Clips pixels using the averages of opposite neighbour.
  8842. @item 22
  8843. Same as mode 21 but simpler and faster.
  8844. @item 23
  8845. Small edge and halo removal, but reputed useless.
  8846. @item 24
  8847. Similar as 23.
  8848. @end table
  8849. @section removelogo
  8850. Suppress a TV station logo, using an image file to determine which
  8851. pixels comprise the logo. It works by filling in the pixels that
  8852. comprise the logo with neighboring pixels.
  8853. The filter accepts the following options:
  8854. @table @option
  8855. @item filename, f
  8856. Set the filter bitmap file, which can be any image format supported by
  8857. libavformat. The width and height of the image file must match those of the
  8858. video stream being processed.
  8859. @end table
  8860. Pixels in the provided bitmap image with a value of zero are not
  8861. considered part of the logo, non-zero pixels are considered part of
  8862. the logo. If you use white (255) for the logo and black (0) for the
  8863. rest, you will be safe. For making the filter bitmap, it is
  8864. recommended to take a screen capture of a black frame with the logo
  8865. visible, and then using a threshold filter followed by the erode
  8866. filter once or twice.
  8867. If needed, little splotches can be fixed manually. Remember that if
  8868. logo pixels are not covered, the filter quality will be much
  8869. reduced. Marking too many pixels as part of the logo does not hurt as
  8870. much, but it will increase the amount of blurring needed to cover over
  8871. the image and will destroy more information than necessary, and extra
  8872. pixels will slow things down on a large logo.
  8873. @section repeatfields
  8874. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8875. fields based on its value.
  8876. @section reverse
  8877. Reverse a video clip.
  8878. Warning: This filter requires memory to buffer the entire clip, so trimming
  8879. is suggested.
  8880. @subsection Examples
  8881. @itemize
  8882. @item
  8883. Take the first 5 seconds of a clip, and reverse it.
  8884. @example
  8885. trim=end=5,reverse
  8886. @end example
  8887. @end itemize
  8888. @section rotate
  8889. Rotate video by an arbitrary angle expressed in radians.
  8890. The filter accepts the following options:
  8891. A description of the optional parameters follows.
  8892. @table @option
  8893. @item angle, a
  8894. Set an expression for the angle by which to rotate the input video
  8895. clockwise, expressed as a number of radians. A negative value will
  8896. result in a counter-clockwise rotation. By default it is set to "0".
  8897. This expression is evaluated for each frame.
  8898. @item out_w, ow
  8899. Set the output width expression, default value is "iw".
  8900. This expression is evaluated just once during configuration.
  8901. @item out_h, oh
  8902. Set the output height expression, default value is "ih".
  8903. This expression is evaluated just once during configuration.
  8904. @item bilinear
  8905. Enable bilinear interpolation if set to 1, a value of 0 disables
  8906. it. Default value is 1.
  8907. @item fillcolor, c
  8908. Set the color used to fill the output area not covered by the rotated
  8909. image. For the general syntax of this option, check the "Color" section in the
  8910. ffmpeg-utils manual. If the special value "none" is selected then no
  8911. background is printed (useful for example if the background is never shown).
  8912. Default value is "black".
  8913. @end table
  8914. The expressions for the angle and the output size can contain the
  8915. following constants and functions:
  8916. @table @option
  8917. @item n
  8918. sequential number of the input frame, starting from 0. It is always NAN
  8919. before the first frame is filtered.
  8920. @item t
  8921. time in seconds of the input frame, it is set to 0 when the filter is
  8922. configured. It is always NAN before the first frame is filtered.
  8923. @item hsub
  8924. @item vsub
  8925. horizontal and vertical chroma subsample values. For example for the
  8926. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8927. @item in_w, iw
  8928. @item in_h, ih
  8929. the input video width and height
  8930. @item out_w, ow
  8931. @item out_h, oh
  8932. the output width and height, that is the size of the padded area as
  8933. specified by the @var{width} and @var{height} expressions
  8934. @item rotw(a)
  8935. @item roth(a)
  8936. the minimal width/height required for completely containing the input
  8937. video rotated by @var{a} radians.
  8938. These are only available when computing the @option{out_w} and
  8939. @option{out_h} expressions.
  8940. @end table
  8941. @subsection Examples
  8942. @itemize
  8943. @item
  8944. Rotate the input by PI/6 radians clockwise:
  8945. @example
  8946. rotate=PI/6
  8947. @end example
  8948. @item
  8949. Rotate the input by PI/6 radians counter-clockwise:
  8950. @example
  8951. rotate=-PI/6
  8952. @end example
  8953. @item
  8954. Rotate the input by 45 degrees clockwise:
  8955. @example
  8956. rotate=45*PI/180
  8957. @end example
  8958. @item
  8959. Apply a constant rotation with period T, starting from an angle of PI/3:
  8960. @example
  8961. rotate=PI/3+2*PI*t/T
  8962. @end example
  8963. @item
  8964. Make the input video rotation oscillating with a period of T
  8965. seconds and an amplitude of A radians:
  8966. @example
  8967. rotate=A*sin(2*PI/T*t)
  8968. @end example
  8969. @item
  8970. Rotate the video, output size is chosen so that the whole rotating
  8971. input video is always completely contained in the output:
  8972. @example
  8973. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8974. @end example
  8975. @item
  8976. Rotate the video, reduce the output size so that no background is ever
  8977. shown:
  8978. @example
  8979. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8980. @end example
  8981. @end itemize
  8982. @subsection Commands
  8983. The filter supports the following commands:
  8984. @table @option
  8985. @item a, angle
  8986. Set the angle expression.
  8987. The command accepts the same syntax of the corresponding option.
  8988. If the specified expression is not valid, it is kept at its current
  8989. value.
  8990. @end table
  8991. @section sab
  8992. Apply Shape Adaptive Blur.
  8993. The filter accepts the following options:
  8994. @table @option
  8995. @item luma_radius, lr
  8996. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8997. value is 1.0. A greater value will result in a more blurred image, and
  8998. in slower processing.
  8999. @item luma_pre_filter_radius, lpfr
  9000. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9001. value is 1.0.
  9002. @item luma_strength, ls
  9003. Set luma maximum difference between pixels to still be considered, must
  9004. be a value in the 0.1-100.0 range, default value is 1.0.
  9005. @item chroma_radius, cr
  9006. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9007. greater value will result in a more blurred image, and in slower
  9008. processing.
  9009. @item chroma_pre_filter_radius, cpfr
  9010. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9011. @item chroma_strength, cs
  9012. Set chroma maximum difference between pixels to still be considered,
  9013. must be a value in the -0.9-100.0 range.
  9014. @end table
  9015. Each chroma option value, if not explicitly specified, is set to the
  9016. corresponding luma option value.
  9017. @anchor{scale}
  9018. @section scale
  9019. Scale (resize) the input video, using the libswscale library.
  9020. The scale filter forces the output display aspect ratio to be the same
  9021. of the input, by changing the output sample aspect ratio.
  9022. If the input image format is different from the format requested by
  9023. the next filter, the scale filter will convert the input to the
  9024. requested format.
  9025. @subsection Options
  9026. The filter accepts the following options, or any of the options
  9027. supported by the libswscale scaler.
  9028. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9029. the complete list of scaler options.
  9030. @table @option
  9031. @item width, w
  9032. @item height, h
  9033. Set the output video dimension expression. Default value is the input
  9034. dimension.
  9035. If the value is 0, the input width is used for the output.
  9036. If one of the values is -1, the scale filter will use a value that
  9037. maintains the aspect ratio of the input image, calculated from the
  9038. other specified dimension. If both of them are -1, the input size is
  9039. used
  9040. If one of the values is -n with n > 1, the scale filter will also use a value
  9041. that maintains the aspect ratio of the input image, calculated from the other
  9042. specified dimension. After that it will, however, make sure that the calculated
  9043. dimension is divisible by n and adjust the value if necessary.
  9044. See below for the list of accepted constants for use in the dimension
  9045. expression.
  9046. @item eval
  9047. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9048. @table @samp
  9049. @item init
  9050. Only evaluate expressions once during the filter initialization or when a command is processed.
  9051. @item frame
  9052. Evaluate expressions for each incoming frame.
  9053. @end table
  9054. Default value is @samp{init}.
  9055. @item interl
  9056. Set the interlacing mode. It accepts the following values:
  9057. @table @samp
  9058. @item 1
  9059. Force interlaced aware scaling.
  9060. @item 0
  9061. Do not apply interlaced scaling.
  9062. @item -1
  9063. Select interlaced aware scaling depending on whether the source frames
  9064. are flagged as interlaced or not.
  9065. @end table
  9066. Default value is @samp{0}.
  9067. @item flags
  9068. Set libswscale scaling flags. See
  9069. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9070. complete list of values. If not explicitly specified the filter applies
  9071. the default flags.
  9072. @item param0, param1
  9073. Set libswscale input parameters for scaling algorithms that need them. See
  9074. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9075. complete documentation. If not explicitly specified the filter applies
  9076. empty parameters.
  9077. @item size, s
  9078. Set the video size. For the syntax of this option, check the
  9079. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9080. @item in_color_matrix
  9081. @item out_color_matrix
  9082. Set in/output YCbCr color space type.
  9083. This allows the autodetected value to be overridden as well as allows forcing
  9084. a specific value used for the output and encoder.
  9085. If not specified, the color space type depends on the pixel format.
  9086. Possible values:
  9087. @table @samp
  9088. @item auto
  9089. Choose automatically.
  9090. @item bt709
  9091. Format conforming to International Telecommunication Union (ITU)
  9092. Recommendation BT.709.
  9093. @item fcc
  9094. Set color space conforming to the United States Federal Communications
  9095. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9096. @item bt601
  9097. Set color space conforming to:
  9098. @itemize
  9099. @item
  9100. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9101. @item
  9102. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9103. @item
  9104. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9105. @end itemize
  9106. @item smpte240m
  9107. Set color space conforming to SMPTE ST 240:1999.
  9108. @end table
  9109. @item in_range
  9110. @item out_range
  9111. Set in/output YCbCr sample range.
  9112. This allows the autodetected value to be overridden as well as allows forcing
  9113. a specific value used for the output and encoder. If not specified, the
  9114. range depends on the pixel format. Possible values:
  9115. @table @samp
  9116. @item auto
  9117. Choose automatically.
  9118. @item jpeg/full/pc
  9119. Set full range (0-255 in case of 8-bit luma).
  9120. @item mpeg/tv
  9121. Set "MPEG" range (16-235 in case of 8-bit luma).
  9122. @end table
  9123. @item force_original_aspect_ratio
  9124. Enable decreasing or increasing output video width or height if necessary to
  9125. keep the original aspect ratio. Possible values:
  9126. @table @samp
  9127. @item disable
  9128. Scale the video as specified and disable this feature.
  9129. @item decrease
  9130. The output video dimensions will automatically be decreased if needed.
  9131. @item increase
  9132. The output video dimensions will automatically be increased if needed.
  9133. @end table
  9134. One useful instance of this option is that when you know a specific device's
  9135. maximum allowed resolution, you can use this to limit the output video to
  9136. that, while retaining the aspect ratio. For example, device A allows
  9137. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9138. decrease) and specifying 1280x720 to the command line makes the output
  9139. 1280x533.
  9140. Please note that this is a different thing than specifying -1 for @option{w}
  9141. or @option{h}, you still need to specify the output resolution for this option
  9142. to work.
  9143. @end table
  9144. The values of the @option{w} and @option{h} options are expressions
  9145. containing the following constants:
  9146. @table @var
  9147. @item in_w
  9148. @item in_h
  9149. The input width and height
  9150. @item iw
  9151. @item ih
  9152. These are the same as @var{in_w} and @var{in_h}.
  9153. @item out_w
  9154. @item out_h
  9155. The output (scaled) width and height
  9156. @item ow
  9157. @item oh
  9158. These are the same as @var{out_w} and @var{out_h}
  9159. @item a
  9160. The same as @var{iw} / @var{ih}
  9161. @item sar
  9162. input sample aspect ratio
  9163. @item dar
  9164. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9165. @item hsub
  9166. @item vsub
  9167. horizontal and vertical input chroma subsample values. For example for the
  9168. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9169. @item ohsub
  9170. @item ovsub
  9171. horizontal and vertical output chroma subsample values. For example for the
  9172. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9173. @end table
  9174. @subsection Examples
  9175. @itemize
  9176. @item
  9177. Scale the input video to a size of 200x100
  9178. @example
  9179. scale=w=200:h=100
  9180. @end example
  9181. This is equivalent to:
  9182. @example
  9183. scale=200:100
  9184. @end example
  9185. or:
  9186. @example
  9187. scale=200x100
  9188. @end example
  9189. @item
  9190. Specify a size abbreviation for the output size:
  9191. @example
  9192. scale=qcif
  9193. @end example
  9194. which can also be written as:
  9195. @example
  9196. scale=size=qcif
  9197. @end example
  9198. @item
  9199. Scale the input to 2x:
  9200. @example
  9201. scale=w=2*iw:h=2*ih
  9202. @end example
  9203. @item
  9204. The above is the same as:
  9205. @example
  9206. scale=2*in_w:2*in_h
  9207. @end example
  9208. @item
  9209. Scale the input to 2x with forced interlaced scaling:
  9210. @example
  9211. scale=2*iw:2*ih:interl=1
  9212. @end example
  9213. @item
  9214. Scale the input to half size:
  9215. @example
  9216. scale=w=iw/2:h=ih/2
  9217. @end example
  9218. @item
  9219. Increase the width, and set the height to the same size:
  9220. @example
  9221. scale=3/2*iw:ow
  9222. @end example
  9223. @item
  9224. Seek Greek harmony:
  9225. @example
  9226. scale=iw:1/PHI*iw
  9227. scale=ih*PHI:ih
  9228. @end example
  9229. @item
  9230. Increase the height, and set the width to 3/2 of the height:
  9231. @example
  9232. scale=w=3/2*oh:h=3/5*ih
  9233. @end example
  9234. @item
  9235. Increase the size, making the size a multiple of the chroma
  9236. subsample values:
  9237. @example
  9238. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9239. @end example
  9240. @item
  9241. Increase the width to a maximum of 500 pixels,
  9242. keeping the same aspect ratio as the input:
  9243. @example
  9244. scale=w='min(500\, iw*3/2):h=-1'
  9245. @end example
  9246. @end itemize
  9247. @subsection Commands
  9248. This filter supports the following commands:
  9249. @table @option
  9250. @item width, w
  9251. @item height, h
  9252. Set the output video dimension expression.
  9253. The command accepts the same syntax of the corresponding option.
  9254. If the specified expression is not valid, it is kept at its current
  9255. value.
  9256. @end table
  9257. @section scale_npp
  9258. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9259. format conversion on CUDA video frames. Setting the output width and height
  9260. works in the same way as for the @var{scale} filter.
  9261. The following additional options are accepted:
  9262. @table @option
  9263. @item format
  9264. The pixel format of the output CUDA frames. If set to the string "same" (the
  9265. default), the input format will be kept. Note that automatic format negotiation
  9266. and conversion is not yet supported for hardware frames
  9267. @item interp_algo
  9268. The interpolation algorithm used for resizing. One of the following:
  9269. @table @option
  9270. @item nn
  9271. Nearest neighbour.
  9272. @item linear
  9273. @item cubic
  9274. @item cubic2p_bspline
  9275. 2-parameter cubic (B=1, C=0)
  9276. @item cubic2p_catmullrom
  9277. 2-parameter cubic (B=0, C=1/2)
  9278. @item cubic2p_b05c03
  9279. 2-parameter cubic (B=1/2, C=3/10)
  9280. @item super
  9281. Supersampling
  9282. @item lanczos
  9283. @end table
  9284. @end table
  9285. @section scale2ref
  9286. Scale (resize) the input video, based on a reference video.
  9287. See the scale filter for available options, scale2ref supports the same but
  9288. uses the reference video instead of the main input as basis.
  9289. @subsection Examples
  9290. @itemize
  9291. @item
  9292. Scale a subtitle stream to match the main video in size before overlaying
  9293. @example
  9294. 'scale2ref[b][a];[a][b]overlay'
  9295. @end example
  9296. @end itemize
  9297. @anchor{selectivecolor}
  9298. @section selectivecolor
  9299. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9300. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9301. by the "purity" of the color (that is, how saturated it already is).
  9302. This filter is similar to the Adobe Photoshop Selective Color tool.
  9303. The filter accepts the following options:
  9304. @table @option
  9305. @item correction_method
  9306. Select color correction method.
  9307. Available values are:
  9308. @table @samp
  9309. @item absolute
  9310. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9311. component value).
  9312. @item relative
  9313. Specified adjustments are relative to the original component value.
  9314. @end table
  9315. Default is @code{absolute}.
  9316. @item reds
  9317. Adjustments for red pixels (pixels where the red component is the maximum)
  9318. @item yellows
  9319. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9320. @item greens
  9321. Adjustments for green pixels (pixels where the green component is the maximum)
  9322. @item cyans
  9323. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9324. @item blues
  9325. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9326. @item magentas
  9327. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9328. @item whites
  9329. Adjustments for white pixels (pixels where all components are greater than 128)
  9330. @item neutrals
  9331. Adjustments for all pixels except pure black and pure white
  9332. @item blacks
  9333. Adjustments for black pixels (pixels where all components are lesser than 128)
  9334. @item psfile
  9335. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9336. @end table
  9337. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9338. 4 space separated floating point adjustment values in the [-1,1] range,
  9339. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9340. pixels of its range.
  9341. @subsection Examples
  9342. @itemize
  9343. @item
  9344. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9345. increase magenta by 27% in blue areas:
  9346. @example
  9347. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9348. @end example
  9349. @item
  9350. Use a Photoshop selective color preset:
  9351. @example
  9352. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9353. @end example
  9354. @end itemize
  9355. @anchor{separatefields}
  9356. @section separatefields
  9357. The @code{separatefields} takes a frame-based video input and splits
  9358. each frame into its components fields, producing a new half height clip
  9359. with twice the frame rate and twice the frame count.
  9360. This filter use field-dominance information in frame to decide which
  9361. of each pair of fields to place first in the output.
  9362. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9363. @section setdar, setsar
  9364. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9365. output video.
  9366. This is done by changing the specified Sample (aka Pixel) Aspect
  9367. Ratio, according to the following equation:
  9368. @example
  9369. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9370. @end example
  9371. Keep in mind that the @code{setdar} filter does not modify the pixel
  9372. dimensions of the video frame. Also, the display aspect ratio set by
  9373. this filter may be changed by later filters in the filterchain,
  9374. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9375. applied.
  9376. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9377. the filter output video.
  9378. Note that as a consequence of the application of this filter, the
  9379. output display aspect ratio will change according to the equation
  9380. above.
  9381. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9382. filter may be changed by later filters in the filterchain, e.g. if
  9383. another "setsar" or a "setdar" filter is applied.
  9384. It accepts the following parameters:
  9385. @table @option
  9386. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9387. Set the aspect ratio used by the filter.
  9388. The parameter can be a floating point number string, an expression, or
  9389. a string of the form @var{num}:@var{den}, where @var{num} and
  9390. @var{den} are the numerator and denominator of the aspect ratio. If
  9391. the parameter is not specified, it is assumed the value "0".
  9392. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9393. should be escaped.
  9394. @item max
  9395. Set the maximum integer value to use for expressing numerator and
  9396. denominator when reducing the expressed aspect ratio to a rational.
  9397. Default value is @code{100}.
  9398. @end table
  9399. The parameter @var{sar} is an expression containing
  9400. the following constants:
  9401. @table @option
  9402. @item E, PI, PHI
  9403. These are approximated values for the mathematical constants e
  9404. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9405. @item w, h
  9406. The input width and height.
  9407. @item a
  9408. These are the same as @var{w} / @var{h}.
  9409. @item sar
  9410. The input sample aspect ratio.
  9411. @item dar
  9412. The input display aspect ratio. It is the same as
  9413. (@var{w} / @var{h}) * @var{sar}.
  9414. @item hsub, vsub
  9415. Horizontal and vertical chroma subsample values. For example, for the
  9416. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9417. @end table
  9418. @subsection Examples
  9419. @itemize
  9420. @item
  9421. To change the display aspect ratio to 16:9, specify one of the following:
  9422. @example
  9423. setdar=dar=1.77777
  9424. setdar=dar=16/9
  9425. @end example
  9426. @item
  9427. To change the sample aspect ratio to 10:11, specify:
  9428. @example
  9429. setsar=sar=10/11
  9430. @end example
  9431. @item
  9432. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9433. 1000 in the aspect ratio reduction, use the command:
  9434. @example
  9435. setdar=ratio=16/9:max=1000
  9436. @end example
  9437. @end itemize
  9438. @anchor{setfield}
  9439. @section setfield
  9440. Force field for the output video frame.
  9441. The @code{setfield} filter marks the interlace type field for the
  9442. output frames. It does not change the input frame, but only sets the
  9443. corresponding property, which affects how the frame is treated by
  9444. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9445. The filter accepts the following options:
  9446. @table @option
  9447. @item mode
  9448. Available values are:
  9449. @table @samp
  9450. @item auto
  9451. Keep the same field property.
  9452. @item bff
  9453. Mark the frame as bottom-field-first.
  9454. @item tff
  9455. Mark the frame as top-field-first.
  9456. @item prog
  9457. Mark the frame as progressive.
  9458. @end table
  9459. @end table
  9460. @section showinfo
  9461. Show a line containing various information for each input video frame.
  9462. The input video is not modified.
  9463. The shown line contains a sequence of key/value pairs of the form
  9464. @var{key}:@var{value}.
  9465. The following values are shown in the output:
  9466. @table @option
  9467. @item n
  9468. The (sequential) number of the input frame, starting from 0.
  9469. @item pts
  9470. The Presentation TimeStamp of the input frame, expressed as a number of
  9471. time base units. The time base unit depends on the filter input pad.
  9472. @item pts_time
  9473. The Presentation TimeStamp of the input frame, expressed as a number of
  9474. seconds.
  9475. @item pos
  9476. The position of the frame in the input stream, or -1 if this information is
  9477. unavailable and/or meaningless (for example in case of synthetic video).
  9478. @item fmt
  9479. The pixel format name.
  9480. @item sar
  9481. The sample aspect ratio of the input frame, expressed in the form
  9482. @var{num}/@var{den}.
  9483. @item s
  9484. The size of the input frame. For the syntax of this option, check the
  9485. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9486. @item i
  9487. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9488. for bottom field first).
  9489. @item iskey
  9490. This is 1 if the frame is a key frame, 0 otherwise.
  9491. @item type
  9492. The picture type of the input frame ("I" for an I-frame, "P" for a
  9493. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9494. Also refer to the documentation of the @code{AVPictureType} enum and of
  9495. the @code{av_get_picture_type_char} function defined in
  9496. @file{libavutil/avutil.h}.
  9497. @item checksum
  9498. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9499. @item plane_checksum
  9500. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9501. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9502. @end table
  9503. @section showpalette
  9504. Displays the 256 colors palette of each frame. This filter is only relevant for
  9505. @var{pal8} pixel format frames.
  9506. It accepts the following option:
  9507. @table @option
  9508. @item s
  9509. Set the size of the box used to represent one palette color entry. Default is
  9510. @code{30} (for a @code{30x30} pixel box).
  9511. @end table
  9512. @section shuffleframes
  9513. Reorder and/or duplicate and/or drop video frames.
  9514. It accepts the following parameters:
  9515. @table @option
  9516. @item mapping
  9517. Set the destination indexes of input frames.
  9518. This is space or '|' separated list of indexes that maps input frames to output
  9519. frames. Number of indexes also sets maximal value that each index may have.
  9520. '-1' index have special meaning and that is to drop frame.
  9521. @end table
  9522. The first frame has the index 0. The default is to keep the input unchanged.
  9523. @subsection Examples
  9524. @itemize
  9525. @item
  9526. Swap second and third frame of every three frames of the input:
  9527. @example
  9528. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9529. @end example
  9530. @item
  9531. Swap 10th and 1st frame of every ten frames of the input:
  9532. @example
  9533. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9534. @end example
  9535. @end itemize
  9536. @section shuffleplanes
  9537. Reorder and/or duplicate video planes.
  9538. It accepts the following parameters:
  9539. @table @option
  9540. @item map0
  9541. The index of the input plane to be used as the first output plane.
  9542. @item map1
  9543. The index of the input plane to be used as the second output plane.
  9544. @item map2
  9545. The index of the input plane to be used as the third output plane.
  9546. @item map3
  9547. The index of the input plane to be used as the fourth output plane.
  9548. @end table
  9549. The first plane has the index 0. The default is to keep the input unchanged.
  9550. @subsection Examples
  9551. @itemize
  9552. @item
  9553. Swap the second and third planes of the input:
  9554. @example
  9555. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9556. @end example
  9557. @end itemize
  9558. @anchor{signalstats}
  9559. @section signalstats
  9560. Evaluate various visual metrics that assist in determining issues associated
  9561. with the digitization of analog video media.
  9562. By default the filter will log these metadata values:
  9563. @table @option
  9564. @item YMIN
  9565. Display the minimal Y value contained within the input frame. Expressed in
  9566. range of [0-255].
  9567. @item YLOW
  9568. Display the Y value at the 10% percentile within the input frame. Expressed in
  9569. range of [0-255].
  9570. @item YAVG
  9571. Display the average Y value within the input frame. Expressed in range of
  9572. [0-255].
  9573. @item YHIGH
  9574. Display the Y value at the 90% percentile within the input frame. Expressed in
  9575. range of [0-255].
  9576. @item YMAX
  9577. Display the maximum Y value contained within the input frame. Expressed in
  9578. range of [0-255].
  9579. @item UMIN
  9580. Display the minimal U value contained within the input frame. Expressed in
  9581. range of [0-255].
  9582. @item ULOW
  9583. Display the U value at the 10% percentile within the input frame. Expressed in
  9584. range of [0-255].
  9585. @item UAVG
  9586. Display the average U value within the input frame. Expressed in range of
  9587. [0-255].
  9588. @item UHIGH
  9589. Display the U value at the 90% percentile within the input frame. Expressed in
  9590. range of [0-255].
  9591. @item UMAX
  9592. Display the maximum U value contained within the input frame. Expressed in
  9593. range of [0-255].
  9594. @item VMIN
  9595. Display the minimal V value contained within the input frame. Expressed in
  9596. range of [0-255].
  9597. @item VLOW
  9598. Display the V value at the 10% percentile within the input frame. Expressed in
  9599. range of [0-255].
  9600. @item VAVG
  9601. Display the average V value within the input frame. Expressed in range of
  9602. [0-255].
  9603. @item VHIGH
  9604. Display the V value at the 90% percentile within the input frame. Expressed in
  9605. range of [0-255].
  9606. @item VMAX
  9607. Display the maximum V value contained within the input frame. Expressed in
  9608. range of [0-255].
  9609. @item SATMIN
  9610. Display the minimal saturation value contained within the input frame.
  9611. Expressed in range of [0-~181.02].
  9612. @item SATLOW
  9613. Display the saturation value at the 10% percentile within the input frame.
  9614. Expressed in range of [0-~181.02].
  9615. @item SATAVG
  9616. Display the average saturation value within the input frame. Expressed in range
  9617. of [0-~181.02].
  9618. @item SATHIGH
  9619. Display the saturation value at the 90% percentile within the input frame.
  9620. Expressed in range of [0-~181.02].
  9621. @item SATMAX
  9622. Display the maximum saturation value contained within the input frame.
  9623. Expressed in range of [0-~181.02].
  9624. @item HUEMED
  9625. Display the median value for hue within the input frame. Expressed in range of
  9626. [0-360].
  9627. @item HUEAVG
  9628. Display the average value for hue within the input frame. Expressed in range of
  9629. [0-360].
  9630. @item YDIF
  9631. Display the average of sample value difference between all values of the Y
  9632. plane in the current frame and corresponding values of the previous input frame.
  9633. Expressed in range of [0-255].
  9634. @item UDIF
  9635. Display the average of sample value difference between all values of the U
  9636. plane in the current frame and corresponding values of the previous input frame.
  9637. Expressed in range of [0-255].
  9638. @item VDIF
  9639. Display the average of sample value difference between all values of the V
  9640. plane in the current frame and corresponding values of the previous input frame.
  9641. Expressed in range of [0-255].
  9642. @item YBITDEPTH
  9643. Display bit depth of Y plane in current frame.
  9644. Expressed in range of [0-16].
  9645. @item UBITDEPTH
  9646. Display bit depth of U plane in current frame.
  9647. Expressed in range of [0-16].
  9648. @item VBITDEPTH
  9649. Display bit depth of V plane in current frame.
  9650. Expressed in range of [0-16].
  9651. @end table
  9652. The filter accepts the following options:
  9653. @table @option
  9654. @item stat
  9655. @item out
  9656. @option{stat} specify an additional form of image analysis.
  9657. @option{out} output video with the specified type of pixel highlighted.
  9658. Both options accept the following values:
  9659. @table @samp
  9660. @item tout
  9661. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9662. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9663. include the results of video dropouts, head clogs, or tape tracking issues.
  9664. @item vrep
  9665. Identify @var{vertical line repetition}. Vertical line repetition includes
  9666. similar rows of pixels within a frame. In born-digital video vertical line
  9667. repetition is common, but this pattern is uncommon in video digitized from an
  9668. analog source. When it occurs in video that results from the digitization of an
  9669. analog source it can indicate concealment from a dropout compensator.
  9670. @item brng
  9671. Identify pixels that fall outside of legal broadcast range.
  9672. @end table
  9673. @item color, c
  9674. Set the highlight color for the @option{out} option. The default color is
  9675. yellow.
  9676. @end table
  9677. @subsection Examples
  9678. @itemize
  9679. @item
  9680. Output data of various video metrics:
  9681. @example
  9682. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9683. @end example
  9684. @item
  9685. Output specific data about the minimum and maximum values of the Y plane per frame:
  9686. @example
  9687. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9688. @end example
  9689. @item
  9690. Playback video while highlighting pixels that are outside of broadcast range in red.
  9691. @example
  9692. ffplay example.mov -vf signalstats="out=brng:color=red"
  9693. @end example
  9694. @item
  9695. Playback video with signalstats metadata drawn over the frame.
  9696. @example
  9697. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9698. @end example
  9699. The contents of signalstat_drawtext.txt used in the command are:
  9700. @example
  9701. time %@{pts:hms@}
  9702. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9703. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9704. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9705. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9706. @end example
  9707. @end itemize
  9708. @anchor{smartblur}
  9709. @section smartblur
  9710. Blur the input video without impacting the outlines.
  9711. It accepts the following options:
  9712. @table @option
  9713. @item luma_radius, lr
  9714. Set the luma radius. The option value must be a float number in
  9715. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9716. used to blur the image (slower if larger). Default value is 1.0.
  9717. @item luma_strength, ls
  9718. Set the luma strength. The option value must be a float number
  9719. in the range [-1.0,1.0] that configures the blurring. A value included
  9720. in [0.0,1.0] will blur the image whereas a value included in
  9721. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9722. @item luma_threshold, lt
  9723. Set the luma threshold used as a coefficient to determine
  9724. whether a pixel should be blurred or not. The option value must be an
  9725. integer in the range [-30,30]. A value of 0 will filter all the image,
  9726. a value included in [0,30] will filter flat areas and a value included
  9727. in [-30,0] will filter edges. Default value is 0.
  9728. @item chroma_radius, cr
  9729. Set the chroma radius. The option value must be a float number in
  9730. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9731. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  9732. @item chroma_strength, cs
  9733. Set the chroma strength. The option value must be a float number
  9734. in the range [-1.0,1.0] that configures the blurring. A value included
  9735. in [0.0,1.0] will blur the image whereas a value included in
  9736. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  9737. @item chroma_threshold, ct
  9738. Set the chroma threshold used as a coefficient to determine
  9739. whether a pixel should be blurred or not. The option value must be an
  9740. integer in the range [-30,30]. A value of 0 will filter all the image,
  9741. a value included in [0,30] will filter flat areas and a value included
  9742. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  9743. @end table
  9744. If a chroma option is not explicitly set, the corresponding luma value
  9745. is set.
  9746. @section ssim
  9747. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9748. This filter takes in input two input videos, the first input is
  9749. considered the "main" source and is passed unchanged to the
  9750. output. The second input is used as a "reference" video for computing
  9751. the SSIM.
  9752. Both video inputs must have the same resolution and pixel format for
  9753. this filter to work correctly. Also it assumes that both inputs
  9754. have the same number of frames, which are compared one by one.
  9755. The filter stores the calculated SSIM of each frame.
  9756. The description of the accepted parameters follows.
  9757. @table @option
  9758. @item stats_file, f
  9759. If specified the filter will use the named file to save the SSIM of
  9760. each individual frame. When filename equals "-" the data is sent to
  9761. standard output.
  9762. @end table
  9763. The file printed if @var{stats_file} is selected, contains a sequence of
  9764. key/value pairs of the form @var{key}:@var{value} for each compared
  9765. couple of frames.
  9766. A description of each shown parameter follows:
  9767. @table @option
  9768. @item n
  9769. sequential number of the input frame, starting from 1
  9770. @item Y, U, V, R, G, B
  9771. SSIM of the compared frames for the component specified by the suffix.
  9772. @item All
  9773. SSIM of the compared frames for the whole frame.
  9774. @item dB
  9775. Same as above but in dB representation.
  9776. @end table
  9777. For example:
  9778. @example
  9779. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9780. [main][ref] ssim="stats_file=stats.log" [out]
  9781. @end example
  9782. On this example the input file being processed is compared with the
  9783. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9784. is stored in @file{stats.log}.
  9785. Another example with both psnr and ssim at same time:
  9786. @example
  9787. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9788. @end example
  9789. @section stereo3d
  9790. Convert between different stereoscopic image formats.
  9791. The filters accept the following options:
  9792. @table @option
  9793. @item in
  9794. Set stereoscopic image format of input.
  9795. Available values for input image formats are:
  9796. @table @samp
  9797. @item sbsl
  9798. side by side parallel (left eye left, right eye right)
  9799. @item sbsr
  9800. side by side crosseye (right eye left, left eye right)
  9801. @item sbs2l
  9802. side by side parallel with half width resolution
  9803. (left eye left, right eye right)
  9804. @item sbs2r
  9805. side by side crosseye with half width resolution
  9806. (right eye left, left eye right)
  9807. @item abl
  9808. above-below (left eye above, right eye below)
  9809. @item abr
  9810. above-below (right eye above, left eye below)
  9811. @item ab2l
  9812. above-below with half height resolution
  9813. (left eye above, right eye below)
  9814. @item ab2r
  9815. above-below with half height resolution
  9816. (right eye above, left eye below)
  9817. @item al
  9818. alternating frames (left eye first, right eye second)
  9819. @item ar
  9820. alternating frames (right eye first, left eye second)
  9821. @item irl
  9822. interleaved rows (left eye has top row, right eye starts on next row)
  9823. @item irr
  9824. interleaved rows (right eye has top row, left eye starts on next row)
  9825. @item icl
  9826. interleaved columns, left eye first
  9827. @item icr
  9828. interleaved columns, right eye first
  9829. Default value is @samp{sbsl}.
  9830. @end table
  9831. @item out
  9832. Set stereoscopic image format of output.
  9833. @table @samp
  9834. @item sbsl
  9835. side by side parallel (left eye left, right eye right)
  9836. @item sbsr
  9837. side by side crosseye (right eye left, left eye right)
  9838. @item sbs2l
  9839. side by side parallel with half width resolution
  9840. (left eye left, right eye right)
  9841. @item sbs2r
  9842. side by side crosseye with half width resolution
  9843. (right eye left, left eye right)
  9844. @item abl
  9845. above-below (left eye above, right eye below)
  9846. @item abr
  9847. above-below (right eye above, left eye below)
  9848. @item ab2l
  9849. above-below with half height resolution
  9850. (left eye above, right eye below)
  9851. @item ab2r
  9852. above-below with half height resolution
  9853. (right eye above, left eye below)
  9854. @item al
  9855. alternating frames (left eye first, right eye second)
  9856. @item ar
  9857. alternating frames (right eye first, left eye second)
  9858. @item irl
  9859. interleaved rows (left eye has top row, right eye starts on next row)
  9860. @item irr
  9861. interleaved rows (right eye has top row, left eye starts on next row)
  9862. @item arbg
  9863. anaglyph red/blue gray
  9864. (red filter on left eye, blue filter on right eye)
  9865. @item argg
  9866. anaglyph red/green gray
  9867. (red filter on left eye, green filter on right eye)
  9868. @item arcg
  9869. anaglyph red/cyan gray
  9870. (red filter on left eye, cyan filter on right eye)
  9871. @item arch
  9872. anaglyph red/cyan half colored
  9873. (red filter on left eye, cyan filter on right eye)
  9874. @item arcc
  9875. anaglyph red/cyan color
  9876. (red filter on left eye, cyan filter on right eye)
  9877. @item arcd
  9878. anaglyph red/cyan color optimized with the least squares projection of dubois
  9879. (red filter on left eye, cyan filter on right eye)
  9880. @item agmg
  9881. anaglyph green/magenta gray
  9882. (green filter on left eye, magenta filter on right eye)
  9883. @item agmh
  9884. anaglyph green/magenta half colored
  9885. (green filter on left eye, magenta filter on right eye)
  9886. @item agmc
  9887. anaglyph green/magenta colored
  9888. (green filter on left eye, magenta filter on right eye)
  9889. @item agmd
  9890. anaglyph green/magenta color optimized with the least squares projection of dubois
  9891. (green filter on left eye, magenta filter on right eye)
  9892. @item aybg
  9893. anaglyph yellow/blue gray
  9894. (yellow filter on left eye, blue filter on right eye)
  9895. @item aybh
  9896. anaglyph yellow/blue half colored
  9897. (yellow filter on left eye, blue filter on right eye)
  9898. @item aybc
  9899. anaglyph yellow/blue colored
  9900. (yellow filter on left eye, blue filter on right eye)
  9901. @item aybd
  9902. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9903. (yellow filter on left eye, blue filter on right eye)
  9904. @item ml
  9905. mono output (left eye only)
  9906. @item mr
  9907. mono output (right eye only)
  9908. @item chl
  9909. checkerboard, left eye first
  9910. @item chr
  9911. checkerboard, right eye first
  9912. @item icl
  9913. interleaved columns, left eye first
  9914. @item icr
  9915. interleaved columns, right eye first
  9916. @item hdmi
  9917. HDMI frame pack
  9918. @end table
  9919. Default value is @samp{arcd}.
  9920. @end table
  9921. @subsection Examples
  9922. @itemize
  9923. @item
  9924. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9925. @example
  9926. stereo3d=sbsl:aybd
  9927. @end example
  9928. @item
  9929. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9930. @example
  9931. stereo3d=abl:sbsr
  9932. @end example
  9933. @end itemize
  9934. @section streamselect, astreamselect
  9935. Select video or audio streams.
  9936. The filter accepts the following options:
  9937. @table @option
  9938. @item inputs
  9939. Set number of inputs. Default is 2.
  9940. @item map
  9941. Set input indexes to remap to outputs.
  9942. @end table
  9943. @subsection Commands
  9944. The @code{streamselect} and @code{astreamselect} filter supports the following
  9945. commands:
  9946. @table @option
  9947. @item map
  9948. Set input indexes to remap to outputs.
  9949. @end table
  9950. @subsection Examples
  9951. @itemize
  9952. @item
  9953. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9954. @example
  9955. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9956. @end example
  9957. @item
  9958. Same as above, but for audio:
  9959. @example
  9960. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9961. @end example
  9962. @end itemize
  9963. @section sobel
  9964. Apply sobel operator to input video stream.
  9965. The filter accepts the following option:
  9966. @table @option
  9967. @item planes
  9968. Set which planes will be processed, unprocessed planes will be copied.
  9969. By default value 0xf, all planes will be processed.
  9970. @item scale
  9971. Set value which will be multiplied with filtered result.
  9972. @item delta
  9973. Set value which will be added to filtered result.
  9974. @end table
  9975. @anchor{spp}
  9976. @section spp
  9977. Apply a simple postprocessing filter that compresses and decompresses the image
  9978. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9979. and average the results.
  9980. The filter accepts the following options:
  9981. @table @option
  9982. @item quality
  9983. Set quality. This option defines the number of levels for averaging. It accepts
  9984. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9985. effect. A value of @code{6} means the higher quality. For each increment of
  9986. that value the speed drops by a factor of approximately 2. Default value is
  9987. @code{3}.
  9988. @item qp
  9989. Force a constant quantization parameter. If not set, the filter will use the QP
  9990. from the video stream (if available).
  9991. @item mode
  9992. Set thresholding mode. Available modes are:
  9993. @table @samp
  9994. @item hard
  9995. Set hard thresholding (default).
  9996. @item soft
  9997. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9998. @end table
  9999. @item use_bframe_qp
  10000. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10001. option may cause flicker since the B-Frames have often larger QP. Default is
  10002. @code{0} (not enabled).
  10003. @end table
  10004. @anchor{subtitles}
  10005. @section subtitles
  10006. Draw subtitles on top of input video using the libass library.
  10007. To enable compilation of this filter you need to configure FFmpeg with
  10008. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10009. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10010. Alpha) subtitles format.
  10011. The filter accepts the following options:
  10012. @table @option
  10013. @item filename, f
  10014. Set the filename of the subtitle file to read. It must be specified.
  10015. @item original_size
  10016. Specify the size of the original video, the video for which the ASS file
  10017. was composed. For the syntax of this option, check the
  10018. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10019. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10020. correctly scale the fonts if the aspect ratio has been changed.
  10021. @item fontsdir
  10022. Set a directory path containing fonts that can be used by the filter.
  10023. These fonts will be used in addition to whatever the font provider uses.
  10024. @item charenc
  10025. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10026. useful if not UTF-8.
  10027. @item stream_index, si
  10028. Set subtitles stream index. @code{subtitles} filter only.
  10029. @item force_style
  10030. Override default style or script info parameters of the subtitles. It accepts a
  10031. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10032. @end table
  10033. If the first key is not specified, it is assumed that the first value
  10034. specifies the @option{filename}.
  10035. For example, to render the file @file{sub.srt} on top of the input
  10036. video, use the command:
  10037. @example
  10038. subtitles=sub.srt
  10039. @end example
  10040. which is equivalent to:
  10041. @example
  10042. subtitles=filename=sub.srt
  10043. @end example
  10044. To render the default subtitles stream from file @file{video.mkv}, use:
  10045. @example
  10046. subtitles=video.mkv
  10047. @end example
  10048. To render the second subtitles stream from that file, use:
  10049. @example
  10050. subtitles=video.mkv:si=1
  10051. @end example
  10052. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10053. @code{DejaVu Serif}, use:
  10054. @example
  10055. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10056. @end example
  10057. @section super2xsai
  10058. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10059. Interpolate) pixel art scaling algorithm.
  10060. Useful for enlarging pixel art images without reducing sharpness.
  10061. @section swaprect
  10062. Swap two rectangular objects in video.
  10063. This filter accepts the following options:
  10064. @table @option
  10065. @item w
  10066. Set object width.
  10067. @item h
  10068. Set object height.
  10069. @item x1
  10070. Set 1st rect x coordinate.
  10071. @item y1
  10072. Set 1st rect y coordinate.
  10073. @item x2
  10074. Set 2nd rect x coordinate.
  10075. @item y2
  10076. Set 2nd rect y coordinate.
  10077. All expressions are evaluated once for each frame.
  10078. @end table
  10079. The all options are expressions containing the following constants:
  10080. @table @option
  10081. @item w
  10082. @item h
  10083. The input width and height.
  10084. @item a
  10085. same as @var{w} / @var{h}
  10086. @item sar
  10087. input sample aspect ratio
  10088. @item dar
  10089. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10090. @item n
  10091. The number of the input frame, starting from 0.
  10092. @item t
  10093. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10094. @item pos
  10095. the position in the file of the input frame, NAN if unknown
  10096. @end table
  10097. @section swapuv
  10098. Swap U & V plane.
  10099. @section telecine
  10100. Apply telecine process to the video.
  10101. This filter accepts the following options:
  10102. @table @option
  10103. @item first_field
  10104. @table @samp
  10105. @item top, t
  10106. top field first
  10107. @item bottom, b
  10108. bottom field first
  10109. The default value is @code{top}.
  10110. @end table
  10111. @item pattern
  10112. A string of numbers representing the pulldown pattern you wish to apply.
  10113. The default value is @code{23}.
  10114. @end table
  10115. @example
  10116. Some typical patterns:
  10117. NTSC output (30i):
  10118. 27.5p: 32222
  10119. 24p: 23 (classic)
  10120. 24p: 2332 (preferred)
  10121. 20p: 33
  10122. 18p: 334
  10123. 16p: 3444
  10124. PAL output (25i):
  10125. 27.5p: 12222
  10126. 24p: 222222222223 ("Euro pulldown")
  10127. 16.67p: 33
  10128. 16p: 33333334
  10129. @end example
  10130. @section threshold
  10131. Apply threshold effect to video stream.
  10132. This filter needs four video streams to perform thresholding.
  10133. First stream is stream we are filtering.
  10134. Second stream is holding threshold values, third stream is holding min values,
  10135. and last, fourth stream is holding max values.
  10136. The filter accepts the following option:
  10137. @table @option
  10138. @item planes
  10139. Set which planes will be processed, unprocessed planes will be copied.
  10140. By default value 0xf, all planes will be processed.
  10141. @end table
  10142. For example if first stream pixel's component value is less then threshold value
  10143. of pixel component from 2nd threshold stream, third stream value will picked,
  10144. otherwise fourth stream pixel component value will be picked.
  10145. Using color source filter one can perform various types of thresholding:
  10146. @subsection Examples
  10147. @itemize
  10148. @item
  10149. Binary threshold, using gray color as threshold:
  10150. @example
  10151. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10152. @end example
  10153. @item
  10154. Inverted binary threshold, using gray color as threshold:
  10155. @example
  10156. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10157. @end example
  10158. @item
  10159. Truncate binary threshold, using gray color as threshold:
  10160. @example
  10161. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10162. @end example
  10163. @item
  10164. Threshold to zero, using gray color as threshold:
  10165. @example
  10166. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10167. @end example
  10168. @item
  10169. Inverted threshold to zero, using gray color as threshold:
  10170. @example
  10171. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10172. @end example
  10173. @end itemize
  10174. @section thumbnail
  10175. Select the most representative frame in a given sequence of consecutive frames.
  10176. The filter accepts the following options:
  10177. @table @option
  10178. @item n
  10179. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10180. will pick one of them, and then handle the next batch of @var{n} frames until
  10181. the end. Default is @code{100}.
  10182. @end table
  10183. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10184. value will result in a higher memory usage, so a high value is not recommended.
  10185. @subsection Examples
  10186. @itemize
  10187. @item
  10188. Extract one picture each 50 frames:
  10189. @example
  10190. thumbnail=50
  10191. @end example
  10192. @item
  10193. Complete example of a thumbnail creation with @command{ffmpeg}:
  10194. @example
  10195. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10196. @end example
  10197. @end itemize
  10198. @section tile
  10199. Tile several successive frames together.
  10200. The filter accepts the following options:
  10201. @table @option
  10202. @item layout
  10203. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10204. this option, check the
  10205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10206. @item nb_frames
  10207. Set the maximum number of frames to render in the given area. It must be less
  10208. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10209. the area will be used.
  10210. @item margin
  10211. Set the outer border margin in pixels.
  10212. @item padding
  10213. Set the inner border thickness (i.e. the number of pixels between frames). For
  10214. more advanced padding options (such as having different values for the edges),
  10215. refer to the pad video filter.
  10216. @item color
  10217. Specify the color of the unused area. For the syntax of this option, check the
  10218. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10219. is "black".
  10220. @end table
  10221. @subsection Examples
  10222. @itemize
  10223. @item
  10224. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10225. @example
  10226. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10227. @end example
  10228. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10229. duplicating each output frame to accommodate the originally detected frame
  10230. rate.
  10231. @item
  10232. Display @code{5} pictures in an area of @code{3x2} frames,
  10233. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10234. mixed flat and named options:
  10235. @example
  10236. tile=3x2:nb_frames=5:padding=7:margin=2
  10237. @end example
  10238. @end itemize
  10239. @section tinterlace
  10240. Perform various types of temporal field interlacing.
  10241. Frames are counted starting from 1, so the first input frame is
  10242. considered odd.
  10243. The filter accepts the following options:
  10244. @table @option
  10245. @item mode
  10246. Specify the mode of the interlacing. This option can also be specified
  10247. as a value alone. See below for a list of values for this option.
  10248. Available values are:
  10249. @table @samp
  10250. @item merge, 0
  10251. Move odd frames into the upper field, even into the lower field,
  10252. generating a double height frame at half frame rate.
  10253. @example
  10254. ------> time
  10255. Input:
  10256. Frame 1 Frame 2 Frame 3 Frame 4
  10257. 11111 22222 33333 44444
  10258. 11111 22222 33333 44444
  10259. 11111 22222 33333 44444
  10260. 11111 22222 33333 44444
  10261. Output:
  10262. 11111 33333
  10263. 22222 44444
  10264. 11111 33333
  10265. 22222 44444
  10266. 11111 33333
  10267. 22222 44444
  10268. 11111 33333
  10269. 22222 44444
  10270. @end example
  10271. @item drop_even, 1
  10272. Only output odd frames, even frames are dropped, generating a frame with
  10273. unchanged height at half frame rate.
  10274. @example
  10275. ------> time
  10276. Input:
  10277. Frame 1 Frame 2 Frame 3 Frame 4
  10278. 11111 22222 33333 44444
  10279. 11111 22222 33333 44444
  10280. 11111 22222 33333 44444
  10281. 11111 22222 33333 44444
  10282. Output:
  10283. 11111 33333
  10284. 11111 33333
  10285. 11111 33333
  10286. 11111 33333
  10287. @end example
  10288. @item drop_odd, 2
  10289. Only output even frames, odd frames are dropped, generating a frame with
  10290. unchanged height at half frame rate.
  10291. @example
  10292. ------> time
  10293. Input:
  10294. Frame 1 Frame 2 Frame 3 Frame 4
  10295. 11111 22222 33333 44444
  10296. 11111 22222 33333 44444
  10297. 11111 22222 33333 44444
  10298. 11111 22222 33333 44444
  10299. Output:
  10300. 22222 44444
  10301. 22222 44444
  10302. 22222 44444
  10303. 22222 44444
  10304. @end example
  10305. @item pad, 3
  10306. Expand each frame to full height, but pad alternate lines with black,
  10307. generating a frame with double height at the same input frame rate.
  10308. @example
  10309. ------> time
  10310. Input:
  10311. Frame 1 Frame 2 Frame 3 Frame 4
  10312. 11111 22222 33333 44444
  10313. 11111 22222 33333 44444
  10314. 11111 22222 33333 44444
  10315. 11111 22222 33333 44444
  10316. Output:
  10317. 11111 ..... 33333 .....
  10318. ..... 22222 ..... 44444
  10319. 11111 ..... 33333 .....
  10320. ..... 22222 ..... 44444
  10321. 11111 ..... 33333 .....
  10322. ..... 22222 ..... 44444
  10323. 11111 ..... 33333 .....
  10324. ..... 22222 ..... 44444
  10325. @end example
  10326. @item interleave_top, 4
  10327. Interleave the upper field from odd frames with the lower field from
  10328. even frames, generating a frame with unchanged height at half frame rate.
  10329. @example
  10330. ------> time
  10331. Input:
  10332. Frame 1 Frame 2 Frame 3 Frame 4
  10333. 11111<- 22222 33333<- 44444
  10334. 11111 22222<- 33333 44444<-
  10335. 11111<- 22222 33333<- 44444
  10336. 11111 22222<- 33333 44444<-
  10337. Output:
  10338. 11111 33333
  10339. 22222 44444
  10340. 11111 33333
  10341. 22222 44444
  10342. @end example
  10343. @item interleave_bottom, 5
  10344. Interleave the lower field from odd frames with the upper field from
  10345. even frames, generating a frame with unchanged height at half frame rate.
  10346. @example
  10347. ------> time
  10348. Input:
  10349. Frame 1 Frame 2 Frame 3 Frame 4
  10350. 11111 22222<- 33333 44444<-
  10351. 11111<- 22222 33333<- 44444
  10352. 11111 22222<- 33333 44444<-
  10353. 11111<- 22222 33333<- 44444
  10354. Output:
  10355. 22222 44444
  10356. 11111 33333
  10357. 22222 44444
  10358. 11111 33333
  10359. @end example
  10360. @item interlacex2, 6
  10361. Double frame rate with unchanged height. Frames are inserted each
  10362. containing the second temporal field from the previous input frame and
  10363. the first temporal field from the next input frame. This mode relies on
  10364. the top_field_first flag. Useful for interlaced video displays with no
  10365. field synchronisation.
  10366. @example
  10367. ------> time
  10368. Input:
  10369. Frame 1 Frame 2 Frame 3 Frame 4
  10370. 11111 22222 33333 44444
  10371. 11111 22222 33333 44444
  10372. 11111 22222 33333 44444
  10373. 11111 22222 33333 44444
  10374. Output:
  10375. 11111 22222 22222 33333 33333 44444 44444
  10376. 11111 11111 22222 22222 33333 33333 44444
  10377. 11111 22222 22222 33333 33333 44444 44444
  10378. 11111 11111 22222 22222 33333 33333 44444
  10379. @end example
  10380. @item mergex2, 7
  10381. Move odd frames into the upper field, even into the lower field,
  10382. generating a double height frame at same frame rate.
  10383. @example
  10384. ------> time
  10385. Input:
  10386. Frame 1 Frame 2 Frame 3 Frame 4
  10387. 11111 22222 33333 44444
  10388. 11111 22222 33333 44444
  10389. 11111 22222 33333 44444
  10390. 11111 22222 33333 44444
  10391. Output:
  10392. 11111 33333 33333 55555
  10393. 22222 22222 44444 44444
  10394. 11111 33333 33333 55555
  10395. 22222 22222 44444 44444
  10396. 11111 33333 33333 55555
  10397. 22222 22222 44444 44444
  10398. 11111 33333 33333 55555
  10399. 22222 22222 44444 44444
  10400. @end example
  10401. @end table
  10402. Numeric values are deprecated but are accepted for backward
  10403. compatibility reasons.
  10404. Default mode is @code{merge}.
  10405. @item flags
  10406. Specify flags influencing the filter process.
  10407. Available value for @var{flags} is:
  10408. @table @option
  10409. @item low_pass_filter, vlfp
  10410. Enable vertical low-pass filtering in the filter.
  10411. Vertical low-pass filtering is required when creating an interlaced
  10412. destination from a progressive source which contains high-frequency
  10413. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10414. patterning.
  10415. Vertical low-pass filtering can only be enabled for @option{mode}
  10416. @var{interleave_top} and @var{interleave_bottom}.
  10417. @end table
  10418. @end table
  10419. @section transpose
  10420. Transpose rows with columns in the input video and optionally flip it.
  10421. It accepts the following parameters:
  10422. @table @option
  10423. @item dir
  10424. Specify the transposition direction.
  10425. Can assume the following values:
  10426. @table @samp
  10427. @item 0, 4, cclock_flip
  10428. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10429. @example
  10430. L.R L.l
  10431. . . -> . .
  10432. l.r R.r
  10433. @end example
  10434. @item 1, 5, clock
  10435. Rotate by 90 degrees clockwise, that is:
  10436. @example
  10437. L.R l.L
  10438. . . -> . .
  10439. l.r r.R
  10440. @end example
  10441. @item 2, 6, cclock
  10442. Rotate by 90 degrees counterclockwise, that is:
  10443. @example
  10444. L.R R.r
  10445. . . -> . .
  10446. l.r L.l
  10447. @end example
  10448. @item 3, 7, clock_flip
  10449. Rotate by 90 degrees clockwise and vertically flip, that is:
  10450. @example
  10451. L.R r.R
  10452. . . -> . .
  10453. l.r l.L
  10454. @end example
  10455. @end table
  10456. For values between 4-7, the transposition is only done if the input
  10457. video geometry is portrait and not landscape. These values are
  10458. deprecated, the @code{passthrough} option should be used instead.
  10459. Numerical values are deprecated, and should be dropped in favor of
  10460. symbolic constants.
  10461. @item passthrough
  10462. Do not apply the transposition if the input geometry matches the one
  10463. specified by the specified value. It accepts the following values:
  10464. @table @samp
  10465. @item none
  10466. Always apply transposition.
  10467. @item portrait
  10468. Preserve portrait geometry (when @var{height} >= @var{width}).
  10469. @item landscape
  10470. Preserve landscape geometry (when @var{width} >= @var{height}).
  10471. @end table
  10472. Default value is @code{none}.
  10473. @end table
  10474. For example to rotate by 90 degrees clockwise and preserve portrait
  10475. layout:
  10476. @example
  10477. transpose=dir=1:passthrough=portrait
  10478. @end example
  10479. The command above can also be specified as:
  10480. @example
  10481. transpose=1:portrait
  10482. @end example
  10483. @section trim
  10484. Trim the input so that the output contains one continuous subpart of the input.
  10485. It accepts the following parameters:
  10486. @table @option
  10487. @item start
  10488. Specify the time of the start of the kept section, i.e. the frame with the
  10489. timestamp @var{start} will be the first frame in the output.
  10490. @item end
  10491. Specify the time of the first frame that will be dropped, i.e. the frame
  10492. immediately preceding the one with the timestamp @var{end} will be the last
  10493. frame in the output.
  10494. @item start_pts
  10495. This is the same as @var{start}, except this option sets the start timestamp
  10496. in timebase units instead of seconds.
  10497. @item end_pts
  10498. This is the same as @var{end}, except this option sets the end timestamp
  10499. in timebase units instead of seconds.
  10500. @item duration
  10501. The maximum duration of the output in seconds.
  10502. @item start_frame
  10503. The number of the first frame that should be passed to the output.
  10504. @item end_frame
  10505. The number of the first frame that should be dropped.
  10506. @end table
  10507. @option{start}, @option{end}, and @option{duration} are expressed as time
  10508. duration specifications; see
  10509. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10510. for the accepted syntax.
  10511. Note that the first two sets of the start/end options and the @option{duration}
  10512. option look at the frame timestamp, while the _frame variants simply count the
  10513. frames that pass through the filter. Also note that this filter does not modify
  10514. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10515. setpts filter after the trim filter.
  10516. If multiple start or end options are set, this filter tries to be greedy and
  10517. keep all the frames that match at least one of the specified constraints. To keep
  10518. only the part that matches all the constraints at once, chain multiple trim
  10519. filters.
  10520. The defaults are such that all the input is kept. So it is possible to set e.g.
  10521. just the end values to keep everything before the specified time.
  10522. Examples:
  10523. @itemize
  10524. @item
  10525. Drop everything except the second minute of input:
  10526. @example
  10527. ffmpeg -i INPUT -vf trim=60:120
  10528. @end example
  10529. @item
  10530. Keep only the first second:
  10531. @example
  10532. ffmpeg -i INPUT -vf trim=duration=1
  10533. @end example
  10534. @end itemize
  10535. @anchor{unsharp}
  10536. @section unsharp
  10537. Sharpen or blur the input video.
  10538. It accepts the following parameters:
  10539. @table @option
  10540. @item luma_msize_x, lx
  10541. Set the luma matrix horizontal size. It must be an odd integer between
  10542. 3 and 23. The default value is 5.
  10543. @item luma_msize_y, ly
  10544. Set the luma matrix vertical size. It must be an odd integer between 3
  10545. and 23. The default value is 5.
  10546. @item luma_amount, la
  10547. Set the luma effect strength. It must be a floating point number, reasonable
  10548. values lay between -1.5 and 1.5.
  10549. Negative values will blur the input video, while positive values will
  10550. sharpen it, a value of zero will disable the effect.
  10551. Default value is 1.0.
  10552. @item chroma_msize_x, cx
  10553. Set the chroma matrix horizontal size. It must be an odd integer
  10554. between 3 and 23. The default value is 5.
  10555. @item chroma_msize_y, cy
  10556. Set the chroma matrix vertical size. It must be an odd integer
  10557. between 3 and 23. The default value is 5.
  10558. @item chroma_amount, ca
  10559. Set the chroma effect strength. It must be a floating point number, reasonable
  10560. values lay between -1.5 and 1.5.
  10561. Negative values will blur the input video, while positive values will
  10562. sharpen it, a value of zero will disable the effect.
  10563. Default value is 0.0.
  10564. @item opencl
  10565. If set to 1, specify using OpenCL capabilities, only available if
  10566. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10567. @end table
  10568. All parameters are optional and default to the equivalent of the
  10569. string '5:5:1.0:5:5:0.0'.
  10570. @subsection Examples
  10571. @itemize
  10572. @item
  10573. Apply strong luma sharpen effect:
  10574. @example
  10575. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10576. @end example
  10577. @item
  10578. Apply a strong blur of both luma and chroma parameters:
  10579. @example
  10580. unsharp=7:7:-2:7:7:-2
  10581. @end example
  10582. @end itemize
  10583. @section uspp
  10584. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10585. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10586. shifts and average the results.
  10587. The way this differs from the behavior of spp is that uspp actually encodes &
  10588. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10589. DCT similar to MJPEG.
  10590. The filter accepts the following options:
  10591. @table @option
  10592. @item quality
  10593. Set quality. This option defines the number of levels for averaging. It accepts
  10594. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10595. effect. A value of @code{8} means the higher quality. For each increment of
  10596. that value the speed drops by a factor of approximately 2. Default value is
  10597. @code{3}.
  10598. @item qp
  10599. Force a constant quantization parameter. If not set, the filter will use the QP
  10600. from the video stream (if available).
  10601. @end table
  10602. @section vaguedenoiser
  10603. Apply a wavelet based denoiser.
  10604. It transforms each frame from the video input into the wavelet domain,
  10605. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10606. the obtained coefficients. It does an inverse wavelet transform after.
  10607. Due to wavelet properties, it should give a nice smoothed result, and
  10608. reduced noise, without blurring picture features.
  10609. This filter accepts the following options:
  10610. @table @option
  10611. @item threshold
  10612. The filtering strength. The higher, the more filtered the video will be.
  10613. Hard thresholding can use a higher threshold than soft thresholding
  10614. before the video looks overfiltered.
  10615. @item method
  10616. The filtering method the filter will use.
  10617. It accepts the following values:
  10618. @table @samp
  10619. @item hard
  10620. All values under the threshold will be zeroed.
  10621. @item soft
  10622. All values under the threshold will be zeroed. All values above will be
  10623. reduced by the threshold.
  10624. @item garrote
  10625. Scales or nullifies coefficients - intermediary between (more) soft and
  10626. (less) hard thresholding.
  10627. @end table
  10628. @item nsteps
  10629. Number of times, the wavelet will decompose the picture. Picture can't
  10630. be decomposed beyond a particular point (typically, 8 for a 640x480
  10631. frame - as 2^9 = 512 > 480)
  10632. @item percent
  10633. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10634. @item planes
  10635. A list of the planes to process. By default all planes are processed.
  10636. @end table
  10637. @section vectorscope
  10638. Display 2 color component values in the two dimensional graph (which is called
  10639. a vectorscope).
  10640. This filter accepts the following options:
  10641. @table @option
  10642. @item mode, m
  10643. Set vectorscope mode.
  10644. It accepts the following values:
  10645. @table @samp
  10646. @item gray
  10647. Gray values are displayed on graph, higher brightness means more pixels have
  10648. same component color value on location in graph. This is the default mode.
  10649. @item color
  10650. Gray values are displayed on graph. Surrounding pixels values which are not
  10651. present in video frame are drawn in gradient of 2 color components which are
  10652. set by option @code{x} and @code{y}. The 3rd color component is static.
  10653. @item color2
  10654. Actual color components values present in video frame are displayed on graph.
  10655. @item color3
  10656. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10657. on graph increases value of another color component, which is luminance by
  10658. default values of @code{x} and @code{y}.
  10659. @item color4
  10660. Actual colors present in video frame are displayed on graph. If two different
  10661. colors map to same position on graph then color with higher value of component
  10662. not present in graph is picked.
  10663. @item color5
  10664. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10665. component picked from radial gradient.
  10666. @end table
  10667. @item x
  10668. Set which color component will be represented on X-axis. Default is @code{1}.
  10669. @item y
  10670. Set which color component will be represented on Y-axis. Default is @code{2}.
  10671. @item intensity, i
  10672. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10673. of color component which represents frequency of (X, Y) location in graph.
  10674. @item envelope, e
  10675. @table @samp
  10676. @item none
  10677. No envelope, this is default.
  10678. @item instant
  10679. Instant envelope, even darkest single pixel will be clearly highlighted.
  10680. @item peak
  10681. Hold maximum and minimum values presented in graph over time. This way you
  10682. can still spot out of range values without constantly looking at vectorscope.
  10683. @item peak+instant
  10684. Peak and instant envelope combined together.
  10685. @end table
  10686. @item graticule, g
  10687. Set what kind of graticule to draw.
  10688. @table @samp
  10689. @item none
  10690. @item green
  10691. @item color
  10692. @end table
  10693. @item opacity, o
  10694. Set graticule opacity.
  10695. @item flags, f
  10696. Set graticule flags.
  10697. @table @samp
  10698. @item white
  10699. Draw graticule for white point.
  10700. @item black
  10701. Draw graticule for black point.
  10702. @item name
  10703. Draw color points short names.
  10704. @end table
  10705. @item bgopacity, b
  10706. Set background opacity.
  10707. @item lthreshold, l
  10708. Set low threshold for color component not represented on X or Y axis.
  10709. Values lower than this value will be ignored. Default is 0.
  10710. Note this value is multiplied with actual max possible value one pixel component
  10711. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10712. is 0.1 * 255 = 25.
  10713. @item hthreshold, h
  10714. Set high threshold for color component not represented on X or Y axis.
  10715. Values higher than this value will be ignored. Default is 1.
  10716. Note this value is multiplied with actual max possible value one pixel component
  10717. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10718. is 0.9 * 255 = 230.
  10719. @item colorspace, c
  10720. Set what kind of colorspace to use when drawing graticule.
  10721. @table @samp
  10722. @item auto
  10723. @item 601
  10724. @item 709
  10725. @end table
  10726. Default is auto.
  10727. @end table
  10728. @anchor{vidstabdetect}
  10729. @section vidstabdetect
  10730. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10731. @ref{vidstabtransform} for pass 2.
  10732. This filter generates a file with relative translation and rotation
  10733. transform information about subsequent frames, which is then used by
  10734. the @ref{vidstabtransform} filter.
  10735. To enable compilation of this filter you need to configure FFmpeg with
  10736. @code{--enable-libvidstab}.
  10737. This filter accepts the following options:
  10738. @table @option
  10739. @item result
  10740. Set the path to the file used to write the transforms information.
  10741. Default value is @file{transforms.trf}.
  10742. @item shakiness
  10743. Set how shaky the video is and how quick the camera is. It accepts an
  10744. integer in the range 1-10, a value of 1 means little shakiness, a
  10745. value of 10 means strong shakiness. Default value is 5.
  10746. @item accuracy
  10747. Set the accuracy of the detection process. It must be a value in the
  10748. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10749. accuracy. Default value is 15.
  10750. @item stepsize
  10751. Set stepsize of the search process. The region around minimum is
  10752. scanned with 1 pixel resolution. Default value is 6.
  10753. @item mincontrast
  10754. Set minimum contrast. Below this value a local measurement field is
  10755. discarded. Must be a floating point value in the range 0-1. Default
  10756. value is 0.3.
  10757. @item tripod
  10758. Set reference frame number for tripod mode.
  10759. If enabled, the motion of the frames is compared to a reference frame
  10760. in the filtered stream, identified by the specified number. The idea
  10761. is to compensate all movements in a more-or-less static scene and keep
  10762. the camera view absolutely still.
  10763. If set to 0, it is disabled. The frames are counted starting from 1.
  10764. @item show
  10765. Show fields and transforms in the resulting frames. It accepts an
  10766. integer in the range 0-2. Default value is 0, which disables any
  10767. visualization.
  10768. @end table
  10769. @subsection Examples
  10770. @itemize
  10771. @item
  10772. Use default values:
  10773. @example
  10774. vidstabdetect
  10775. @end example
  10776. @item
  10777. Analyze strongly shaky movie and put the results in file
  10778. @file{mytransforms.trf}:
  10779. @example
  10780. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10781. @end example
  10782. @item
  10783. Visualize the result of internal transformations in the resulting
  10784. video:
  10785. @example
  10786. vidstabdetect=show=1
  10787. @end example
  10788. @item
  10789. Analyze a video with medium shakiness using @command{ffmpeg}:
  10790. @example
  10791. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10792. @end example
  10793. @end itemize
  10794. @anchor{vidstabtransform}
  10795. @section vidstabtransform
  10796. Video stabilization/deshaking: pass 2 of 2,
  10797. see @ref{vidstabdetect} for pass 1.
  10798. Read a file with transform information for each frame and
  10799. apply/compensate them. Together with the @ref{vidstabdetect}
  10800. filter this can be used to deshake videos. See also
  10801. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10802. the @ref{unsharp} filter, see below.
  10803. To enable compilation of this filter you need to configure FFmpeg with
  10804. @code{--enable-libvidstab}.
  10805. @subsection Options
  10806. @table @option
  10807. @item input
  10808. Set path to the file used to read the transforms. Default value is
  10809. @file{transforms.trf}.
  10810. @item smoothing
  10811. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10812. camera movements. Default value is 10.
  10813. For example a number of 10 means that 21 frames are used (10 in the
  10814. past and 10 in the future) to smoothen the motion in the video. A
  10815. larger value leads to a smoother video, but limits the acceleration of
  10816. the camera (pan/tilt movements). 0 is a special case where a static
  10817. camera is simulated.
  10818. @item optalgo
  10819. Set the camera path optimization algorithm.
  10820. Accepted values are:
  10821. @table @samp
  10822. @item gauss
  10823. gaussian kernel low-pass filter on camera motion (default)
  10824. @item avg
  10825. averaging on transformations
  10826. @end table
  10827. @item maxshift
  10828. Set maximal number of pixels to translate frames. Default value is -1,
  10829. meaning no limit.
  10830. @item maxangle
  10831. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10832. value is -1, meaning no limit.
  10833. @item crop
  10834. Specify how to deal with borders that may be visible due to movement
  10835. compensation.
  10836. Available values are:
  10837. @table @samp
  10838. @item keep
  10839. keep image information from previous frame (default)
  10840. @item black
  10841. fill the border black
  10842. @end table
  10843. @item invert
  10844. Invert transforms if set to 1. Default value is 0.
  10845. @item relative
  10846. Consider transforms as relative to previous frame if set to 1,
  10847. absolute if set to 0. Default value is 0.
  10848. @item zoom
  10849. Set percentage to zoom. A positive value will result in a zoom-in
  10850. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10851. zoom).
  10852. @item optzoom
  10853. Set optimal zooming to avoid borders.
  10854. Accepted values are:
  10855. @table @samp
  10856. @item 0
  10857. disabled
  10858. @item 1
  10859. optimal static zoom value is determined (only very strong movements
  10860. will lead to visible borders) (default)
  10861. @item 2
  10862. optimal adaptive zoom value is determined (no borders will be
  10863. visible), see @option{zoomspeed}
  10864. @end table
  10865. Note that the value given at zoom is added to the one calculated here.
  10866. @item zoomspeed
  10867. Set percent to zoom maximally each frame (enabled when
  10868. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10869. 0.25.
  10870. @item interpol
  10871. Specify type of interpolation.
  10872. Available values are:
  10873. @table @samp
  10874. @item no
  10875. no interpolation
  10876. @item linear
  10877. linear only horizontal
  10878. @item bilinear
  10879. linear in both directions (default)
  10880. @item bicubic
  10881. cubic in both directions (slow)
  10882. @end table
  10883. @item tripod
  10884. Enable virtual tripod mode if set to 1, which is equivalent to
  10885. @code{relative=0:smoothing=0}. Default value is 0.
  10886. Use also @code{tripod} option of @ref{vidstabdetect}.
  10887. @item debug
  10888. Increase log verbosity if set to 1. Also the detected global motions
  10889. are written to the temporary file @file{global_motions.trf}. Default
  10890. value is 0.
  10891. @end table
  10892. @subsection Examples
  10893. @itemize
  10894. @item
  10895. Use @command{ffmpeg} for a typical stabilization with default values:
  10896. @example
  10897. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10898. @end example
  10899. Note the use of the @ref{unsharp} filter which is always recommended.
  10900. @item
  10901. Zoom in a bit more and load transform data from a given file:
  10902. @example
  10903. vidstabtransform=zoom=5:input="mytransforms.trf"
  10904. @end example
  10905. @item
  10906. Smoothen the video even more:
  10907. @example
  10908. vidstabtransform=smoothing=30
  10909. @end example
  10910. @end itemize
  10911. @section vflip
  10912. Flip the input video vertically.
  10913. For example, to vertically flip a video with @command{ffmpeg}:
  10914. @example
  10915. ffmpeg -i in.avi -vf "vflip" out.avi
  10916. @end example
  10917. @anchor{vignette}
  10918. @section vignette
  10919. Make or reverse a natural vignetting effect.
  10920. The filter accepts the following options:
  10921. @table @option
  10922. @item angle, a
  10923. Set lens angle expression as a number of radians.
  10924. The value is clipped in the @code{[0,PI/2]} range.
  10925. Default value: @code{"PI/5"}
  10926. @item x0
  10927. @item y0
  10928. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10929. by default.
  10930. @item mode
  10931. Set forward/backward mode.
  10932. Available modes are:
  10933. @table @samp
  10934. @item forward
  10935. The larger the distance from the central point, the darker the image becomes.
  10936. @item backward
  10937. The larger the distance from the central point, the brighter the image becomes.
  10938. This can be used to reverse a vignette effect, though there is no automatic
  10939. detection to extract the lens @option{angle} and other settings (yet). It can
  10940. also be used to create a burning effect.
  10941. @end table
  10942. Default value is @samp{forward}.
  10943. @item eval
  10944. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10945. It accepts the following values:
  10946. @table @samp
  10947. @item init
  10948. Evaluate expressions only once during the filter initialization.
  10949. @item frame
  10950. Evaluate expressions for each incoming frame. This is way slower than the
  10951. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10952. allows advanced dynamic expressions.
  10953. @end table
  10954. Default value is @samp{init}.
  10955. @item dither
  10956. Set dithering to reduce the circular banding effects. Default is @code{1}
  10957. (enabled).
  10958. @item aspect
  10959. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10960. Setting this value to the SAR of the input will make a rectangular vignetting
  10961. following the dimensions of the video.
  10962. Default is @code{1/1}.
  10963. @end table
  10964. @subsection Expressions
  10965. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10966. following parameters.
  10967. @table @option
  10968. @item w
  10969. @item h
  10970. input width and height
  10971. @item n
  10972. the number of input frame, starting from 0
  10973. @item pts
  10974. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10975. @var{TB} units, NAN if undefined
  10976. @item r
  10977. frame rate of the input video, NAN if the input frame rate is unknown
  10978. @item t
  10979. the PTS (Presentation TimeStamp) of the filtered video frame,
  10980. expressed in seconds, NAN if undefined
  10981. @item tb
  10982. time base of the input video
  10983. @end table
  10984. @subsection Examples
  10985. @itemize
  10986. @item
  10987. Apply simple strong vignetting effect:
  10988. @example
  10989. vignette=PI/4
  10990. @end example
  10991. @item
  10992. Make a flickering vignetting:
  10993. @example
  10994. vignette='PI/4+random(1)*PI/50':eval=frame
  10995. @end example
  10996. @end itemize
  10997. @section vstack
  10998. Stack input videos vertically.
  10999. All streams must be of same pixel format and of same width.
  11000. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11001. to create same output.
  11002. The filter accept the following option:
  11003. @table @option
  11004. @item inputs
  11005. Set number of input streams. Default is 2.
  11006. @item shortest
  11007. If set to 1, force the output to terminate when the shortest input
  11008. terminates. Default value is 0.
  11009. @end table
  11010. @section w3fdif
  11011. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11012. Deinterlacing Filter").
  11013. Based on the process described by Martin Weston for BBC R&D, and
  11014. implemented based on the de-interlace algorithm written by Jim
  11015. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11016. uses filter coefficients calculated by BBC R&D.
  11017. There are two sets of filter coefficients, so called "simple":
  11018. and "complex". Which set of filter coefficients is used can
  11019. be set by passing an optional parameter:
  11020. @table @option
  11021. @item filter
  11022. Set the interlacing filter coefficients. Accepts one of the following values:
  11023. @table @samp
  11024. @item simple
  11025. Simple filter coefficient set.
  11026. @item complex
  11027. More-complex filter coefficient set.
  11028. @end table
  11029. Default value is @samp{complex}.
  11030. @item deint
  11031. Specify which frames to deinterlace. Accept one of the following values:
  11032. @table @samp
  11033. @item all
  11034. Deinterlace all frames,
  11035. @item interlaced
  11036. Only deinterlace frames marked as interlaced.
  11037. @end table
  11038. Default value is @samp{all}.
  11039. @end table
  11040. @section waveform
  11041. Video waveform monitor.
  11042. The waveform monitor plots color component intensity. By default luminance
  11043. only. Each column of the waveform corresponds to a column of pixels in the
  11044. source video.
  11045. It accepts the following options:
  11046. @table @option
  11047. @item mode, m
  11048. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11049. In row mode, the graph on the left side represents color component value 0 and
  11050. the right side represents value = 255. In column mode, the top side represents
  11051. color component value = 0 and bottom side represents value = 255.
  11052. @item intensity, i
  11053. Set intensity. Smaller values are useful to find out how many values of the same
  11054. luminance are distributed across input rows/columns.
  11055. Default value is @code{0.04}. Allowed range is [0, 1].
  11056. @item mirror, r
  11057. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11058. In mirrored mode, higher values will be represented on the left
  11059. side for @code{row} mode and at the top for @code{column} mode. Default is
  11060. @code{1} (mirrored).
  11061. @item display, d
  11062. Set display mode.
  11063. It accepts the following values:
  11064. @table @samp
  11065. @item overlay
  11066. Presents information identical to that in the @code{parade}, except
  11067. that the graphs representing color components are superimposed directly
  11068. over one another.
  11069. This display mode makes it easier to spot relative differences or similarities
  11070. in overlapping areas of the color components that are supposed to be identical,
  11071. such as neutral whites, grays, or blacks.
  11072. @item stack
  11073. Display separate graph for the color components side by side in
  11074. @code{row} mode or one below the other in @code{column} mode.
  11075. @item parade
  11076. Display separate graph for the color components side by side in
  11077. @code{column} mode or one below the other in @code{row} mode.
  11078. Using this display mode makes it easy to spot color casts in the highlights
  11079. and shadows of an image, by comparing the contours of the top and the bottom
  11080. graphs of each waveform. Since whites, grays, and blacks are characterized
  11081. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11082. should display three waveforms of roughly equal width/height. If not, the
  11083. correction is easy to perform by making level adjustments the three waveforms.
  11084. @end table
  11085. Default is @code{stack}.
  11086. @item components, c
  11087. Set which color components to display. Default is 1, which means only luminance
  11088. or red color component if input is in RGB colorspace. If is set for example to
  11089. 7 it will display all 3 (if) available color components.
  11090. @item envelope, e
  11091. @table @samp
  11092. @item none
  11093. No envelope, this is default.
  11094. @item instant
  11095. Instant envelope, minimum and maximum values presented in graph will be easily
  11096. visible even with small @code{step} value.
  11097. @item peak
  11098. Hold minimum and maximum values presented in graph across time. This way you
  11099. can still spot out of range values without constantly looking at waveforms.
  11100. @item peak+instant
  11101. Peak and instant envelope combined together.
  11102. @end table
  11103. @item filter, f
  11104. @table @samp
  11105. @item lowpass
  11106. No filtering, this is default.
  11107. @item flat
  11108. Luma and chroma combined together.
  11109. @item aflat
  11110. Similar as above, but shows difference between blue and red chroma.
  11111. @item chroma
  11112. Displays only chroma.
  11113. @item color
  11114. Displays actual color value on waveform.
  11115. @item acolor
  11116. Similar as above, but with luma showing frequency of chroma values.
  11117. @end table
  11118. @item graticule, g
  11119. Set which graticule to display.
  11120. @table @samp
  11121. @item none
  11122. Do not display graticule.
  11123. @item green
  11124. Display green graticule showing legal broadcast ranges.
  11125. @end table
  11126. @item opacity, o
  11127. Set graticule opacity.
  11128. @item flags, fl
  11129. Set graticule flags.
  11130. @table @samp
  11131. @item numbers
  11132. Draw numbers above lines. By default enabled.
  11133. @item dots
  11134. Draw dots instead of lines.
  11135. @end table
  11136. @item scale, s
  11137. Set scale used for displaying graticule.
  11138. @table @samp
  11139. @item digital
  11140. @item millivolts
  11141. @item ire
  11142. @end table
  11143. Default is digital.
  11144. @item bgopacity, b
  11145. Set background opacity.
  11146. @end table
  11147. @section weave
  11148. The @code{weave} takes a field-based video input and join
  11149. each two sequential fields into single frame, producing a new double
  11150. height clip with half the frame rate and half the frame count.
  11151. It accepts the following option:
  11152. @table @option
  11153. @item first_field
  11154. Set first field. Available values are:
  11155. @table @samp
  11156. @item top, t
  11157. Set the frame as top-field-first.
  11158. @item bottom, b
  11159. Set the frame as bottom-field-first.
  11160. @end table
  11161. @end table
  11162. @subsection Examples
  11163. @itemize
  11164. @item
  11165. Interlace video using @ref{select} and @ref{separatefields} filter:
  11166. @example
  11167. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11168. @end example
  11169. @end itemize
  11170. @section xbr
  11171. Apply the xBR high-quality magnification filter which is designed for pixel
  11172. art. It follows a set of edge-detection rules, see
  11173. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11174. It accepts the following option:
  11175. @table @option
  11176. @item n
  11177. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11178. @code{3xBR} and @code{4} for @code{4xBR}.
  11179. Default is @code{3}.
  11180. @end table
  11181. @anchor{yadif}
  11182. @section yadif
  11183. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11184. filter").
  11185. It accepts the following parameters:
  11186. @table @option
  11187. @item mode
  11188. The interlacing mode to adopt. It accepts one of the following values:
  11189. @table @option
  11190. @item 0, send_frame
  11191. Output one frame for each frame.
  11192. @item 1, send_field
  11193. Output one frame for each field.
  11194. @item 2, send_frame_nospatial
  11195. Like @code{send_frame}, but it skips the spatial interlacing check.
  11196. @item 3, send_field_nospatial
  11197. Like @code{send_field}, but it skips the spatial interlacing check.
  11198. @end table
  11199. The default value is @code{send_frame}.
  11200. @item parity
  11201. The picture field parity assumed for the input interlaced video. It accepts one
  11202. of the following values:
  11203. @table @option
  11204. @item 0, tff
  11205. Assume the top field is first.
  11206. @item 1, bff
  11207. Assume the bottom field is first.
  11208. @item -1, auto
  11209. Enable automatic detection of field parity.
  11210. @end table
  11211. The default value is @code{auto}.
  11212. If the interlacing is unknown or the decoder does not export this information,
  11213. top field first will be assumed.
  11214. @item deint
  11215. Specify which frames to deinterlace. Accept one of the following
  11216. values:
  11217. @table @option
  11218. @item 0, all
  11219. Deinterlace all frames.
  11220. @item 1, interlaced
  11221. Only deinterlace frames marked as interlaced.
  11222. @end table
  11223. The default value is @code{all}.
  11224. @end table
  11225. @section zoompan
  11226. Apply Zoom & Pan effect.
  11227. This filter accepts the following options:
  11228. @table @option
  11229. @item zoom, z
  11230. Set the zoom expression. Default is 1.
  11231. @item x
  11232. @item y
  11233. Set the x and y expression. Default is 0.
  11234. @item d
  11235. Set the duration expression in number of frames.
  11236. This sets for how many number of frames effect will last for
  11237. single input image.
  11238. @item s
  11239. Set the output image size, default is 'hd720'.
  11240. @item fps
  11241. Set the output frame rate, default is '25'.
  11242. @end table
  11243. Each expression can contain the following constants:
  11244. @table @option
  11245. @item in_w, iw
  11246. Input width.
  11247. @item in_h, ih
  11248. Input height.
  11249. @item out_w, ow
  11250. Output width.
  11251. @item out_h, oh
  11252. Output height.
  11253. @item in
  11254. Input frame count.
  11255. @item on
  11256. Output frame count.
  11257. @item x
  11258. @item y
  11259. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11260. for current input frame.
  11261. @item px
  11262. @item py
  11263. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11264. not yet such frame (first input frame).
  11265. @item zoom
  11266. Last calculated zoom from 'z' expression for current input frame.
  11267. @item pzoom
  11268. Last calculated zoom of last output frame of previous input frame.
  11269. @item duration
  11270. Number of output frames for current input frame. Calculated from 'd' expression
  11271. for each input frame.
  11272. @item pduration
  11273. number of output frames created for previous input frame
  11274. @item a
  11275. Rational number: input width / input height
  11276. @item sar
  11277. sample aspect ratio
  11278. @item dar
  11279. display aspect ratio
  11280. @end table
  11281. @subsection Examples
  11282. @itemize
  11283. @item
  11284. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11285. @example
  11286. 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
  11287. @end example
  11288. @item
  11289. Zoom-in up to 1.5 and pan always at center of picture:
  11290. @example
  11291. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11292. @end example
  11293. @item
  11294. Same as above but without pausing:
  11295. @example
  11296. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11297. @end example
  11298. @end itemize
  11299. @section zscale
  11300. Scale (resize) the input video, using the z.lib library:
  11301. https://github.com/sekrit-twc/zimg.
  11302. The zscale filter forces the output display aspect ratio to be the same
  11303. as the input, by changing the output sample aspect ratio.
  11304. If the input image format is different from the format requested by
  11305. the next filter, the zscale filter will convert the input to the
  11306. requested format.
  11307. @subsection Options
  11308. The filter accepts the following options.
  11309. @table @option
  11310. @item width, w
  11311. @item height, h
  11312. Set the output video dimension expression. Default value is the input
  11313. dimension.
  11314. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11315. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11316. If one of the values is -1, the zscale filter will use a value that
  11317. maintains the aspect ratio of the input image, calculated from the
  11318. other specified dimension. If both of them are -1, the input size is
  11319. used
  11320. If one of the values is -n with n > 1, the zscale filter will also use a value
  11321. that maintains the aspect ratio of the input image, calculated from the other
  11322. specified dimension. After that it will, however, make sure that the calculated
  11323. dimension is divisible by n and adjust the value if necessary.
  11324. See below for the list of accepted constants for use in the dimension
  11325. expression.
  11326. @item size, s
  11327. Set the video size. For the syntax of this option, check the
  11328. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11329. @item dither, d
  11330. Set the dither type.
  11331. Possible values are:
  11332. @table @var
  11333. @item none
  11334. @item ordered
  11335. @item random
  11336. @item error_diffusion
  11337. @end table
  11338. Default is none.
  11339. @item filter, f
  11340. Set the resize filter type.
  11341. Possible values are:
  11342. @table @var
  11343. @item point
  11344. @item bilinear
  11345. @item bicubic
  11346. @item spline16
  11347. @item spline36
  11348. @item lanczos
  11349. @end table
  11350. Default is bilinear.
  11351. @item range, r
  11352. Set the color range.
  11353. Possible values are:
  11354. @table @var
  11355. @item input
  11356. @item limited
  11357. @item full
  11358. @end table
  11359. Default is same as input.
  11360. @item primaries, p
  11361. Set the color primaries.
  11362. Possible values are:
  11363. @table @var
  11364. @item input
  11365. @item 709
  11366. @item unspecified
  11367. @item 170m
  11368. @item 240m
  11369. @item 2020
  11370. @end table
  11371. Default is same as input.
  11372. @item transfer, t
  11373. Set the transfer characteristics.
  11374. Possible values are:
  11375. @table @var
  11376. @item input
  11377. @item 709
  11378. @item unspecified
  11379. @item 601
  11380. @item linear
  11381. @item 2020_10
  11382. @item 2020_12
  11383. @item smpte2084
  11384. @item iec61966-2-1
  11385. @item arib-std-b67
  11386. @end table
  11387. Default is same as input.
  11388. @item matrix, m
  11389. Set the colorspace matrix.
  11390. Possible value are:
  11391. @table @var
  11392. @item input
  11393. @item 709
  11394. @item unspecified
  11395. @item 470bg
  11396. @item 170m
  11397. @item 2020_ncl
  11398. @item 2020_cl
  11399. @end table
  11400. Default is same as input.
  11401. @item rangein, rin
  11402. Set the input color range.
  11403. Possible values are:
  11404. @table @var
  11405. @item input
  11406. @item limited
  11407. @item full
  11408. @end table
  11409. Default is same as input.
  11410. @item primariesin, pin
  11411. Set the input color primaries.
  11412. Possible values are:
  11413. @table @var
  11414. @item input
  11415. @item 709
  11416. @item unspecified
  11417. @item 170m
  11418. @item 240m
  11419. @item 2020
  11420. @end table
  11421. Default is same as input.
  11422. @item transferin, tin
  11423. Set the input transfer characteristics.
  11424. Possible values are:
  11425. @table @var
  11426. @item input
  11427. @item 709
  11428. @item unspecified
  11429. @item 601
  11430. @item linear
  11431. @item 2020_10
  11432. @item 2020_12
  11433. @end table
  11434. Default is same as input.
  11435. @item matrixin, min
  11436. Set the input colorspace matrix.
  11437. Possible value are:
  11438. @table @var
  11439. @item input
  11440. @item 709
  11441. @item unspecified
  11442. @item 470bg
  11443. @item 170m
  11444. @item 2020_ncl
  11445. @item 2020_cl
  11446. @end table
  11447. @item chromal, c
  11448. Set the output chroma location.
  11449. Possible values are:
  11450. @table @var
  11451. @item input
  11452. @item left
  11453. @item center
  11454. @item topleft
  11455. @item top
  11456. @item bottomleft
  11457. @item bottom
  11458. @end table
  11459. @item chromalin, cin
  11460. Set the input chroma location.
  11461. Possible values are:
  11462. @table @var
  11463. @item input
  11464. @item left
  11465. @item center
  11466. @item topleft
  11467. @item top
  11468. @item bottomleft
  11469. @item bottom
  11470. @end table
  11471. @item npl
  11472. Set the nominal peak luminance.
  11473. @end table
  11474. The values of the @option{w} and @option{h} options are expressions
  11475. containing the following constants:
  11476. @table @var
  11477. @item in_w
  11478. @item in_h
  11479. The input width and height
  11480. @item iw
  11481. @item ih
  11482. These are the same as @var{in_w} and @var{in_h}.
  11483. @item out_w
  11484. @item out_h
  11485. The output (scaled) width and height
  11486. @item ow
  11487. @item oh
  11488. These are the same as @var{out_w} and @var{out_h}
  11489. @item a
  11490. The same as @var{iw} / @var{ih}
  11491. @item sar
  11492. input sample aspect ratio
  11493. @item dar
  11494. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11495. @item hsub
  11496. @item vsub
  11497. horizontal and vertical input chroma subsample values. For example for the
  11498. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11499. @item ohsub
  11500. @item ovsub
  11501. horizontal and vertical output chroma subsample values. For example for the
  11502. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11503. @end table
  11504. @table @option
  11505. @end table
  11506. @c man end VIDEO FILTERS
  11507. @chapter Video Sources
  11508. @c man begin VIDEO SOURCES
  11509. Below is a description of the currently available video sources.
  11510. @section buffer
  11511. Buffer video frames, and make them available to the filter chain.
  11512. This source is mainly intended for a programmatic use, in particular
  11513. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11514. It accepts the following parameters:
  11515. @table @option
  11516. @item video_size
  11517. Specify the size (width and height) of the buffered video frames. For the
  11518. syntax of this option, check the
  11519. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11520. @item width
  11521. The input video width.
  11522. @item height
  11523. The input video height.
  11524. @item pix_fmt
  11525. A string representing the pixel format of the buffered video frames.
  11526. It may be a number corresponding to a pixel format, or a pixel format
  11527. name.
  11528. @item time_base
  11529. Specify the timebase assumed by the timestamps of the buffered frames.
  11530. @item frame_rate
  11531. Specify the frame rate expected for the video stream.
  11532. @item pixel_aspect, sar
  11533. The sample (pixel) aspect ratio of the input video.
  11534. @item sws_param
  11535. Specify the optional parameters to be used for the scale filter which
  11536. is automatically inserted when an input change is detected in the
  11537. input size or format.
  11538. @item hw_frames_ctx
  11539. When using a hardware pixel format, this should be a reference to an
  11540. AVHWFramesContext describing input frames.
  11541. @end table
  11542. For example:
  11543. @example
  11544. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11545. @end example
  11546. will instruct the source to accept video frames with size 320x240 and
  11547. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11548. square pixels (1:1 sample aspect ratio).
  11549. Since the pixel format with name "yuv410p" corresponds to the number 6
  11550. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11551. this example corresponds to:
  11552. @example
  11553. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11554. @end example
  11555. Alternatively, the options can be specified as a flat string, but this
  11556. syntax is deprecated:
  11557. @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}]
  11558. @section cellauto
  11559. Create a pattern generated by an elementary cellular automaton.
  11560. The initial state of the cellular automaton can be defined through the
  11561. @option{filename} and @option{pattern} options. If such options are
  11562. not specified an initial state is created randomly.
  11563. At each new frame a new row in the video is filled with the result of
  11564. the cellular automaton next generation. The behavior when the whole
  11565. frame is filled is defined by the @option{scroll} option.
  11566. This source accepts the following options:
  11567. @table @option
  11568. @item filename, f
  11569. Read the initial cellular automaton state, i.e. the starting row, from
  11570. the specified file.
  11571. In the file, each non-whitespace character is considered an alive
  11572. cell, a newline will terminate the row, and further characters in the
  11573. file will be ignored.
  11574. @item pattern, p
  11575. Read the initial cellular automaton state, i.e. the starting row, from
  11576. the specified string.
  11577. Each non-whitespace character in the string is considered an alive
  11578. cell, a newline will terminate the row, and further characters in the
  11579. string will be ignored.
  11580. @item rate, r
  11581. Set the video rate, that is the number of frames generated per second.
  11582. Default is 25.
  11583. @item random_fill_ratio, ratio
  11584. Set the random fill ratio for the initial cellular automaton row. It
  11585. is a floating point number value ranging from 0 to 1, defaults to
  11586. 1/PHI.
  11587. This option is ignored when a file or a pattern is specified.
  11588. @item random_seed, seed
  11589. Set the seed for filling randomly the initial row, must be an integer
  11590. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11591. set to -1, the filter will try to use a good random seed on a best
  11592. effort basis.
  11593. @item rule
  11594. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11595. Default value is 110.
  11596. @item size, s
  11597. Set the size of the output video. For the syntax of this option, check the
  11598. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11599. If @option{filename} or @option{pattern} is specified, the size is set
  11600. by default to the width of the specified initial state row, and the
  11601. height is set to @var{width} * PHI.
  11602. If @option{size} is set, it must contain the width of the specified
  11603. pattern string, and the specified pattern will be centered in the
  11604. larger row.
  11605. If a filename or a pattern string is not specified, the size value
  11606. defaults to "320x518" (used for a randomly generated initial state).
  11607. @item scroll
  11608. If set to 1, scroll the output upward when all the rows in the output
  11609. have been already filled. If set to 0, the new generated row will be
  11610. written over the top row just after the bottom row is filled.
  11611. Defaults to 1.
  11612. @item start_full, full
  11613. If set to 1, completely fill the output with generated rows before
  11614. outputting the first frame.
  11615. This is the default behavior, for disabling set the value to 0.
  11616. @item stitch
  11617. If set to 1, stitch the left and right row edges together.
  11618. This is the default behavior, for disabling set the value to 0.
  11619. @end table
  11620. @subsection Examples
  11621. @itemize
  11622. @item
  11623. Read the initial state from @file{pattern}, and specify an output of
  11624. size 200x400.
  11625. @example
  11626. cellauto=f=pattern:s=200x400
  11627. @end example
  11628. @item
  11629. Generate a random initial row with a width of 200 cells, with a fill
  11630. ratio of 2/3:
  11631. @example
  11632. cellauto=ratio=2/3:s=200x200
  11633. @end example
  11634. @item
  11635. Create a pattern generated by rule 18 starting by a single alive cell
  11636. centered on an initial row with width 100:
  11637. @example
  11638. cellauto=p=@@:s=100x400:full=0:rule=18
  11639. @end example
  11640. @item
  11641. Specify a more elaborated initial pattern:
  11642. @example
  11643. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11644. @end example
  11645. @end itemize
  11646. @anchor{coreimagesrc}
  11647. @section coreimagesrc
  11648. Video source generated on GPU using Apple's CoreImage API on OSX.
  11649. This video source is a specialized version of the @ref{coreimage} video filter.
  11650. Use a core image generator at the beginning of the applied filterchain to
  11651. generate the content.
  11652. The coreimagesrc video source accepts the following options:
  11653. @table @option
  11654. @item list_generators
  11655. List all available generators along with all their respective options as well as
  11656. possible minimum and maximum values along with the default values.
  11657. @example
  11658. list_generators=true
  11659. @end example
  11660. @item size, s
  11661. Specify the size of the sourced video. For the syntax of this option, check the
  11662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11663. The default value is @code{320x240}.
  11664. @item rate, r
  11665. Specify the frame rate of the sourced video, as the number of frames
  11666. generated per second. It has to be a string in the format
  11667. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11668. number or a valid video frame rate abbreviation. The default value is
  11669. "25".
  11670. @item sar
  11671. Set the sample aspect ratio of the sourced video.
  11672. @item duration, d
  11673. Set the duration of the sourced video. See
  11674. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11675. for the accepted syntax.
  11676. If not specified, or the expressed duration is negative, the video is
  11677. supposed to be generated forever.
  11678. @end table
  11679. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11680. A complete filterchain can be used for further processing of the
  11681. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11682. and examples for details.
  11683. @subsection Examples
  11684. @itemize
  11685. @item
  11686. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11687. given as complete and escaped command-line for Apple's standard bash shell:
  11688. @example
  11689. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11690. @end example
  11691. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11692. need for a nullsrc video source.
  11693. @end itemize
  11694. @section mandelbrot
  11695. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11696. point specified with @var{start_x} and @var{start_y}.
  11697. This source accepts the following options:
  11698. @table @option
  11699. @item end_pts
  11700. Set the terminal pts value. Default value is 400.
  11701. @item end_scale
  11702. Set the terminal scale value.
  11703. Must be a floating point value. Default value is 0.3.
  11704. @item inner
  11705. Set the inner coloring mode, that is the algorithm used to draw the
  11706. Mandelbrot fractal internal region.
  11707. It shall assume one of the following values:
  11708. @table @option
  11709. @item black
  11710. Set black mode.
  11711. @item convergence
  11712. Show time until convergence.
  11713. @item mincol
  11714. Set color based on point closest to the origin of the iterations.
  11715. @item period
  11716. Set period mode.
  11717. @end table
  11718. Default value is @var{mincol}.
  11719. @item bailout
  11720. Set the bailout value. Default value is 10.0.
  11721. @item maxiter
  11722. Set the maximum of iterations performed by the rendering
  11723. algorithm. Default value is 7189.
  11724. @item outer
  11725. Set outer coloring mode.
  11726. It shall assume one of following values:
  11727. @table @option
  11728. @item iteration_count
  11729. Set iteration cound mode.
  11730. @item normalized_iteration_count
  11731. set normalized iteration count mode.
  11732. @end table
  11733. Default value is @var{normalized_iteration_count}.
  11734. @item rate, r
  11735. Set frame rate, expressed as number of frames per second. Default
  11736. value is "25".
  11737. @item size, s
  11738. Set frame size. For the syntax of this option, check the "Video
  11739. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11740. @item start_scale
  11741. Set the initial scale value. Default value is 3.0.
  11742. @item start_x
  11743. Set the initial x position. Must be a floating point value between
  11744. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11745. @item start_y
  11746. Set the initial y position. Must be a floating point value between
  11747. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11748. @end table
  11749. @section mptestsrc
  11750. Generate various test patterns, as generated by the MPlayer test filter.
  11751. The size of the generated video is fixed, and is 256x256.
  11752. This source is useful in particular for testing encoding features.
  11753. This source accepts the following options:
  11754. @table @option
  11755. @item rate, r
  11756. Specify the frame rate of the sourced video, as the number of frames
  11757. generated per second. It has to be a string in the format
  11758. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11759. number or a valid video frame rate abbreviation. The default value is
  11760. "25".
  11761. @item duration, d
  11762. Set the duration of the sourced video. See
  11763. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11764. for the accepted syntax.
  11765. If not specified, or the expressed duration is negative, the video is
  11766. supposed to be generated forever.
  11767. @item test, t
  11768. Set the number or the name of the test to perform. Supported tests are:
  11769. @table @option
  11770. @item dc_luma
  11771. @item dc_chroma
  11772. @item freq_luma
  11773. @item freq_chroma
  11774. @item amp_luma
  11775. @item amp_chroma
  11776. @item cbp
  11777. @item mv
  11778. @item ring1
  11779. @item ring2
  11780. @item all
  11781. @end table
  11782. Default value is "all", which will cycle through the list of all tests.
  11783. @end table
  11784. Some examples:
  11785. @example
  11786. mptestsrc=t=dc_luma
  11787. @end example
  11788. will generate a "dc_luma" test pattern.
  11789. @section frei0r_src
  11790. Provide a frei0r source.
  11791. To enable compilation of this filter you need to install the frei0r
  11792. header and configure FFmpeg with @code{--enable-frei0r}.
  11793. This source accepts the following parameters:
  11794. @table @option
  11795. @item size
  11796. The size of the video to generate. For the syntax of this option, check the
  11797. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11798. @item framerate
  11799. The framerate of the generated video. It may be a string of the form
  11800. @var{num}/@var{den} or a frame rate abbreviation.
  11801. @item filter_name
  11802. The name to the frei0r source to load. For more information regarding frei0r and
  11803. how to set the parameters, read the @ref{frei0r} section in the video filters
  11804. documentation.
  11805. @item filter_params
  11806. A '|'-separated list of parameters to pass to the frei0r source.
  11807. @end table
  11808. For example, to generate a frei0r partik0l source with size 200x200
  11809. and frame rate 10 which is overlaid on the overlay filter main input:
  11810. @example
  11811. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11812. @end example
  11813. @section life
  11814. Generate a life pattern.
  11815. This source is based on a generalization of John Conway's life game.
  11816. The sourced input represents a life grid, each pixel represents a cell
  11817. which can be in one of two possible states, alive or dead. Every cell
  11818. interacts with its eight neighbours, which are the cells that are
  11819. horizontally, vertically, or diagonally adjacent.
  11820. At each interaction the grid evolves according to the adopted rule,
  11821. which specifies the number of neighbor alive cells which will make a
  11822. cell stay alive or born. The @option{rule} option allows one to specify
  11823. the rule to adopt.
  11824. This source accepts the following options:
  11825. @table @option
  11826. @item filename, f
  11827. Set the file from which to read the initial grid state. In the file,
  11828. each non-whitespace character is considered an alive cell, and newline
  11829. is used to delimit the end of each row.
  11830. If this option is not specified, the initial grid is generated
  11831. randomly.
  11832. @item rate, r
  11833. Set the video rate, that is the number of frames generated per second.
  11834. Default is 25.
  11835. @item random_fill_ratio, ratio
  11836. Set the random fill ratio for the initial random grid. It is a
  11837. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11838. It is ignored when a file is specified.
  11839. @item random_seed, seed
  11840. Set the seed for filling the initial random grid, must be an integer
  11841. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11842. set to -1, the filter will try to use a good random seed on a best
  11843. effort basis.
  11844. @item rule
  11845. Set the life rule.
  11846. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11847. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11848. @var{NS} specifies the number of alive neighbor cells which make a
  11849. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11850. which make a dead cell to become alive (i.e. to "born").
  11851. "s" and "b" can be used in place of "S" and "B", respectively.
  11852. Alternatively a rule can be specified by an 18-bits integer. The 9
  11853. high order bits are used to encode the next cell state if it is alive
  11854. for each number of neighbor alive cells, the low order bits specify
  11855. the rule for "borning" new cells. Higher order bits encode for an
  11856. higher number of neighbor cells.
  11857. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11858. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11859. Default value is "S23/B3", which is the original Conway's game of life
  11860. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11861. cells, and will born a new cell if there are three alive cells around
  11862. a dead cell.
  11863. @item size, s
  11864. Set the size of the output video. For the syntax of this option, check the
  11865. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11866. If @option{filename} is specified, the size is set by default to the
  11867. same size of the input file. If @option{size} is set, it must contain
  11868. the size specified in the input file, and the initial grid defined in
  11869. that file is centered in the larger resulting area.
  11870. If a filename is not specified, the size value defaults to "320x240"
  11871. (used for a randomly generated initial grid).
  11872. @item stitch
  11873. If set to 1, stitch the left and right grid edges together, and the
  11874. top and bottom edges also. Defaults to 1.
  11875. @item mold
  11876. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11877. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11878. value from 0 to 255.
  11879. @item life_color
  11880. Set the color of living (or new born) cells.
  11881. @item death_color
  11882. Set the color of dead cells. If @option{mold} is set, this is the first color
  11883. used to represent a dead cell.
  11884. @item mold_color
  11885. Set mold color, for definitely dead and moldy cells.
  11886. For the syntax of these 3 color options, check the "Color" section in the
  11887. ffmpeg-utils manual.
  11888. @end table
  11889. @subsection Examples
  11890. @itemize
  11891. @item
  11892. Read a grid from @file{pattern}, and center it on a grid of size
  11893. 300x300 pixels:
  11894. @example
  11895. life=f=pattern:s=300x300
  11896. @end example
  11897. @item
  11898. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11899. @example
  11900. life=ratio=2/3:s=200x200
  11901. @end example
  11902. @item
  11903. Specify a custom rule for evolving a randomly generated grid:
  11904. @example
  11905. life=rule=S14/B34
  11906. @end example
  11907. @item
  11908. Full example with slow death effect (mold) using @command{ffplay}:
  11909. @example
  11910. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11911. @end example
  11912. @end itemize
  11913. @anchor{allrgb}
  11914. @anchor{allyuv}
  11915. @anchor{color}
  11916. @anchor{haldclutsrc}
  11917. @anchor{nullsrc}
  11918. @anchor{rgbtestsrc}
  11919. @anchor{smptebars}
  11920. @anchor{smptehdbars}
  11921. @anchor{testsrc}
  11922. @anchor{testsrc2}
  11923. @anchor{yuvtestsrc}
  11924. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11925. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11926. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11927. The @code{color} source provides an uniformly colored input.
  11928. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11929. @ref{haldclut} filter.
  11930. The @code{nullsrc} source returns unprocessed video frames. It is
  11931. mainly useful to be employed in analysis / debugging tools, or as the
  11932. source for filters which ignore the input data.
  11933. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11934. detecting RGB vs BGR issues. You should see a red, green and blue
  11935. stripe from top to bottom.
  11936. The @code{smptebars} source generates a color bars pattern, based on
  11937. the SMPTE Engineering Guideline EG 1-1990.
  11938. The @code{smptehdbars} source generates a color bars pattern, based on
  11939. the SMPTE RP 219-2002.
  11940. The @code{testsrc} source generates a test video pattern, showing a
  11941. color pattern, a scrolling gradient and a timestamp. This is mainly
  11942. intended for testing purposes.
  11943. The @code{testsrc2} source is similar to testsrc, but supports more
  11944. pixel formats instead of just @code{rgb24}. This allows using it as an
  11945. input for other tests without requiring a format conversion.
  11946. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11947. see a y, cb and cr stripe from top to bottom.
  11948. The sources accept the following parameters:
  11949. @table @option
  11950. @item color, c
  11951. Specify the color of the source, only available in the @code{color}
  11952. source. For the syntax of this option, check the "Color" section in the
  11953. ffmpeg-utils manual.
  11954. @item level
  11955. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11956. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11957. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11958. coded on a @code{1/(N*N)} scale.
  11959. @item size, s
  11960. Specify the size of the sourced video. For the syntax of this option, check the
  11961. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11962. The default value is @code{320x240}.
  11963. This option is not available with the @code{haldclutsrc} filter.
  11964. @item rate, r
  11965. Specify the frame rate of the sourced video, as the number of frames
  11966. generated per second. It has to be a string in the format
  11967. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11968. number or a valid video frame rate abbreviation. The default value is
  11969. "25".
  11970. @item sar
  11971. Set the sample aspect ratio of the sourced video.
  11972. @item duration, d
  11973. Set the duration of the sourced video. See
  11974. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11975. for the accepted syntax.
  11976. If not specified, or the expressed duration is negative, the video is
  11977. supposed to be generated forever.
  11978. @item decimals, n
  11979. Set the number of decimals to show in the timestamp, only available in the
  11980. @code{testsrc} source.
  11981. The displayed timestamp value will correspond to the original
  11982. timestamp value multiplied by the power of 10 of the specified
  11983. value. Default value is 0.
  11984. @end table
  11985. For example the following:
  11986. @example
  11987. testsrc=duration=5.3:size=qcif:rate=10
  11988. @end example
  11989. will generate a video with a duration of 5.3 seconds, with size
  11990. 176x144 and a frame rate of 10 frames per second.
  11991. The following graph description will generate a red source
  11992. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11993. frames per second.
  11994. @example
  11995. color=c=red@@0.2:s=qcif:r=10
  11996. @end example
  11997. If the input content is to be ignored, @code{nullsrc} can be used. The
  11998. following command generates noise in the luminance plane by employing
  11999. the @code{geq} filter:
  12000. @example
  12001. nullsrc=s=256x256, geq=random(1)*255:128:128
  12002. @end example
  12003. @subsection Commands
  12004. The @code{color} source supports the following commands:
  12005. @table @option
  12006. @item c, color
  12007. Set the color of the created image. Accepts the same syntax of the
  12008. corresponding @option{color} option.
  12009. @end table
  12010. @c man end VIDEO SOURCES
  12011. @chapter Video Sinks
  12012. @c man begin VIDEO SINKS
  12013. Below is a description of the currently available video sinks.
  12014. @section buffersink
  12015. Buffer video frames, and make them available to the end of the filter
  12016. graph.
  12017. This sink is mainly intended for programmatic use, in particular
  12018. through the interface defined in @file{libavfilter/buffersink.h}
  12019. or the options system.
  12020. It accepts a pointer to an AVBufferSinkContext structure, which
  12021. defines the incoming buffers' formats, to be passed as the opaque
  12022. parameter to @code{avfilter_init_filter} for initialization.
  12023. @section nullsink
  12024. Null video sink: do absolutely nothing with the input video. It is
  12025. mainly useful as a template and for use in analysis / debugging
  12026. tools.
  12027. @c man end VIDEO SINKS
  12028. @chapter Multimedia Filters
  12029. @c man begin MULTIMEDIA FILTERS
  12030. Below is a description of the currently available multimedia filters.
  12031. @section abitscope
  12032. Convert input audio to a video output, displaying the audio bit scope.
  12033. The filter accepts the following options:
  12034. @table @option
  12035. @item rate, r
  12036. Set frame rate, expressed as number of frames per second. Default
  12037. value is "25".
  12038. @item size, s
  12039. Specify the video size for the output. For the syntax of this option, check the
  12040. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12041. Default value is @code{1024x256}.
  12042. @item colors
  12043. Specify list of colors separated by space or by '|' which will be used to
  12044. draw channels. Unrecognized or missing colors will be replaced
  12045. by white color.
  12046. @end table
  12047. @section ahistogram
  12048. Convert input audio to a video output, displaying the volume histogram.
  12049. The filter accepts the following options:
  12050. @table @option
  12051. @item dmode
  12052. Specify how histogram is calculated.
  12053. It accepts the following values:
  12054. @table @samp
  12055. @item single
  12056. Use single histogram for all channels.
  12057. @item separate
  12058. Use separate histogram for each channel.
  12059. @end table
  12060. Default is @code{single}.
  12061. @item rate, r
  12062. Set frame rate, expressed as number of frames per second. Default
  12063. value is "25".
  12064. @item size, s
  12065. Specify the video size for the output. For the syntax of this option, check the
  12066. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12067. Default value is @code{hd720}.
  12068. @item scale
  12069. Set display scale.
  12070. It accepts the following values:
  12071. @table @samp
  12072. @item log
  12073. logarithmic
  12074. @item sqrt
  12075. square root
  12076. @item cbrt
  12077. cubic root
  12078. @item lin
  12079. linear
  12080. @item rlog
  12081. reverse logarithmic
  12082. @end table
  12083. Default is @code{log}.
  12084. @item ascale
  12085. Set amplitude scale.
  12086. It accepts the following values:
  12087. @table @samp
  12088. @item log
  12089. logarithmic
  12090. @item lin
  12091. linear
  12092. @end table
  12093. Default is @code{log}.
  12094. @item acount
  12095. Set how much frames to accumulate in histogram.
  12096. Defauls is 1. Setting this to -1 accumulates all frames.
  12097. @item rheight
  12098. Set histogram ratio of window height.
  12099. @item slide
  12100. Set sonogram sliding.
  12101. It accepts the following values:
  12102. @table @samp
  12103. @item replace
  12104. replace old rows with new ones.
  12105. @item scroll
  12106. scroll from top to bottom.
  12107. @end table
  12108. Default is @code{replace}.
  12109. @end table
  12110. @section aphasemeter
  12111. Convert input audio to a video output, displaying the audio phase.
  12112. The filter accepts the following options:
  12113. @table @option
  12114. @item rate, r
  12115. Set the output frame rate. Default value is @code{25}.
  12116. @item size, s
  12117. Set the video size for the output. For the syntax of this option, check the
  12118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12119. Default value is @code{800x400}.
  12120. @item rc
  12121. @item gc
  12122. @item bc
  12123. Specify the red, green, blue contrast. Default values are @code{2},
  12124. @code{7} and @code{1}.
  12125. Allowed range is @code{[0, 255]}.
  12126. @item mpc
  12127. Set color which will be used for drawing median phase. If color is
  12128. @code{none} which is default, no median phase value will be drawn.
  12129. @item video
  12130. Enable video output. Default is enabled.
  12131. @end table
  12132. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12133. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12134. The @code{-1} means left and right channels are completely out of phase and
  12135. @code{1} means channels are in phase.
  12136. @section avectorscope
  12137. Convert input audio to a video output, representing the audio vector
  12138. scope.
  12139. The filter is used to measure the difference between channels of stereo
  12140. audio stream. A monoaural signal, consisting of identical left and right
  12141. signal, results in straight vertical line. Any stereo separation is visible
  12142. as a deviation from this line, creating a Lissajous figure.
  12143. If the straight (or deviation from it) but horizontal line appears this
  12144. indicates that the left and right channels are out of phase.
  12145. The filter accepts the following options:
  12146. @table @option
  12147. @item mode, m
  12148. Set the vectorscope mode.
  12149. Available values are:
  12150. @table @samp
  12151. @item lissajous
  12152. Lissajous rotated by 45 degrees.
  12153. @item lissajous_xy
  12154. Same as above but not rotated.
  12155. @item polar
  12156. Shape resembling half of circle.
  12157. @end table
  12158. Default value is @samp{lissajous}.
  12159. @item size, s
  12160. Set the video size for the output. For the syntax of this option, check the
  12161. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12162. Default value is @code{400x400}.
  12163. @item rate, r
  12164. Set the output frame rate. Default value is @code{25}.
  12165. @item rc
  12166. @item gc
  12167. @item bc
  12168. @item ac
  12169. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12170. @code{160}, @code{80} and @code{255}.
  12171. Allowed range is @code{[0, 255]}.
  12172. @item rf
  12173. @item gf
  12174. @item bf
  12175. @item af
  12176. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12177. @code{10}, @code{5} and @code{5}.
  12178. Allowed range is @code{[0, 255]}.
  12179. @item zoom
  12180. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12181. @item draw
  12182. Set the vectorscope drawing mode.
  12183. Available values are:
  12184. @table @samp
  12185. @item dot
  12186. Draw dot for each sample.
  12187. @item line
  12188. Draw line between previous and current sample.
  12189. @end table
  12190. Default value is @samp{dot}.
  12191. @item scale
  12192. Specify amplitude scale of audio samples.
  12193. Available values are:
  12194. @table @samp
  12195. @item lin
  12196. Linear.
  12197. @item sqrt
  12198. Square root.
  12199. @item cbrt
  12200. Cubic root.
  12201. @item log
  12202. Logarithmic.
  12203. @end table
  12204. @end table
  12205. @subsection Examples
  12206. @itemize
  12207. @item
  12208. Complete example using @command{ffplay}:
  12209. @example
  12210. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12211. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12212. @end example
  12213. @end itemize
  12214. @section bench, abench
  12215. Benchmark part of a filtergraph.
  12216. The filter accepts the following options:
  12217. @table @option
  12218. @item action
  12219. Start or stop a timer.
  12220. Available values are:
  12221. @table @samp
  12222. @item start
  12223. Get the current time, set it as frame metadata (using the key
  12224. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12225. @item stop
  12226. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12227. the input frame metadata to get the time difference. Time difference, average,
  12228. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12229. @code{min}) are then printed. The timestamps are expressed in seconds.
  12230. @end table
  12231. @end table
  12232. @subsection Examples
  12233. @itemize
  12234. @item
  12235. Benchmark @ref{selectivecolor} filter:
  12236. @example
  12237. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12238. @end example
  12239. @end itemize
  12240. @section concat
  12241. Concatenate audio and video streams, joining them together one after the
  12242. other.
  12243. The filter works on segments of synchronized video and audio streams. All
  12244. segments must have the same number of streams of each type, and that will
  12245. also be the number of streams at output.
  12246. The filter accepts the following options:
  12247. @table @option
  12248. @item n
  12249. Set the number of segments. Default is 2.
  12250. @item v
  12251. Set the number of output video streams, that is also the number of video
  12252. streams in each segment. Default is 1.
  12253. @item a
  12254. Set the number of output audio streams, that is also the number of audio
  12255. streams in each segment. Default is 0.
  12256. @item unsafe
  12257. Activate unsafe mode: do not fail if segments have a different format.
  12258. @end table
  12259. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12260. @var{a} audio outputs.
  12261. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12262. segment, in the same order as the outputs, then the inputs for the second
  12263. segment, etc.
  12264. Related streams do not always have exactly the same duration, for various
  12265. reasons including codec frame size or sloppy authoring. For that reason,
  12266. related synchronized streams (e.g. a video and its audio track) should be
  12267. concatenated at once. The concat filter will use the duration of the longest
  12268. stream in each segment (except the last one), and if necessary pad shorter
  12269. audio streams with silence.
  12270. For this filter to work correctly, all segments must start at timestamp 0.
  12271. All corresponding streams must have the same parameters in all segments; the
  12272. filtering system will automatically select a common pixel format for video
  12273. streams, and a common sample format, sample rate and channel layout for
  12274. audio streams, but other settings, such as resolution, must be converted
  12275. explicitly by the user.
  12276. Different frame rates are acceptable but will result in variable frame rate
  12277. at output; be sure to configure the output file to handle it.
  12278. @subsection Examples
  12279. @itemize
  12280. @item
  12281. Concatenate an opening, an episode and an ending, all in bilingual version
  12282. (video in stream 0, audio in streams 1 and 2):
  12283. @example
  12284. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12285. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12286. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12287. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12288. @end example
  12289. @item
  12290. Concatenate two parts, handling audio and video separately, using the
  12291. (a)movie sources, and adjusting the resolution:
  12292. @example
  12293. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12294. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12295. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12296. @end example
  12297. Note that a desync will happen at the stitch if the audio and video streams
  12298. do not have exactly the same duration in the first file.
  12299. @end itemize
  12300. @section drawgraph, adrawgraph
  12301. Draw a graph using input video or audio metadata.
  12302. It accepts the following parameters:
  12303. @table @option
  12304. @item m1
  12305. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12306. @item fg1
  12307. Set 1st foreground color expression.
  12308. @item m2
  12309. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12310. @item fg2
  12311. Set 2nd foreground color expression.
  12312. @item m3
  12313. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12314. @item fg3
  12315. Set 3rd foreground color expression.
  12316. @item m4
  12317. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12318. @item fg4
  12319. Set 4th foreground color expression.
  12320. @item min
  12321. Set minimal value of metadata value.
  12322. @item max
  12323. Set maximal value of metadata value.
  12324. @item bg
  12325. Set graph background color. Default is white.
  12326. @item mode
  12327. Set graph mode.
  12328. Available values for mode is:
  12329. @table @samp
  12330. @item bar
  12331. @item dot
  12332. @item line
  12333. @end table
  12334. Default is @code{line}.
  12335. @item slide
  12336. Set slide mode.
  12337. Available values for slide is:
  12338. @table @samp
  12339. @item frame
  12340. Draw new frame when right border is reached.
  12341. @item replace
  12342. Replace old columns with new ones.
  12343. @item scroll
  12344. Scroll from right to left.
  12345. @item rscroll
  12346. Scroll from left to right.
  12347. @item picture
  12348. Draw single picture.
  12349. @end table
  12350. Default is @code{frame}.
  12351. @item size
  12352. Set size of graph video. For the syntax of this option, check the
  12353. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12354. The default value is @code{900x256}.
  12355. The foreground color expressions can use the following variables:
  12356. @table @option
  12357. @item MIN
  12358. Minimal value of metadata value.
  12359. @item MAX
  12360. Maximal value of metadata value.
  12361. @item VAL
  12362. Current metadata key value.
  12363. @end table
  12364. The color is defined as 0xAABBGGRR.
  12365. @end table
  12366. Example using metadata from @ref{signalstats} filter:
  12367. @example
  12368. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12369. @end example
  12370. Example using metadata from @ref{ebur128} filter:
  12371. @example
  12372. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12373. @end example
  12374. @anchor{ebur128}
  12375. @section ebur128
  12376. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12377. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12378. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12379. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12380. The filter also has a video output (see the @var{video} option) with a real
  12381. time graph to observe the loudness evolution. The graphic contains the logged
  12382. message mentioned above, so it is not printed anymore when this option is set,
  12383. unless the verbose logging is set. The main graphing area contains the
  12384. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12385. the momentary loudness (400 milliseconds).
  12386. More information about the Loudness Recommendation EBU R128 on
  12387. @url{http://tech.ebu.ch/loudness}.
  12388. The filter accepts the following options:
  12389. @table @option
  12390. @item video
  12391. Activate the video output. The audio stream is passed unchanged whether this
  12392. option is set or no. The video stream will be the first output stream if
  12393. activated. Default is @code{0}.
  12394. @item size
  12395. Set the video size. This option is for video only. For the syntax of this
  12396. option, check the
  12397. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12398. Default and minimum resolution is @code{640x480}.
  12399. @item meter
  12400. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12401. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12402. other integer value between this range is allowed.
  12403. @item metadata
  12404. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12405. into 100ms output frames, each of them containing various loudness information
  12406. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12407. Default is @code{0}.
  12408. @item framelog
  12409. Force the frame logging level.
  12410. Available values are:
  12411. @table @samp
  12412. @item info
  12413. information logging level
  12414. @item verbose
  12415. verbose logging level
  12416. @end table
  12417. By default, the logging level is set to @var{info}. If the @option{video} or
  12418. the @option{metadata} options are set, it switches to @var{verbose}.
  12419. @item peak
  12420. Set peak mode(s).
  12421. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12422. values are:
  12423. @table @samp
  12424. @item none
  12425. Disable any peak mode (default).
  12426. @item sample
  12427. Enable sample-peak mode.
  12428. Simple peak mode looking for the higher sample value. It logs a message
  12429. for sample-peak (identified by @code{SPK}).
  12430. @item true
  12431. Enable true-peak mode.
  12432. If enabled, the peak lookup is done on an over-sampled version of the input
  12433. stream for better peak accuracy. It logs a message for true-peak.
  12434. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12435. This mode requires a build with @code{libswresample}.
  12436. @end table
  12437. @item dualmono
  12438. Treat mono input files as "dual mono". If a mono file is intended for playback
  12439. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12440. If set to @code{true}, this option will compensate for this effect.
  12441. Multi-channel input files are not affected by this option.
  12442. @item panlaw
  12443. Set a specific pan law to be used for the measurement of dual mono files.
  12444. This parameter is optional, and has a default value of -3.01dB.
  12445. @end table
  12446. @subsection Examples
  12447. @itemize
  12448. @item
  12449. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12450. @example
  12451. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12452. @end example
  12453. @item
  12454. Run an analysis with @command{ffmpeg}:
  12455. @example
  12456. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12457. @end example
  12458. @end itemize
  12459. @section interleave, ainterleave
  12460. Temporally interleave frames from several inputs.
  12461. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12462. These filters read frames from several inputs and send the oldest
  12463. queued frame to the output.
  12464. Input streams must have well defined, monotonically increasing frame
  12465. timestamp values.
  12466. In order to submit one frame to output, these filters need to enqueue
  12467. at least one frame for each input, so they cannot work in case one
  12468. input is not yet terminated and will not receive incoming frames.
  12469. For example consider the case when one input is a @code{select} filter
  12470. which always drops input frames. The @code{interleave} filter will keep
  12471. reading from that input, but it will never be able to send new frames
  12472. to output until the input sends an end-of-stream signal.
  12473. Also, depending on inputs synchronization, the filters will drop
  12474. frames in case one input receives more frames than the other ones, and
  12475. the queue is already filled.
  12476. These filters accept the following options:
  12477. @table @option
  12478. @item nb_inputs, n
  12479. Set the number of different inputs, it is 2 by default.
  12480. @end table
  12481. @subsection Examples
  12482. @itemize
  12483. @item
  12484. Interleave frames belonging to different streams using @command{ffmpeg}:
  12485. @example
  12486. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12487. @end example
  12488. @item
  12489. Add flickering blur effect:
  12490. @example
  12491. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12492. @end example
  12493. @end itemize
  12494. @section metadata, ametadata
  12495. Manipulate frame metadata.
  12496. This filter accepts the following options:
  12497. @table @option
  12498. @item mode
  12499. Set mode of operation of the filter.
  12500. Can be one of the following:
  12501. @table @samp
  12502. @item select
  12503. If both @code{value} and @code{key} is set, select frames
  12504. which have such metadata. If only @code{key} is set, select
  12505. every frame that has such key in metadata.
  12506. @item add
  12507. Add new metadata @code{key} and @code{value}. If key is already available
  12508. do nothing.
  12509. @item modify
  12510. Modify value of already present key.
  12511. @item delete
  12512. If @code{value} is set, delete only keys that have such value.
  12513. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12514. the frame.
  12515. @item print
  12516. Print key and its value if metadata was found. If @code{key} is not set print all
  12517. metadata values available in frame.
  12518. @end table
  12519. @item key
  12520. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12521. @item value
  12522. Set metadata value which will be used. This option is mandatory for
  12523. @code{modify} and @code{add} mode.
  12524. @item function
  12525. Which function to use when comparing metadata value and @code{value}.
  12526. Can be one of following:
  12527. @table @samp
  12528. @item same_str
  12529. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12530. @item starts_with
  12531. Values are interpreted as strings, returns true if metadata value starts with
  12532. the @code{value} option string.
  12533. @item less
  12534. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12535. @item equal
  12536. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12537. @item greater
  12538. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12539. @item expr
  12540. Values are interpreted as floats, returns true if expression from option @code{expr}
  12541. evaluates to true.
  12542. @end table
  12543. @item expr
  12544. Set expression which is used when @code{function} is set to @code{expr}.
  12545. The expression is evaluated through the eval API and can contain the following
  12546. constants:
  12547. @table @option
  12548. @item VALUE1
  12549. Float representation of @code{value} from metadata key.
  12550. @item VALUE2
  12551. Float representation of @code{value} as supplied by user in @code{value} option.
  12552. @end table
  12553. @item file
  12554. If specified in @code{print} mode, output is written to the named file. Instead of
  12555. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12556. for standard output. If @code{file} option is not set, output is written to the log
  12557. with AV_LOG_INFO loglevel.
  12558. @end table
  12559. @subsection Examples
  12560. @itemize
  12561. @item
  12562. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12563. between 0 and 1.
  12564. @example
  12565. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12566. @end example
  12567. @item
  12568. Print silencedetect output to file @file{metadata.txt}.
  12569. @example
  12570. silencedetect,ametadata=mode=print:file=metadata.txt
  12571. @end example
  12572. @item
  12573. Direct all metadata to a pipe with file descriptor 4.
  12574. @example
  12575. metadata=mode=print:file='pipe\:4'
  12576. @end example
  12577. @end itemize
  12578. @section perms, aperms
  12579. Set read/write permissions for the output frames.
  12580. These filters are mainly aimed at developers to test direct path in the
  12581. following filter in the filtergraph.
  12582. The filters accept the following options:
  12583. @table @option
  12584. @item mode
  12585. Select the permissions mode.
  12586. It accepts the following values:
  12587. @table @samp
  12588. @item none
  12589. Do nothing. This is the default.
  12590. @item ro
  12591. Set all the output frames read-only.
  12592. @item rw
  12593. Set all the output frames directly writable.
  12594. @item toggle
  12595. Make the frame read-only if writable, and writable if read-only.
  12596. @item random
  12597. Set each output frame read-only or writable randomly.
  12598. @end table
  12599. @item seed
  12600. Set the seed for the @var{random} mode, must be an integer included between
  12601. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12602. @code{-1}, the filter will try to use a good random seed on a best effort
  12603. basis.
  12604. @end table
  12605. Note: in case of auto-inserted filter between the permission filter and the
  12606. following one, the permission might not be received as expected in that
  12607. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12608. perms/aperms filter can avoid this problem.
  12609. @section realtime, arealtime
  12610. Slow down filtering to match real time approximatively.
  12611. These filters will pause the filtering for a variable amount of time to
  12612. match the output rate with the input timestamps.
  12613. They are similar to the @option{re} option to @code{ffmpeg}.
  12614. They accept the following options:
  12615. @table @option
  12616. @item limit
  12617. Time limit for the pauses. Any pause longer than that will be considered
  12618. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12619. @end table
  12620. @anchor{select}
  12621. @section select, aselect
  12622. Select frames to pass in output.
  12623. This filter accepts the following options:
  12624. @table @option
  12625. @item expr, e
  12626. Set expression, which is evaluated for each input frame.
  12627. If the expression is evaluated to zero, the frame is discarded.
  12628. If the evaluation result is negative or NaN, the frame is sent to the
  12629. first output; otherwise it is sent to the output with index
  12630. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12631. For example a value of @code{1.2} corresponds to the output with index
  12632. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12633. @item outputs, n
  12634. Set the number of outputs. The output to which to send the selected
  12635. frame is based on the result of the evaluation. Default value is 1.
  12636. @end table
  12637. The expression can contain the following constants:
  12638. @table @option
  12639. @item n
  12640. The (sequential) number of the filtered frame, starting from 0.
  12641. @item selected_n
  12642. The (sequential) number of the selected frame, starting from 0.
  12643. @item prev_selected_n
  12644. The sequential number of the last selected frame. It's NAN if undefined.
  12645. @item TB
  12646. The timebase of the input timestamps.
  12647. @item pts
  12648. The PTS (Presentation TimeStamp) of the filtered video frame,
  12649. expressed in @var{TB} units. It's NAN if undefined.
  12650. @item t
  12651. The PTS of the filtered video frame,
  12652. expressed in seconds. It's NAN if undefined.
  12653. @item prev_pts
  12654. The PTS of the previously filtered video frame. It's NAN if undefined.
  12655. @item prev_selected_pts
  12656. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12657. @item prev_selected_t
  12658. The PTS of the last previously selected video frame. It's NAN if undefined.
  12659. @item start_pts
  12660. The PTS of the first video frame in the video. It's NAN if undefined.
  12661. @item start_t
  12662. The time of the first video frame in the video. It's NAN if undefined.
  12663. @item pict_type @emph{(video only)}
  12664. The type of the filtered frame. It can assume one of the following
  12665. values:
  12666. @table @option
  12667. @item I
  12668. @item P
  12669. @item B
  12670. @item S
  12671. @item SI
  12672. @item SP
  12673. @item BI
  12674. @end table
  12675. @item interlace_type @emph{(video only)}
  12676. The frame interlace type. It can assume one of the following values:
  12677. @table @option
  12678. @item PROGRESSIVE
  12679. The frame is progressive (not interlaced).
  12680. @item TOPFIRST
  12681. The frame is top-field-first.
  12682. @item BOTTOMFIRST
  12683. The frame is bottom-field-first.
  12684. @end table
  12685. @item consumed_sample_n @emph{(audio only)}
  12686. the number of selected samples before the current frame
  12687. @item samples_n @emph{(audio only)}
  12688. the number of samples in the current frame
  12689. @item sample_rate @emph{(audio only)}
  12690. the input sample rate
  12691. @item key
  12692. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12693. @item pos
  12694. the position in the file of the filtered frame, -1 if the information
  12695. is not available (e.g. for synthetic video)
  12696. @item scene @emph{(video only)}
  12697. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12698. probability for the current frame to introduce a new scene, while a higher
  12699. value means the current frame is more likely to be one (see the example below)
  12700. @item concatdec_select
  12701. The concat demuxer can select only part of a concat input file by setting an
  12702. inpoint and an outpoint, but the output packets may not be entirely contained
  12703. in the selected interval. By using this variable, it is possible to skip frames
  12704. generated by the concat demuxer which are not exactly contained in the selected
  12705. interval.
  12706. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12707. and the @var{lavf.concat.duration} packet metadata values which are also
  12708. present in the decoded frames.
  12709. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12710. start_time and either the duration metadata is missing or the frame pts is less
  12711. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12712. missing.
  12713. That basically means that an input frame is selected if its pts is within the
  12714. interval set by the concat demuxer.
  12715. @end table
  12716. The default value of the select expression is "1".
  12717. @subsection Examples
  12718. @itemize
  12719. @item
  12720. Select all frames in input:
  12721. @example
  12722. select
  12723. @end example
  12724. The example above is the same as:
  12725. @example
  12726. select=1
  12727. @end example
  12728. @item
  12729. Skip all frames:
  12730. @example
  12731. select=0
  12732. @end example
  12733. @item
  12734. Select only I-frames:
  12735. @example
  12736. select='eq(pict_type\,I)'
  12737. @end example
  12738. @item
  12739. Select one frame every 100:
  12740. @example
  12741. select='not(mod(n\,100))'
  12742. @end example
  12743. @item
  12744. Select only frames contained in the 10-20 time interval:
  12745. @example
  12746. select=between(t\,10\,20)
  12747. @end example
  12748. @item
  12749. Select only I-frames contained in the 10-20 time interval:
  12750. @example
  12751. select=between(t\,10\,20)*eq(pict_type\,I)
  12752. @end example
  12753. @item
  12754. Select frames with a minimum distance of 10 seconds:
  12755. @example
  12756. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12757. @end example
  12758. @item
  12759. Use aselect to select only audio frames with samples number > 100:
  12760. @example
  12761. aselect='gt(samples_n\,100)'
  12762. @end example
  12763. @item
  12764. Create a mosaic of the first scenes:
  12765. @example
  12766. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12767. @end example
  12768. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12769. choice.
  12770. @item
  12771. Send even and odd frames to separate outputs, and compose them:
  12772. @example
  12773. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12774. @end example
  12775. @item
  12776. Select useful frames from an ffconcat file which is using inpoints and
  12777. outpoints but where the source files are not intra frame only.
  12778. @example
  12779. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12780. @end example
  12781. @end itemize
  12782. @section sendcmd, asendcmd
  12783. Send commands to filters in the filtergraph.
  12784. These filters read commands to be sent to other filters in the
  12785. filtergraph.
  12786. @code{sendcmd} must be inserted between two video filters,
  12787. @code{asendcmd} must be inserted between two audio filters, but apart
  12788. from that they act the same way.
  12789. The specification of commands can be provided in the filter arguments
  12790. with the @var{commands} option, or in a file specified by the
  12791. @var{filename} option.
  12792. These filters accept the following options:
  12793. @table @option
  12794. @item commands, c
  12795. Set the commands to be read and sent to the other filters.
  12796. @item filename, f
  12797. Set the filename of the commands to be read and sent to the other
  12798. filters.
  12799. @end table
  12800. @subsection Commands syntax
  12801. A commands description consists of a sequence of interval
  12802. specifications, comprising a list of commands to be executed when a
  12803. particular event related to that interval occurs. The occurring event
  12804. is typically the current frame time entering or leaving a given time
  12805. interval.
  12806. An interval is specified by the following syntax:
  12807. @example
  12808. @var{START}[-@var{END}] @var{COMMANDS};
  12809. @end example
  12810. The time interval is specified by the @var{START} and @var{END} times.
  12811. @var{END} is optional and defaults to the maximum time.
  12812. The current frame time is considered within the specified interval if
  12813. it is included in the interval [@var{START}, @var{END}), that is when
  12814. the time is greater or equal to @var{START} and is lesser than
  12815. @var{END}.
  12816. @var{COMMANDS} consists of a sequence of one or more command
  12817. specifications, separated by ",", relating to that interval. The
  12818. syntax of a command specification is given by:
  12819. @example
  12820. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12821. @end example
  12822. @var{FLAGS} is optional and specifies the type of events relating to
  12823. the time interval which enable sending the specified command, and must
  12824. be a non-null sequence of identifier flags separated by "+" or "|" and
  12825. enclosed between "[" and "]".
  12826. The following flags are recognized:
  12827. @table @option
  12828. @item enter
  12829. The command is sent when the current frame timestamp enters the
  12830. specified interval. In other words, the command is sent when the
  12831. previous frame timestamp was not in the given interval, and the
  12832. current is.
  12833. @item leave
  12834. The command is sent when the current frame timestamp leaves the
  12835. specified interval. In other words, the command is sent when the
  12836. previous frame timestamp was in the given interval, and the
  12837. current is not.
  12838. @end table
  12839. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12840. assumed.
  12841. @var{TARGET} specifies the target of the command, usually the name of
  12842. the filter class or a specific filter instance name.
  12843. @var{COMMAND} specifies the name of the command for the target filter.
  12844. @var{ARG} is optional and specifies the optional list of argument for
  12845. the given @var{COMMAND}.
  12846. Between one interval specification and another, whitespaces, or
  12847. sequences of characters starting with @code{#} until the end of line,
  12848. are ignored and can be used to annotate comments.
  12849. A simplified BNF description of the commands specification syntax
  12850. follows:
  12851. @example
  12852. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12853. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12854. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12855. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12856. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12857. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12858. @end example
  12859. @subsection Examples
  12860. @itemize
  12861. @item
  12862. Specify audio tempo change at second 4:
  12863. @example
  12864. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12865. @end example
  12866. @item
  12867. Specify a list of drawtext and hue commands in a file.
  12868. @example
  12869. # show text in the interval 5-10
  12870. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12871. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12872. # desaturate the image in the interval 15-20
  12873. 15.0-20.0 [enter] hue s 0,
  12874. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12875. [leave] hue s 1,
  12876. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12877. # apply an exponential saturation fade-out effect, starting from time 25
  12878. 25 [enter] hue s exp(25-t)
  12879. @end example
  12880. A filtergraph allowing to read and process the above command list
  12881. stored in a file @file{test.cmd}, can be specified with:
  12882. @example
  12883. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12884. @end example
  12885. @end itemize
  12886. @anchor{setpts}
  12887. @section setpts, asetpts
  12888. Change the PTS (presentation timestamp) of the input frames.
  12889. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12890. This filter accepts the following options:
  12891. @table @option
  12892. @item expr
  12893. The expression which is evaluated for each frame to construct its timestamp.
  12894. @end table
  12895. The expression is evaluated through the eval API and can contain the following
  12896. constants:
  12897. @table @option
  12898. @item FRAME_RATE
  12899. frame rate, only defined for constant frame-rate video
  12900. @item PTS
  12901. The presentation timestamp in input
  12902. @item N
  12903. The count of the input frame for video or the number of consumed samples,
  12904. not including the current frame for audio, starting from 0.
  12905. @item NB_CONSUMED_SAMPLES
  12906. The number of consumed samples, not including the current frame (only
  12907. audio)
  12908. @item NB_SAMPLES, S
  12909. The number of samples in the current frame (only audio)
  12910. @item SAMPLE_RATE, SR
  12911. The audio sample rate.
  12912. @item STARTPTS
  12913. The PTS of the first frame.
  12914. @item STARTT
  12915. the time in seconds of the first frame
  12916. @item INTERLACED
  12917. State whether the current frame is interlaced.
  12918. @item T
  12919. the time in seconds of the current frame
  12920. @item POS
  12921. original position in the file of the frame, or undefined if undefined
  12922. for the current frame
  12923. @item PREV_INPTS
  12924. The previous input PTS.
  12925. @item PREV_INT
  12926. previous input time in seconds
  12927. @item PREV_OUTPTS
  12928. The previous output PTS.
  12929. @item PREV_OUTT
  12930. previous output time in seconds
  12931. @item RTCTIME
  12932. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12933. instead.
  12934. @item RTCSTART
  12935. The wallclock (RTC) time at the start of the movie in microseconds.
  12936. @item TB
  12937. The timebase of the input timestamps.
  12938. @end table
  12939. @subsection Examples
  12940. @itemize
  12941. @item
  12942. Start counting PTS from zero
  12943. @example
  12944. setpts=PTS-STARTPTS
  12945. @end example
  12946. @item
  12947. Apply fast motion effect:
  12948. @example
  12949. setpts=0.5*PTS
  12950. @end example
  12951. @item
  12952. Apply slow motion effect:
  12953. @example
  12954. setpts=2.0*PTS
  12955. @end example
  12956. @item
  12957. Set fixed rate of 25 frames per second:
  12958. @example
  12959. setpts=N/(25*TB)
  12960. @end example
  12961. @item
  12962. Set fixed rate 25 fps with some jitter:
  12963. @example
  12964. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12965. @end example
  12966. @item
  12967. Apply an offset of 10 seconds to the input PTS:
  12968. @example
  12969. setpts=PTS+10/TB
  12970. @end example
  12971. @item
  12972. Generate timestamps from a "live source" and rebase onto the current timebase:
  12973. @example
  12974. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12975. @end example
  12976. @item
  12977. Generate timestamps by counting samples:
  12978. @example
  12979. asetpts=N/SR/TB
  12980. @end example
  12981. @end itemize
  12982. @section settb, asettb
  12983. Set the timebase to use for the output frames timestamps.
  12984. It is mainly useful for testing timebase configuration.
  12985. It accepts the following parameters:
  12986. @table @option
  12987. @item expr, tb
  12988. The expression which is evaluated into the output timebase.
  12989. @end table
  12990. The value for @option{tb} is an arithmetic expression representing a
  12991. rational. The expression can contain the constants "AVTB" (the default
  12992. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12993. audio only). Default value is "intb".
  12994. @subsection Examples
  12995. @itemize
  12996. @item
  12997. Set the timebase to 1/25:
  12998. @example
  12999. settb=expr=1/25
  13000. @end example
  13001. @item
  13002. Set the timebase to 1/10:
  13003. @example
  13004. settb=expr=0.1
  13005. @end example
  13006. @item
  13007. Set the timebase to 1001/1000:
  13008. @example
  13009. settb=1+0.001
  13010. @end example
  13011. @item
  13012. Set the timebase to 2*intb:
  13013. @example
  13014. settb=2*intb
  13015. @end example
  13016. @item
  13017. Set the default timebase value:
  13018. @example
  13019. settb=AVTB
  13020. @end example
  13021. @end itemize
  13022. @section showcqt
  13023. Convert input audio to a video output representing frequency spectrum
  13024. logarithmically using Brown-Puckette constant Q transform algorithm with
  13025. direct frequency domain coefficient calculation (but the transform itself
  13026. is not really constant Q, instead the Q factor is actually variable/clamped),
  13027. with musical tone scale, from E0 to D#10.
  13028. The filter accepts the following options:
  13029. @table @option
  13030. @item size, s
  13031. Specify the video size for the output. It must be even. For the syntax of this option,
  13032. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13033. Default value is @code{1920x1080}.
  13034. @item fps, rate, r
  13035. Set the output frame rate. Default value is @code{25}.
  13036. @item bar_h
  13037. Set the bargraph height. It must be even. Default value is @code{-1} which
  13038. computes the bargraph height automatically.
  13039. @item axis_h
  13040. Set the axis height. It must be even. Default value is @code{-1} which computes
  13041. the axis height automatically.
  13042. @item sono_h
  13043. Set the sonogram height. It must be even. Default value is @code{-1} which
  13044. computes the sonogram height automatically.
  13045. @item fullhd
  13046. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13047. instead. Default value is @code{1}.
  13048. @item sono_v, volume
  13049. Specify the sonogram volume expression. It can contain variables:
  13050. @table @option
  13051. @item bar_v
  13052. the @var{bar_v} evaluated expression
  13053. @item frequency, freq, f
  13054. the frequency where it is evaluated
  13055. @item timeclamp, tc
  13056. the value of @var{timeclamp} option
  13057. @end table
  13058. and functions:
  13059. @table @option
  13060. @item a_weighting(f)
  13061. A-weighting of equal loudness
  13062. @item b_weighting(f)
  13063. B-weighting of equal loudness
  13064. @item c_weighting(f)
  13065. C-weighting of equal loudness.
  13066. @end table
  13067. Default value is @code{16}.
  13068. @item bar_v, volume2
  13069. Specify the bargraph volume expression. It can contain variables:
  13070. @table @option
  13071. @item sono_v
  13072. the @var{sono_v} evaluated expression
  13073. @item frequency, freq, f
  13074. the frequency where it is evaluated
  13075. @item timeclamp, tc
  13076. the value of @var{timeclamp} option
  13077. @end table
  13078. and functions:
  13079. @table @option
  13080. @item a_weighting(f)
  13081. A-weighting of equal loudness
  13082. @item b_weighting(f)
  13083. B-weighting of equal loudness
  13084. @item c_weighting(f)
  13085. C-weighting of equal loudness.
  13086. @end table
  13087. Default value is @code{sono_v}.
  13088. @item sono_g, gamma
  13089. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13090. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13091. Acceptable range is @code{[1, 7]}.
  13092. @item bar_g, gamma2
  13093. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13094. @code{[1, 7]}.
  13095. @item bar_t
  13096. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13097. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13098. @item timeclamp, tc
  13099. Specify the transform timeclamp. At low frequency, there is trade-off between
  13100. accuracy in time domain and frequency domain. If timeclamp is lower,
  13101. event in time domain is represented more accurately (such as fast bass drum),
  13102. otherwise event in frequency domain is represented more accurately
  13103. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13104. @item basefreq
  13105. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13106. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13107. @item endfreq
  13108. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13109. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13110. @item coeffclamp
  13111. This option is deprecated and ignored.
  13112. @item tlength
  13113. Specify the transform length in time domain. Use this option to control accuracy
  13114. trade-off between time domain and frequency domain at every frequency sample.
  13115. It can contain variables:
  13116. @table @option
  13117. @item frequency, freq, f
  13118. the frequency where it is evaluated
  13119. @item timeclamp, tc
  13120. the value of @var{timeclamp} option.
  13121. @end table
  13122. Default value is @code{384*tc/(384+tc*f)}.
  13123. @item count
  13124. Specify the transform count for every video frame. Default value is @code{6}.
  13125. Acceptable range is @code{[1, 30]}.
  13126. @item fcount
  13127. Specify the transform count for every single pixel. Default value is @code{0},
  13128. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13129. @item fontfile
  13130. Specify font file for use with freetype to draw the axis. If not specified,
  13131. use embedded font. Note that drawing with font file or embedded font is not
  13132. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13133. option instead.
  13134. @item font
  13135. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13136. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13137. @item fontcolor
  13138. Specify font color expression. This is arithmetic expression that should return
  13139. integer value 0xRRGGBB. It can contain variables:
  13140. @table @option
  13141. @item frequency, freq, f
  13142. the frequency where it is evaluated
  13143. @item timeclamp, tc
  13144. the value of @var{timeclamp} option
  13145. @end table
  13146. and functions:
  13147. @table @option
  13148. @item midi(f)
  13149. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13150. @item r(x), g(x), b(x)
  13151. red, green, and blue value of intensity x.
  13152. @end table
  13153. Default value is @code{st(0, (midi(f)-59.5)/12);
  13154. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13155. r(1-ld(1)) + b(ld(1))}.
  13156. @item axisfile
  13157. Specify image file to draw the axis. This option override @var{fontfile} and
  13158. @var{fontcolor} option.
  13159. @item axis, text
  13160. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13161. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13162. Default value is @code{1}.
  13163. @item csp
  13164. Set colorspace. The accepted values are:
  13165. @table @samp
  13166. @item unspecified
  13167. Unspecified (default)
  13168. @item bt709
  13169. BT.709
  13170. @item fcc
  13171. FCC
  13172. @item bt470bg
  13173. BT.470BG or BT.601-6 625
  13174. @item smpte170m
  13175. SMPTE-170M or BT.601-6 525
  13176. @item smpte240m
  13177. SMPTE-240M
  13178. @item bt2020ncl
  13179. BT.2020 with non-constant luminance
  13180. @end table
  13181. @item cscheme
  13182. Set spectrogram color scheme. This is list of floating point values with format
  13183. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13184. The default is @code{1|0.5|0|0|0.5|1}.
  13185. @end table
  13186. @subsection Examples
  13187. @itemize
  13188. @item
  13189. Playing audio while showing the spectrum:
  13190. @example
  13191. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13192. @end example
  13193. @item
  13194. Same as above, but with frame rate 30 fps:
  13195. @example
  13196. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13197. @end example
  13198. @item
  13199. Playing at 1280x720:
  13200. @example
  13201. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13202. @end example
  13203. @item
  13204. Disable sonogram display:
  13205. @example
  13206. sono_h=0
  13207. @end example
  13208. @item
  13209. A1 and its harmonics: A1, A2, (near)E3, A3:
  13210. @example
  13211. 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),
  13212. asplit[a][out1]; [a] showcqt [out0]'
  13213. @end example
  13214. @item
  13215. Same as above, but with more accuracy in frequency domain:
  13216. @example
  13217. 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),
  13218. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13219. @end example
  13220. @item
  13221. Custom volume:
  13222. @example
  13223. bar_v=10:sono_v=bar_v*a_weighting(f)
  13224. @end example
  13225. @item
  13226. Custom gamma, now spectrum is linear to the amplitude.
  13227. @example
  13228. bar_g=2:sono_g=2
  13229. @end example
  13230. @item
  13231. Custom tlength equation:
  13232. @example
  13233. 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)))'
  13234. @end example
  13235. @item
  13236. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13237. @example
  13238. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13239. @end example
  13240. @item
  13241. Custom font using fontconfig:
  13242. @example
  13243. font='Courier New,Monospace,mono|bold'
  13244. @end example
  13245. @item
  13246. Custom frequency range with custom axis using image file:
  13247. @example
  13248. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13249. @end example
  13250. @end itemize
  13251. @section showfreqs
  13252. Convert input audio to video output representing the audio power spectrum.
  13253. Audio amplitude is on Y-axis while frequency is on X-axis.
  13254. The filter accepts the following options:
  13255. @table @option
  13256. @item size, s
  13257. Specify size of video. For the syntax of this option, check the
  13258. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13259. Default is @code{1024x512}.
  13260. @item mode
  13261. Set display mode.
  13262. This set how each frequency bin will be represented.
  13263. It accepts the following values:
  13264. @table @samp
  13265. @item line
  13266. @item bar
  13267. @item dot
  13268. @end table
  13269. Default is @code{bar}.
  13270. @item ascale
  13271. Set amplitude scale.
  13272. It accepts the following values:
  13273. @table @samp
  13274. @item lin
  13275. Linear scale.
  13276. @item sqrt
  13277. Square root scale.
  13278. @item cbrt
  13279. Cubic root scale.
  13280. @item log
  13281. Logarithmic scale.
  13282. @end table
  13283. Default is @code{log}.
  13284. @item fscale
  13285. Set frequency scale.
  13286. It accepts the following values:
  13287. @table @samp
  13288. @item lin
  13289. Linear scale.
  13290. @item log
  13291. Logarithmic scale.
  13292. @item rlog
  13293. Reverse logarithmic scale.
  13294. @end table
  13295. Default is @code{lin}.
  13296. @item win_size
  13297. Set window size.
  13298. It accepts the following values:
  13299. @table @samp
  13300. @item w16
  13301. @item w32
  13302. @item w64
  13303. @item w128
  13304. @item w256
  13305. @item w512
  13306. @item w1024
  13307. @item w2048
  13308. @item w4096
  13309. @item w8192
  13310. @item w16384
  13311. @item w32768
  13312. @item w65536
  13313. @end table
  13314. Default is @code{w2048}
  13315. @item win_func
  13316. Set windowing function.
  13317. It accepts the following values:
  13318. @table @samp
  13319. @item rect
  13320. @item bartlett
  13321. @item hanning
  13322. @item hamming
  13323. @item blackman
  13324. @item welch
  13325. @item flattop
  13326. @item bharris
  13327. @item bnuttall
  13328. @item bhann
  13329. @item sine
  13330. @item nuttall
  13331. @item lanczos
  13332. @item gauss
  13333. @item tukey
  13334. @item dolph
  13335. @item cauchy
  13336. @item parzen
  13337. @item poisson
  13338. @end table
  13339. Default is @code{hanning}.
  13340. @item overlap
  13341. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13342. which means optimal overlap for selected window function will be picked.
  13343. @item averaging
  13344. Set time averaging. Setting this to 0 will display current maximal peaks.
  13345. Default is @code{1}, which means time averaging is disabled.
  13346. @item colors
  13347. Specify list of colors separated by space or by '|' which will be used to
  13348. draw channel frequencies. Unrecognized or missing colors will be replaced
  13349. by white color.
  13350. @item cmode
  13351. Set channel display mode.
  13352. It accepts the following values:
  13353. @table @samp
  13354. @item combined
  13355. @item separate
  13356. @end table
  13357. Default is @code{combined}.
  13358. @item minamp
  13359. Set minimum amplitude used in @code{log} amplitude scaler.
  13360. @end table
  13361. @anchor{showspectrum}
  13362. @section showspectrum
  13363. Convert input audio to a video output, representing the audio frequency
  13364. spectrum.
  13365. The filter accepts the following options:
  13366. @table @option
  13367. @item size, s
  13368. Specify the video size for the output. For the syntax of this option, check the
  13369. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13370. Default value is @code{640x512}.
  13371. @item slide
  13372. Specify how the spectrum should slide along the window.
  13373. It accepts the following values:
  13374. @table @samp
  13375. @item replace
  13376. the samples start again on the left when they reach the right
  13377. @item scroll
  13378. the samples scroll from right to left
  13379. @item fullframe
  13380. frames are only produced when the samples reach the right
  13381. @item rscroll
  13382. the samples scroll from left to right
  13383. @end table
  13384. Default value is @code{replace}.
  13385. @item mode
  13386. Specify display mode.
  13387. It accepts the following values:
  13388. @table @samp
  13389. @item combined
  13390. all channels are displayed in the same row
  13391. @item separate
  13392. all channels are displayed in separate rows
  13393. @end table
  13394. Default value is @samp{combined}.
  13395. @item color
  13396. Specify display color mode.
  13397. It accepts the following values:
  13398. @table @samp
  13399. @item channel
  13400. each channel is displayed in a separate color
  13401. @item intensity
  13402. each channel is displayed using the same color scheme
  13403. @item rainbow
  13404. each channel is displayed using the rainbow color scheme
  13405. @item moreland
  13406. each channel is displayed using the moreland color scheme
  13407. @item nebulae
  13408. each channel is displayed using the nebulae color scheme
  13409. @item fire
  13410. each channel is displayed using the fire color scheme
  13411. @item fiery
  13412. each channel is displayed using the fiery color scheme
  13413. @item fruit
  13414. each channel is displayed using the fruit color scheme
  13415. @item cool
  13416. each channel is displayed using the cool color scheme
  13417. @end table
  13418. Default value is @samp{channel}.
  13419. @item scale
  13420. Specify scale used for calculating intensity color values.
  13421. It accepts the following values:
  13422. @table @samp
  13423. @item lin
  13424. linear
  13425. @item sqrt
  13426. square root, default
  13427. @item cbrt
  13428. cubic root
  13429. @item log
  13430. logarithmic
  13431. @item 4thrt
  13432. 4th root
  13433. @item 5thrt
  13434. 5th root
  13435. @end table
  13436. Default value is @samp{sqrt}.
  13437. @item saturation
  13438. Set saturation modifier for displayed colors. Negative values provide
  13439. alternative color scheme. @code{0} is no saturation at all.
  13440. Saturation must be in [-10.0, 10.0] range.
  13441. Default value is @code{1}.
  13442. @item win_func
  13443. Set window function.
  13444. It accepts the following values:
  13445. @table @samp
  13446. @item rect
  13447. @item bartlett
  13448. @item hann
  13449. @item hanning
  13450. @item hamming
  13451. @item blackman
  13452. @item welch
  13453. @item flattop
  13454. @item bharris
  13455. @item bnuttall
  13456. @item bhann
  13457. @item sine
  13458. @item nuttall
  13459. @item lanczos
  13460. @item gauss
  13461. @item tukey
  13462. @item dolph
  13463. @item cauchy
  13464. @item parzen
  13465. @item poisson
  13466. @end table
  13467. Default value is @code{hann}.
  13468. @item orientation
  13469. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13470. @code{horizontal}. Default is @code{vertical}.
  13471. @item overlap
  13472. Set ratio of overlap window. Default value is @code{0}.
  13473. When value is @code{1} overlap is set to recommended size for specific
  13474. window function currently used.
  13475. @item gain
  13476. Set scale gain for calculating intensity color values.
  13477. Default value is @code{1}.
  13478. @item data
  13479. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13480. @item rotation
  13481. Set color rotation, must be in [-1.0, 1.0] range.
  13482. Default value is @code{0}.
  13483. @end table
  13484. The usage is very similar to the showwaves filter; see the examples in that
  13485. section.
  13486. @subsection Examples
  13487. @itemize
  13488. @item
  13489. Large window with logarithmic color scaling:
  13490. @example
  13491. showspectrum=s=1280x480:scale=log
  13492. @end example
  13493. @item
  13494. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13495. @example
  13496. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13497. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13498. @end example
  13499. @end itemize
  13500. @section showspectrumpic
  13501. Convert input audio to a single video frame, representing the audio frequency
  13502. spectrum.
  13503. The filter accepts the following options:
  13504. @table @option
  13505. @item size, s
  13506. Specify the video size for the output. For the syntax of this option, check the
  13507. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13508. Default value is @code{4096x2048}.
  13509. @item mode
  13510. Specify display mode.
  13511. It accepts the following values:
  13512. @table @samp
  13513. @item combined
  13514. all channels are displayed in the same row
  13515. @item separate
  13516. all channels are displayed in separate rows
  13517. @end table
  13518. Default value is @samp{combined}.
  13519. @item color
  13520. Specify display color mode.
  13521. It accepts the following values:
  13522. @table @samp
  13523. @item channel
  13524. each channel is displayed in a separate color
  13525. @item intensity
  13526. each channel is displayed using the same color scheme
  13527. @item rainbow
  13528. each channel is displayed using the rainbow color scheme
  13529. @item moreland
  13530. each channel is displayed using the moreland color scheme
  13531. @item nebulae
  13532. each channel is displayed using the nebulae color scheme
  13533. @item fire
  13534. each channel is displayed using the fire color scheme
  13535. @item fiery
  13536. each channel is displayed using the fiery color scheme
  13537. @item fruit
  13538. each channel is displayed using the fruit color scheme
  13539. @item cool
  13540. each channel is displayed using the cool color scheme
  13541. @end table
  13542. Default value is @samp{intensity}.
  13543. @item scale
  13544. Specify scale used for calculating intensity color values.
  13545. It accepts the following values:
  13546. @table @samp
  13547. @item lin
  13548. linear
  13549. @item sqrt
  13550. square root, default
  13551. @item cbrt
  13552. cubic root
  13553. @item log
  13554. logarithmic
  13555. @item 4thrt
  13556. 4th root
  13557. @item 5thrt
  13558. 5th root
  13559. @end table
  13560. Default value is @samp{log}.
  13561. @item saturation
  13562. Set saturation modifier for displayed colors. Negative values provide
  13563. alternative color scheme. @code{0} is no saturation at all.
  13564. Saturation must be in [-10.0, 10.0] range.
  13565. Default value is @code{1}.
  13566. @item win_func
  13567. Set window function.
  13568. It accepts the following values:
  13569. @table @samp
  13570. @item rect
  13571. @item bartlett
  13572. @item hann
  13573. @item hanning
  13574. @item hamming
  13575. @item blackman
  13576. @item welch
  13577. @item flattop
  13578. @item bharris
  13579. @item bnuttall
  13580. @item bhann
  13581. @item sine
  13582. @item nuttall
  13583. @item lanczos
  13584. @item gauss
  13585. @item tukey
  13586. @item dolph
  13587. @item cauchy
  13588. @item parzen
  13589. @item poisson
  13590. @end table
  13591. Default value is @code{hann}.
  13592. @item orientation
  13593. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13594. @code{horizontal}. Default is @code{vertical}.
  13595. @item gain
  13596. Set scale gain for calculating intensity color values.
  13597. Default value is @code{1}.
  13598. @item legend
  13599. Draw time and frequency axes and legends. Default is enabled.
  13600. @item rotation
  13601. Set color rotation, must be in [-1.0, 1.0] range.
  13602. Default value is @code{0}.
  13603. @end table
  13604. @subsection Examples
  13605. @itemize
  13606. @item
  13607. Extract an audio spectrogram of a whole audio track
  13608. in a 1024x1024 picture using @command{ffmpeg}:
  13609. @example
  13610. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13611. @end example
  13612. @end itemize
  13613. @section showvolume
  13614. Convert input audio volume to a video output.
  13615. The filter accepts the following options:
  13616. @table @option
  13617. @item rate, r
  13618. Set video rate.
  13619. @item b
  13620. Set border width, allowed range is [0, 5]. Default is 1.
  13621. @item w
  13622. Set channel width, allowed range is [80, 8192]. Default is 400.
  13623. @item h
  13624. Set channel height, allowed range is [1, 900]. Default is 20.
  13625. @item f
  13626. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13627. @item c
  13628. Set volume color expression.
  13629. The expression can use the following variables:
  13630. @table @option
  13631. @item VOLUME
  13632. Current max volume of channel in dB.
  13633. @item PEAK
  13634. Current peak.
  13635. @item CHANNEL
  13636. Current channel number, starting from 0.
  13637. @end table
  13638. @item t
  13639. If set, displays channel names. Default is enabled.
  13640. @item v
  13641. If set, displays volume values. Default is enabled.
  13642. @item o
  13643. Set orientation, can be @code{horizontal} or @code{vertical},
  13644. default is @code{horizontal}.
  13645. @item s
  13646. Set step size, allowed range s [0, 5]. Default is 0, which means
  13647. step is disabled.
  13648. @end table
  13649. @section showwaves
  13650. Convert input audio to a video output, representing the samples waves.
  13651. The filter accepts the following options:
  13652. @table @option
  13653. @item size, s
  13654. Specify the video size for the output. For the syntax of this option, check the
  13655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13656. Default value is @code{600x240}.
  13657. @item mode
  13658. Set display mode.
  13659. Available values are:
  13660. @table @samp
  13661. @item point
  13662. Draw a point for each sample.
  13663. @item line
  13664. Draw a vertical line for each sample.
  13665. @item p2p
  13666. Draw a point for each sample and a line between them.
  13667. @item cline
  13668. Draw a centered vertical line for each sample.
  13669. @end table
  13670. Default value is @code{point}.
  13671. @item n
  13672. Set the number of samples which are printed on the same column. A
  13673. larger value will decrease the frame rate. Must be a positive
  13674. integer. This option can be set only if the value for @var{rate}
  13675. is not explicitly specified.
  13676. @item rate, r
  13677. Set the (approximate) output frame rate. This is done by setting the
  13678. option @var{n}. Default value is "25".
  13679. @item split_channels
  13680. Set if channels should be drawn separately or overlap. Default value is 0.
  13681. @item colors
  13682. Set colors separated by '|' which are going to be used for drawing of each channel.
  13683. @item scale
  13684. Set amplitude scale.
  13685. Available values are:
  13686. @table @samp
  13687. @item lin
  13688. Linear.
  13689. @item log
  13690. Logarithmic.
  13691. @item sqrt
  13692. Square root.
  13693. @item cbrt
  13694. Cubic root.
  13695. @end table
  13696. Default is linear.
  13697. @end table
  13698. @subsection Examples
  13699. @itemize
  13700. @item
  13701. Output the input file audio and the corresponding video representation
  13702. at the same time:
  13703. @example
  13704. amovie=a.mp3,asplit[out0],showwaves[out1]
  13705. @end example
  13706. @item
  13707. Create a synthetic signal and show it with showwaves, forcing a
  13708. frame rate of 30 frames per second:
  13709. @example
  13710. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13711. @end example
  13712. @end itemize
  13713. @section showwavespic
  13714. Convert input audio to a single video frame, representing the samples waves.
  13715. The filter accepts the following options:
  13716. @table @option
  13717. @item size, s
  13718. Specify the video size for the output. For the syntax of this option, check the
  13719. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13720. Default value is @code{600x240}.
  13721. @item split_channels
  13722. Set if channels should be drawn separately or overlap. Default value is 0.
  13723. @item colors
  13724. Set colors separated by '|' which are going to be used for drawing of each channel.
  13725. @item scale
  13726. Set amplitude scale.
  13727. Available values are:
  13728. @table @samp
  13729. @item lin
  13730. Linear.
  13731. @item log
  13732. Logarithmic.
  13733. @item sqrt
  13734. Square root.
  13735. @item cbrt
  13736. Cubic root.
  13737. @end table
  13738. Default is linear.
  13739. @end table
  13740. @subsection Examples
  13741. @itemize
  13742. @item
  13743. Extract a channel split representation of the wave form of a whole audio track
  13744. in a 1024x800 picture using @command{ffmpeg}:
  13745. @example
  13746. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13747. @end example
  13748. @end itemize
  13749. @section sidedata, asidedata
  13750. Delete frame side data, or select frames based on it.
  13751. This filter accepts the following options:
  13752. @table @option
  13753. @item mode
  13754. Set mode of operation of the filter.
  13755. Can be one of the following:
  13756. @table @samp
  13757. @item select
  13758. Select every frame with side data of @code{type}.
  13759. @item delete
  13760. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13761. data in the frame.
  13762. @end table
  13763. @item type
  13764. Set side data type used with all modes. Must be set for @code{select} mode. For
  13765. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13766. in @file{libavutil/frame.h}. For example, to choose
  13767. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13768. @end table
  13769. @section spectrumsynth
  13770. Sythesize audio from 2 input video spectrums, first input stream represents
  13771. magnitude across time and second represents phase across time.
  13772. The filter will transform from frequency domain as displayed in videos back
  13773. to time domain as presented in audio output.
  13774. This filter is primarily created for reversing processed @ref{showspectrum}
  13775. filter outputs, but can synthesize sound from other spectrograms too.
  13776. But in such case results are going to be poor if the phase data is not
  13777. available, because in such cases phase data need to be recreated, usually
  13778. its just recreated from random noise.
  13779. For best results use gray only output (@code{channel} color mode in
  13780. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13781. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13782. @code{data} option. Inputs videos should generally use @code{fullframe}
  13783. slide mode as that saves resources needed for decoding video.
  13784. The filter accepts the following options:
  13785. @table @option
  13786. @item sample_rate
  13787. Specify sample rate of output audio, the sample rate of audio from which
  13788. spectrum was generated may differ.
  13789. @item channels
  13790. Set number of channels represented in input video spectrums.
  13791. @item scale
  13792. Set scale which was used when generating magnitude input spectrum.
  13793. Can be @code{lin} or @code{log}. Default is @code{log}.
  13794. @item slide
  13795. Set slide which was used when generating inputs spectrums.
  13796. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13797. Default is @code{fullframe}.
  13798. @item win_func
  13799. Set window function used for resynthesis.
  13800. @item overlap
  13801. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13802. which means optimal overlap for selected window function will be picked.
  13803. @item orientation
  13804. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13805. Default is @code{vertical}.
  13806. @end table
  13807. @subsection Examples
  13808. @itemize
  13809. @item
  13810. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13811. then resynthesize videos back to audio with spectrumsynth:
  13812. @example
  13813. 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
  13814. 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
  13815. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13816. @end example
  13817. @end itemize
  13818. @section split, asplit
  13819. Split input into several identical outputs.
  13820. @code{asplit} works with audio input, @code{split} with video.
  13821. The filter accepts a single parameter which specifies the number of outputs. If
  13822. unspecified, it defaults to 2.
  13823. @subsection Examples
  13824. @itemize
  13825. @item
  13826. Create two separate outputs from the same input:
  13827. @example
  13828. [in] split [out0][out1]
  13829. @end example
  13830. @item
  13831. To create 3 or more outputs, you need to specify the number of
  13832. outputs, like in:
  13833. @example
  13834. [in] asplit=3 [out0][out1][out2]
  13835. @end example
  13836. @item
  13837. Create two separate outputs from the same input, one cropped and
  13838. one padded:
  13839. @example
  13840. [in] split [splitout1][splitout2];
  13841. [splitout1] crop=100:100:0:0 [cropout];
  13842. [splitout2] pad=200:200:100:100 [padout];
  13843. @end example
  13844. @item
  13845. Create 5 copies of the input audio with @command{ffmpeg}:
  13846. @example
  13847. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13848. @end example
  13849. @end itemize
  13850. @section zmq, azmq
  13851. Receive commands sent through a libzmq client, and forward them to
  13852. filters in the filtergraph.
  13853. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13854. must be inserted between two video filters, @code{azmq} between two
  13855. audio filters.
  13856. To enable these filters you need to install the libzmq library and
  13857. headers and configure FFmpeg with @code{--enable-libzmq}.
  13858. For more information about libzmq see:
  13859. @url{http://www.zeromq.org/}
  13860. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13861. receives messages sent through a network interface defined by the
  13862. @option{bind_address} option.
  13863. The received message must be in the form:
  13864. @example
  13865. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13866. @end example
  13867. @var{TARGET} specifies the target of the command, usually the name of
  13868. the filter class or a specific filter instance name.
  13869. @var{COMMAND} specifies the name of the command for the target filter.
  13870. @var{ARG} is optional and specifies the optional argument list for the
  13871. given @var{COMMAND}.
  13872. Upon reception, the message is processed and the corresponding command
  13873. is injected into the filtergraph. Depending on the result, the filter
  13874. will send a reply to the client, adopting the format:
  13875. @example
  13876. @var{ERROR_CODE} @var{ERROR_REASON}
  13877. @var{MESSAGE}
  13878. @end example
  13879. @var{MESSAGE} is optional.
  13880. @subsection Examples
  13881. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13882. be used to send commands processed by these filters.
  13883. Consider the following filtergraph generated by @command{ffplay}
  13884. @example
  13885. ffplay -dumpgraph 1 -f lavfi "
  13886. color=s=100x100:c=red [l];
  13887. color=s=100x100:c=blue [r];
  13888. nullsrc=s=200x100, zmq [bg];
  13889. [bg][l] overlay [bg+l];
  13890. [bg+l][r] overlay=x=100 "
  13891. @end example
  13892. To change the color of the left side of the video, the following
  13893. command can be used:
  13894. @example
  13895. echo Parsed_color_0 c yellow | tools/zmqsend
  13896. @end example
  13897. To change the right side:
  13898. @example
  13899. echo Parsed_color_1 c pink | tools/zmqsend
  13900. @end example
  13901. @c man end MULTIMEDIA FILTERS
  13902. @chapter Multimedia Sources
  13903. @c man begin MULTIMEDIA SOURCES
  13904. Below is a description of the currently available multimedia sources.
  13905. @section amovie
  13906. This is the same as @ref{movie} source, except it selects an audio
  13907. stream by default.
  13908. @anchor{movie}
  13909. @section movie
  13910. Read audio and/or video stream(s) from a movie container.
  13911. It accepts the following parameters:
  13912. @table @option
  13913. @item filename
  13914. The name of the resource to read (not necessarily a file; it can also be a
  13915. device or a stream accessed through some protocol).
  13916. @item format_name, f
  13917. Specifies the format assumed for the movie to read, and can be either
  13918. the name of a container or an input device. If not specified, the
  13919. format is guessed from @var{movie_name} or by probing.
  13920. @item seek_point, sp
  13921. Specifies the seek point in seconds. The frames will be output
  13922. starting from this seek point. The parameter is evaluated with
  13923. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13924. postfix. The default value is "0".
  13925. @item streams, s
  13926. Specifies the streams to read. Several streams can be specified,
  13927. separated by "+". The source will then have as many outputs, in the
  13928. same order. The syntax is explained in the ``Stream specifiers''
  13929. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13930. respectively the default (best suited) video and audio stream. Default
  13931. is "dv", or "da" if the filter is called as "amovie".
  13932. @item stream_index, si
  13933. Specifies the index of the video stream to read. If the value is -1,
  13934. the most suitable video stream will be automatically selected. The default
  13935. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13936. audio instead of video.
  13937. @item loop
  13938. Specifies how many times to read the stream in sequence.
  13939. If the value is 0, the stream will be looped infinitely.
  13940. Default value is "1".
  13941. Note that when the movie is looped the source timestamps are not
  13942. changed, so it will generate non monotonically increasing timestamps.
  13943. @item discontinuity
  13944. Specifies the time difference between frames above which the point is
  13945. considered a timestamp discontinuity which is removed by adjusting the later
  13946. timestamps.
  13947. @end table
  13948. It allows overlaying a second video on top of the main input of
  13949. a filtergraph, as shown in this graph:
  13950. @example
  13951. input -----------> deltapts0 --> overlay --> output
  13952. ^
  13953. |
  13954. movie --> scale--> deltapts1 -------+
  13955. @end example
  13956. @subsection Examples
  13957. @itemize
  13958. @item
  13959. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13960. on top of the input labelled "in":
  13961. @example
  13962. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13963. [in] setpts=PTS-STARTPTS [main];
  13964. [main][over] overlay=16:16 [out]
  13965. @end example
  13966. @item
  13967. Read from a video4linux2 device, and overlay it on top of the input
  13968. labelled "in":
  13969. @example
  13970. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13971. [in] setpts=PTS-STARTPTS [main];
  13972. [main][over] overlay=16:16 [out]
  13973. @end example
  13974. @item
  13975. Read the first video stream and the audio stream with id 0x81 from
  13976. dvd.vob; the video is connected to the pad named "video" and the audio is
  13977. connected to the pad named "audio":
  13978. @example
  13979. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13980. @end example
  13981. @end itemize
  13982. @subsection Commands
  13983. Both movie and amovie support the following commands:
  13984. @table @option
  13985. @item seek
  13986. Perform seek using "av_seek_frame".
  13987. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13988. @itemize
  13989. @item
  13990. @var{stream_index}: If stream_index is -1, a default
  13991. stream is selected, and @var{timestamp} is automatically converted
  13992. from AV_TIME_BASE units to the stream specific time_base.
  13993. @item
  13994. @var{timestamp}: Timestamp in AVStream.time_base units
  13995. or, if no stream is specified, in AV_TIME_BASE units.
  13996. @item
  13997. @var{flags}: Flags which select direction and seeking mode.
  13998. @end itemize
  13999. @item get_duration
  14000. Get movie duration in AV_TIME_BASE units.
  14001. @end table
  14002. @c man end MULTIMEDIA SOURCES