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.

19067 lines
507KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @chapter Audio Filters
  251. @c man begin AUDIO FILTERS
  252. When you configure your FFmpeg build, you can disable any of the
  253. existing filters using @code{--disable-filters}.
  254. The configure output will show the audio filters included in your
  255. build.
  256. Below is a description of the currently available audio filters.
  257. @section acompressor
  258. A compressor is mainly used to reduce the dynamic range of a signal.
  259. Especially modern music is mostly compressed at a high ratio to
  260. improve the overall loudness. It's done to get the highest attention
  261. of a listener, "fatten" the sound and bring more "power" to the track.
  262. If a signal is compressed too much it may sound dull or "dead"
  263. afterwards or it may start to "pump" (which could be a powerful effect
  264. but can also destroy a track completely).
  265. The right compression is the key to reach a professional sound and is
  266. the high art of mixing and mastering. Because of its complex settings
  267. it may take a long time to get the right feeling for this kind of effect.
  268. Compression is done by detecting the volume above a chosen level
  269. @code{threshold} and dividing it by the factor set with @code{ratio}.
  270. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  271. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  272. the signal would cause distortion of the waveform the reduction can be
  273. levelled over the time. This is done by setting "Attack" and "Release".
  274. @code{attack} determines how long the signal has to rise above the threshold
  275. before any reduction will occur and @code{release} sets the time the signal
  276. has to fall below the threshold to reduce the reduction again. Shorter signals
  277. than the chosen attack time will be left untouched.
  278. The overall reduction of the signal can be made up afterwards with the
  279. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  280. raising the makeup to this level results in a signal twice as loud than the
  281. source. To gain a softer entry in the compression the @code{knee} flattens the
  282. hard edge at the threshold in the range of the chosen decibels.
  283. The filter accepts the following options:
  284. @table @option
  285. @item level_in
  286. Set input gain. Default is 1. Range is between 0.015625 and 64.
  287. @item threshold
  288. If a signal of stream rises above this level it will affect the gain
  289. reduction.
  290. By default it is 0.125. Range is between 0.00097563 and 1.
  291. @item ratio
  292. Set a ratio by which the signal is reduced. 1:2 means that if the level
  293. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  294. Default is 2. Range is between 1 and 20.
  295. @item attack
  296. Amount of milliseconds the signal has to rise above the threshold before gain
  297. reduction starts. Default is 20. Range is between 0.01 and 2000.
  298. @item release
  299. Amount of milliseconds the signal has to fall below the threshold before
  300. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  301. @item makeup
  302. Set the amount by how much signal will be amplified after processing.
  303. Default is 1. Range is from 1 to 64.
  304. @item knee
  305. Curve the sharp knee around the threshold to enter gain reduction more softly.
  306. Default is 2.82843. Range is between 1 and 8.
  307. @item link
  308. Choose if the @code{average} level between all channels of input stream
  309. or the louder(@code{maximum}) channel of input stream affects the
  310. reduction. Default is @code{average}.
  311. @item detection
  312. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  313. of @code{rms}. Default is @code{rms} which is mostly smoother.
  314. @item mix
  315. How much to use compressed signal in output. Default is 1.
  316. Range is between 0 and 1.
  317. @end table
  318. @section acopy
  319. Copy the input audio source unchanged to the output. This is mainly useful for
  320. testing purposes.
  321. @section acrossfade
  322. Apply cross fade from one input audio stream to another input audio stream.
  323. The cross fade is applied for specified duration near the end of first stream.
  324. The filter accepts the following options:
  325. @table @option
  326. @item nb_samples, ns
  327. Specify the number of samples for which the cross fade effect has to last.
  328. At the end of the cross fade effect the first input audio will be completely
  329. silent. Default is 44100.
  330. @item duration, d
  331. Specify the duration of the cross fade effect. See
  332. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  333. for the accepted syntax.
  334. By default the duration is determined by @var{nb_samples}.
  335. If set this option is used instead of @var{nb_samples}.
  336. @item overlap, o
  337. Should first stream end overlap with second stream start. Default is enabled.
  338. @item curve1
  339. Set curve for cross fade transition for first stream.
  340. @item curve2
  341. Set curve for cross fade transition for second stream.
  342. For description of available curve types see @ref{afade} filter description.
  343. @end table
  344. @subsection Examples
  345. @itemize
  346. @item
  347. Cross fade from one input to another:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  350. @end example
  351. @item
  352. Cross fade from one input to another but without overlapping:
  353. @example
  354. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  355. @end example
  356. @end itemize
  357. @section acrusher
  358. Reduce audio bit resolution.
  359. This filter is bit crusher with enhanced functionality. A bit crusher
  360. is used to audibly reduce number of bits an audio signal is sampled
  361. with. This doesn't change the bit depth at all, it just produces the
  362. effect. Material reduced in bit depth sounds more harsh and "digital".
  363. This filter is able to even round to continuous values instead of discrete
  364. bit depths.
  365. Additionally it has a D/C offset which results in different crushing of
  366. the lower and the upper half of the signal.
  367. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  368. Another feature of this filter is the logarithmic mode.
  369. This setting switches from linear distances between bits to logarithmic ones.
  370. The result is a much more "natural" sounding crusher which doesn't gate low
  371. signals for example. The human ear has a logarithmic perception, too
  372. so this kind of crushing is much more pleasant.
  373. Logarithmic crushing is also able to get anti-aliased.
  374. The filter accepts the following options:
  375. @table @option
  376. @item level_in
  377. Set level in.
  378. @item level_out
  379. Set level out.
  380. @item bits
  381. Set bit reduction.
  382. @item mix
  383. Set mixing amount.
  384. @item mode
  385. Can be linear: @code{lin} or logarithmic: @code{log}.
  386. @item dc
  387. Set DC.
  388. @item aa
  389. Set anti-aliasing.
  390. @item samples
  391. Set sample reduction.
  392. @item lfo
  393. Enable LFO. By default disabled.
  394. @item lforange
  395. Set LFO range.
  396. @item lforate
  397. Set LFO rate.
  398. @end table
  399. @section adelay
  400. Delay one or more audio channels.
  401. Samples in delayed channel are filled with silence.
  402. The filter accepts the following option:
  403. @table @option
  404. @item delays
  405. Set list of delays in milliseconds for each channel separated by '|'.
  406. At least one delay greater than 0 should be provided.
  407. Unused delays will be silently ignored. If number of given delays is
  408. smaller than number of channels all remaining channels will not be delayed.
  409. If you want to delay exact number of samples, append 'S' to number.
  410. @end table
  411. @subsection Examples
  412. @itemize
  413. @item
  414. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  415. the second channel (and any other channels that may be present) unchanged.
  416. @example
  417. adelay=1500|0|500
  418. @end example
  419. @item
  420. Delay second channel by 500 samples, the third channel by 700 samples and leave
  421. the first channel (and any other channels that may be present) unchanged.
  422. @example
  423. adelay=0|500S|700S
  424. @end example
  425. @end itemize
  426. @section aecho
  427. Apply echoing to the input audio.
  428. Echoes are reflected sound and can occur naturally amongst mountains
  429. (and sometimes large buildings) when talking or shouting; digital echo
  430. effects emulate this behaviour and are often used to help fill out the
  431. sound of a single instrument or vocal. The time difference between the
  432. original signal and the reflection is the @code{delay}, and the
  433. loudness of the reflected signal is the @code{decay}.
  434. Multiple echoes can have different delays and decays.
  435. A description of the accepted parameters follows.
  436. @table @option
  437. @item in_gain
  438. Set input gain of reflected signal. Default is @code{0.6}.
  439. @item out_gain
  440. Set output gain of reflected signal. Default is @code{0.3}.
  441. @item delays
  442. Set list of time intervals in milliseconds between original signal and reflections
  443. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  444. Default is @code{1000}.
  445. @item decays
  446. Set list of loudnesses of reflected signals separated by '|'.
  447. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  448. Default is @code{0.5}.
  449. @end table
  450. @subsection Examples
  451. @itemize
  452. @item
  453. Make it sound as if there are twice as many instruments as are actually playing:
  454. @example
  455. aecho=0.8:0.88:60:0.4
  456. @end example
  457. @item
  458. If delay is very short, then it sound like a (metallic) robot playing music:
  459. @example
  460. aecho=0.8:0.88:6:0.4
  461. @end example
  462. @item
  463. A longer delay will sound like an open air concert in the mountains:
  464. @example
  465. aecho=0.8:0.9:1000:0.3
  466. @end example
  467. @item
  468. Same as above but with one more mountain:
  469. @example
  470. aecho=0.8:0.9:1000|1800:0.3|0.25
  471. @end example
  472. @end itemize
  473. @section aemphasis
  474. Audio emphasis filter creates or restores material directly taken from LPs or
  475. emphased CDs with different filter curves. E.g. to store music on vinyl the
  476. signal has to be altered by a filter first to even out the disadvantages of
  477. this recording medium.
  478. Once the material is played back the inverse filter has to be applied to
  479. restore the distortion of the frequency response.
  480. The filter accepts the following options:
  481. @table @option
  482. @item level_in
  483. Set input gain.
  484. @item level_out
  485. Set output gain.
  486. @item mode
  487. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  488. use @code{production} mode. Default is @code{reproduction} mode.
  489. @item type
  490. Set filter type. Selects medium. Can be one of the following:
  491. @table @option
  492. @item col
  493. select Columbia.
  494. @item emi
  495. select EMI.
  496. @item bsi
  497. select BSI (78RPM).
  498. @item riaa
  499. select RIAA.
  500. @item cd
  501. select Compact Disc (CD).
  502. @item 50fm
  503. select 50µs (FM).
  504. @item 75fm
  505. select 75µs (FM).
  506. @item 50kf
  507. select 50µs (FM-KF).
  508. @item 75kf
  509. select 75µs (FM-KF).
  510. @end table
  511. @end table
  512. @section aeval
  513. Modify an audio signal according to the specified expressions.
  514. This filter accepts one or more expressions (one for each channel),
  515. which are evaluated and used to modify a corresponding audio signal.
  516. It accepts the following parameters:
  517. @table @option
  518. @item exprs
  519. Set the '|'-separated expressions list for each separate channel. If
  520. the number of input channels is greater than the number of
  521. expressions, the last specified expression is used for the remaining
  522. output channels.
  523. @item channel_layout, c
  524. Set output channel layout. If not specified, the channel layout is
  525. specified by the number of expressions. If set to @samp{same}, it will
  526. use by default the same input channel layout.
  527. @end table
  528. Each expression in @var{exprs} can contain the following constants and functions:
  529. @table @option
  530. @item ch
  531. channel number of the current expression
  532. @item n
  533. number of the evaluated sample, starting from 0
  534. @item s
  535. sample rate
  536. @item t
  537. time of the evaluated sample expressed in seconds
  538. @item nb_in_channels
  539. @item nb_out_channels
  540. input and output number of channels
  541. @item val(CH)
  542. the value of input channel with number @var{CH}
  543. @end table
  544. Note: this filter is slow. For faster processing you should use a
  545. dedicated filter.
  546. @subsection Examples
  547. @itemize
  548. @item
  549. Half volume:
  550. @example
  551. aeval=val(ch)/2:c=same
  552. @end example
  553. @item
  554. Invert phase of the second channel:
  555. @example
  556. aeval=val(0)|-val(1)
  557. @end example
  558. @end itemize
  559. @anchor{afade}
  560. @section afade
  561. Apply fade-in/out effect to input audio.
  562. A description of the accepted parameters follows.
  563. @table @option
  564. @item type, t
  565. Specify the effect type, can be either @code{in} for fade-in, or
  566. @code{out} for a fade-out effect. Default is @code{in}.
  567. @item start_sample, ss
  568. Specify the number of the start sample for starting to apply the fade
  569. effect. Default is 0.
  570. @item nb_samples, ns
  571. Specify the number of samples for which the fade effect has to last. At
  572. the end of the fade-in effect the output audio will have the same
  573. volume as the input audio, at the end of the fade-out transition
  574. the output audio will be silence. Default is 44100.
  575. @item start_time, st
  576. Specify the start time of the fade effect. Default is 0.
  577. The value must be specified as a time duration; see
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. If set this option is used instead of @var{start_sample}.
  581. @item duration, d
  582. Specify the duration of the fade effect. See
  583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  584. for the accepted syntax.
  585. At the end of the fade-in effect the output audio will have the same
  586. volume as the input audio, at the end of the fade-out transition
  587. the output audio will be silence.
  588. By default the duration is determined by @var{nb_samples}.
  589. If set this option is used instead of @var{nb_samples}.
  590. @item curve
  591. Set curve for fade transition.
  592. It accepts the following values:
  593. @table @option
  594. @item tri
  595. select triangular, linear slope (default)
  596. @item qsin
  597. select quarter of sine wave
  598. @item hsin
  599. select half of sine wave
  600. @item esin
  601. select exponential sine wave
  602. @item log
  603. select logarithmic
  604. @item ipar
  605. select inverted parabola
  606. @item qua
  607. select quadratic
  608. @item cub
  609. select cubic
  610. @item squ
  611. select square root
  612. @item cbr
  613. select cubic root
  614. @item par
  615. select parabola
  616. @item exp
  617. select exponential
  618. @item iqsin
  619. select inverted quarter of sine wave
  620. @item ihsin
  621. select inverted half of sine wave
  622. @item dese
  623. select double-exponential seat
  624. @item desi
  625. select double-exponential sigmoid
  626. @end table
  627. @end table
  628. @subsection Examples
  629. @itemize
  630. @item
  631. Fade in first 15 seconds of audio:
  632. @example
  633. afade=t=in:ss=0:d=15
  634. @end example
  635. @item
  636. Fade out last 25 seconds of a 900 seconds audio:
  637. @example
  638. afade=t=out:st=875:d=25
  639. @end example
  640. @end itemize
  641. @section afftfilt
  642. Apply arbitrary expressions to samples in frequency domain.
  643. @table @option
  644. @item real
  645. Set frequency domain real expression for each separate channel separated
  646. by '|'. Default is "1".
  647. If the number of input channels is greater than the number of
  648. expressions, the last specified expression is used for the remaining
  649. output channels.
  650. @item imag
  651. Set frequency domain imaginary expression for each separate channel
  652. separated by '|'. If not set, @var{real} option is used.
  653. Each expression in @var{real} and @var{imag} can contain the following
  654. constants:
  655. @table @option
  656. @item sr
  657. sample rate
  658. @item b
  659. current frequency bin number
  660. @item nb
  661. number of available bins
  662. @item ch
  663. channel number of the current expression
  664. @item chs
  665. number of channels
  666. @item pts
  667. current frame pts
  668. @end table
  669. @item win_size
  670. Set window size.
  671. It accepts the following values:
  672. @table @samp
  673. @item w16
  674. @item w32
  675. @item w64
  676. @item w128
  677. @item w256
  678. @item w512
  679. @item w1024
  680. @item w2048
  681. @item w4096
  682. @item w8192
  683. @item w16384
  684. @item w32768
  685. @item w65536
  686. @end table
  687. Default is @code{w4096}
  688. @item win_func
  689. Set window function. Default is @code{hann}.
  690. @item overlap
  691. Set window overlap. If set to 1, the recommended overlap for selected
  692. window function will be picked. Default is @code{0.75}.
  693. @end table
  694. @subsection Examples
  695. @itemize
  696. @item
  697. Leave almost only low frequencies in audio:
  698. @example
  699. afftfilt="1-clip((b/nb)*b,0,1)"
  700. @end example
  701. @end itemize
  702. @section afir
  703. Apply an arbitrary Frequency Impulse Response filter.
  704. This filter is designed for applying long FIR filters,
  705. up to 30 seconds long.
  706. It can be used as component for digital crossover filters,
  707. room equalization, cross talk cancellation, wavefield synthesis,
  708. auralization, ambiophonics and ambisonics.
  709. This filter uses second stream as FIR coefficients.
  710. If second stream holds single channel, it will be used
  711. for all input channels in first stream, otherwise
  712. number of channels in second stream must be same as
  713. number of channels in first stream.
  714. It accepts the following parameters:
  715. @table @option
  716. @item dry
  717. Set dry gain. This sets input gain.
  718. @item wet
  719. Set wet gain. This sets final output gain.
  720. @item length
  721. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  722. @item again
  723. Enable applying gain measured from power of IR.
  724. @end table
  725. @subsection Examples
  726. @itemize
  727. @item
  728. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  729. @example
  730. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  731. @end example
  732. @end itemize
  733. @anchor{aformat}
  734. @section aformat
  735. Set output format constraints for the input audio. The framework will
  736. negotiate the most appropriate format to minimize conversions.
  737. It accepts the following parameters:
  738. @table @option
  739. @item sample_fmts
  740. A '|'-separated list of requested sample formats.
  741. @item sample_rates
  742. A '|'-separated list of requested sample rates.
  743. @item channel_layouts
  744. A '|'-separated list of requested channel layouts.
  745. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the required syntax.
  747. @end table
  748. If a parameter is omitted, all values are allowed.
  749. Force the output to either unsigned 8-bit or signed 16-bit stereo
  750. @example
  751. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  752. @end example
  753. @section agate
  754. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  755. processing reduces disturbing noise between useful signals.
  756. Gating is done by detecting the volume below a chosen level @var{threshold}
  757. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  758. floor is set via @var{range}. Because an exact manipulation of the signal
  759. would cause distortion of the waveform the reduction can be levelled over
  760. time. This is done by setting @var{attack} and @var{release}.
  761. @var{attack} determines how long the signal has to fall below the threshold
  762. before any reduction will occur and @var{release} sets the time the signal
  763. has to rise above the threshold to reduce the reduction again.
  764. Shorter signals than the chosen attack time will be left untouched.
  765. @table @option
  766. @item level_in
  767. Set input level before filtering.
  768. Default is 1. Allowed range is from 0.015625 to 64.
  769. @item range
  770. Set the level of gain reduction when the signal is below the threshold.
  771. Default is 0.06125. Allowed range is from 0 to 1.
  772. @item threshold
  773. If a signal rises above this level the gain reduction is released.
  774. Default is 0.125. Allowed range is from 0 to 1.
  775. @item ratio
  776. Set a ratio by which the signal is reduced.
  777. Default is 2. Allowed range is from 1 to 9000.
  778. @item attack
  779. Amount of milliseconds the signal has to rise above the threshold before gain
  780. reduction stops.
  781. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  782. @item release
  783. Amount of milliseconds the signal has to fall below the threshold before the
  784. reduction is increased again. Default is 250 milliseconds.
  785. Allowed range is from 0.01 to 9000.
  786. @item makeup
  787. Set amount of amplification of signal after processing.
  788. Default is 1. Allowed range is from 1 to 64.
  789. @item knee
  790. Curve the sharp knee around the threshold to enter gain reduction more softly.
  791. Default is 2.828427125. Allowed range is from 1 to 8.
  792. @item detection
  793. Choose if exact signal should be taken for detection or an RMS like one.
  794. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  795. @item link
  796. Choose if the average level between all channels or the louder channel affects
  797. the reduction.
  798. Default is @code{average}. Can be @code{average} or @code{maximum}.
  799. @end table
  800. @section alimiter
  801. The limiter prevents an input signal from rising over a desired threshold.
  802. This limiter uses lookahead technology to prevent your signal from distorting.
  803. It means that there is a small delay after the signal is processed. Keep in mind
  804. that the delay it produces is the attack time you set.
  805. The filter accepts the following options:
  806. @table @option
  807. @item level_in
  808. Set input gain. Default is 1.
  809. @item level_out
  810. Set output gain. Default is 1.
  811. @item limit
  812. Don't let signals above this level pass the limiter. Default is 1.
  813. @item attack
  814. The limiter will reach its attenuation level in this amount of time in
  815. milliseconds. Default is 5 milliseconds.
  816. @item release
  817. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  818. Default is 50 milliseconds.
  819. @item asc
  820. When gain reduction is always needed ASC takes care of releasing to an
  821. average reduction level rather than reaching a reduction of 0 in the release
  822. time.
  823. @item asc_level
  824. Select how much the release time is affected by ASC, 0 means nearly no changes
  825. in release time while 1 produces higher release times.
  826. @item level
  827. Auto level output signal. Default is enabled.
  828. This normalizes audio back to 0dB if enabled.
  829. @end table
  830. Depending on picked setting it is recommended to upsample input 2x or 4x times
  831. with @ref{aresample} before applying this filter.
  832. @section allpass
  833. Apply a two-pole all-pass filter with central frequency (in Hz)
  834. @var{frequency}, and filter-width @var{width}.
  835. An all-pass filter changes the audio's frequency to phase relationship
  836. without changing its frequency to amplitude relationship.
  837. The filter accepts the following options:
  838. @table @option
  839. @item frequency, f
  840. Set frequency in Hz.
  841. @item width_type, t
  842. Set method to specify band-width of filter.
  843. @table @option
  844. @item h
  845. Hz
  846. @item q
  847. Q-Factor
  848. @item o
  849. octave
  850. @item s
  851. slope
  852. @end table
  853. @item width, w
  854. Specify the band-width of a filter in width_type units.
  855. @item channels, c
  856. Specify which channels to filter, by default all available are filtered.
  857. @end table
  858. @section aloop
  859. Loop audio samples.
  860. The filter accepts the following options:
  861. @table @option
  862. @item loop
  863. Set the number of loops.
  864. @item size
  865. Set maximal number of samples.
  866. @item start
  867. Set first sample of loop.
  868. @end table
  869. @anchor{amerge}
  870. @section amerge
  871. Merge two or more audio streams into a single multi-channel stream.
  872. The filter accepts the following options:
  873. @table @option
  874. @item inputs
  875. Set the number of inputs. Default is 2.
  876. @end table
  877. If the channel layouts of the inputs are disjoint, and therefore compatible,
  878. the channel layout of the output will be set accordingly and the channels
  879. will be reordered as necessary. If the channel layouts of the inputs are not
  880. disjoint, the output will have all the channels of the first input then all
  881. the channels of the second input, in that order, and the channel layout of
  882. the output will be the default value corresponding to the total number of
  883. channels.
  884. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  885. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  886. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  887. first input, b1 is the first channel of the second input).
  888. On the other hand, if both input are in stereo, the output channels will be
  889. in the default order: a1, a2, b1, b2, and the channel layout will be
  890. arbitrarily set to 4.0, which may or may not be the expected value.
  891. All inputs must have the same sample rate, and format.
  892. If inputs do not have the same duration, the output will stop with the
  893. shortest.
  894. @subsection Examples
  895. @itemize
  896. @item
  897. Merge two mono files into a stereo stream:
  898. @example
  899. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  900. @end example
  901. @item
  902. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  903. @example
  904. 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
  905. @end example
  906. @end itemize
  907. @section amix
  908. Mixes multiple audio inputs into a single output.
  909. Note that this filter only supports float samples (the @var{amerge}
  910. and @var{pan} audio filters support many formats). If the @var{amix}
  911. input has integer samples then @ref{aresample} will be automatically
  912. inserted to perform the conversion to float samples.
  913. For example
  914. @example
  915. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  916. @end example
  917. will mix 3 input audio streams to a single output with the same duration as the
  918. first input and a dropout transition time of 3 seconds.
  919. It accepts the following parameters:
  920. @table @option
  921. @item inputs
  922. The number of inputs. If unspecified, it defaults to 2.
  923. @item duration
  924. How to determine the end-of-stream.
  925. @table @option
  926. @item longest
  927. The duration of the longest input. (default)
  928. @item shortest
  929. The duration of the shortest input.
  930. @item first
  931. The duration of the first input.
  932. @end table
  933. @item dropout_transition
  934. The transition time, in seconds, for volume renormalization when an input
  935. stream ends. The default value is 2 seconds.
  936. @end table
  937. @section anequalizer
  938. High-order parametric multiband equalizer for each channel.
  939. It accepts the following parameters:
  940. @table @option
  941. @item params
  942. This option string is in format:
  943. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  944. Each equalizer band is separated by '|'.
  945. @table @option
  946. @item chn
  947. Set channel number to which equalization will be applied.
  948. If input doesn't have that channel the entry is ignored.
  949. @item f
  950. Set central frequency for band.
  951. If input doesn't have that frequency the entry is ignored.
  952. @item w
  953. Set band width in hertz.
  954. @item g
  955. Set band gain in dB.
  956. @item t
  957. Set filter type for band, optional, can be:
  958. @table @samp
  959. @item 0
  960. Butterworth, this is default.
  961. @item 1
  962. Chebyshev type 1.
  963. @item 2
  964. Chebyshev type 2.
  965. @end table
  966. @end table
  967. @item curves
  968. With this option activated frequency response of anequalizer is displayed
  969. in video stream.
  970. @item size
  971. Set video stream size. Only useful if curves option is activated.
  972. @item mgain
  973. Set max gain that will be displayed. Only useful if curves option is activated.
  974. Setting this to a reasonable value makes it possible to display gain which is derived from
  975. neighbour bands which are too close to each other and thus produce higher gain
  976. when both are activated.
  977. @item fscale
  978. Set frequency scale used to draw frequency response in video output.
  979. Can be linear or logarithmic. Default is logarithmic.
  980. @item colors
  981. Set color for each channel curve which is going to be displayed in video stream.
  982. This is list of color names separated by space or by '|'.
  983. Unrecognised or missing colors will be replaced by white color.
  984. @end table
  985. @subsection Examples
  986. @itemize
  987. @item
  988. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  989. for first 2 channels using Chebyshev type 1 filter:
  990. @example
  991. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  992. @end example
  993. @end itemize
  994. @subsection Commands
  995. This filter supports the following commands:
  996. @table @option
  997. @item change
  998. Alter existing filter parameters.
  999. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1000. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1001. error is returned.
  1002. @var{freq} set new frequency parameter.
  1003. @var{width} set new width parameter in herz.
  1004. @var{gain} set new gain parameter in dB.
  1005. Full filter invocation with asendcmd may look like this:
  1006. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1007. @end table
  1008. @section anull
  1009. Pass the audio source unchanged to the output.
  1010. @section apad
  1011. Pad the end of an audio stream with silence.
  1012. This can be used together with @command{ffmpeg} @option{-shortest} to
  1013. extend audio streams to the same length as the video stream.
  1014. A description of the accepted options follows.
  1015. @table @option
  1016. @item packet_size
  1017. Set silence packet size. Default value is 4096.
  1018. @item pad_len
  1019. Set the number of samples of silence to add to the end. After the
  1020. value is reached, the stream is terminated. This option is mutually
  1021. exclusive with @option{whole_len}.
  1022. @item whole_len
  1023. Set the minimum total number of samples in the output audio stream. If
  1024. the value is longer than the input audio length, silence is added to
  1025. the end, until the value is reached. This option is mutually exclusive
  1026. with @option{pad_len}.
  1027. @end table
  1028. If neither the @option{pad_len} nor the @option{whole_len} option is
  1029. set, the filter will add silence to the end of the input stream
  1030. indefinitely.
  1031. @subsection Examples
  1032. @itemize
  1033. @item
  1034. Add 1024 samples of silence to the end of the input:
  1035. @example
  1036. apad=pad_len=1024
  1037. @end example
  1038. @item
  1039. Make sure the audio output will contain at least 10000 samples, pad
  1040. the input with silence if required:
  1041. @example
  1042. apad=whole_len=10000
  1043. @end example
  1044. @item
  1045. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1046. video stream will always result the shortest and will be converted
  1047. until the end in the output file when using the @option{shortest}
  1048. option:
  1049. @example
  1050. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1051. @end example
  1052. @end itemize
  1053. @section aphaser
  1054. Add a phasing effect to the input audio.
  1055. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1056. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1057. A description of the accepted parameters follows.
  1058. @table @option
  1059. @item in_gain
  1060. Set input gain. Default is 0.4.
  1061. @item out_gain
  1062. Set output gain. Default is 0.74
  1063. @item delay
  1064. Set delay in milliseconds. Default is 3.0.
  1065. @item decay
  1066. Set decay. Default is 0.4.
  1067. @item speed
  1068. Set modulation speed in Hz. Default is 0.5.
  1069. @item type
  1070. Set modulation type. Default is triangular.
  1071. It accepts the following values:
  1072. @table @samp
  1073. @item triangular, t
  1074. @item sinusoidal, s
  1075. @end table
  1076. @end table
  1077. @section apulsator
  1078. Audio pulsator is something between an autopanner and a tremolo.
  1079. But it can produce funny stereo effects as well. Pulsator changes the volume
  1080. of the left and right channel based on a LFO (low frequency oscillator) with
  1081. different waveforms and shifted phases.
  1082. This filter have the ability to define an offset between left and right
  1083. channel. An offset of 0 means that both LFO shapes match each other.
  1084. The left and right channel are altered equally - a conventional tremolo.
  1085. An offset of 50% means that the shape of the right channel is exactly shifted
  1086. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1087. an autopanner. At 1 both curves match again. Every setting in between moves the
  1088. phase shift gapless between all stages and produces some "bypassing" sounds with
  1089. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1090. the 0.5) the faster the signal passes from the left to the right speaker.
  1091. The filter accepts the following options:
  1092. @table @option
  1093. @item level_in
  1094. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1095. @item level_out
  1096. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1097. @item mode
  1098. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1099. sawup or sawdown. Default is sine.
  1100. @item amount
  1101. Set modulation. Define how much of original signal is affected by the LFO.
  1102. @item offset_l
  1103. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1104. @item offset_r
  1105. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1106. @item width
  1107. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1108. @item timing
  1109. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1110. @item bpm
  1111. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1112. is set to bpm.
  1113. @item ms
  1114. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1115. is set to ms.
  1116. @item hz
  1117. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1118. if timing is set to hz.
  1119. @end table
  1120. @anchor{aresample}
  1121. @section aresample
  1122. Resample the input audio to the specified parameters, using the
  1123. libswresample library. If none are specified then the filter will
  1124. automatically convert between its input and output.
  1125. This filter is also able to stretch/squeeze the audio data to make it match
  1126. the timestamps or to inject silence / cut out audio to make it match the
  1127. timestamps, do a combination of both or do neither.
  1128. The filter accepts the syntax
  1129. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1130. expresses a sample rate and @var{resampler_options} is a list of
  1131. @var{key}=@var{value} pairs, separated by ":". See the
  1132. @ref{Resampler Options,,the "Resampler Options" section in the
  1133. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1134. for the complete list of supported options.
  1135. @subsection Examples
  1136. @itemize
  1137. @item
  1138. Resample the input audio to 44100Hz:
  1139. @example
  1140. aresample=44100
  1141. @end example
  1142. @item
  1143. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1144. samples per second compensation:
  1145. @example
  1146. aresample=async=1000
  1147. @end example
  1148. @end itemize
  1149. @section areverse
  1150. Reverse an audio clip.
  1151. Warning: This filter requires memory to buffer the entire clip, so trimming
  1152. is suggested.
  1153. @subsection Examples
  1154. @itemize
  1155. @item
  1156. Take the first 5 seconds of a clip, and reverse it.
  1157. @example
  1158. atrim=end=5,areverse
  1159. @end example
  1160. @end itemize
  1161. @section asetnsamples
  1162. Set the number of samples per each output audio frame.
  1163. The last output packet may contain a different number of samples, as
  1164. the filter will flush all the remaining samples when the input audio
  1165. signals its end.
  1166. The filter accepts the following options:
  1167. @table @option
  1168. @item nb_out_samples, n
  1169. Set the number of frames per each output audio frame. The number is
  1170. intended as the number of samples @emph{per each channel}.
  1171. Default value is 1024.
  1172. @item pad, p
  1173. If set to 1, the filter will pad the last audio frame with zeroes, so
  1174. that the last frame will contain the same number of samples as the
  1175. previous ones. Default value is 1.
  1176. @end table
  1177. For example, to set the number of per-frame samples to 1234 and
  1178. disable padding for the last frame, use:
  1179. @example
  1180. asetnsamples=n=1234:p=0
  1181. @end example
  1182. @section asetrate
  1183. Set the sample rate without altering the PCM data.
  1184. This will result in a change of speed and pitch.
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item sample_rate, r
  1188. Set the output sample rate. Default is 44100 Hz.
  1189. @end table
  1190. @section ashowinfo
  1191. Show a line containing various information for each input audio frame.
  1192. The input audio is not modified.
  1193. The shown line contains a sequence of key/value pairs of the form
  1194. @var{key}:@var{value}.
  1195. The following values are shown in the output:
  1196. @table @option
  1197. @item n
  1198. The (sequential) number of the input frame, starting from 0.
  1199. @item pts
  1200. The presentation timestamp of the input frame, in time base units; the time base
  1201. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1202. @item pts_time
  1203. The presentation timestamp of the input frame in seconds.
  1204. @item pos
  1205. position of the frame in the input stream, -1 if this information in
  1206. unavailable and/or meaningless (for example in case of synthetic audio)
  1207. @item fmt
  1208. The sample format.
  1209. @item chlayout
  1210. The channel layout.
  1211. @item rate
  1212. The sample rate for the audio frame.
  1213. @item nb_samples
  1214. The number of samples (per channel) in the frame.
  1215. @item checksum
  1216. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1217. audio, the data is treated as if all the planes were concatenated.
  1218. @item plane_checksums
  1219. A list of Adler-32 checksums for each data plane.
  1220. @end table
  1221. @anchor{astats}
  1222. @section astats
  1223. Display time domain statistical information about the audio channels.
  1224. Statistics are calculated and displayed for each audio channel and,
  1225. where applicable, an overall figure is also given.
  1226. It accepts the following option:
  1227. @table @option
  1228. @item length
  1229. Short window length in seconds, used for peak and trough RMS measurement.
  1230. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1231. @item metadata
  1232. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1233. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1234. disabled.
  1235. Available keys for each channel are:
  1236. DC_offset
  1237. Min_level
  1238. Max_level
  1239. Min_difference
  1240. Max_difference
  1241. Mean_difference
  1242. RMS_difference
  1243. Peak_level
  1244. RMS_peak
  1245. RMS_trough
  1246. Crest_factor
  1247. Flat_factor
  1248. Peak_count
  1249. Bit_depth
  1250. Dynamic_range
  1251. and for Overall:
  1252. DC_offset
  1253. Min_level
  1254. Max_level
  1255. Min_difference
  1256. Max_difference
  1257. Mean_difference
  1258. RMS_difference
  1259. Peak_level
  1260. RMS_level
  1261. RMS_peak
  1262. RMS_trough
  1263. Flat_factor
  1264. Peak_count
  1265. Bit_depth
  1266. Number_of_samples
  1267. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1268. this @code{lavfi.astats.Overall.Peak_count}.
  1269. For description what each key means read below.
  1270. @item reset
  1271. Set number of frame after which stats are going to be recalculated.
  1272. Default is disabled.
  1273. @end table
  1274. A description of each shown parameter follows:
  1275. @table @option
  1276. @item DC offset
  1277. Mean amplitude displacement from zero.
  1278. @item Min level
  1279. Minimal sample level.
  1280. @item Max level
  1281. Maximal sample level.
  1282. @item Min difference
  1283. Minimal difference between two consecutive samples.
  1284. @item Max difference
  1285. Maximal difference between two consecutive samples.
  1286. @item Mean difference
  1287. Mean difference between two consecutive samples.
  1288. The average of each difference between two consecutive samples.
  1289. @item RMS difference
  1290. Root Mean Square difference between two consecutive samples.
  1291. @item Peak level dB
  1292. @item RMS level dB
  1293. Standard peak and RMS level measured in dBFS.
  1294. @item RMS peak dB
  1295. @item RMS trough dB
  1296. Peak and trough values for RMS level measured over a short window.
  1297. @item Crest factor
  1298. Standard ratio of peak to RMS level (note: not in dB).
  1299. @item Flat factor
  1300. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1301. (i.e. either @var{Min level} or @var{Max level}).
  1302. @item Peak count
  1303. Number of occasions (not the number of samples) that the signal attained either
  1304. @var{Min level} or @var{Max level}.
  1305. @item Bit depth
  1306. Overall bit depth of audio. Number of bits used for each sample.
  1307. @item Dynamic range
  1308. Measured dynamic range of audio in dB.
  1309. @end table
  1310. @section atempo
  1311. Adjust audio tempo.
  1312. The filter accepts exactly one parameter, the audio tempo. If not
  1313. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1314. be in the [0.5, 2.0] range.
  1315. @subsection Examples
  1316. @itemize
  1317. @item
  1318. Slow down audio to 80% tempo:
  1319. @example
  1320. atempo=0.8
  1321. @end example
  1322. @item
  1323. To speed up audio to 125% tempo:
  1324. @example
  1325. atempo=1.25
  1326. @end example
  1327. @end itemize
  1328. @section atrim
  1329. Trim the input so that the output contains one continuous subpart of the input.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item start
  1333. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1334. sample with the timestamp @var{start} will be the first sample in the output.
  1335. @item end
  1336. Specify time of the first audio sample that will be dropped, i.e. the
  1337. audio sample immediately preceding the one with the timestamp @var{end} will be
  1338. the last sample in the output.
  1339. @item start_pts
  1340. Same as @var{start}, except this option sets the start timestamp in samples
  1341. instead of seconds.
  1342. @item end_pts
  1343. Same as @var{end}, except this option sets the end timestamp in samples instead
  1344. of seconds.
  1345. @item duration
  1346. The maximum duration of the output in seconds.
  1347. @item start_sample
  1348. The number of the first sample that should be output.
  1349. @item end_sample
  1350. The number of the first sample that should be dropped.
  1351. @end table
  1352. @option{start}, @option{end}, and @option{duration} are expressed as time
  1353. duration specifications; see
  1354. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1355. Note that the first two sets of the start/end options and the @option{duration}
  1356. option look at the frame timestamp, while the _sample options simply count the
  1357. samples that pass through the filter. So start/end_pts and start/end_sample will
  1358. give different results when the timestamps are wrong, inexact or do not start at
  1359. zero. Also note that this filter does not modify the timestamps. If you wish
  1360. to have the output timestamps start at zero, insert the asetpts filter after the
  1361. atrim filter.
  1362. If multiple start or end options are set, this filter tries to be greedy and
  1363. keep all samples that match at least one of the specified constraints. To keep
  1364. only the part that matches all the constraints at once, chain multiple atrim
  1365. filters.
  1366. The defaults are such that all the input is kept. So it is possible to set e.g.
  1367. just the end values to keep everything before the specified time.
  1368. Examples:
  1369. @itemize
  1370. @item
  1371. Drop everything except the second minute of input:
  1372. @example
  1373. ffmpeg -i INPUT -af atrim=60:120
  1374. @end example
  1375. @item
  1376. Keep only the first 1000 samples:
  1377. @example
  1378. ffmpeg -i INPUT -af atrim=end_sample=1000
  1379. @end example
  1380. @end itemize
  1381. @section bandpass
  1382. Apply a two-pole Butterworth band-pass filter with central
  1383. frequency @var{frequency}, and (3dB-point) band-width width.
  1384. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1385. instead of the default: constant 0dB peak gain.
  1386. The filter roll off at 6dB per octave (20dB per decade).
  1387. The filter accepts the following options:
  1388. @table @option
  1389. @item frequency, f
  1390. Set the filter's central frequency. Default is @code{3000}.
  1391. @item csg
  1392. Constant skirt gain if set to 1. Defaults to 0.
  1393. @item width_type, t
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @item channels, c
  1408. Specify which channels to filter, by default all available are filtered.
  1409. @end table
  1410. @section bandreject
  1411. Apply a two-pole Butterworth band-reject filter with central
  1412. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1413. The filter roll off at 6dB per octave (20dB per decade).
  1414. The filter accepts the following options:
  1415. @table @option
  1416. @item frequency, f
  1417. Set the filter's central frequency. Default is @code{3000}.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bass
  1436. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1437. shelving filter with a response similar to that of a standard
  1438. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item gain, g
  1442. Give the gain at 0 Hz. Its useful range is about -20
  1443. (for a large cut) to +20 (for a large boost).
  1444. Beware of clipping when using a positive gain.
  1445. @item frequency, f
  1446. Set the filter's central frequency and so can be used
  1447. to extend or reduce the frequency range to be boosted or cut.
  1448. The default value is @code{100} Hz.
  1449. @item width_type, t
  1450. Set method to specify band-width of filter.
  1451. @table @option
  1452. @item h
  1453. Hz
  1454. @item q
  1455. Q-Factor
  1456. @item o
  1457. octave
  1458. @item s
  1459. slope
  1460. @end table
  1461. @item width, w
  1462. Determine how steep is the filter's shelf transition.
  1463. @item channels, c
  1464. Specify which channels to filter, by default all available are filtered.
  1465. @end table
  1466. @section biquad
  1467. Apply a biquad IIR filter with the given coefficients.
  1468. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1469. are the numerator and denominator coefficients respectively.
  1470. and @var{channels}, @var{c} specify which channels to filter, by default all
  1471. available are filtered.
  1472. @section bs2b
  1473. Bauer stereo to binaural transformation, which improves headphone listening of
  1474. stereo audio records.
  1475. To enable compilation of this filter you need to configure FFmpeg with
  1476. @code{--enable-libbs2b}.
  1477. It accepts the following parameters:
  1478. @table @option
  1479. @item profile
  1480. Pre-defined crossfeed level.
  1481. @table @option
  1482. @item default
  1483. Default level (fcut=700, feed=50).
  1484. @item cmoy
  1485. Chu Moy circuit (fcut=700, feed=60).
  1486. @item jmeier
  1487. Jan Meier circuit (fcut=650, feed=95).
  1488. @end table
  1489. @item fcut
  1490. Cut frequency (in Hz).
  1491. @item feed
  1492. Feed level (in Hz).
  1493. @end table
  1494. @section channelmap
  1495. Remap input channels to new locations.
  1496. It accepts the following parameters:
  1497. @table @option
  1498. @item map
  1499. Map channels from input to output. The argument is a '|'-separated list of
  1500. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1501. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1502. channel (e.g. FL for front left) or its index in the input channel layout.
  1503. @var{out_channel} is the name of the output channel or its index in the output
  1504. channel layout. If @var{out_channel} is not given then it is implicitly an
  1505. index, starting with zero and increasing by one for each mapping.
  1506. @item channel_layout
  1507. The channel layout of the output stream.
  1508. @end table
  1509. If no mapping is present, the filter will implicitly map input channels to
  1510. output channels, preserving indices.
  1511. For example, assuming a 5.1+downmix input MOV file,
  1512. @example
  1513. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1514. @end example
  1515. will create an output WAV file tagged as stereo from the downmix channels of
  1516. the input.
  1517. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1518. @example
  1519. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1520. @end example
  1521. @section channelsplit
  1522. Split each channel from an input audio stream into a separate output stream.
  1523. It accepts the following parameters:
  1524. @table @option
  1525. @item channel_layout
  1526. The channel layout of the input stream. The default is "stereo".
  1527. @end table
  1528. For example, assuming a stereo input MP3 file,
  1529. @example
  1530. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1531. @end example
  1532. will create an output Matroska file with two audio streams, one containing only
  1533. the left channel and the other the right channel.
  1534. Split a 5.1 WAV file into per-channel files:
  1535. @example
  1536. ffmpeg -i in.wav -filter_complex
  1537. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1538. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1539. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1540. side_right.wav
  1541. @end example
  1542. @section chorus
  1543. Add a chorus effect to the audio.
  1544. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1545. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1546. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1547. The modulation depth defines the range the modulated delay is played before or after
  1548. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1549. sound tuned around the original one, like in a chorus where some vocals are slightly
  1550. off key.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item in_gain
  1554. Set input gain. Default is 0.4.
  1555. @item out_gain
  1556. Set output gain. Default is 0.4.
  1557. @item delays
  1558. Set delays. A typical delay is around 40ms to 60ms.
  1559. @item decays
  1560. Set decays.
  1561. @item speeds
  1562. Set speeds.
  1563. @item depths
  1564. Set depths.
  1565. @end table
  1566. @subsection Examples
  1567. @itemize
  1568. @item
  1569. A single delay:
  1570. @example
  1571. chorus=0.7:0.9:55:0.4:0.25:2
  1572. @end example
  1573. @item
  1574. Two delays:
  1575. @example
  1576. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1577. @end example
  1578. @item
  1579. Fuller sounding chorus with three delays:
  1580. @example
  1581. 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
  1582. @end example
  1583. @end itemize
  1584. @section compand
  1585. Compress or expand the audio's dynamic range.
  1586. It accepts the following parameters:
  1587. @table @option
  1588. @item attacks
  1589. @item decays
  1590. A list of times in seconds for each channel over which the instantaneous level
  1591. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1592. increase of volume and @var{decays} refers to decrease of volume. For most
  1593. situations, the attack time (response to the audio getting louder) should be
  1594. shorter than the decay time, because the human ear is more sensitive to sudden
  1595. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1596. a typical value for decay is 0.8 seconds.
  1597. If specified number of attacks & decays is lower than number of channels, the last
  1598. set attack/decay will be used for all remaining channels.
  1599. @item points
  1600. A list of points for the transfer function, specified in dB relative to the
  1601. maximum possible signal amplitude. Each key points list must be defined using
  1602. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1603. @code{x0/y0 x1/y1 x2/y2 ....}
  1604. The input values must be in strictly increasing order but the transfer function
  1605. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1606. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1607. function are @code{-70/-70|-60/-20|1/0}.
  1608. @item soft-knee
  1609. Set the curve radius in dB for all joints. It defaults to 0.01.
  1610. @item gain
  1611. Set the additional gain in dB to be applied at all points on the transfer
  1612. function. This allows for easy adjustment of the overall gain.
  1613. It defaults to 0.
  1614. @item volume
  1615. Set an initial volume, in dB, to be assumed for each channel when filtering
  1616. starts. This permits the user to supply a nominal level initially, so that, for
  1617. example, a very large gain is not applied to initial signal levels before the
  1618. companding has begun to operate. A typical value for audio which is initially
  1619. quiet is -90 dB. It defaults to 0.
  1620. @item delay
  1621. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1622. delayed before being fed to the volume adjuster. Specifying a delay
  1623. approximately equal to the attack/decay times allows the filter to effectively
  1624. operate in predictive rather than reactive mode. It defaults to 0.
  1625. @end table
  1626. @subsection Examples
  1627. @itemize
  1628. @item
  1629. Make music with both quiet and loud passages suitable for listening to in a
  1630. noisy environment:
  1631. @example
  1632. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1633. @end example
  1634. Another example for audio with whisper and explosion parts:
  1635. @example
  1636. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1637. @end example
  1638. @item
  1639. A noise gate for when the noise is at a lower level than the signal:
  1640. @example
  1641. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1642. @end example
  1643. @item
  1644. Here is another noise gate, this time for when the noise is at a higher level
  1645. than the signal (making it, in some ways, similar to squelch):
  1646. @example
  1647. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1648. @end example
  1649. @item
  1650. 2:1 compression starting at -6dB:
  1651. @example
  1652. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1653. @end example
  1654. @item
  1655. 2:1 compression starting at -9dB:
  1656. @example
  1657. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1658. @end example
  1659. @item
  1660. 2:1 compression starting at -12dB:
  1661. @example
  1662. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1663. @end example
  1664. @item
  1665. 2:1 compression starting at -18dB:
  1666. @example
  1667. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1668. @end example
  1669. @item
  1670. 3:1 compression starting at -15dB:
  1671. @example
  1672. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1673. @end example
  1674. @item
  1675. Compressor/Gate:
  1676. @example
  1677. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1678. @end example
  1679. @item
  1680. Expander:
  1681. @example
  1682. 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
  1683. @end example
  1684. @item
  1685. Hard limiter at -6dB:
  1686. @example
  1687. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1688. @end example
  1689. @item
  1690. Hard limiter at -12dB:
  1691. @example
  1692. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1693. @end example
  1694. @item
  1695. Hard noise gate at -35 dB:
  1696. @example
  1697. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1698. @end example
  1699. @item
  1700. Soft limiter:
  1701. @example
  1702. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1703. @end example
  1704. @end itemize
  1705. @section compensationdelay
  1706. Compensation Delay Line is a metric based delay to compensate differing
  1707. positions of microphones or speakers.
  1708. For example, you have recorded guitar with two microphones placed in
  1709. different location. Because the front of sound wave has fixed speed in
  1710. normal conditions, the phasing of microphones can vary and depends on
  1711. their location and interposition. The best sound mix can be achieved when
  1712. these microphones are in phase (synchronized). Note that distance of
  1713. ~30 cm between microphones makes one microphone to capture signal in
  1714. antiphase to another microphone. That makes the final mix sounding moody.
  1715. This filter helps to solve phasing problems by adding different delays
  1716. to each microphone track and make them synchronized.
  1717. The best result can be reached when you take one track as base and
  1718. synchronize other tracks one by one with it.
  1719. Remember that synchronization/delay tolerance depends on sample rate, too.
  1720. Higher sample rates will give more tolerance.
  1721. It accepts the following parameters:
  1722. @table @option
  1723. @item mm
  1724. Set millimeters distance. This is compensation distance for fine tuning.
  1725. Default is 0.
  1726. @item cm
  1727. Set cm distance. This is compensation distance for tightening distance setup.
  1728. Default is 0.
  1729. @item m
  1730. Set meters distance. This is compensation distance for hard distance setup.
  1731. Default is 0.
  1732. @item dry
  1733. Set dry amount. Amount of unprocessed (dry) signal.
  1734. Default is 0.
  1735. @item wet
  1736. Set wet amount. Amount of processed (wet) signal.
  1737. Default is 1.
  1738. @item temp
  1739. Set temperature degree in Celsius. This is the temperature of the environment.
  1740. Default is 20.
  1741. @end table
  1742. @section crossfeed
  1743. Apply headphone crossfeed filter.
  1744. Crossfeed is the process of blending the left and right channels of stereo
  1745. audio recording.
  1746. It is mainly used to reduce extreme stereo separation of low frequencies.
  1747. The intent is to produce more speaker like sound to the listener.
  1748. The filter accepts the following options:
  1749. @table @option
  1750. @item strength
  1751. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1752. This sets gain of low shelf filter for side part of stereo image.
  1753. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1754. @item range
  1755. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1756. This sets cut off frequency of low shelf filter. Default is cut off near
  1757. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1758. @item level_in
  1759. Set input gain. Default is 0.9.
  1760. @item level_out
  1761. Set output gain. Default is 1.
  1762. @end table
  1763. @section crystalizer
  1764. Simple algorithm to expand audio dynamic range.
  1765. The filter accepts the following options:
  1766. @table @option
  1767. @item i
  1768. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1769. (unchanged sound) to 10.0 (maximum effect).
  1770. @item c
  1771. Enable clipping. By default is enabled.
  1772. @end table
  1773. @section dcshift
  1774. Apply a DC shift to the audio.
  1775. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1776. in the recording chain) from the audio. The effect of a DC offset is reduced
  1777. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1778. a signal has a DC offset.
  1779. @table @option
  1780. @item shift
  1781. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1782. the audio.
  1783. @item limitergain
  1784. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1785. used to prevent clipping.
  1786. @end table
  1787. @section dynaudnorm
  1788. Dynamic Audio Normalizer.
  1789. This filter applies a certain amount of gain to the input audio in order
  1790. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1791. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1792. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1793. This allows for applying extra gain to the "quiet" sections of the audio
  1794. while avoiding distortions or clipping the "loud" sections. In other words:
  1795. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1796. sections, in the sense that the volume of each section is brought to the
  1797. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1798. this goal *without* applying "dynamic range compressing". It will retain 100%
  1799. of the dynamic range *within* each section of the audio file.
  1800. @table @option
  1801. @item f
  1802. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1803. Default is 500 milliseconds.
  1804. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1805. referred to as frames. This is required, because a peak magnitude has no
  1806. meaning for just a single sample value. Instead, we need to determine the
  1807. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1808. normalizer would simply use the peak magnitude of the complete file, the
  1809. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1810. frame. The length of a frame is specified in milliseconds. By default, the
  1811. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1812. been found to give good results with most files.
  1813. Note that the exact frame length, in number of samples, will be determined
  1814. automatically, based on the sampling rate of the individual input audio file.
  1815. @item g
  1816. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1817. number. Default is 31.
  1818. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1819. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1820. is specified in frames, centered around the current frame. For the sake of
  1821. simplicity, this must be an odd number. Consequently, the default value of 31
  1822. takes into account the current frame, as well as the 15 preceding frames and
  1823. the 15 subsequent frames. Using a larger window results in a stronger
  1824. smoothing effect and thus in less gain variation, i.e. slower gain
  1825. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1826. effect and thus in more gain variation, i.e. faster gain adaptation.
  1827. In other words, the more you increase this value, the more the Dynamic Audio
  1828. Normalizer will behave like a "traditional" normalization filter. On the
  1829. contrary, the more you decrease this value, the more the Dynamic Audio
  1830. Normalizer will behave like a dynamic range compressor.
  1831. @item p
  1832. Set the target peak value. This specifies the highest permissible magnitude
  1833. level for the normalized audio input. This filter will try to approach the
  1834. target peak magnitude as closely as possible, but at the same time it also
  1835. makes sure that the normalized signal will never exceed the peak magnitude.
  1836. A frame's maximum local gain factor is imposed directly by the target peak
  1837. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1838. It is not recommended to go above this value.
  1839. @item m
  1840. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1841. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1842. factor for each input frame, i.e. the maximum gain factor that does not
  1843. result in clipping or distortion. The maximum gain factor is determined by
  1844. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1845. additionally bounds the frame's maximum gain factor by a predetermined
  1846. (global) maximum gain factor. This is done in order to avoid excessive gain
  1847. factors in "silent" or almost silent frames. By default, the maximum gain
  1848. factor is 10.0, For most inputs the default value should be sufficient and
  1849. it usually is not recommended to increase this value. Though, for input
  1850. with an extremely low overall volume level, it may be necessary to allow even
  1851. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1852. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1853. Instead, a "sigmoid" threshold function will be applied. This way, the
  1854. gain factors will smoothly approach the threshold value, but never exceed that
  1855. value.
  1856. @item r
  1857. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1858. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1859. This means that the maximum local gain factor for each frame is defined
  1860. (only) by the frame's highest magnitude sample. This way, the samples can
  1861. be amplified as much as possible without exceeding the maximum signal
  1862. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1863. Normalizer can also take into account the frame's root mean square,
  1864. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1865. determine the power of a time-varying signal. It is therefore considered
  1866. that the RMS is a better approximation of the "perceived loudness" than
  1867. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1868. frames to a constant RMS value, a uniform "perceived loudness" can be
  1869. established. If a target RMS value has been specified, a frame's local gain
  1870. factor is defined as the factor that would result in exactly that RMS value.
  1871. Note, however, that the maximum local gain factor is still restricted by the
  1872. frame's highest magnitude sample, in order to prevent clipping.
  1873. @item n
  1874. Enable channels coupling. By default is enabled.
  1875. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1876. amount. This means the same gain factor will be applied to all channels, i.e.
  1877. the maximum possible gain factor is determined by the "loudest" channel.
  1878. However, in some recordings, it may happen that the volume of the different
  1879. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1880. In this case, this option can be used to disable the channel coupling. This way,
  1881. the gain factor will be determined independently for each channel, depending
  1882. only on the individual channel's highest magnitude sample. This allows for
  1883. harmonizing the volume of the different channels.
  1884. @item c
  1885. Enable DC bias correction. By default is disabled.
  1886. An audio signal (in the time domain) is a sequence of sample values.
  1887. In the Dynamic Audio Normalizer these sample values are represented in the
  1888. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1889. audio signal, or "waveform", should be centered around the zero point.
  1890. That means if we calculate the mean value of all samples in a file, or in a
  1891. single frame, then the result should be 0.0 or at least very close to that
  1892. value. If, however, there is a significant deviation of the mean value from
  1893. 0.0, in either positive or negative direction, this is referred to as a
  1894. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1895. Audio Normalizer provides optional DC bias correction.
  1896. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1897. the mean value, or "DC correction" offset, of each input frame and subtract
  1898. that value from all of the frame's sample values which ensures those samples
  1899. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1900. boundaries, the DC correction offset values will be interpolated smoothly
  1901. between neighbouring frames.
  1902. @item b
  1903. Enable alternative boundary mode. By default is disabled.
  1904. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1905. around each frame. This includes the preceding frames as well as the
  1906. subsequent frames. However, for the "boundary" frames, located at the very
  1907. beginning and at the very end of the audio file, not all neighbouring
  1908. frames are available. In particular, for the first few frames in the audio
  1909. file, the preceding frames are not known. And, similarly, for the last few
  1910. frames in the audio file, the subsequent frames are not known. Thus, the
  1911. question arises which gain factors should be assumed for the missing frames
  1912. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1913. to deal with this situation. The default boundary mode assumes a gain factor
  1914. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1915. "fade out" at the beginning and at the end of the input, respectively.
  1916. @item s
  1917. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1918. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1919. compression. This means that signal peaks will not be pruned and thus the
  1920. full dynamic range will be retained within each local neighbourhood. However,
  1921. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1922. normalization algorithm with a more "traditional" compression.
  1923. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1924. (thresholding) function. If (and only if) the compression feature is enabled,
  1925. all input frames will be processed by a soft knee thresholding function prior
  1926. to the actual normalization process. Put simply, the thresholding function is
  1927. going to prune all samples whose magnitude exceeds a certain threshold value.
  1928. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1929. value. Instead, the threshold value will be adjusted for each individual
  1930. frame.
  1931. In general, smaller parameters result in stronger compression, and vice versa.
  1932. Values below 3.0 are not recommended, because audible distortion may appear.
  1933. @end table
  1934. @section earwax
  1935. Make audio easier to listen to on headphones.
  1936. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1937. so that when listened to on headphones the stereo image is moved from
  1938. inside your head (standard for headphones) to outside and in front of
  1939. the listener (standard for speakers).
  1940. Ported from SoX.
  1941. @section equalizer
  1942. Apply a two-pole peaking equalisation (EQ) filter. With this
  1943. filter, the signal-level at and around a selected frequency can
  1944. be increased or decreased, whilst (unlike bandpass and bandreject
  1945. filters) that at all other frequencies is unchanged.
  1946. In order to produce complex equalisation curves, this filter can
  1947. be given several times, each with a different central frequency.
  1948. The filter accepts the following options:
  1949. @table @option
  1950. @item frequency, f
  1951. Set the filter's central frequency in Hz.
  1952. @item width_type, t
  1953. Set method to specify band-width of filter.
  1954. @table @option
  1955. @item h
  1956. Hz
  1957. @item q
  1958. Q-Factor
  1959. @item o
  1960. octave
  1961. @item s
  1962. slope
  1963. @end table
  1964. @item width, w
  1965. Specify the band-width of a filter in width_type units.
  1966. @item gain, g
  1967. Set the required gain or attenuation in dB.
  1968. Beware of clipping when using a positive gain.
  1969. @item channels, c
  1970. Specify which channels to filter, by default all available are filtered.
  1971. @end table
  1972. @subsection Examples
  1973. @itemize
  1974. @item
  1975. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1976. @example
  1977. equalizer=f=1000:t=h:width=200:g=-10
  1978. @end example
  1979. @item
  1980. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1981. @example
  1982. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  1983. @end example
  1984. @end itemize
  1985. @section extrastereo
  1986. Linearly increases the difference between left and right channels which
  1987. adds some sort of "live" effect to playback.
  1988. The filter accepts the following options:
  1989. @table @option
  1990. @item m
  1991. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1992. (average of both channels), with 1.0 sound will be unchanged, with
  1993. -1.0 left and right channels will be swapped.
  1994. @item c
  1995. Enable clipping. By default is enabled.
  1996. @end table
  1997. @section firequalizer
  1998. Apply FIR Equalization using arbitrary frequency response.
  1999. The filter accepts the following option:
  2000. @table @option
  2001. @item gain
  2002. Set gain curve equation (in dB). The expression can contain variables:
  2003. @table @option
  2004. @item f
  2005. the evaluated frequency
  2006. @item sr
  2007. sample rate
  2008. @item ch
  2009. channel number, set to 0 when multichannels evaluation is disabled
  2010. @item chid
  2011. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2012. multichannels evaluation is disabled
  2013. @item chs
  2014. number of channels
  2015. @item chlayout
  2016. channel_layout, see libavutil/channel_layout.h
  2017. @end table
  2018. and functions:
  2019. @table @option
  2020. @item gain_interpolate(f)
  2021. interpolate gain on frequency f based on gain_entry
  2022. @item cubic_interpolate(f)
  2023. same as gain_interpolate, but smoother
  2024. @end table
  2025. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2026. @item gain_entry
  2027. Set gain entry for gain_interpolate function. The expression can
  2028. contain functions:
  2029. @table @option
  2030. @item entry(f, g)
  2031. store gain entry at frequency f with value g
  2032. @end table
  2033. This option is also available as command.
  2034. @item delay
  2035. Set filter delay in seconds. Higher value means more accurate.
  2036. Default is @code{0.01}.
  2037. @item accuracy
  2038. Set filter accuracy in Hz. Lower value means more accurate.
  2039. Default is @code{5}.
  2040. @item wfunc
  2041. Set window function. Acceptable values are:
  2042. @table @option
  2043. @item rectangular
  2044. rectangular window, useful when gain curve is already smooth
  2045. @item hann
  2046. hann window (default)
  2047. @item hamming
  2048. hamming window
  2049. @item blackman
  2050. blackman window
  2051. @item nuttall3
  2052. 3-terms continuous 1st derivative nuttall window
  2053. @item mnuttall3
  2054. minimum 3-terms discontinuous nuttall window
  2055. @item nuttall
  2056. 4-terms continuous 1st derivative nuttall window
  2057. @item bnuttall
  2058. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2059. @item bharris
  2060. blackman-harris window
  2061. @item tukey
  2062. tukey window
  2063. @end table
  2064. @item fixed
  2065. If enabled, use fixed number of audio samples. This improves speed when
  2066. filtering with large delay. Default is disabled.
  2067. @item multi
  2068. Enable multichannels evaluation on gain. Default is disabled.
  2069. @item zero_phase
  2070. Enable zero phase mode by subtracting timestamp to compensate delay.
  2071. Default is disabled.
  2072. @item scale
  2073. Set scale used by gain. Acceptable values are:
  2074. @table @option
  2075. @item linlin
  2076. linear frequency, linear gain
  2077. @item linlog
  2078. linear frequency, logarithmic (in dB) gain (default)
  2079. @item loglin
  2080. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2081. @item loglog
  2082. logarithmic frequency, logarithmic gain
  2083. @end table
  2084. @item dumpfile
  2085. Set file for dumping, suitable for gnuplot.
  2086. @item dumpscale
  2087. Set scale for dumpfile. Acceptable values are same with scale option.
  2088. Default is linlog.
  2089. @item fft2
  2090. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2091. Default is disabled.
  2092. @end table
  2093. @subsection Examples
  2094. @itemize
  2095. @item
  2096. lowpass at 1000 Hz:
  2097. @example
  2098. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2099. @end example
  2100. @item
  2101. lowpass at 1000 Hz with gain_entry:
  2102. @example
  2103. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2104. @end example
  2105. @item
  2106. custom equalization:
  2107. @example
  2108. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2109. @end example
  2110. @item
  2111. higher delay with zero phase to compensate delay:
  2112. @example
  2113. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2114. @end example
  2115. @item
  2116. lowpass on left channel, highpass on right channel:
  2117. @example
  2118. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2119. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2120. @end example
  2121. @end itemize
  2122. @section flanger
  2123. Apply a flanging effect to the audio.
  2124. The filter accepts the following options:
  2125. @table @option
  2126. @item delay
  2127. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2128. @item depth
  2129. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2130. @item regen
  2131. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2132. Default value is 0.
  2133. @item width
  2134. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2135. Default value is 71.
  2136. @item speed
  2137. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2138. @item shape
  2139. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2140. Default value is @var{sinusoidal}.
  2141. @item phase
  2142. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2143. Default value is 25.
  2144. @item interp
  2145. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2146. Default is @var{linear}.
  2147. @end table
  2148. @section hdcd
  2149. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2150. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2151. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2152. of HDCD, and detects the Transient Filter flag.
  2153. @example
  2154. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2155. @end example
  2156. When using the filter with wav, note the default encoding for wav is 16-bit,
  2157. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2158. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2159. @example
  2160. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2161. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2162. @end example
  2163. The filter accepts the following options:
  2164. @table @option
  2165. @item disable_autoconvert
  2166. Disable any automatic format conversion or resampling in the filter graph.
  2167. @item process_stereo
  2168. Process the stereo channels together. If target_gain does not match between
  2169. channels, consider it invalid and use the last valid target_gain.
  2170. @item cdt_ms
  2171. Set the code detect timer period in ms.
  2172. @item force_pe
  2173. Always extend peaks above -3dBFS even if PE isn't signaled.
  2174. @item analyze_mode
  2175. Replace audio with a solid tone and adjust the amplitude to signal some
  2176. specific aspect of the decoding process. The output file can be loaded in
  2177. an audio editor alongside the original to aid analysis.
  2178. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2179. Modes are:
  2180. @table @samp
  2181. @item 0, off
  2182. Disabled
  2183. @item 1, lle
  2184. Gain adjustment level at each sample
  2185. @item 2, pe
  2186. Samples where peak extend occurs
  2187. @item 3, cdt
  2188. Samples where the code detect timer is active
  2189. @item 4, tgm
  2190. Samples where the target gain does not match between channels
  2191. @end table
  2192. @end table
  2193. @section headphone
  2194. Apply head-related transfer functions (HRTFs) to create virtual
  2195. loudspeakers around the user for binaural listening via headphones.
  2196. The HRIRs are provided via additional streams, for each channel
  2197. one stereo input stream is needed.
  2198. The filter accepts the following options:
  2199. @table @option
  2200. @item map
  2201. Set mapping of input streams for convolution.
  2202. The argument is a '|'-separated list of channel names in order as they
  2203. are given as additional stream inputs for filter.
  2204. This also specify number of input streams. Number of input streams
  2205. must be not less than number of channels in first stream plus one.
  2206. @item gain
  2207. Set gain applied to audio. Value is in dB. Default is 0.
  2208. @item type
  2209. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2210. processing audio in time domain which is slow.
  2211. @var{freq} is processing audio in frequency domain which is fast.
  2212. Default is @var{freq}.
  2213. @item lfe
  2214. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2215. @end table
  2216. @subsection Examples
  2217. @itemize
  2218. @item
  2219. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2220. each amovie filter use stereo file with IR coefficients as input.
  2221. The files give coefficients for each position of virtual loudspeaker:
  2222. @example
  2223. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2224. output.wav
  2225. @end example
  2226. @end itemize
  2227. @section highpass
  2228. Apply a high-pass filter with 3dB point frequency.
  2229. The filter can be either single-pole, or double-pole (the default).
  2230. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item frequency, f
  2234. Set frequency in Hz. Default is 3000.
  2235. @item poles, p
  2236. Set number of poles. Default is 2.
  2237. @item width_type, t
  2238. Set method to specify band-width of filter.
  2239. @table @option
  2240. @item h
  2241. Hz
  2242. @item q
  2243. Q-Factor
  2244. @item o
  2245. octave
  2246. @item s
  2247. slope
  2248. @end table
  2249. @item width, w
  2250. Specify the band-width of a filter in width_type units.
  2251. Applies only to double-pole filter.
  2252. The default is 0.707q and gives a Butterworth response.
  2253. @item channels, c
  2254. Specify which channels to filter, by default all available are filtered.
  2255. @end table
  2256. @section join
  2257. Join multiple input streams into one multi-channel stream.
  2258. It accepts the following parameters:
  2259. @table @option
  2260. @item inputs
  2261. The number of input streams. It defaults to 2.
  2262. @item channel_layout
  2263. The desired output channel layout. It defaults to stereo.
  2264. @item map
  2265. Map channels from inputs to output. The argument is a '|'-separated list of
  2266. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2267. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2268. can be either the name of the input channel (e.g. FL for front left) or its
  2269. index in the specified input stream. @var{out_channel} is the name of the output
  2270. channel.
  2271. @end table
  2272. The filter will attempt to guess the mappings when they are not specified
  2273. explicitly. It does so by first trying to find an unused matching input channel
  2274. and if that fails it picks the first unused input channel.
  2275. Join 3 inputs (with properly set channel layouts):
  2276. @example
  2277. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2278. @end example
  2279. Build a 5.1 output from 6 single-channel streams:
  2280. @example
  2281. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2282. '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'
  2283. out
  2284. @end example
  2285. @section ladspa
  2286. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2287. To enable compilation of this filter you need to configure FFmpeg with
  2288. @code{--enable-ladspa}.
  2289. @table @option
  2290. @item file, f
  2291. Specifies the name of LADSPA plugin library to load. If the environment
  2292. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2293. each one of the directories specified by the colon separated list in
  2294. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2295. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2296. @file{/usr/lib/ladspa/}.
  2297. @item plugin, p
  2298. Specifies the plugin within the library. Some libraries contain only
  2299. one plugin, but others contain many of them. If this is not set filter
  2300. will list all available plugins within the specified library.
  2301. @item controls, c
  2302. Set the '|' separated list of controls which are zero or more floating point
  2303. values that determine the behavior of the loaded plugin (for example delay,
  2304. threshold or gain).
  2305. Controls need to be defined using the following syntax:
  2306. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2307. @var{valuei} is the value set on the @var{i}-th control.
  2308. Alternatively they can be also defined using the following syntax:
  2309. @var{value0}|@var{value1}|@var{value2}|..., where
  2310. @var{valuei} is the value set on the @var{i}-th control.
  2311. If @option{controls} is set to @code{help}, all available controls and
  2312. their valid ranges are printed.
  2313. @item sample_rate, s
  2314. Specify the sample rate, default to 44100. Only used if plugin have
  2315. zero inputs.
  2316. @item nb_samples, n
  2317. Set the number of samples per channel per each output frame, default
  2318. is 1024. Only used if plugin have zero inputs.
  2319. @item duration, d
  2320. Set the minimum duration of the sourced audio. See
  2321. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2322. for the accepted syntax.
  2323. Note that the resulting duration may be greater than the specified duration,
  2324. as the generated audio is always cut at the end of a complete frame.
  2325. If not specified, or the expressed duration is negative, the audio is
  2326. supposed to be generated forever.
  2327. Only used if plugin have zero inputs.
  2328. @end table
  2329. @subsection Examples
  2330. @itemize
  2331. @item
  2332. List all available plugins within amp (LADSPA example plugin) library:
  2333. @example
  2334. ladspa=file=amp
  2335. @end example
  2336. @item
  2337. List all available controls and their valid ranges for @code{vcf_notch}
  2338. plugin from @code{VCF} library:
  2339. @example
  2340. ladspa=f=vcf:p=vcf_notch:c=help
  2341. @end example
  2342. @item
  2343. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2344. plugin library:
  2345. @example
  2346. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2347. @end example
  2348. @item
  2349. Add reverberation to the audio using TAP-plugins
  2350. (Tom's Audio Processing plugins):
  2351. @example
  2352. ladspa=file=tap_reverb:tap_reverb
  2353. @end example
  2354. @item
  2355. Generate white noise, with 0.2 amplitude:
  2356. @example
  2357. ladspa=file=cmt:noise_source_white:c=c0=.2
  2358. @end example
  2359. @item
  2360. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2361. @code{C* Audio Plugin Suite} (CAPS) library:
  2362. @example
  2363. ladspa=file=caps:Click:c=c1=20'
  2364. @end example
  2365. @item
  2366. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2367. @example
  2368. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2369. @end example
  2370. @item
  2371. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2372. @code{SWH Plugins} collection:
  2373. @example
  2374. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2375. @end example
  2376. @item
  2377. Attenuate low frequencies using Multiband EQ from Steve Harris
  2378. @code{SWH Plugins} collection:
  2379. @example
  2380. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2381. @end example
  2382. @item
  2383. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2384. (CAPS) library:
  2385. @example
  2386. ladspa=caps:Narrower
  2387. @end example
  2388. @item
  2389. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2390. @example
  2391. ladspa=caps:White:.2
  2392. @end example
  2393. @item
  2394. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2395. @example
  2396. ladspa=caps:Fractal:c=c1=1
  2397. @end example
  2398. @item
  2399. Dynamic volume normalization using @code{VLevel} plugin:
  2400. @example
  2401. ladspa=vlevel-ladspa:vlevel_mono
  2402. @end example
  2403. @end itemize
  2404. @subsection Commands
  2405. This filter supports the following commands:
  2406. @table @option
  2407. @item cN
  2408. Modify the @var{N}-th control value.
  2409. If the specified value is not valid, it is ignored and prior one is kept.
  2410. @end table
  2411. @section loudnorm
  2412. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2413. Support for both single pass (livestreams, files) and double pass (files) modes.
  2414. This algorithm can target IL, LRA, and maximum true peak.
  2415. The filter accepts the following options:
  2416. @table @option
  2417. @item I, i
  2418. Set integrated loudness target.
  2419. Range is -70.0 - -5.0. Default value is -24.0.
  2420. @item LRA, lra
  2421. Set loudness range target.
  2422. Range is 1.0 - 20.0. Default value is 7.0.
  2423. @item TP, tp
  2424. Set maximum true peak.
  2425. Range is -9.0 - +0.0. Default value is -2.0.
  2426. @item measured_I, measured_i
  2427. Measured IL of input file.
  2428. Range is -99.0 - +0.0.
  2429. @item measured_LRA, measured_lra
  2430. Measured LRA of input file.
  2431. Range is 0.0 - 99.0.
  2432. @item measured_TP, measured_tp
  2433. Measured true peak of input file.
  2434. Range is -99.0 - +99.0.
  2435. @item measured_thresh
  2436. Measured threshold of input file.
  2437. Range is -99.0 - +0.0.
  2438. @item offset
  2439. Set offset gain. Gain is applied before the true-peak limiter.
  2440. Range is -99.0 - +99.0. Default is +0.0.
  2441. @item linear
  2442. Normalize linearly if possible.
  2443. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2444. to be specified in order to use this mode.
  2445. Options are true or false. Default is true.
  2446. @item dual_mono
  2447. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2448. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2449. If set to @code{true}, this option will compensate for this effect.
  2450. Multi-channel input files are not affected by this option.
  2451. Options are true or false. Default is false.
  2452. @item print_format
  2453. Set print format for stats. Options are summary, json, or none.
  2454. Default value is none.
  2455. @end table
  2456. @section lowpass
  2457. Apply a low-pass filter with 3dB point frequency.
  2458. The filter can be either single-pole or double-pole (the default).
  2459. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2460. The filter accepts the following options:
  2461. @table @option
  2462. @item frequency, f
  2463. Set frequency in Hz. Default is 500.
  2464. @item poles, p
  2465. Set number of poles. Default is 2.
  2466. @item width_type, t
  2467. Set method to specify band-width of filter.
  2468. @table @option
  2469. @item h
  2470. Hz
  2471. @item q
  2472. Q-Factor
  2473. @item o
  2474. octave
  2475. @item s
  2476. slope
  2477. @end table
  2478. @item width, w
  2479. Specify the band-width of a filter in width_type units.
  2480. Applies only to double-pole filter.
  2481. The default is 0.707q and gives a Butterworth response.
  2482. @item channels, c
  2483. Specify which channels to filter, by default all available are filtered.
  2484. @end table
  2485. @subsection Examples
  2486. @itemize
  2487. @item
  2488. Lowpass only LFE channel, it LFE is not present it does nothing:
  2489. @example
  2490. lowpass=c=LFE
  2491. @end example
  2492. @end itemize
  2493. @anchor{pan}
  2494. @section pan
  2495. Mix channels with specific gain levels. The filter accepts the output
  2496. channel layout followed by a set of channels definitions.
  2497. This filter is also designed to efficiently remap the channels of an audio
  2498. stream.
  2499. The filter accepts parameters of the form:
  2500. "@var{l}|@var{outdef}|@var{outdef}|..."
  2501. @table @option
  2502. @item l
  2503. output channel layout or number of channels
  2504. @item outdef
  2505. output channel specification, of the form:
  2506. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2507. @item out_name
  2508. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2509. number (c0, c1, etc.)
  2510. @item gain
  2511. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2512. @item in_name
  2513. input channel to use, see out_name for details; it is not possible to mix
  2514. named and numbered input channels
  2515. @end table
  2516. If the `=' in a channel specification is replaced by `<', then the gains for
  2517. that specification will be renormalized so that the total is 1, thus
  2518. avoiding clipping noise.
  2519. @subsection Mixing examples
  2520. For example, if you want to down-mix from stereo to mono, but with a bigger
  2521. factor for the left channel:
  2522. @example
  2523. pan=1c|c0=0.9*c0+0.1*c1
  2524. @end example
  2525. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2526. 7-channels surround:
  2527. @example
  2528. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2529. @end example
  2530. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2531. that should be preferred (see "-ac" option) unless you have very specific
  2532. needs.
  2533. @subsection Remapping examples
  2534. The channel remapping will be effective if, and only if:
  2535. @itemize
  2536. @item gain coefficients are zeroes or ones,
  2537. @item only one input per channel output,
  2538. @end itemize
  2539. If all these conditions are satisfied, the filter will notify the user ("Pure
  2540. channel mapping detected"), and use an optimized and lossless method to do the
  2541. remapping.
  2542. For example, if you have a 5.1 source and want a stereo audio stream by
  2543. dropping the extra channels:
  2544. @example
  2545. pan="stereo| c0=FL | c1=FR"
  2546. @end example
  2547. Given the same source, you can also switch front left and front right channels
  2548. and keep the input channel layout:
  2549. @example
  2550. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2551. @end example
  2552. If the input is a stereo audio stream, you can mute the front left channel (and
  2553. still keep the stereo channel layout) with:
  2554. @example
  2555. pan="stereo|c1=c1"
  2556. @end example
  2557. Still with a stereo audio stream input, you can copy the right channel in both
  2558. front left and right:
  2559. @example
  2560. pan="stereo| c0=FR | c1=FR"
  2561. @end example
  2562. @section replaygain
  2563. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2564. outputs it unchanged.
  2565. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2566. @section resample
  2567. Convert the audio sample format, sample rate and channel layout. It is
  2568. not meant to be used directly.
  2569. @section rubberband
  2570. Apply time-stretching and pitch-shifting with librubberband.
  2571. The filter accepts the following options:
  2572. @table @option
  2573. @item tempo
  2574. Set tempo scale factor.
  2575. @item pitch
  2576. Set pitch scale factor.
  2577. @item transients
  2578. Set transients detector.
  2579. Possible values are:
  2580. @table @var
  2581. @item crisp
  2582. @item mixed
  2583. @item smooth
  2584. @end table
  2585. @item detector
  2586. Set detector.
  2587. Possible values are:
  2588. @table @var
  2589. @item compound
  2590. @item percussive
  2591. @item soft
  2592. @end table
  2593. @item phase
  2594. Set phase.
  2595. Possible values are:
  2596. @table @var
  2597. @item laminar
  2598. @item independent
  2599. @end table
  2600. @item window
  2601. Set processing window size.
  2602. Possible values are:
  2603. @table @var
  2604. @item standard
  2605. @item short
  2606. @item long
  2607. @end table
  2608. @item smoothing
  2609. Set smoothing.
  2610. Possible values are:
  2611. @table @var
  2612. @item off
  2613. @item on
  2614. @end table
  2615. @item formant
  2616. Enable formant preservation when shift pitching.
  2617. Possible values are:
  2618. @table @var
  2619. @item shifted
  2620. @item preserved
  2621. @end table
  2622. @item pitchq
  2623. Set pitch quality.
  2624. Possible values are:
  2625. @table @var
  2626. @item quality
  2627. @item speed
  2628. @item consistency
  2629. @end table
  2630. @item channels
  2631. Set channels.
  2632. Possible values are:
  2633. @table @var
  2634. @item apart
  2635. @item together
  2636. @end table
  2637. @end table
  2638. @section sidechaincompress
  2639. This filter acts like normal compressor but has the ability to compress
  2640. detected signal using second input signal.
  2641. It needs two input streams and returns one output stream.
  2642. First input stream will be processed depending on second stream signal.
  2643. The filtered signal then can be filtered with other filters in later stages of
  2644. processing. See @ref{pan} and @ref{amerge} filter.
  2645. The filter accepts the following options:
  2646. @table @option
  2647. @item level_in
  2648. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2649. @item threshold
  2650. If a signal of second stream raises above this level it will affect the gain
  2651. reduction of first stream.
  2652. By default is 0.125. Range is between 0.00097563 and 1.
  2653. @item ratio
  2654. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2655. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2656. Default is 2. Range is between 1 and 20.
  2657. @item attack
  2658. Amount of milliseconds the signal has to rise above the threshold before gain
  2659. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2660. @item release
  2661. Amount of milliseconds the signal has to fall below the threshold before
  2662. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2663. @item makeup
  2664. Set the amount by how much signal will be amplified after processing.
  2665. Default is 1. Range is from 1 to 64.
  2666. @item knee
  2667. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2668. Default is 2.82843. Range is between 1 and 8.
  2669. @item link
  2670. Choose if the @code{average} level between all channels of side-chain stream
  2671. or the louder(@code{maximum}) channel of side-chain stream affects the
  2672. reduction. Default is @code{average}.
  2673. @item detection
  2674. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2675. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2676. @item level_sc
  2677. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2678. @item mix
  2679. How much to use compressed signal in output. Default is 1.
  2680. Range is between 0 and 1.
  2681. @end table
  2682. @subsection Examples
  2683. @itemize
  2684. @item
  2685. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2686. depending on the signal of 2nd input and later compressed signal to be
  2687. merged with 2nd input:
  2688. @example
  2689. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2690. @end example
  2691. @end itemize
  2692. @section sidechaingate
  2693. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2694. filter the detected signal before sending it to the gain reduction stage.
  2695. Normally a gate uses the full range signal to detect a level above the
  2696. threshold.
  2697. For example: If you cut all lower frequencies from your sidechain signal
  2698. the gate will decrease the volume of your track only if not enough highs
  2699. appear. With this technique you are able to reduce the resonation of a
  2700. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2701. guitar.
  2702. It needs two input streams and returns one output stream.
  2703. First input stream will be processed depending on second stream signal.
  2704. The filter accepts the following options:
  2705. @table @option
  2706. @item level_in
  2707. Set input level before filtering.
  2708. Default is 1. Allowed range is from 0.015625 to 64.
  2709. @item range
  2710. Set the level of gain reduction when the signal is below the threshold.
  2711. Default is 0.06125. Allowed range is from 0 to 1.
  2712. @item threshold
  2713. If a signal rises above this level the gain reduction is released.
  2714. Default is 0.125. Allowed range is from 0 to 1.
  2715. @item ratio
  2716. Set a ratio about which the signal is reduced.
  2717. Default is 2. Allowed range is from 1 to 9000.
  2718. @item attack
  2719. Amount of milliseconds the signal has to rise above the threshold before gain
  2720. reduction stops.
  2721. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2722. @item release
  2723. Amount of milliseconds the signal has to fall below the threshold before the
  2724. reduction is increased again. Default is 250 milliseconds.
  2725. Allowed range is from 0.01 to 9000.
  2726. @item makeup
  2727. Set amount of amplification of signal after processing.
  2728. Default is 1. Allowed range is from 1 to 64.
  2729. @item knee
  2730. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2731. Default is 2.828427125. Allowed range is from 1 to 8.
  2732. @item detection
  2733. Choose if exact signal should be taken for detection or an RMS like one.
  2734. Default is rms. Can be peak or rms.
  2735. @item link
  2736. Choose if the average level between all channels or the louder channel affects
  2737. the reduction.
  2738. Default is average. Can be average or maximum.
  2739. @item level_sc
  2740. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2741. @end table
  2742. @section silencedetect
  2743. Detect silence in an audio stream.
  2744. This filter logs a message when it detects that the input audio volume is less
  2745. or equal to a noise tolerance value for a duration greater or equal to the
  2746. minimum detected noise duration.
  2747. The printed times and duration are expressed in seconds.
  2748. The filter accepts the following options:
  2749. @table @option
  2750. @item duration, d
  2751. Set silence duration until notification (default is 2 seconds).
  2752. @item noise, n
  2753. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2754. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2755. @end table
  2756. @subsection Examples
  2757. @itemize
  2758. @item
  2759. Detect 5 seconds of silence with -50dB noise tolerance:
  2760. @example
  2761. silencedetect=n=-50dB:d=5
  2762. @end example
  2763. @item
  2764. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2765. tolerance in @file{silence.mp3}:
  2766. @example
  2767. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2768. @end example
  2769. @end itemize
  2770. @section silenceremove
  2771. Remove silence from the beginning, middle or end of the audio.
  2772. The filter accepts the following options:
  2773. @table @option
  2774. @item start_periods
  2775. This value is used to indicate if audio should be trimmed at beginning of
  2776. the audio. A value of zero indicates no silence should be trimmed from the
  2777. beginning. When specifying a non-zero value, it trims audio up until it
  2778. finds non-silence. Normally, when trimming silence from beginning of audio
  2779. the @var{start_periods} will be @code{1} but it can be increased to higher
  2780. values to trim all audio up to specific count of non-silence periods.
  2781. Default value is @code{0}.
  2782. @item start_duration
  2783. Specify the amount of time that non-silence must be detected before it stops
  2784. trimming audio. By increasing the duration, bursts of noises can be treated
  2785. as silence and trimmed off. Default value is @code{0}.
  2786. @item start_threshold
  2787. This indicates what sample value should be treated as silence. For digital
  2788. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2789. you may wish to increase the value to account for background noise.
  2790. Can be specified in dB (in case "dB" is appended to the specified value)
  2791. or amplitude ratio. Default value is @code{0}.
  2792. @item stop_periods
  2793. Set the count for trimming silence from the end of audio.
  2794. To remove silence from the middle of a file, specify a @var{stop_periods}
  2795. that is negative. This value is then treated as a positive value and is
  2796. used to indicate the effect should restart processing as specified by
  2797. @var{start_periods}, making it suitable for removing periods of silence
  2798. in the middle of the audio.
  2799. Default value is @code{0}.
  2800. @item stop_duration
  2801. Specify a duration of silence that must exist before audio is not copied any
  2802. more. By specifying a higher duration, silence that is wanted can be left in
  2803. the audio.
  2804. Default value is @code{0}.
  2805. @item stop_threshold
  2806. This is the same as @option{start_threshold} but for trimming silence from
  2807. the end of audio.
  2808. Can be specified in dB (in case "dB" is appended to the specified value)
  2809. or amplitude ratio. Default value is @code{0}.
  2810. @item leave_silence
  2811. This indicates that @var{stop_duration} length of audio should be left intact
  2812. at the beginning of each period of silence.
  2813. For example, if you want to remove long pauses between words but do not want
  2814. to remove the pauses completely. Default value is @code{0}.
  2815. @item detection
  2816. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2817. and works better with digital silence which is exactly 0.
  2818. Default value is @code{rms}.
  2819. @item window
  2820. Set ratio used to calculate size of window for detecting silence.
  2821. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2822. @end table
  2823. @subsection Examples
  2824. @itemize
  2825. @item
  2826. The following example shows how this filter can be used to start a recording
  2827. that does not contain the delay at the start which usually occurs between
  2828. pressing the record button and the start of the performance:
  2829. @example
  2830. silenceremove=1:5:0.02
  2831. @end example
  2832. @item
  2833. Trim all silence encountered from beginning to end where there is more than 1
  2834. second of silence in audio:
  2835. @example
  2836. silenceremove=0:0:0:-1:1:-90dB
  2837. @end example
  2838. @end itemize
  2839. @section sofalizer
  2840. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2841. loudspeakers around the user for binaural listening via headphones (audio
  2842. formats up to 9 channels supported).
  2843. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2844. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2845. Austrian Academy of Sciences.
  2846. To enable compilation of this filter you need to configure FFmpeg with
  2847. @code{--enable-libmysofa}.
  2848. The filter accepts the following options:
  2849. @table @option
  2850. @item sofa
  2851. Set the SOFA file used for rendering.
  2852. @item gain
  2853. Set gain applied to audio. Value is in dB. Default is 0.
  2854. @item rotation
  2855. Set rotation of virtual loudspeakers in deg. Default is 0.
  2856. @item elevation
  2857. Set elevation of virtual speakers in deg. Default is 0.
  2858. @item radius
  2859. Set distance in meters between loudspeakers and the listener with near-field
  2860. HRTFs. Default is 1.
  2861. @item type
  2862. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2863. processing audio in time domain which is slow.
  2864. @var{freq} is processing audio in frequency domain which is fast.
  2865. Default is @var{freq}.
  2866. @item speakers
  2867. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2868. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2869. Each virtual loudspeaker is described with short channel name following with
  2870. azimuth and elevation in degreees.
  2871. Each virtual loudspeaker description is separated by '|'.
  2872. For example to override front left and front right channel positions use:
  2873. 'speakers=FL 45 15|FR 345 15'.
  2874. Descriptions with unrecognised channel names are ignored.
  2875. @item lfegain
  2876. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2877. @end table
  2878. @subsection Examples
  2879. @itemize
  2880. @item
  2881. Using ClubFritz6 sofa file:
  2882. @example
  2883. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2884. @end example
  2885. @item
  2886. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2887. @example
  2888. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2889. @end example
  2890. @item
  2891. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2892. and also with custom gain:
  2893. @example
  2894. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2895. @end example
  2896. @end itemize
  2897. @section stereotools
  2898. This filter has some handy utilities to manage stereo signals, for converting
  2899. M/S stereo recordings to L/R signal while having control over the parameters
  2900. or spreading the stereo image of master track.
  2901. The filter accepts the following options:
  2902. @table @option
  2903. @item level_in
  2904. Set input level before filtering for both channels. Defaults is 1.
  2905. Allowed range is from 0.015625 to 64.
  2906. @item level_out
  2907. Set output level after filtering for both channels. Defaults is 1.
  2908. Allowed range is from 0.015625 to 64.
  2909. @item balance_in
  2910. Set input balance between both channels. Default is 0.
  2911. Allowed range is from -1 to 1.
  2912. @item balance_out
  2913. Set output balance between both channels. Default is 0.
  2914. Allowed range is from -1 to 1.
  2915. @item softclip
  2916. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2917. clipping. Disabled by default.
  2918. @item mutel
  2919. Mute the left channel. Disabled by default.
  2920. @item muter
  2921. Mute the right channel. Disabled by default.
  2922. @item phasel
  2923. Change the phase of the left channel. Disabled by default.
  2924. @item phaser
  2925. Change the phase of the right channel. Disabled by default.
  2926. @item mode
  2927. Set stereo mode. Available values are:
  2928. @table @samp
  2929. @item lr>lr
  2930. Left/Right to Left/Right, this is default.
  2931. @item lr>ms
  2932. Left/Right to Mid/Side.
  2933. @item ms>lr
  2934. Mid/Side to Left/Right.
  2935. @item lr>ll
  2936. Left/Right to Left/Left.
  2937. @item lr>rr
  2938. Left/Right to Right/Right.
  2939. @item lr>l+r
  2940. Left/Right to Left + Right.
  2941. @item lr>rl
  2942. Left/Right to Right/Left.
  2943. @item ms>ll
  2944. Mid/Side to Left/Left.
  2945. @item ms>rr
  2946. Mid/Side to Right/Right.
  2947. @end table
  2948. @item slev
  2949. Set level of side signal. Default is 1.
  2950. Allowed range is from 0.015625 to 64.
  2951. @item sbal
  2952. Set balance of side signal. Default is 0.
  2953. Allowed range is from -1 to 1.
  2954. @item mlev
  2955. Set level of the middle signal. Default is 1.
  2956. Allowed range is from 0.015625 to 64.
  2957. @item mpan
  2958. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2959. @item base
  2960. Set stereo base between mono and inversed channels. Default is 0.
  2961. Allowed range is from -1 to 1.
  2962. @item delay
  2963. Set delay in milliseconds how much to delay left from right channel and
  2964. vice versa. Default is 0. Allowed range is from -20 to 20.
  2965. @item sclevel
  2966. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2967. @item phase
  2968. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2969. @item bmode_in, bmode_out
  2970. Set balance mode for balance_in/balance_out option.
  2971. Can be one of the following:
  2972. @table @samp
  2973. @item balance
  2974. Classic balance mode. Attenuate one channel at time.
  2975. Gain is raised up to 1.
  2976. @item amplitude
  2977. Similar as classic mode above but gain is raised up to 2.
  2978. @item power
  2979. Equal power distribution, from -6dB to +6dB range.
  2980. @end table
  2981. @end table
  2982. @subsection Examples
  2983. @itemize
  2984. @item
  2985. Apply karaoke like effect:
  2986. @example
  2987. stereotools=mlev=0.015625
  2988. @end example
  2989. @item
  2990. Convert M/S signal to L/R:
  2991. @example
  2992. "stereotools=mode=ms>lr"
  2993. @end example
  2994. @end itemize
  2995. @section stereowiden
  2996. This filter enhance the stereo effect by suppressing signal common to both
  2997. channels and by delaying the signal of left into right and vice versa,
  2998. thereby widening the stereo effect.
  2999. The filter accepts the following options:
  3000. @table @option
  3001. @item delay
  3002. Time in milliseconds of the delay of left signal into right and vice versa.
  3003. Default is 20 milliseconds.
  3004. @item feedback
  3005. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3006. effect of left signal in right output and vice versa which gives widening
  3007. effect. Default is 0.3.
  3008. @item crossfeed
  3009. Cross feed of left into right with inverted phase. This helps in suppressing
  3010. the mono. If the value is 1 it will cancel all the signal common to both
  3011. channels. Default is 0.3.
  3012. @item drymix
  3013. Set level of input signal of original channel. Default is 0.8.
  3014. @end table
  3015. @section superequalizer
  3016. Apply 18 band equalizer.
  3017. The filter accepts the following options:
  3018. @table @option
  3019. @item 1b
  3020. Set 65Hz band gain.
  3021. @item 2b
  3022. Set 92Hz band gain.
  3023. @item 3b
  3024. Set 131Hz band gain.
  3025. @item 4b
  3026. Set 185Hz band gain.
  3027. @item 5b
  3028. Set 262Hz band gain.
  3029. @item 6b
  3030. Set 370Hz band gain.
  3031. @item 7b
  3032. Set 523Hz band gain.
  3033. @item 8b
  3034. Set 740Hz band gain.
  3035. @item 9b
  3036. Set 1047Hz band gain.
  3037. @item 10b
  3038. Set 1480Hz band gain.
  3039. @item 11b
  3040. Set 2093Hz band gain.
  3041. @item 12b
  3042. Set 2960Hz band gain.
  3043. @item 13b
  3044. Set 4186Hz band gain.
  3045. @item 14b
  3046. Set 5920Hz band gain.
  3047. @item 15b
  3048. Set 8372Hz band gain.
  3049. @item 16b
  3050. Set 11840Hz band gain.
  3051. @item 17b
  3052. Set 16744Hz band gain.
  3053. @item 18b
  3054. Set 20000Hz band gain.
  3055. @end table
  3056. @section surround
  3057. Apply audio surround upmix filter.
  3058. This filter allows to produce multichannel output from audio stream.
  3059. The filter accepts the following options:
  3060. @table @option
  3061. @item chl_out
  3062. Set output channel layout. By default, this is @var{5.1}.
  3063. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3064. for the required syntax.
  3065. @item chl_in
  3066. Set input channel layout. By default, this is @var{stereo}.
  3067. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3068. for the required syntax.
  3069. @item level_in
  3070. Set input volume level. By default, this is @var{1}.
  3071. @item level_out
  3072. Set output volume level. By default, this is @var{1}.
  3073. @item lfe
  3074. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3075. @item lfe_low
  3076. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3077. @item lfe_high
  3078. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3079. @end table
  3080. @section treble
  3081. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3082. shelving filter with a response similar to that of a standard
  3083. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3084. The filter accepts the following options:
  3085. @table @option
  3086. @item gain, g
  3087. Give the gain at whichever is the lower of ~22 kHz and the
  3088. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3089. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3090. @item frequency, f
  3091. Set the filter's central frequency and so can be used
  3092. to extend or reduce the frequency range to be boosted or cut.
  3093. The default value is @code{3000} Hz.
  3094. @item width_type, t
  3095. Set method to specify band-width of filter.
  3096. @table @option
  3097. @item h
  3098. Hz
  3099. @item q
  3100. Q-Factor
  3101. @item o
  3102. octave
  3103. @item s
  3104. slope
  3105. @end table
  3106. @item width, w
  3107. Determine how steep is the filter's shelf transition.
  3108. @item channels, c
  3109. Specify which channels to filter, by default all available are filtered.
  3110. @end table
  3111. @section tremolo
  3112. Sinusoidal amplitude modulation.
  3113. The filter accepts the following options:
  3114. @table @option
  3115. @item f
  3116. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3117. (20 Hz or lower) will result in a tremolo effect.
  3118. This filter may also be used as a ring modulator by specifying
  3119. a modulation frequency higher than 20 Hz.
  3120. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3121. @item d
  3122. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3123. Default value is 0.5.
  3124. @end table
  3125. @section vibrato
  3126. Sinusoidal phase modulation.
  3127. The filter accepts the following options:
  3128. @table @option
  3129. @item f
  3130. Modulation frequency in Hertz.
  3131. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3132. @item d
  3133. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3134. Default value is 0.5.
  3135. @end table
  3136. @section volume
  3137. Adjust the input audio volume.
  3138. It accepts the following parameters:
  3139. @table @option
  3140. @item volume
  3141. Set audio volume expression.
  3142. Output values are clipped to the maximum value.
  3143. The output audio volume is given by the relation:
  3144. @example
  3145. @var{output_volume} = @var{volume} * @var{input_volume}
  3146. @end example
  3147. The default value for @var{volume} is "1.0".
  3148. @item precision
  3149. This parameter represents the mathematical precision.
  3150. It determines which input sample formats will be allowed, which affects the
  3151. precision of the volume scaling.
  3152. @table @option
  3153. @item fixed
  3154. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3155. @item float
  3156. 32-bit floating-point; this limits input sample format to FLT. (default)
  3157. @item double
  3158. 64-bit floating-point; this limits input sample format to DBL.
  3159. @end table
  3160. @item replaygain
  3161. Choose the behaviour on encountering ReplayGain side data in input frames.
  3162. @table @option
  3163. @item drop
  3164. Remove ReplayGain side data, ignoring its contents (the default).
  3165. @item ignore
  3166. Ignore ReplayGain side data, but leave it in the frame.
  3167. @item track
  3168. Prefer the track gain, if present.
  3169. @item album
  3170. Prefer the album gain, if present.
  3171. @end table
  3172. @item replaygain_preamp
  3173. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3174. Default value for @var{replaygain_preamp} is 0.0.
  3175. @item eval
  3176. Set when the volume expression is evaluated.
  3177. It accepts the following values:
  3178. @table @samp
  3179. @item once
  3180. only evaluate expression once during the filter initialization, or
  3181. when the @samp{volume} command is sent
  3182. @item frame
  3183. evaluate expression for each incoming frame
  3184. @end table
  3185. Default value is @samp{once}.
  3186. @end table
  3187. The volume expression can contain the following parameters.
  3188. @table @option
  3189. @item n
  3190. frame number (starting at zero)
  3191. @item nb_channels
  3192. number of channels
  3193. @item nb_consumed_samples
  3194. number of samples consumed by the filter
  3195. @item nb_samples
  3196. number of samples in the current frame
  3197. @item pos
  3198. original frame position in the file
  3199. @item pts
  3200. frame PTS
  3201. @item sample_rate
  3202. sample rate
  3203. @item startpts
  3204. PTS at start of stream
  3205. @item startt
  3206. time at start of stream
  3207. @item t
  3208. frame time
  3209. @item tb
  3210. timestamp timebase
  3211. @item volume
  3212. last set volume value
  3213. @end table
  3214. Note that when @option{eval} is set to @samp{once} only the
  3215. @var{sample_rate} and @var{tb} variables are available, all other
  3216. variables will evaluate to NAN.
  3217. @subsection Commands
  3218. This filter supports the following commands:
  3219. @table @option
  3220. @item volume
  3221. Modify the volume expression.
  3222. The command accepts the same syntax of the corresponding option.
  3223. If the specified expression is not valid, it is kept at its current
  3224. value.
  3225. @item replaygain_noclip
  3226. Prevent clipping by limiting the gain applied.
  3227. Default value for @var{replaygain_noclip} is 1.
  3228. @end table
  3229. @subsection Examples
  3230. @itemize
  3231. @item
  3232. Halve the input audio volume:
  3233. @example
  3234. volume=volume=0.5
  3235. volume=volume=1/2
  3236. volume=volume=-6.0206dB
  3237. @end example
  3238. In all the above example the named key for @option{volume} can be
  3239. omitted, for example like in:
  3240. @example
  3241. volume=0.5
  3242. @end example
  3243. @item
  3244. Increase input audio power by 6 decibels using fixed-point precision:
  3245. @example
  3246. volume=volume=6dB:precision=fixed
  3247. @end example
  3248. @item
  3249. Fade volume after time 10 with an annihilation period of 5 seconds:
  3250. @example
  3251. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3252. @end example
  3253. @end itemize
  3254. @section volumedetect
  3255. Detect the volume of the input video.
  3256. The filter has no parameters. The input is not modified. Statistics about
  3257. the volume will be printed in the log when the input stream end is reached.
  3258. In particular it will show the mean volume (root mean square), maximum
  3259. volume (on a per-sample basis), and the beginning of a histogram of the
  3260. registered volume values (from the maximum value to a cumulated 1/1000 of
  3261. the samples).
  3262. All volumes are in decibels relative to the maximum PCM value.
  3263. @subsection Examples
  3264. Here is an excerpt of the output:
  3265. @example
  3266. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3267. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3268. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3269. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3270. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3271. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3272. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3273. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3274. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3275. @end example
  3276. It means that:
  3277. @itemize
  3278. @item
  3279. The mean square energy is approximately -27 dB, or 10^-2.7.
  3280. @item
  3281. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3282. @item
  3283. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3284. @end itemize
  3285. In other words, raising the volume by +4 dB does not cause any clipping,
  3286. raising it by +5 dB causes clipping for 6 samples, etc.
  3287. @c man end AUDIO FILTERS
  3288. @chapter Audio Sources
  3289. @c man begin AUDIO SOURCES
  3290. Below is a description of the currently available audio sources.
  3291. @section abuffer
  3292. Buffer audio frames, and make them available to the filter chain.
  3293. This source is mainly intended for a programmatic use, in particular
  3294. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3295. It accepts the following parameters:
  3296. @table @option
  3297. @item time_base
  3298. The timebase which will be used for timestamps of submitted frames. It must be
  3299. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3300. @item sample_rate
  3301. The sample rate of the incoming audio buffers.
  3302. @item sample_fmt
  3303. The sample format of the incoming audio buffers.
  3304. Either a sample format name or its corresponding integer representation from
  3305. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3306. @item channel_layout
  3307. The channel layout of the incoming audio buffers.
  3308. Either a channel layout name from channel_layout_map in
  3309. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3310. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3311. @item channels
  3312. The number of channels of the incoming audio buffers.
  3313. If both @var{channels} and @var{channel_layout} are specified, then they
  3314. must be consistent.
  3315. @end table
  3316. @subsection Examples
  3317. @example
  3318. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3319. @end example
  3320. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3321. Since the sample format with name "s16p" corresponds to the number
  3322. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3323. equivalent to:
  3324. @example
  3325. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3326. @end example
  3327. @section aevalsrc
  3328. Generate an audio signal specified by an expression.
  3329. This source accepts in input one or more expressions (one for each
  3330. channel), which are evaluated and used to generate a corresponding
  3331. audio signal.
  3332. This source accepts the following options:
  3333. @table @option
  3334. @item exprs
  3335. Set the '|'-separated expressions list for each separate channel. In case the
  3336. @option{channel_layout} option is not specified, the selected channel layout
  3337. depends on the number of provided expressions. Otherwise the last
  3338. specified expression is applied to the remaining output channels.
  3339. @item channel_layout, c
  3340. Set the channel layout. The number of channels in the specified layout
  3341. must be equal to the number of specified expressions.
  3342. @item duration, d
  3343. Set the minimum duration of the sourced audio. See
  3344. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3345. for the accepted syntax.
  3346. Note that the resulting duration may be greater than the specified
  3347. duration, as the generated audio is always cut at the end of a
  3348. complete frame.
  3349. If not specified, or the expressed duration is negative, the audio is
  3350. supposed to be generated forever.
  3351. @item nb_samples, n
  3352. Set the number of samples per channel per each output frame,
  3353. default to 1024.
  3354. @item sample_rate, s
  3355. Specify the sample rate, default to 44100.
  3356. @end table
  3357. Each expression in @var{exprs} can contain the following constants:
  3358. @table @option
  3359. @item n
  3360. number of the evaluated sample, starting from 0
  3361. @item t
  3362. time of the evaluated sample expressed in seconds, starting from 0
  3363. @item s
  3364. sample rate
  3365. @end table
  3366. @subsection Examples
  3367. @itemize
  3368. @item
  3369. Generate silence:
  3370. @example
  3371. aevalsrc=0
  3372. @end example
  3373. @item
  3374. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3375. 8000 Hz:
  3376. @example
  3377. aevalsrc="sin(440*2*PI*t):s=8000"
  3378. @end example
  3379. @item
  3380. Generate a two channels signal, specify the channel layout (Front
  3381. Center + Back Center) explicitly:
  3382. @example
  3383. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3384. @end example
  3385. @item
  3386. Generate white noise:
  3387. @example
  3388. aevalsrc="-2+random(0)"
  3389. @end example
  3390. @item
  3391. Generate an amplitude modulated signal:
  3392. @example
  3393. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3394. @end example
  3395. @item
  3396. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3397. @example
  3398. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3399. @end example
  3400. @end itemize
  3401. @section anullsrc
  3402. The null audio source, return unprocessed audio frames. It is mainly useful
  3403. as a template and to be employed in analysis / debugging tools, or as
  3404. the source for filters which ignore the input data (for example the sox
  3405. synth filter).
  3406. This source accepts the following options:
  3407. @table @option
  3408. @item channel_layout, cl
  3409. Specifies the channel layout, and can be either an integer or a string
  3410. representing a channel layout. The default value of @var{channel_layout}
  3411. is "stereo".
  3412. Check the channel_layout_map definition in
  3413. @file{libavutil/channel_layout.c} for the mapping between strings and
  3414. channel layout values.
  3415. @item sample_rate, r
  3416. Specifies the sample rate, and defaults to 44100.
  3417. @item nb_samples, n
  3418. Set the number of samples per requested frames.
  3419. @end table
  3420. @subsection Examples
  3421. @itemize
  3422. @item
  3423. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3424. @example
  3425. anullsrc=r=48000:cl=4
  3426. @end example
  3427. @item
  3428. Do the same operation with a more obvious syntax:
  3429. @example
  3430. anullsrc=r=48000:cl=mono
  3431. @end example
  3432. @end itemize
  3433. All the parameters need to be explicitly defined.
  3434. @section flite
  3435. Synthesize a voice utterance using the libflite library.
  3436. To enable compilation of this filter you need to configure FFmpeg with
  3437. @code{--enable-libflite}.
  3438. Note that the flite library is not thread-safe.
  3439. The filter accepts the following options:
  3440. @table @option
  3441. @item list_voices
  3442. If set to 1, list the names of the available voices and exit
  3443. immediately. Default value is 0.
  3444. @item nb_samples, n
  3445. Set the maximum number of samples per frame. Default value is 512.
  3446. @item textfile
  3447. Set the filename containing the text to speak.
  3448. @item text
  3449. Set the text to speak.
  3450. @item voice, v
  3451. Set the voice to use for the speech synthesis. Default value is
  3452. @code{kal}. See also the @var{list_voices} option.
  3453. @end table
  3454. @subsection Examples
  3455. @itemize
  3456. @item
  3457. Read from file @file{speech.txt}, and synthesize the text using the
  3458. standard flite voice:
  3459. @example
  3460. flite=textfile=speech.txt
  3461. @end example
  3462. @item
  3463. Read the specified text selecting the @code{slt} voice:
  3464. @example
  3465. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3466. @end example
  3467. @item
  3468. Input text to ffmpeg:
  3469. @example
  3470. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3471. @end example
  3472. @item
  3473. Make @file{ffplay} speak the specified text, using @code{flite} and
  3474. the @code{lavfi} device:
  3475. @example
  3476. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3477. @end example
  3478. @end itemize
  3479. For more information about libflite, check:
  3480. @url{http://www.speech.cs.cmu.edu/flite/}
  3481. @section anoisesrc
  3482. Generate a noise audio signal.
  3483. The filter accepts the following options:
  3484. @table @option
  3485. @item sample_rate, r
  3486. Specify the sample rate. Default value is 48000 Hz.
  3487. @item amplitude, a
  3488. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3489. is 1.0.
  3490. @item duration, d
  3491. Specify the duration of the generated audio stream. Not specifying this option
  3492. results in noise with an infinite length.
  3493. @item color, colour, c
  3494. Specify the color of noise. Available noise colors are white, pink, brown,
  3495. blue and violet. Default color is white.
  3496. @item seed, s
  3497. Specify a value used to seed the PRNG.
  3498. @item nb_samples, n
  3499. Set the number of samples per each output frame, default is 1024.
  3500. @end table
  3501. @subsection Examples
  3502. @itemize
  3503. @item
  3504. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3505. @example
  3506. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3507. @end example
  3508. @end itemize
  3509. @section sine
  3510. Generate an audio signal made of a sine wave with amplitude 1/8.
  3511. The audio signal is bit-exact.
  3512. The filter accepts the following options:
  3513. @table @option
  3514. @item frequency, f
  3515. Set the carrier frequency. Default is 440 Hz.
  3516. @item beep_factor, b
  3517. Enable a periodic beep every second with frequency @var{beep_factor} times
  3518. the carrier frequency. Default is 0, meaning the beep is disabled.
  3519. @item sample_rate, r
  3520. Specify the sample rate, default is 44100.
  3521. @item duration, d
  3522. Specify the duration of the generated audio stream.
  3523. @item samples_per_frame
  3524. Set the number of samples per output frame.
  3525. The expression can contain the following constants:
  3526. @table @option
  3527. @item n
  3528. The (sequential) number of the output audio frame, starting from 0.
  3529. @item pts
  3530. The PTS (Presentation TimeStamp) of the output audio frame,
  3531. expressed in @var{TB} units.
  3532. @item t
  3533. The PTS of the output audio frame, expressed in seconds.
  3534. @item TB
  3535. The timebase of the output audio frames.
  3536. @end table
  3537. Default is @code{1024}.
  3538. @end table
  3539. @subsection Examples
  3540. @itemize
  3541. @item
  3542. Generate a simple 440 Hz sine wave:
  3543. @example
  3544. sine
  3545. @end example
  3546. @item
  3547. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3548. @example
  3549. sine=220:4:d=5
  3550. sine=f=220:b=4:d=5
  3551. sine=frequency=220:beep_factor=4:duration=5
  3552. @end example
  3553. @item
  3554. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3555. pattern:
  3556. @example
  3557. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3558. @end example
  3559. @end itemize
  3560. @c man end AUDIO SOURCES
  3561. @chapter Audio Sinks
  3562. @c man begin AUDIO SINKS
  3563. Below is a description of the currently available audio sinks.
  3564. @section abuffersink
  3565. Buffer audio frames, and make them available to the end of filter chain.
  3566. This sink is mainly intended for programmatic use, in particular
  3567. through the interface defined in @file{libavfilter/buffersink.h}
  3568. or the options system.
  3569. It accepts a pointer to an AVABufferSinkContext structure, which
  3570. defines the incoming buffers' formats, to be passed as the opaque
  3571. parameter to @code{avfilter_init_filter} for initialization.
  3572. @section anullsink
  3573. Null audio sink; do absolutely nothing with the input audio. It is
  3574. mainly useful as a template and for use in analysis / debugging
  3575. tools.
  3576. @c man end AUDIO SINKS
  3577. @chapter Video Filters
  3578. @c man begin VIDEO FILTERS
  3579. When you configure your FFmpeg build, you can disable any of the
  3580. existing filters using @code{--disable-filters}.
  3581. The configure output will show the video filters included in your
  3582. build.
  3583. Below is a description of the currently available video filters.
  3584. @section alphaextract
  3585. Extract the alpha component from the input as a grayscale video. This
  3586. is especially useful with the @var{alphamerge} filter.
  3587. @section alphamerge
  3588. Add or replace the alpha component of the primary input with the
  3589. grayscale value of a second input. This is intended for use with
  3590. @var{alphaextract} to allow the transmission or storage of frame
  3591. sequences that have alpha in a format that doesn't support an alpha
  3592. channel.
  3593. For example, to reconstruct full frames from a normal YUV-encoded video
  3594. and a separate video created with @var{alphaextract}, you might use:
  3595. @example
  3596. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3597. @end example
  3598. Since this filter is designed for reconstruction, it operates on frame
  3599. sequences without considering timestamps, and terminates when either
  3600. input reaches end of stream. This will cause problems if your encoding
  3601. pipeline drops frames. If you're trying to apply an image as an
  3602. overlay to a video stream, consider the @var{overlay} filter instead.
  3603. @section ass
  3604. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3605. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3606. Substation Alpha) subtitles files.
  3607. This filter accepts the following option in addition to the common options from
  3608. the @ref{subtitles} filter:
  3609. @table @option
  3610. @item shaping
  3611. Set the shaping engine
  3612. Available values are:
  3613. @table @samp
  3614. @item auto
  3615. The default libass shaping engine, which is the best available.
  3616. @item simple
  3617. Fast, font-agnostic shaper that can do only substitutions
  3618. @item complex
  3619. Slower shaper using OpenType for substitutions and positioning
  3620. @end table
  3621. The default is @code{auto}.
  3622. @end table
  3623. @section atadenoise
  3624. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3625. The filter accepts the following options:
  3626. @table @option
  3627. @item 0a
  3628. Set threshold A for 1st plane. Default is 0.02.
  3629. Valid range is 0 to 0.3.
  3630. @item 0b
  3631. Set threshold B for 1st plane. Default is 0.04.
  3632. Valid range is 0 to 5.
  3633. @item 1a
  3634. Set threshold A for 2nd plane. Default is 0.02.
  3635. Valid range is 0 to 0.3.
  3636. @item 1b
  3637. Set threshold B for 2nd plane. Default is 0.04.
  3638. Valid range is 0 to 5.
  3639. @item 2a
  3640. Set threshold A for 3rd plane. Default is 0.02.
  3641. Valid range is 0 to 0.3.
  3642. @item 2b
  3643. Set threshold B for 3rd plane. Default is 0.04.
  3644. Valid range is 0 to 5.
  3645. Threshold A is designed to react on abrupt changes in the input signal and
  3646. threshold B is designed to react on continuous changes in the input signal.
  3647. @item s
  3648. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3649. number in range [5, 129].
  3650. @item p
  3651. Set what planes of frame filter will use for averaging. Default is all.
  3652. @end table
  3653. @section avgblur
  3654. Apply average blur filter.
  3655. The filter accepts the following options:
  3656. @table @option
  3657. @item sizeX
  3658. Set horizontal kernel size.
  3659. @item planes
  3660. Set which planes to filter. By default all planes are filtered.
  3661. @item sizeY
  3662. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3663. Default is @code{0}.
  3664. @end table
  3665. @section bbox
  3666. Compute the bounding box for the non-black pixels in the input frame
  3667. luminance plane.
  3668. This filter computes the bounding box containing all the pixels with a
  3669. luminance value greater than the minimum allowed value.
  3670. The parameters describing the bounding box are printed on the filter
  3671. log.
  3672. The filter accepts the following option:
  3673. @table @option
  3674. @item min_val
  3675. Set the minimal luminance value. Default is @code{16}.
  3676. @end table
  3677. @section bitplanenoise
  3678. Show and measure bit plane noise.
  3679. The filter accepts the following options:
  3680. @table @option
  3681. @item bitplane
  3682. Set which plane to analyze. Default is @code{1}.
  3683. @item filter
  3684. Filter out noisy pixels from @code{bitplane} set above.
  3685. Default is disabled.
  3686. @end table
  3687. @section blackdetect
  3688. Detect video intervals that are (almost) completely black. Can be
  3689. useful to detect chapter transitions, commercials, or invalid
  3690. recordings. Output lines contains the time for the start, end and
  3691. duration of the detected black interval expressed in seconds.
  3692. In order to display the output lines, you need to set the loglevel at
  3693. least to the AV_LOG_INFO value.
  3694. The filter accepts the following options:
  3695. @table @option
  3696. @item black_min_duration, d
  3697. Set the minimum detected black duration expressed in seconds. It must
  3698. be a non-negative floating point number.
  3699. Default value is 2.0.
  3700. @item picture_black_ratio_th, pic_th
  3701. Set the threshold for considering a picture "black".
  3702. Express the minimum value for the ratio:
  3703. @example
  3704. @var{nb_black_pixels} / @var{nb_pixels}
  3705. @end example
  3706. for which a picture is considered black.
  3707. Default value is 0.98.
  3708. @item pixel_black_th, pix_th
  3709. Set the threshold for considering a pixel "black".
  3710. The threshold expresses the maximum pixel luminance value for which a
  3711. pixel is considered "black". The provided value is scaled according to
  3712. the following equation:
  3713. @example
  3714. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3715. @end example
  3716. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3717. the input video format, the range is [0-255] for YUV full-range
  3718. formats and [16-235] for YUV non full-range formats.
  3719. Default value is 0.10.
  3720. @end table
  3721. The following example sets the maximum pixel threshold to the minimum
  3722. value, and detects only black intervals of 2 or more seconds:
  3723. @example
  3724. blackdetect=d=2:pix_th=0.00
  3725. @end example
  3726. @section blackframe
  3727. Detect frames that are (almost) completely black. Can be useful to
  3728. detect chapter transitions or commercials. Output lines consist of
  3729. the frame number of the detected frame, the percentage of blackness,
  3730. the position in the file if known or -1 and the timestamp in seconds.
  3731. In order to display the output lines, you need to set the loglevel at
  3732. least to the AV_LOG_INFO value.
  3733. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3734. The value represents the percentage of pixels in the picture that
  3735. are below the threshold value.
  3736. It accepts the following parameters:
  3737. @table @option
  3738. @item amount
  3739. The percentage of the pixels that have to be below the threshold; it defaults to
  3740. @code{98}.
  3741. @item threshold, thresh
  3742. The threshold below which a pixel value is considered black; it defaults to
  3743. @code{32}.
  3744. @end table
  3745. @section blend, tblend
  3746. Blend two video frames into each other.
  3747. The @code{blend} filter takes two input streams and outputs one
  3748. stream, the first input is the "top" layer and second input is
  3749. "bottom" layer. By default, the output terminates when the longest input terminates.
  3750. The @code{tblend} (time blend) filter takes two consecutive frames
  3751. from one single stream, and outputs the result obtained by blending
  3752. the new frame on top of the old frame.
  3753. A description of the accepted options follows.
  3754. @table @option
  3755. @item c0_mode
  3756. @item c1_mode
  3757. @item c2_mode
  3758. @item c3_mode
  3759. @item all_mode
  3760. Set blend mode for specific pixel component or all pixel components in case
  3761. of @var{all_mode}. Default value is @code{normal}.
  3762. Available values for component modes are:
  3763. @table @samp
  3764. @item addition
  3765. @item addition128
  3766. @item and
  3767. @item average
  3768. @item burn
  3769. @item darken
  3770. @item difference
  3771. @item difference128
  3772. @item divide
  3773. @item dodge
  3774. @item freeze
  3775. @item exclusion
  3776. @item extremity
  3777. @item glow
  3778. @item hardlight
  3779. @item hardmix
  3780. @item heat
  3781. @item lighten
  3782. @item linearlight
  3783. @item multiply
  3784. @item multiply128
  3785. @item negation
  3786. @item normal
  3787. @item or
  3788. @item overlay
  3789. @item phoenix
  3790. @item pinlight
  3791. @item reflect
  3792. @item screen
  3793. @item softlight
  3794. @item subtract
  3795. @item vividlight
  3796. @item xor
  3797. @end table
  3798. @item c0_opacity
  3799. @item c1_opacity
  3800. @item c2_opacity
  3801. @item c3_opacity
  3802. @item all_opacity
  3803. Set blend opacity for specific pixel component or all pixel components in case
  3804. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3805. @item c0_expr
  3806. @item c1_expr
  3807. @item c2_expr
  3808. @item c3_expr
  3809. @item all_expr
  3810. Set blend expression for specific pixel component or all pixel components in case
  3811. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3812. The expressions can use the following variables:
  3813. @table @option
  3814. @item N
  3815. The sequential number of the filtered frame, starting from @code{0}.
  3816. @item X
  3817. @item Y
  3818. the coordinates of the current sample
  3819. @item W
  3820. @item H
  3821. the width and height of currently filtered plane
  3822. @item SW
  3823. @item SH
  3824. Width and height scale depending on the currently filtered plane. It is the
  3825. ratio between the corresponding luma plane number of pixels and the current
  3826. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3827. @code{0.5,0.5} for chroma planes.
  3828. @item T
  3829. Time of the current frame, expressed in seconds.
  3830. @item TOP, A
  3831. Value of pixel component at current location for first video frame (top layer).
  3832. @item BOTTOM, B
  3833. Value of pixel component at current location for second video frame (bottom layer).
  3834. @end table
  3835. @item shortest
  3836. Force termination when the shortest input terminates. Default is
  3837. @code{0}. This option is only defined for the @code{blend} filter.
  3838. @item repeatlast
  3839. Continue applying the last bottom frame after the end of the stream. A value of
  3840. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3841. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3842. @end table
  3843. @subsection Examples
  3844. @itemize
  3845. @item
  3846. Apply transition from bottom layer to top layer in first 10 seconds:
  3847. @example
  3848. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3849. @end example
  3850. @item
  3851. Apply 1x1 checkerboard effect:
  3852. @example
  3853. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3854. @end example
  3855. @item
  3856. Apply uncover left effect:
  3857. @example
  3858. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3859. @end example
  3860. @item
  3861. Apply uncover down effect:
  3862. @example
  3863. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3864. @end example
  3865. @item
  3866. Apply uncover up-left effect:
  3867. @example
  3868. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3869. @end example
  3870. @item
  3871. Split diagonally video and shows top and bottom layer on each side:
  3872. @example
  3873. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3874. @end example
  3875. @item
  3876. Display differences between the current and the previous frame:
  3877. @example
  3878. tblend=all_mode=difference128
  3879. @end example
  3880. @end itemize
  3881. @section boxblur
  3882. Apply a boxblur algorithm to the input video.
  3883. It accepts the following parameters:
  3884. @table @option
  3885. @item luma_radius, lr
  3886. @item luma_power, lp
  3887. @item chroma_radius, cr
  3888. @item chroma_power, cp
  3889. @item alpha_radius, ar
  3890. @item alpha_power, ap
  3891. @end table
  3892. A description of the accepted options follows.
  3893. @table @option
  3894. @item luma_radius, lr
  3895. @item chroma_radius, cr
  3896. @item alpha_radius, ar
  3897. Set an expression for the box radius in pixels used for blurring the
  3898. corresponding input plane.
  3899. The radius value must be a non-negative number, and must not be
  3900. greater than the value of the expression @code{min(w,h)/2} for the
  3901. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3902. planes.
  3903. Default value for @option{luma_radius} is "2". If not specified,
  3904. @option{chroma_radius} and @option{alpha_radius} default to the
  3905. corresponding value set for @option{luma_radius}.
  3906. The expressions can contain the following constants:
  3907. @table @option
  3908. @item w
  3909. @item h
  3910. The input width and height in pixels.
  3911. @item cw
  3912. @item ch
  3913. The input chroma image width and height in pixels.
  3914. @item hsub
  3915. @item vsub
  3916. The horizontal and vertical chroma subsample values. For example, for the
  3917. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3918. @end table
  3919. @item luma_power, lp
  3920. @item chroma_power, cp
  3921. @item alpha_power, ap
  3922. Specify how many times the boxblur filter is applied to the
  3923. corresponding plane.
  3924. Default value for @option{luma_power} is 2. If not specified,
  3925. @option{chroma_power} and @option{alpha_power} default to the
  3926. corresponding value set for @option{luma_power}.
  3927. A value of 0 will disable the effect.
  3928. @end table
  3929. @subsection Examples
  3930. @itemize
  3931. @item
  3932. Apply a boxblur filter with the luma, chroma, and alpha radii
  3933. set to 2:
  3934. @example
  3935. boxblur=luma_radius=2:luma_power=1
  3936. boxblur=2:1
  3937. @end example
  3938. @item
  3939. Set the luma radius to 2, and alpha and chroma radius to 0:
  3940. @example
  3941. boxblur=2:1:cr=0:ar=0
  3942. @end example
  3943. @item
  3944. Set the luma and chroma radii to a fraction of the video dimension:
  3945. @example
  3946. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3947. @end example
  3948. @end itemize
  3949. @section bwdif
  3950. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3951. Deinterlacing Filter").
  3952. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3953. interpolation algorithms.
  3954. It accepts the following parameters:
  3955. @table @option
  3956. @item mode
  3957. The interlacing mode to adopt. It accepts one of the following values:
  3958. @table @option
  3959. @item 0, send_frame
  3960. Output one frame for each frame.
  3961. @item 1, send_field
  3962. Output one frame for each field.
  3963. @end table
  3964. The default value is @code{send_field}.
  3965. @item parity
  3966. The picture field parity assumed for the input interlaced video. It accepts one
  3967. of the following values:
  3968. @table @option
  3969. @item 0, tff
  3970. Assume the top field is first.
  3971. @item 1, bff
  3972. Assume the bottom field is first.
  3973. @item -1, auto
  3974. Enable automatic detection of field parity.
  3975. @end table
  3976. The default value is @code{auto}.
  3977. If the interlacing is unknown or the decoder does not export this information,
  3978. top field first will be assumed.
  3979. @item deint
  3980. Specify which frames to deinterlace. Accept one of the following
  3981. values:
  3982. @table @option
  3983. @item 0, all
  3984. Deinterlace all frames.
  3985. @item 1, interlaced
  3986. Only deinterlace frames marked as interlaced.
  3987. @end table
  3988. The default value is @code{all}.
  3989. @end table
  3990. @section chromakey
  3991. YUV colorspace color/chroma keying.
  3992. The filter accepts the following options:
  3993. @table @option
  3994. @item color
  3995. The color which will be replaced with transparency.
  3996. @item similarity
  3997. Similarity percentage with the key color.
  3998. 0.01 matches only the exact key color, while 1.0 matches everything.
  3999. @item blend
  4000. Blend percentage.
  4001. 0.0 makes pixels either fully transparent, or not transparent at all.
  4002. Higher values result in semi-transparent pixels, with a higher transparency
  4003. the more similar the pixels color is to the key color.
  4004. @item yuv
  4005. Signals that the color passed is already in YUV instead of RGB.
  4006. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4007. This can be used to pass exact YUV values as hexadecimal numbers.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. Make every green pixel in the input image transparent:
  4013. @example
  4014. ffmpeg -i input.png -vf chromakey=green out.png
  4015. @end example
  4016. @item
  4017. Overlay a greenscreen-video on top of a static black background.
  4018. @example
  4019. 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
  4020. @end example
  4021. @end itemize
  4022. @section ciescope
  4023. Display CIE color diagram with pixels overlaid onto it.
  4024. The filter accepts the following options:
  4025. @table @option
  4026. @item system
  4027. Set color system.
  4028. @table @samp
  4029. @item ntsc, 470m
  4030. @item ebu, 470bg
  4031. @item smpte
  4032. @item 240m
  4033. @item apple
  4034. @item widergb
  4035. @item cie1931
  4036. @item rec709, hdtv
  4037. @item uhdtv, rec2020
  4038. @end table
  4039. @item cie
  4040. Set CIE system.
  4041. @table @samp
  4042. @item xyy
  4043. @item ucs
  4044. @item luv
  4045. @end table
  4046. @item gamuts
  4047. Set what gamuts to draw.
  4048. See @code{system} option for available values.
  4049. @item size, s
  4050. Set ciescope size, by default set to 512.
  4051. @item intensity, i
  4052. Set intensity used to map input pixel values to CIE diagram.
  4053. @item contrast
  4054. Set contrast used to draw tongue colors that are out of active color system gamut.
  4055. @item corrgamma
  4056. Correct gamma displayed on scope, by default enabled.
  4057. @item showwhite
  4058. Show white point on CIE diagram, by default disabled.
  4059. @item gamma
  4060. Set input gamma. Used only with XYZ input color space.
  4061. @end table
  4062. @section codecview
  4063. Visualize information exported by some codecs.
  4064. Some codecs can export information through frames using side-data or other
  4065. means. For example, some MPEG based codecs export motion vectors through the
  4066. @var{export_mvs} flag in the codec @option{flags2} option.
  4067. The filter accepts the following option:
  4068. @table @option
  4069. @item mv
  4070. Set motion vectors to visualize.
  4071. Available flags for @var{mv} are:
  4072. @table @samp
  4073. @item pf
  4074. forward predicted MVs of P-frames
  4075. @item bf
  4076. forward predicted MVs of B-frames
  4077. @item bb
  4078. backward predicted MVs of B-frames
  4079. @end table
  4080. @item qp
  4081. Display quantization parameters using the chroma planes.
  4082. @item mv_type, mvt
  4083. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4084. Available flags for @var{mv_type} are:
  4085. @table @samp
  4086. @item fp
  4087. forward predicted MVs
  4088. @item bp
  4089. backward predicted MVs
  4090. @end table
  4091. @item frame_type, ft
  4092. Set frame type to visualize motion vectors of.
  4093. Available flags for @var{frame_type} are:
  4094. @table @samp
  4095. @item if
  4096. intra-coded frames (I-frames)
  4097. @item pf
  4098. predicted frames (P-frames)
  4099. @item bf
  4100. bi-directionally predicted frames (B-frames)
  4101. @end table
  4102. @end table
  4103. @subsection Examples
  4104. @itemize
  4105. @item
  4106. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4107. @example
  4108. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4109. @end example
  4110. @item
  4111. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4112. @example
  4113. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4114. @end example
  4115. @end itemize
  4116. @section colorbalance
  4117. Modify intensity of primary colors (red, green and blue) of input frames.
  4118. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4119. regions for the red-cyan, green-magenta or blue-yellow balance.
  4120. A positive adjustment value shifts the balance towards the primary color, a negative
  4121. value towards the complementary color.
  4122. The filter accepts the following options:
  4123. @table @option
  4124. @item rs
  4125. @item gs
  4126. @item bs
  4127. Adjust red, green and blue shadows (darkest pixels).
  4128. @item rm
  4129. @item gm
  4130. @item bm
  4131. Adjust red, green and blue midtones (medium pixels).
  4132. @item rh
  4133. @item gh
  4134. @item bh
  4135. Adjust red, green and blue highlights (brightest pixels).
  4136. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4137. @end table
  4138. @subsection Examples
  4139. @itemize
  4140. @item
  4141. Add red color cast to shadows:
  4142. @example
  4143. colorbalance=rs=.3
  4144. @end example
  4145. @end itemize
  4146. @section colorkey
  4147. RGB colorspace color keying.
  4148. The filter accepts the following options:
  4149. @table @option
  4150. @item color
  4151. The color which will be replaced with transparency.
  4152. @item similarity
  4153. Similarity percentage with the key color.
  4154. 0.01 matches only the exact key color, while 1.0 matches everything.
  4155. @item blend
  4156. Blend percentage.
  4157. 0.0 makes pixels either fully transparent, or not transparent at all.
  4158. Higher values result in semi-transparent pixels, with a higher transparency
  4159. the more similar the pixels color is to the key color.
  4160. @end table
  4161. @subsection Examples
  4162. @itemize
  4163. @item
  4164. Make every green pixel in the input image transparent:
  4165. @example
  4166. ffmpeg -i input.png -vf colorkey=green out.png
  4167. @end example
  4168. @item
  4169. Overlay a greenscreen-video on top of a static background image.
  4170. @example
  4171. 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
  4172. @end example
  4173. @end itemize
  4174. @section colorlevels
  4175. Adjust video input frames using levels.
  4176. The filter accepts the following options:
  4177. @table @option
  4178. @item rimin
  4179. @item gimin
  4180. @item bimin
  4181. @item aimin
  4182. Adjust red, green, blue and alpha input black point.
  4183. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4184. @item rimax
  4185. @item gimax
  4186. @item bimax
  4187. @item aimax
  4188. Adjust red, green, blue and alpha input white point.
  4189. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4190. Input levels are used to lighten highlights (bright tones), darken shadows
  4191. (dark tones), change the balance of bright and dark tones.
  4192. @item romin
  4193. @item gomin
  4194. @item bomin
  4195. @item aomin
  4196. Adjust red, green, blue and alpha output black point.
  4197. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4198. @item romax
  4199. @item gomax
  4200. @item bomax
  4201. @item aomax
  4202. Adjust red, green, blue and alpha output white point.
  4203. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4204. Output levels allows manual selection of a constrained output level range.
  4205. @end table
  4206. @subsection Examples
  4207. @itemize
  4208. @item
  4209. Make video output darker:
  4210. @example
  4211. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4212. @end example
  4213. @item
  4214. Increase contrast:
  4215. @example
  4216. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4217. @end example
  4218. @item
  4219. Make video output lighter:
  4220. @example
  4221. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4222. @end example
  4223. @item
  4224. Increase brightness:
  4225. @example
  4226. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4227. @end example
  4228. @end itemize
  4229. @section colorchannelmixer
  4230. Adjust video input frames by re-mixing color channels.
  4231. This filter modifies a color channel by adding the values associated to
  4232. the other channels of the same pixels. For example if the value to
  4233. modify is red, the output value will be:
  4234. @example
  4235. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4236. @end example
  4237. The filter accepts the following options:
  4238. @table @option
  4239. @item rr
  4240. @item rg
  4241. @item rb
  4242. @item ra
  4243. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4244. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4245. @item gr
  4246. @item gg
  4247. @item gb
  4248. @item ga
  4249. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4250. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4251. @item br
  4252. @item bg
  4253. @item bb
  4254. @item ba
  4255. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4256. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4257. @item ar
  4258. @item ag
  4259. @item ab
  4260. @item aa
  4261. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4262. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4263. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4264. @end table
  4265. @subsection Examples
  4266. @itemize
  4267. @item
  4268. Convert source to grayscale:
  4269. @example
  4270. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4271. @end example
  4272. @item
  4273. Simulate sepia tones:
  4274. @example
  4275. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4276. @end example
  4277. @end itemize
  4278. @section colormatrix
  4279. Convert color matrix.
  4280. The filter accepts the following options:
  4281. @table @option
  4282. @item src
  4283. @item dst
  4284. Specify the source and destination color matrix. Both values must be
  4285. specified.
  4286. The accepted values are:
  4287. @table @samp
  4288. @item bt709
  4289. BT.709
  4290. @item fcc
  4291. FCC
  4292. @item bt601
  4293. BT.601
  4294. @item bt470
  4295. BT.470
  4296. @item bt470bg
  4297. BT.470BG
  4298. @item smpte170m
  4299. SMPTE-170M
  4300. @item smpte240m
  4301. SMPTE-240M
  4302. @item bt2020
  4303. BT.2020
  4304. @end table
  4305. @end table
  4306. For example to convert from BT.601 to SMPTE-240M, use the command:
  4307. @example
  4308. colormatrix=bt601:smpte240m
  4309. @end example
  4310. @section colorspace
  4311. Convert colorspace, transfer characteristics or color primaries.
  4312. Input video needs to have an even size.
  4313. The filter accepts the following options:
  4314. @table @option
  4315. @anchor{all}
  4316. @item all
  4317. Specify all color properties at once.
  4318. The accepted values are:
  4319. @table @samp
  4320. @item bt470m
  4321. BT.470M
  4322. @item bt470bg
  4323. BT.470BG
  4324. @item bt601-6-525
  4325. BT.601-6 525
  4326. @item bt601-6-625
  4327. BT.601-6 625
  4328. @item bt709
  4329. BT.709
  4330. @item smpte170m
  4331. SMPTE-170M
  4332. @item smpte240m
  4333. SMPTE-240M
  4334. @item bt2020
  4335. BT.2020
  4336. @end table
  4337. @anchor{space}
  4338. @item space
  4339. Specify output colorspace.
  4340. The accepted values are:
  4341. @table @samp
  4342. @item bt709
  4343. BT.709
  4344. @item fcc
  4345. FCC
  4346. @item bt470bg
  4347. BT.470BG or BT.601-6 625
  4348. @item smpte170m
  4349. SMPTE-170M or BT.601-6 525
  4350. @item smpte240m
  4351. SMPTE-240M
  4352. @item ycgco
  4353. YCgCo
  4354. @item bt2020ncl
  4355. BT.2020 with non-constant luminance
  4356. @end table
  4357. @anchor{trc}
  4358. @item trc
  4359. Specify output transfer characteristics.
  4360. The accepted values are:
  4361. @table @samp
  4362. @item bt709
  4363. BT.709
  4364. @item bt470m
  4365. BT.470M
  4366. @item bt470bg
  4367. BT.470BG
  4368. @item gamma22
  4369. Constant gamma of 2.2
  4370. @item gamma28
  4371. Constant gamma of 2.8
  4372. @item smpte170m
  4373. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4374. @item smpte240m
  4375. SMPTE-240M
  4376. @item srgb
  4377. SRGB
  4378. @item iec61966-2-1
  4379. iec61966-2-1
  4380. @item iec61966-2-4
  4381. iec61966-2-4
  4382. @item xvycc
  4383. xvycc
  4384. @item bt2020-10
  4385. BT.2020 for 10-bits content
  4386. @item bt2020-12
  4387. BT.2020 for 12-bits content
  4388. @end table
  4389. @anchor{primaries}
  4390. @item primaries
  4391. Specify output color primaries.
  4392. The accepted values are:
  4393. @table @samp
  4394. @item bt709
  4395. BT.709
  4396. @item bt470m
  4397. BT.470M
  4398. @item bt470bg
  4399. BT.470BG or BT.601-6 625
  4400. @item smpte170m
  4401. SMPTE-170M or BT.601-6 525
  4402. @item smpte240m
  4403. SMPTE-240M
  4404. @item film
  4405. film
  4406. @item smpte431
  4407. SMPTE-431
  4408. @item smpte432
  4409. SMPTE-432
  4410. @item bt2020
  4411. BT.2020
  4412. @item jedec-p22
  4413. JEDEC P22 phosphors
  4414. @end table
  4415. @anchor{range}
  4416. @item range
  4417. Specify output color range.
  4418. The accepted values are:
  4419. @table @samp
  4420. @item tv
  4421. TV (restricted) range
  4422. @item mpeg
  4423. MPEG (restricted) range
  4424. @item pc
  4425. PC (full) range
  4426. @item jpeg
  4427. JPEG (full) range
  4428. @end table
  4429. @item format
  4430. Specify output color format.
  4431. The accepted values are:
  4432. @table @samp
  4433. @item yuv420p
  4434. YUV 4:2:0 planar 8-bits
  4435. @item yuv420p10
  4436. YUV 4:2:0 planar 10-bits
  4437. @item yuv420p12
  4438. YUV 4:2:0 planar 12-bits
  4439. @item yuv422p
  4440. YUV 4:2:2 planar 8-bits
  4441. @item yuv422p10
  4442. YUV 4:2:2 planar 10-bits
  4443. @item yuv422p12
  4444. YUV 4:2:2 planar 12-bits
  4445. @item yuv444p
  4446. YUV 4:4:4 planar 8-bits
  4447. @item yuv444p10
  4448. YUV 4:4:4 planar 10-bits
  4449. @item yuv444p12
  4450. YUV 4:4:4 planar 12-bits
  4451. @end table
  4452. @item fast
  4453. Do a fast conversion, which skips gamma/primary correction. This will take
  4454. significantly less CPU, but will be mathematically incorrect. To get output
  4455. compatible with that produced by the colormatrix filter, use fast=1.
  4456. @item dither
  4457. Specify dithering mode.
  4458. The accepted values are:
  4459. @table @samp
  4460. @item none
  4461. No dithering
  4462. @item fsb
  4463. Floyd-Steinberg dithering
  4464. @end table
  4465. @item wpadapt
  4466. Whitepoint adaptation mode.
  4467. The accepted values are:
  4468. @table @samp
  4469. @item bradford
  4470. Bradford whitepoint adaptation
  4471. @item vonkries
  4472. von Kries whitepoint adaptation
  4473. @item identity
  4474. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4475. @end table
  4476. @item iall
  4477. Override all input properties at once. Same accepted values as @ref{all}.
  4478. @item ispace
  4479. Override input colorspace. Same accepted values as @ref{space}.
  4480. @item iprimaries
  4481. Override input color primaries. Same accepted values as @ref{primaries}.
  4482. @item itrc
  4483. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4484. @item irange
  4485. Override input color range. Same accepted values as @ref{range}.
  4486. @end table
  4487. The filter converts the transfer characteristics, color space and color
  4488. primaries to the specified user values. The output value, if not specified,
  4489. is set to a default value based on the "all" property. If that property is
  4490. also not specified, the filter will log an error. The output color range and
  4491. format default to the same value as the input color range and format. The
  4492. input transfer characteristics, color space, color primaries and color range
  4493. should be set on the input data. If any of these are missing, the filter will
  4494. log an error and no conversion will take place.
  4495. For example to convert the input to SMPTE-240M, use the command:
  4496. @example
  4497. colorspace=smpte240m
  4498. @end example
  4499. @section convolution
  4500. Apply convolution 3x3 or 5x5 filter.
  4501. The filter accepts the following options:
  4502. @table @option
  4503. @item 0m
  4504. @item 1m
  4505. @item 2m
  4506. @item 3m
  4507. Set matrix for each plane.
  4508. Matrix is sequence of 9 or 25 signed integers.
  4509. @item 0rdiv
  4510. @item 1rdiv
  4511. @item 2rdiv
  4512. @item 3rdiv
  4513. Set multiplier for calculated value for each plane.
  4514. @item 0bias
  4515. @item 1bias
  4516. @item 2bias
  4517. @item 3bias
  4518. Set bias for each plane. This value is added to the result of the multiplication.
  4519. Useful for making the overall image brighter or darker. Default is 0.0.
  4520. @end table
  4521. @subsection Examples
  4522. @itemize
  4523. @item
  4524. Apply sharpen:
  4525. @example
  4526. 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"
  4527. @end example
  4528. @item
  4529. Apply blur:
  4530. @example
  4531. 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"
  4532. @end example
  4533. @item
  4534. Apply edge enhance:
  4535. @example
  4536. 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"
  4537. @end example
  4538. @item
  4539. Apply edge detect:
  4540. @example
  4541. 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"
  4542. @end example
  4543. @item
  4544. Apply emboss:
  4545. @example
  4546. 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"
  4547. @end example
  4548. @end itemize
  4549. @section copy
  4550. Copy the input video source unchanged to the output. This is mainly useful for
  4551. testing purposes.
  4552. @anchor{coreimage}
  4553. @section coreimage
  4554. Video filtering on GPU using Apple's CoreImage API on OSX.
  4555. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4556. processed by video hardware. However, software-based OpenGL implementations
  4557. exist which means there is no guarantee for hardware processing. It depends on
  4558. the respective OSX.
  4559. There are many filters and image generators provided by Apple that come with a
  4560. large variety of options. The filter has to be referenced by its name along
  4561. with its options.
  4562. The coreimage filter accepts the following options:
  4563. @table @option
  4564. @item list_filters
  4565. List all available filters and generators along with all their respective
  4566. options as well as possible minimum and maximum values along with the default
  4567. values.
  4568. @example
  4569. list_filters=true
  4570. @end example
  4571. @item filter
  4572. Specify all filters by their respective name and options.
  4573. Use @var{list_filters} to determine all valid filter names and options.
  4574. Numerical options are specified by a float value and are automatically clamped
  4575. to their respective value range. Vector and color options have to be specified
  4576. by a list of space separated float values. Character escaping has to be done.
  4577. A special option name @code{default} is available to use default options for a
  4578. filter.
  4579. It is required to specify either @code{default} or at least one of the filter options.
  4580. All omitted options are used with their default values.
  4581. The syntax of the filter string is as follows:
  4582. @example
  4583. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4584. @end example
  4585. @item output_rect
  4586. Specify a rectangle where the output of the filter chain is copied into the
  4587. input image. It is given by a list of space separated float values:
  4588. @example
  4589. output_rect=x\ y\ width\ height
  4590. @end example
  4591. If not given, the output rectangle equals the dimensions of the input image.
  4592. The output rectangle is automatically cropped at the borders of the input
  4593. image. Negative values are valid for each component.
  4594. @example
  4595. output_rect=25\ 25\ 100\ 100
  4596. @end example
  4597. @end table
  4598. Several filters can be chained for successive processing without GPU-HOST
  4599. transfers allowing for fast processing of complex filter chains.
  4600. Currently, only filters with zero (generators) or exactly one (filters) input
  4601. image and one output image are supported. Also, transition filters are not yet
  4602. usable as intended.
  4603. Some filters generate output images with additional padding depending on the
  4604. respective filter kernel. The padding is automatically removed to ensure the
  4605. filter output has the same size as the input image.
  4606. For image generators, the size of the output image is determined by the
  4607. previous output image of the filter chain or the input image of the whole
  4608. filterchain, respectively. The generators do not use the pixel information of
  4609. this image to generate their output. However, the generated output is
  4610. blended onto this image, resulting in partial or complete coverage of the
  4611. output image.
  4612. The @ref{coreimagesrc} video source can be used for generating input images
  4613. which are directly fed into the filter chain. By using it, providing input
  4614. images by another video source or an input video is not required.
  4615. @subsection Examples
  4616. @itemize
  4617. @item
  4618. List all filters available:
  4619. @example
  4620. coreimage=list_filters=true
  4621. @end example
  4622. @item
  4623. Use the CIBoxBlur filter with default options to blur an image:
  4624. @example
  4625. coreimage=filter=CIBoxBlur@@default
  4626. @end example
  4627. @item
  4628. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4629. its center at 100x100 and a radius of 50 pixels:
  4630. @example
  4631. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4632. @end example
  4633. @item
  4634. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4635. given as complete and escaped command-line for Apple's standard bash shell:
  4636. @example
  4637. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4638. @end example
  4639. @end itemize
  4640. @section crop
  4641. Crop the input video to given dimensions.
  4642. It accepts the following parameters:
  4643. @table @option
  4644. @item w, out_w
  4645. The width of the output video. It defaults to @code{iw}.
  4646. This expression is evaluated only once during the filter
  4647. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4648. @item h, out_h
  4649. The height of the output video. It defaults to @code{ih}.
  4650. This expression is evaluated only once during the filter
  4651. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4652. @item x
  4653. The horizontal position, in the input video, of the left edge of the output
  4654. video. It defaults to @code{(in_w-out_w)/2}.
  4655. This expression is evaluated per-frame.
  4656. @item y
  4657. The vertical position, in the input video, of the top edge of the output video.
  4658. It defaults to @code{(in_h-out_h)/2}.
  4659. This expression is evaluated per-frame.
  4660. @item keep_aspect
  4661. If set to 1 will force the output display aspect ratio
  4662. to be the same of the input, by changing the output sample aspect
  4663. ratio. It defaults to 0.
  4664. @item exact
  4665. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4666. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4667. It defaults to 0.
  4668. @end table
  4669. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4670. expressions containing the following constants:
  4671. @table @option
  4672. @item x
  4673. @item y
  4674. The computed values for @var{x} and @var{y}. They are evaluated for
  4675. each new frame.
  4676. @item in_w
  4677. @item in_h
  4678. The input width and height.
  4679. @item iw
  4680. @item ih
  4681. These are the same as @var{in_w} and @var{in_h}.
  4682. @item out_w
  4683. @item out_h
  4684. The output (cropped) width and height.
  4685. @item ow
  4686. @item oh
  4687. These are the same as @var{out_w} and @var{out_h}.
  4688. @item a
  4689. same as @var{iw} / @var{ih}
  4690. @item sar
  4691. input sample aspect ratio
  4692. @item dar
  4693. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4694. @item hsub
  4695. @item vsub
  4696. horizontal and vertical chroma subsample values. For example for the
  4697. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4698. @item n
  4699. The number of the input frame, starting from 0.
  4700. @item pos
  4701. the position in the file of the input frame, NAN if unknown
  4702. @item t
  4703. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4704. @end table
  4705. The expression for @var{out_w} may depend on the value of @var{out_h},
  4706. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4707. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4708. evaluated after @var{out_w} and @var{out_h}.
  4709. The @var{x} and @var{y} parameters specify the expressions for the
  4710. position of the top-left corner of the output (non-cropped) area. They
  4711. are evaluated for each frame. If the evaluated value is not valid, it
  4712. is approximated to the nearest valid value.
  4713. The expression for @var{x} may depend on @var{y}, and the expression
  4714. for @var{y} may depend on @var{x}.
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Crop area with size 100x100 at position (12,34).
  4719. @example
  4720. crop=100:100:12:34
  4721. @end example
  4722. Using named options, the example above becomes:
  4723. @example
  4724. crop=w=100:h=100:x=12:y=34
  4725. @end example
  4726. @item
  4727. Crop the central input area with size 100x100:
  4728. @example
  4729. crop=100:100
  4730. @end example
  4731. @item
  4732. Crop the central input area with size 2/3 of the input video:
  4733. @example
  4734. crop=2/3*in_w:2/3*in_h
  4735. @end example
  4736. @item
  4737. Crop the input video central square:
  4738. @example
  4739. crop=out_w=in_h
  4740. crop=in_h
  4741. @end example
  4742. @item
  4743. Delimit the rectangle with the top-left corner placed at position
  4744. 100:100 and the right-bottom corner corresponding to the right-bottom
  4745. corner of the input image.
  4746. @example
  4747. crop=in_w-100:in_h-100:100:100
  4748. @end example
  4749. @item
  4750. Crop 10 pixels from the left and right borders, and 20 pixels from
  4751. the top and bottom borders
  4752. @example
  4753. crop=in_w-2*10:in_h-2*20
  4754. @end example
  4755. @item
  4756. Keep only the bottom right quarter of the input image:
  4757. @example
  4758. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4759. @end example
  4760. @item
  4761. Crop height for getting Greek harmony:
  4762. @example
  4763. crop=in_w:1/PHI*in_w
  4764. @end example
  4765. @item
  4766. Apply trembling effect:
  4767. @example
  4768. 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)
  4769. @end example
  4770. @item
  4771. Apply erratic camera effect depending on timestamp:
  4772. @example
  4773. 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)"
  4774. @end example
  4775. @item
  4776. Set x depending on the value of y:
  4777. @example
  4778. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4779. @end example
  4780. @end itemize
  4781. @subsection Commands
  4782. This filter supports the following commands:
  4783. @table @option
  4784. @item w, out_w
  4785. @item h, out_h
  4786. @item x
  4787. @item y
  4788. Set width/height of the output video and the horizontal/vertical position
  4789. in the input video.
  4790. The command accepts the same syntax of the corresponding option.
  4791. If the specified expression is not valid, it is kept at its current
  4792. value.
  4793. @end table
  4794. @section cropdetect
  4795. Auto-detect the crop size.
  4796. It calculates the necessary cropping parameters and prints the
  4797. recommended parameters via the logging system. The detected dimensions
  4798. correspond to the non-black area of the input video.
  4799. It accepts the following parameters:
  4800. @table @option
  4801. @item limit
  4802. Set higher black value threshold, which can be optionally specified
  4803. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4804. value greater to the set value is considered non-black. It defaults to 24.
  4805. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4806. on the bitdepth of the pixel format.
  4807. @item round
  4808. The value which the width/height should be divisible by. It defaults to
  4809. 16. The offset is automatically adjusted to center the video. Use 2 to
  4810. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4811. encoding to most video codecs.
  4812. @item reset_count, reset
  4813. Set the counter that determines after how many frames cropdetect will
  4814. reset the previously detected largest video area and start over to
  4815. detect the current optimal crop area. Default value is 0.
  4816. This can be useful when channel logos distort the video area. 0
  4817. indicates 'never reset', and returns the largest area encountered during
  4818. playback.
  4819. @end table
  4820. @anchor{curves}
  4821. @section curves
  4822. Apply color adjustments using curves.
  4823. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4824. component (red, green and blue) has its values defined by @var{N} key points
  4825. tied from each other using a smooth curve. The x-axis represents the pixel
  4826. values from the input frame, and the y-axis the new pixel values to be set for
  4827. the output frame.
  4828. By default, a component curve is defined by the two points @var{(0;0)} and
  4829. @var{(1;1)}. This creates a straight line where each original pixel value is
  4830. "adjusted" to its own value, which means no change to the image.
  4831. The filter allows you to redefine these two points and add some more. A new
  4832. curve (using a natural cubic spline interpolation) will be define to pass
  4833. smoothly through all these new coordinates. The new defined points needs to be
  4834. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4835. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4836. the vector spaces, the values will be clipped accordingly.
  4837. The filter accepts the following options:
  4838. @table @option
  4839. @item preset
  4840. Select one of the available color presets. This option can be used in addition
  4841. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4842. options takes priority on the preset values.
  4843. Available presets are:
  4844. @table @samp
  4845. @item none
  4846. @item color_negative
  4847. @item cross_process
  4848. @item darker
  4849. @item increase_contrast
  4850. @item lighter
  4851. @item linear_contrast
  4852. @item medium_contrast
  4853. @item negative
  4854. @item strong_contrast
  4855. @item vintage
  4856. @end table
  4857. Default is @code{none}.
  4858. @item master, m
  4859. Set the master key points. These points will define a second pass mapping. It
  4860. is sometimes called a "luminance" or "value" mapping. It can be used with
  4861. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4862. post-processing LUT.
  4863. @item red, r
  4864. Set the key points for the red component.
  4865. @item green, g
  4866. Set the key points for the green component.
  4867. @item blue, b
  4868. Set the key points for the blue component.
  4869. @item all
  4870. Set the key points for all components (not including master).
  4871. Can be used in addition to the other key points component
  4872. options. In this case, the unset component(s) will fallback on this
  4873. @option{all} setting.
  4874. @item psfile
  4875. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4876. @item plot
  4877. Save Gnuplot script of the curves in specified file.
  4878. @end table
  4879. To avoid some filtergraph syntax conflicts, each key points list need to be
  4880. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4881. @subsection Examples
  4882. @itemize
  4883. @item
  4884. Increase slightly the middle level of blue:
  4885. @example
  4886. curves=blue='0/0 0.5/0.58 1/1'
  4887. @end example
  4888. @item
  4889. Vintage effect:
  4890. @example
  4891. 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'
  4892. @end example
  4893. Here we obtain the following coordinates for each components:
  4894. @table @var
  4895. @item red
  4896. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4897. @item green
  4898. @code{(0;0) (0.50;0.48) (1;1)}
  4899. @item blue
  4900. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4901. @end table
  4902. @item
  4903. The previous example can also be achieved with the associated built-in preset:
  4904. @example
  4905. curves=preset=vintage
  4906. @end example
  4907. @item
  4908. Or simply:
  4909. @example
  4910. curves=vintage
  4911. @end example
  4912. @item
  4913. Use a Photoshop preset and redefine the points of the green component:
  4914. @example
  4915. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4916. @end example
  4917. @item
  4918. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4919. and @command{gnuplot}:
  4920. @example
  4921. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4922. gnuplot -p /tmp/curves.plt
  4923. @end example
  4924. @end itemize
  4925. @section datascope
  4926. Video data analysis filter.
  4927. This filter shows hexadecimal pixel values of part of video.
  4928. The filter accepts the following options:
  4929. @table @option
  4930. @item size, s
  4931. Set output video size.
  4932. @item x
  4933. Set x offset from where to pick pixels.
  4934. @item y
  4935. Set y offset from where to pick pixels.
  4936. @item mode
  4937. Set scope mode, can be one of the following:
  4938. @table @samp
  4939. @item mono
  4940. Draw hexadecimal pixel values with white color on black background.
  4941. @item color
  4942. Draw hexadecimal pixel values with input video pixel color on black
  4943. background.
  4944. @item color2
  4945. Draw hexadecimal pixel values on color background picked from input video,
  4946. the text color is picked in such way so its always visible.
  4947. @end table
  4948. @item axis
  4949. Draw rows and columns numbers on left and top of video.
  4950. @item opacity
  4951. Set background opacity.
  4952. @end table
  4953. @section dctdnoiz
  4954. Denoise frames using 2D DCT (frequency domain filtering).
  4955. This filter is not designed for real time.
  4956. The filter accepts the following options:
  4957. @table @option
  4958. @item sigma, s
  4959. Set the noise sigma constant.
  4960. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4961. coefficient (absolute value) below this threshold with be dropped.
  4962. If you need a more advanced filtering, see @option{expr}.
  4963. Default is @code{0}.
  4964. @item overlap
  4965. Set number overlapping pixels for each block. Since the filter can be slow, you
  4966. may want to reduce this value, at the cost of a less effective filter and the
  4967. risk of various artefacts.
  4968. If the overlapping value doesn't permit processing the whole input width or
  4969. height, a warning will be displayed and according borders won't be denoised.
  4970. Default value is @var{blocksize}-1, which is the best possible setting.
  4971. @item expr, e
  4972. Set the coefficient factor expression.
  4973. For each coefficient of a DCT block, this expression will be evaluated as a
  4974. multiplier value for the coefficient.
  4975. If this is option is set, the @option{sigma} option will be ignored.
  4976. The absolute value of the coefficient can be accessed through the @var{c}
  4977. variable.
  4978. @item n
  4979. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4980. @var{blocksize}, which is the width and height of the processed blocks.
  4981. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4982. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4983. on the speed processing. Also, a larger block size does not necessarily means a
  4984. better de-noising.
  4985. @end table
  4986. @subsection Examples
  4987. Apply a denoise with a @option{sigma} of @code{4.5}:
  4988. @example
  4989. dctdnoiz=4.5
  4990. @end example
  4991. The same operation can be achieved using the expression system:
  4992. @example
  4993. dctdnoiz=e='gte(c, 4.5*3)'
  4994. @end example
  4995. Violent denoise using a block size of @code{16x16}:
  4996. @example
  4997. dctdnoiz=15:n=4
  4998. @end example
  4999. @section deband
  5000. Remove banding artifacts from input video.
  5001. It works by replacing banded pixels with average value of referenced pixels.
  5002. The filter accepts the following options:
  5003. @table @option
  5004. @item 1thr
  5005. @item 2thr
  5006. @item 3thr
  5007. @item 4thr
  5008. Set banding detection threshold for each plane. Default is 0.02.
  5009. Valid range is 0.00003 to 0.5.
  5010. If difference between current pixel and reference pixel is less than threshold,
  5011. it will be considered as banded.
  5012. @item range, r
  5013. Banding detection range in pixels. Default is 16. If positive, random number
  5014. in range 0 to set value will be used. If negative, exact absolute value
  5015. will be used.
  5016. The range defines square of four pixels around current pixel.
  5017. @item direction, d
  5018. Set direction in radians from which four pixel will be compared. If positive,
  5019. random direction from 0 to set direction will be picked. If negative, exact of
  5020. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5021. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5022. column.
  5023. @item blur, b
  5024. If enabled, current pixel is compared with average value of all four
  5025. surrounding pixels. The default is enabled. If disabled current pixel is
  5026. compared with all four surrounding pixels. The pixel is considered banded
  5027. if only all four differences with surrounding pixels are less than threshold.
  5028. @item coupling, c
  5029. If enabled, current pixel is changed if and only if all pixel components are banded,
  5030. e.g. banding detection threshold is triggered for all color components.
  5031. The default is disabled.
  5032. @end table
  5033. @anchor{decimate}
  5034. @section decimate
  5035. Drop duplicated frames at regular intervals.
  5036. The filter accepts the following options:
  5037. @table @option
  5038. @item cycle
  5039. Set the number of frames from which one will be dropped. Setting this to
  5040. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5041. Default is @code{5}.
  5042. @item dupthresh
  5043. Set the threshold for duplicate detection. If the difference metric for a frame
  5044. is less than or equal to this value, then it is declared as duplicate. Default
  5045. is @code{1.1}
  5046. @item scthresh
  5047. Set scene change threshold. Default is @code{15}.
  5048. @item blockx
  5049. @item blocky
  5050. Set the size of the x and y-axis blocks used during metric calculations.
  5051. Larger blocks give better noise suppression, but also give worse detection of
  5052. small movements. Must be a power of two. Default is @code{32}.
  5053. @item ppsrc
  5054. Mark main input as a pre-processed input and activate clean source input
  5055. stream. This allows the input to be pre-processed with various filters to help
  5056. the metrics calculation while keeping the frame selection lossless. When set to
  5057. @code{1}, the first stream is for the pre-processed input, and the second
  5058. stream is the clean source from where the kept frames are chosen. Default is
  5059. @code{0}.
  5060. @item chroma
  5061. Set whether or not chroma is considered in the metric calculations. Default is
  5062. @code{1}.
  5063. @end table
  5064. @section deflate
  5065. Apply deflate effect to the video.
  5066. This filter replaces the pixel by the local(3x3) average by taking into account
  5067. only values lower than the pixel.
  5068. It accepts the following options:
  5069. @table @option
  5070. @item threshold0
  5071. @item threshold1
  5072. @item threshold2
  5073. @item threshold3
  5074. Limit the maximum change for each plane, default is 65535.
  5075. If 0, plane will remain unchanged.
  5076. @end table
  5077. @section deflicker
  5078. Remove temporal frame luminance variations.
  5079. It accepts the following options:
  5080. @table @option
  5081. @item size, s
  5082. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5083. @item mode, m
  5084. Set averaging mode to smooth temporal luminance variations.
  5085. Available values are:
  5086. @table @samp
  5087. @item am
  5088. Arithmetic mean
  5089. @item gm
  5090. Geometric mean
  5091. @item hm
  5092. Harmonic mean
  5093. @item qm
  5094. Quadratic mean
  5095. @item cm
  5096. Cubic mean
  5097. @item pm
  5098. Power mean
  5099. @item median
  5100. Median
  5101. @end table
  5102. @item bypass
  5103. Do not actually modify frame. Useful when one only wants metadata.
  5104. @end table
  5105. @section dejudder
  5106. Remove judder produced by partially interlaced telecined content.
  5107. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5108. source was partially telecined content then the output of @code{pullup,dejudder}
  5109. will have a variable frame rate. May change the recorded frame rate of the
  5110. container. Aside from that change, this filter will not affect constant frame
  5111. rate video.
  5112. The option available in this filter is:
  5113. @table @option
  5114. @item cycle
  5115. Specify the length of the window over which the judder repeats.
  5116. Accepts any integer greater than 1. Useful values are:
  5117. @table @samp
  5118. @item 4
  5119. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5120. @item 5
  5121. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5122. @item 20
  5123. If a mixture of the two.
  5124. @end table
  5125. The default is @samp{4}.
  5126. @end table
  5127. @section delogo
  5128. Suppress a TV station logo by a simple interpolation of the surrounding
  5129. pixels. Just set a rectangle covering the logo and watch it disappear
  5130. (and sometimes something even uglier appear - your mileage may vary).
  5131. It accepts the following parameters:
  5132. @table @option
  5133. @item x
  5134. @item y
  5135. Specify the top left corner coordinates of the logo. They must be
  5136. specified.
  5137. @item w
  5138. @item h
  5139. Specify the width and height of the logo to clear. They must be
  5140. specified.
  5141. @item band, t
  5142. Specify the thickness of the fuzzy edge of the rectangle (added to
  5143. @var{w} and @var{h}). The default value is 1. This option is
  5144. deprecated, setting higher values should no longer be necessary and
  5145. is not recommended.
  5146. @item show
  5147. When set to 1, a green rectangle is drawn on the screen to simplify
  5148. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5149. The default value is 0.
  5150. The rectangle is drawn on the outermost pixels which will be (partly)
  5151. replaced with interpolated values. The values of the next pixels
  5152. immediately outside this rectangle in each direction will be used to
  5153. compute the interpolated pixel values inside the rectangle.
  5154. @end table
  5155. @subsection Examples
  5156. @itemize
  5157. @item
  5158. Set a rectangle covering the area with top left corner coordinates 0,0
  5159. and size 100x77, and a band of size 10:
  5160. @example
  5161. delogo=x=0:y=0:w=100:h=77:band=10
  5162. @end example
  5163. @end itemize
  5164. @section deshake
  5165. Attempt to fix small changes in horizontal and/or vertical shift. This
  5166. filter helps remove camera shake from hand-holding a camera, bumping a
  5167. tripod, moving on a vehicle, etc.
  5168. The filter accepts the following options:
  5169. @table @option
  5170. @item x
  5171. @item y
  5172. @item w
  5173. @item h
  5174. Specify a rectangular area where to limit the search for motion
  5175. vectors.
  5176. If desired the search for motion vectors can be limited to a
  5177. rectangular area of the frame defined by its top left corner, width
  5178. and height. These parameters have the same meaning as the drawbox
  5179. filter which can be used to visualise the position of the bounding
  5180. box.
  5181. This is useful when simultaneous movement of subjects within the frame
  5182. might be confused for camera motion by the motion vector search.
  5183. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5184. then the full frame is used. This allows later options to be set
  5185. without specifying the bounding box for the motion vector search.
  5186. Default - search the whole frame.
  5187. @item rx
  5188. @item ry
  5189. Specify the maximum extent of movement in x and y directions in the
  5190. range 0-64 pixels. Default 16.
  5191. @item edge
  5192. Specify how to generate pixels to fill blanks at the edge of the
  5193. frame. Available values are:
  5194. @table @samp
  5195. @item blank, 0
  5196. Fill zeroes at blank locations
  5197. @item original, 1
  5198. Original image at blank locations
  5199. @item clamp, 2
  5200. Extruded edge value at blank locations
  5201. @item mirror, 3
  5202. Mirrored edge at blank locations
  5203. @end table
  5204. Default value is @samp{mirror}.
  5205. @item blocksize
  5206. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5207. default 8.
  5208. @item contrast
  5209. Specify the contrast threshold for blocks. Only blocks with more than
  5210. the specified contrast (difference between darkest and lightest
  5211. pixels) will be considered. Range 1-255, default 125.
  5212. @item search
  5213. Specify the search strategy. Available values are:
  5214. @table @samp
  5215. @item exhaustive, 0
  5216. Set exhaustive search
  5217. @item less, 1
  5218. Set less exhaustive search.
  5219. @end table
  5220. Default value is @samp{exhaustive}.
  5221. @item filename
  5222. If set then a detailed log of the motion search is written to the
  5223. specified file.
  5224. @item opencl
  5225. If set to 1, specify using OpenCL capabilities, only available if
  5226. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5227. @end table
  5228. @section detelecine
  5229. Apply an exact inverse of the telecine operation. It requires a predefined
  5230. pattern specified using the pattern option which must be the same as that passed
  5231. to the telecine filter.
  5232. This filter accepts the following options:
  5233. @table @option
  5234. @item first_field
  5235. @table @samp
  5236. @item top, t
  5237. top field first
  5238. @item bottom, b
  5239. bottom field first
  5240. The default value is @code{top}.
  5241. @end table
  5242. @item pattern
  5243. A string of numbers representing the pulldown pattern you wish to apply.
  5244. The default value is @code{23}.
  5245. @item start_frame
  5246. A number representing position of the first frame with respect to the telecine
  5247. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5248. @end table
  5249. @section dilation
  5250. Apply dilation effect to the video.
  5251. This filter replaces the pixel by the local(3x3) maximum.
  5252. It accepts the following options:
  5253. @table @option
  5254. @item threshold0
  5255. @item threshold1
  5256. @item threshold2
  5257. @item threshold3
  5258. Limit the maximum change for each plane, default is 65535.
  5259. If 0, plane will remain unchanged.
  5260. @item coordinates
  5261. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5262. pixels are used.
  5263. Flags to local 3x3 coordinates maps like this:
  5264. 1 2 3
  5265. 4 5
  5266. 6 7 8
  5267. @end table
  5268. @section displace
  5269. Displace pixels as indicated by second and third input stream.
  5270. It takes three input streams and outputs one stream, the first input is the
  5271. source, and second and third input are displacement maps.
  5272. The second input specifies how much to displace pixels along the
  5273. x-axis, while the third input specifies how much to displace pixels
  5274. along the y-axis.
  5275. If one of displacement map streams terminates, last frame from that
  5276. displacement map will be used.
  5277. Note that once generated, displacements maps can be reused over and over again.
  5278. A description of the accepted options follows.
  5279. @table @option
  5280. @item edge
  5281. Set displace behavior for pixels that are out of range.
  5282. Available values are:
  5283. @table @samp
  5284. @item blank
  5285. Missing pixels are replaced by black pixels.
  5286. @item smear
  5287. Adjacent pixels will spread out to replace missing pixels.
  5288. @item wrap
  5289. Out of range pixels are wrapped so they point to pixels of other side.
  5290. @end table
  5291. Default is @samp{smear}.
  5292. @end table
  5293. @subsection Examples
  5294. @itemize
  5295. @item
  5296. Add ripple effect to rgb input of video size hd720:
  5297. @example
  5298. 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
  5299. @end example
  5300. @item
  5301. Add wave effect to rgb input of video size hd720:
  5302. @example
  5303. 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
  5304. @end example
  5305. @end itemize
  5306. @section drawbox
  5307. Draw a colored box on the input image.
  5308. It accepts the following parameters:
  5309. @table @option
  5310. @item x
  5311. @item y
  5312. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5313. @item width, w
  5314. @item height, h
  5315. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5316. the input width and height. It defaults to 0.
  5317. @item color, c
  5318. Specify the color of the box to write. For the general syntax of this option,
  5319. check the "Color" section in the ffmpeg-utils manual. If the special
  5320. value @code{invert} is used, the box edge color is the same as the
  5321. video with inverted luma.
  5322. @item thickness, t
  5323. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5324. See below for the list of accepted constants.
  5325. @end table
  5326. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5327. following constants:
  5328. @table @option
  5329. @item dar
  5330. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5331. @item hsub
  5332. @item vsub
  5333. horizontal and vertical chroma subsample values. For example for the
  5334. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5335. @item in_h, ih
  5336. @item in_w, iw
  5337. The input width and height.
  5338. @item sar
  5339. The input sample aspect ratio.
  5340. @item x
  5341. @item y
  5342. The x and y offset coordinates where the box is drawn.
  5343. @item w
  5344. @item h
  5345. The width and height of the drawn box.
  5346. @item t
  5347. The thickness of the drawn box.
  5348. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5349. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5350. @end table
  5351. @subsection Examples
  5352. @itemize
  5353. @item
  5354. Draw a black box around the edge of the input image:
  5355. @example
  5356. drawbox
  5357. @end example
  5358. @item
  5359. Draw a box with color red and an opacity of 50%:
  5360. @example
  5361. drawbox=10:20:200:60:red@@0.5
  5362. @end example
  5363. The previous example can be specified as:
  5364. @example
  5365. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5366. @end example
  5367. @item
  5368. Fill the box with pink color:
  5369. @example
  5370. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5371. @end example
  5372. @item
  5373. Draw a 2-pixel red 2.40:1 mask:
  5374. @example
  5375. 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
  5376. @end example
  5377. @end itemize
  5378. @section drawgrid
  5379. Draw a grid on the input image.
  5380. It accepts the following parameters:
  5381. @table @option
  5382. @item x
  5383. @item y
  5384. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5385. @item width, w
  5386. @item height, h
  5387. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5388. input width and height, respectively, minus @code{thickness}, so image gets
  5389. framed. Default to 0.
  5390. @item color, c
  5391. Specify the color of the grid. For the general syntax of this option,
  5392. check the "Color" section in the ffmpeg-utils manual. If the special
  5393. value @code{invert} is used, the grid color is the same as the
  5394. video with inverted luma.
  5395. @item thickness, t
  5396. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5397. See below for the list of accepted constants.
  5398. @end table
  5399. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5400. following constants:
  5401. @table @option
  5402. @item dar
  5403. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5404. @item hsub
  5405. @item vsub
  5406. horizontal and vertical chroma subsample values. For example for the
  5407. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5408. @item in_h, ih
  5409. @item in_w, iw
  5410. The input grid cell width and height.
  5411. @item sar
  5412. The input sample aspect ratio.
  5413. @item x
  5414. @item y
  5415. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5416. @item w
  5417. @item h
  5418. The width and height of the drawn cell.
  5419. @item t
  5420. The thickness of the drawn cell.
  5421. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5422. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5423. @end table
  5424. @subsection Examples
  5425. @itemize
  5426. @item
  5427. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5428. @example
  5429. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5430. @end example
  5431. @item
  5432. Draw a white 3x3 grid with an opacity of 50%:
  5433. @example
  5434. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5435. @end example
  5436. @end itemize
  5437. @anchor{drawtext}
  5438. @section drawtext
  5439. Draw a text string or text from a specified file on top of a video, using the
  5440. libfreetype library.
  5441. To enable compilation of this filter, you need to configure FFmpeg with
  5442. @code{--enable-libfreetype}.
  5443. To enable default font fallback and the @var{font} option you need to
  5444. configure FFmpeg with @code{--enable-libfontconfig}.
  5445. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5446. @code{--enable-libfribidi}.
  5447. @subsection Syntax
  5448. It accepts the following parameters:
  5449. @table @option
  5450. @item box
  5451. Used to draw a box around text using the background color.
  5452. The value must be either 1 (enable) or 0 (disable).
  5453. The default value of @var{box} is 0.
  5454. @item boxborderw
  5455. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5456. The default value of @var{boxborderw} is 0.
  5457. @item boxcolor
  5458. The color to be used for drawing box around text. For the syntax of this
  5459. option, check the "Color" section in the ffmpeg-utils manual.
  5460. The default value of @var{boxcolor} is "white".
  5461. @item line_spacing
  5462. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5463. The default value of @var{line_spacing} is 0.
  5464. @item borderw
  5465. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5466. The default value of @var{borderw} is 0.
  5467. @item bordercolor
  5468. Set the color to be used for drawing border around text. For the syntax of this
  5469. option, check the "Color" section in the ffmpeg-utils manual.
  5470. The default value of @var{bordercolor} is "black".
  5471. @item expansion
  5472. Select how the @var{text} is expanded. Can be either @code{none},
  5473. @code{strftime} (deprecated) or
  5474. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5475. below for details.
  5476. @item basetime
  5477. Set a start time for the count. Value is in microseconds. Only applied
  5478. in the deprecated strftime expansion mode. To emulate in normal expansion
  5479. mode use the @code{pts} function, supplying the start time (in seconds)
  5480. as the second argument.
  5481. @item fix_bounds
  5482. If true, check and fix text coords to avoid clipping.
  5483. @item fontcolor
  5484. The color to be used for drawing fonts. For the syntax of this option, check
  5485. the "Color" section in the ffmpeg-utils manual.
  5486. The default value of @var{fontcolor} is "black".
  5487. @item fontcolor_expr
  5488. String which is expanded the same way as @var{text} to obtain dynamic
  5489. @var{fontcolor} value. By default this option has empty value and is not
  5490. processed. When this option is set, it overrides @var{fontcolor} option.
  5491. @item font
  5492. The font family to be used for drawing text. By default Sans.
  5493. @item fontfile
  5494. The font file to be used for drawing text. The path must be included.
  5495. This parameter is mandatory if the fontconfig support is disabled.
  5496. @item alpha
  5497. Draw the text applying alpha blending. The value can
  5498. be a number between 0.0 and 1.0.
  5499. The expression accepts the same variables @var{x, y} as well.
  5500. The default value is 1.
  5501. Please see @var{fontcolor_expr}.
  5502. @item fontsize
  5503. The font size to be used for drawing text.
  5504. The default value of @var{fontsize} is 16.
  5505. @item text_shaping
  5506. If set to 1, attempt to shape the text (for example, reverse the order of
  5507. right-to-left text and join Arabic characters) before drawing it.
  5508. Otherwise, just draw the text exactly as given.
  5509. By default 1 (if supported).
  5510. @item ft_load_flags
  5511. The flags to be used for loading the fonts.
  5512. The flags map the corresponding flags supported by libfreetype, and are
  5513. a combination of the following values:
  5514. @table @var
  5515. @item default
  5516. @item no_scale
  5517. @item no_hinting
  5518. @item render
  5519. @item no_bitmap
  5520. @item vertical_layout
  5521. @item force_autohint
  5522. @item crop_bitmap
  5523. @item pedantic
  5524. @item ignore_global_advance_width
  5525. @item no_recurse
  5526. @item ignore_transform
  5527. @item monochrome
  5528. @item linear_design
  5529. @item no_autohint
  5530. @end table
  5531. Default value is "default".
  5532. For more information consult the documentation for the FT_LOAD_*
  5533. libfreetype flags.
  5534. @item shadowcolor
  5535. The color to be used for drawing a shadow behind the drawn text. For the
  5536. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5537. The default value of @var{shadowcolor} is "black".
  5538. @item shadowx
  5539. @item shadowy
  5540. The x and y offsets for the text shadow position with respect to the
  5541. position of the text. They can be either positive or negative
  5542. values. The default value for both is "0".
  5543. @item start_number
  5544. The starting frame number for the n/frame_num variable. The default value
  5545. is "0".
  5546. @item tabsize
  5547. The size in number of spaces to use for rendering the tab.
  5548. Default value is 4.
  5549. @item timecode
  5550. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5551. format. It can be used with or without text parameter. @var{timecode_rate}
  5552. option must be specified.
  5553. @item timecode_rate, rate, r
  5554. Set the timecode frame rate (timecode only).
  5555. @item tc24hmax
  5556. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5557. Default is 0 (disabled).
  5558. @item text
  5559. The text string to be drawn. The text must be a sequence of UTF-8
  5560. encoded characters.
  5561. This parameter is mandatory if no file is specified with the parameter
  5562. @var{textfile}.
  5563. @item textfile
  5564. A text file containing text to be drawn. The text must be a sequence
  5565. of UTF-8 encoded characters.
  5566. This parameter is mandatory if no text string is specified with the
  5567. parameter @var{text}.
  5568. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5569. @item reload
  5570. If set to 1, the @var{textfile} will be reloaded before each frame.
  5571. Be sure to update it atomically, or it may be read partially, or even fail.
  5572. @item x
  5573. @item y
  5574. The expressions which specify the offsets where text will be drawn
  5575. within the video frame. They are relative to the top/left border of the
  5576. output image.
  5577. The default value of @var{x} and @var{y} is "0".
  5578. See below for the list of accepted constants and functions.
  5579. @end table
  5580. The parameters for @var{x} and @var{y} are expressions containing the
  5581. following constants and functions:
  5582. @table @option
  5583. @item dar
  5584. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5585. @item hsub
  5586. @item vsub
  5587. horizontal and vertical chroma subsample values. For example for the
  5588. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5589. @item line_h, lh
  5590. the height of each text line
  5591. @item main_h, h, H
  5592. the input height
  5593. @item main_w, w, W
  5594. the input width
  5595. @item max_glyph_a, ascent
  5596. the maximum distance from the baseline to the highest/upper grid
  5597. coordinate used to place a glyph outline point, for all the rendered
  5598. glyphs.
  5599. It is a positive value, due to the grid's orientation with the Y axis
  5600. upwards.
  5601. @item max_glyph_d, descent
  5602. the maximum distance from the baseline to the lowest grid coordinate
  5603. used to place a glyph outline point, for all the rendered glyphs.
  5604. This is a negative value, due to the grid's orientation, with the Y axis
  5605. upwards.
  5606. @item max_glyph_h
  5607. maximum glyph height, that is the maximum height for all the glyphs
  5608. contained in the rendered text, it is equivalent to @var{ascent} -
  5609. @var{descent}.
  5610. @item max_glyph_w
  5611. maximum glyph width, that is the maximum width for all the glyphs
  5612. contained in the rendered text
  5613. @item n
  5614. the number of input frame, starting from 0
  5615. @item rand(min, max)
  5616. return a random number included between @var{min} and @var{max}
  5617. @item sar
  5618. The input sample aspect ratio.
  5619. @item t
  5620. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5621. @item text_h, th
  5622. the height of the rendered text
  5623. @item text_w, tw
  5624. the width of the rendered text
  5625. @item x
  5626. @item y
  5627. the x and y offset coordinates where the text is drawn.
  5628. These parameters allow the @var{x} and @var{y} expressions to refer
  5629. each other, so you can for example specify @code{y=x/dar}.
  5630. @end table
  5631. @anchor{drawtext_expansion}
  5632. @subsection Text expansion
  5633. If @option{expansion} is set to @code{strftime},
  5634. the filter recognizes strftime() sequences in the provided text and
  5635. expands them accordingly. Check the documentation of strftime(). This
  5636. feature is deprecated.
  5637. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5638. If @option{expansion} is set to @code{normal} (which is the default),
  5639. the following expansion mechanism is used.
  5640. The backslash character @samp{\}, followed by any character, always expands to
  5641. the second character.
  5642. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5643. braces is a function name, possibly followed by arguments separated by ':'.
  5644. If the arguments contain special characters or delimiters (':' or '@}'),
  5645. they should be escaped.
  5646. Note that they probably must also be escaped as the value for the
  5647. @option{text} option in the filter argument string and as the filter
  5648. argument in the filtergraph description, and possibly also for the shell,
  5649. that makes up to four levels of escaping; using a text file avoids these
  5650. problems.
  5651. The following functions are available:
  5652. @table @command
  5653. @item expr, e
  5654. The expression evaluation result.
  5655. It must take one argument specifying the expression to be evaluated,
  5656. which accepts the same constants and functions as the @var{x} and
  5657. @var{y} values. Note that not all constants should be used, for
  5658. example the text size is not known when evaluating the expression, so
  5659. the constants @var{text_w} and @var{text_h} will have an undefined
  5660. value.
  5661. @item expr_int_format, eif
  5662. Evaluate the expression's value and output as formatted integer.
  5663. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5664. The second argument specifies the output format. Allowed values are @samp{x},
  5665. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5666. @code{printf} function.
  5667. The third parameter is optional and sets the number of positions taken by the output.
  5668. It can be used to add padding with zeros from the left.
  5669. @item gmtime
  5670. The time at which the filter is running, expressed in UTC.
  5671. It can accept an argument: a strftime() format string.
  5672. @item localtime
  5673. The time at which the filter is running, expressed in the local time zone.
  5674. It can accept an argument: a strftime() format string.
  5675. @item metadata
  5676. Frame metadata. Takes one or two arguments.
  5677. The first argument is mandatory and specifies the metadata key.
  5678. The second argument is optional and specifies a default value, used when the
  5679. metadata key is not found or empty.
  5680. @item n, frame_num
  5681. The frame number, starting from 0.
  5682. @item pict_type
  5683. A 1 character description of the current picture type.
  5684. @item pts
  5685. The timestamp of the current frame.
  5686. It can take up to three arguments.
  5687. The first argument is the format of the timestamp; it defaults to @code{flt}
  5688. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5689. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5690. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5691. @code{localtime} stands for the timestamp of the frame formatted as
  5692. local time zone time.
  5693. The second argument is an offset added to the timestamp.
  5694. If the format is set to @code{localtime} or @code{gmtime},
  5695. a third argument may be supplied: a strftime() format string.
  5696. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5697. @end table
  5698. @subsection Examples
  5699. @itemize
  5700. @item
  5701. Draw "Test Text" with font FreeSerif, using the default values for the
  5702. optional parameters.
  5703. @example
  5704. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5705. @end example
  5706. @item
  5707. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5708. and y=50 (counting from the top-left corner of the screen), text is
  5709. yellow with a red box around it. Both the text and the box have an
  5710. opacity of 20%.
  5711. @example
  5712. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5713. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5714. @end example
  5715. Note that the double quotes are not necessary if spaces are not used
  5716. within the parameter list.
  5717. @item
  5718. Show the text at the center of the video frame:
  5719. @example
  5720. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5721. @end example
  5722. @item
  5723. Show the text at a random position, switching to a new position every 30 seconds:
  5724. @example
  5725. 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)"
  5726. @end example
  5727. @item
  5728. Show a text line sliding from right to left in the last row of the video
  5729. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5730. with no newlines.
  5731. @example
  5732. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5733. @end example
  5734. @item
  5735. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5736. @example
  5737. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5738. @end example
  5739. @item
  5740. Draw a single green letter "g", at the center of the input video.
  5741. The glyph baseline is placed at half screen height.
  5742. @example
  5743. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5744. @end example
  5745. @item
  5746. Show text for 1 second every 3 seconds:
  5747. @example
  5748. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5749. @end example
  5750. @item
  5751. Use fontconfig to set the font. Note that the colons need to be escaped.
  5752. @example
  5753. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5754. @end example
  5755. @item
  5756. Print the date of a real-time encoding (see strftime(3)):
  5757. @example
  5758. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5759. @end example
  5760. @item
  5761. Show text fading in and out (appearing/disappearing):
  5762. @example
  5763. #!/bin/sh
  5764. DS=1.0 # display start
  5765. DE=10.0 # display end
  5766. FID=1.5 # fade in duration
  5767. FOD=5 # fade out duration
  5768. 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 @}"
  5769. @end example
  5770. @item
  5771. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5772. and the @option{fontsize} value are included in the @option{y} offset.
  5773. @example
  5774. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5775. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5776. @end example
  5777. @end itemize
  5778. For more information about libfreetype, check:
  5779. @url{http://www.freetype.org/}.
  5780. For more information about fontconfig, check:
  5781. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5782. For more information about libfribidi, check:
  5783. @url{http://fribidi.org/}.
  5784. @section edgedetect
  5785. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5786. The filter accepts the following options:
  5787. @table @option
  5788. @item low
  5789. @item high
  5790. Set low and high threshold values used by the Canny thresholding
  5791. algorithm.
  5792. The high threshold selects the "strong" edge pixels, which are then
  5793. connected through 8-connectivity with the "weak" edge pixels selected
  5794. by the low threshold.
  5795. @var{low} and @var{high} threshold values must be chosen in the range
  5796. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5797. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5798. is @code{50/255}.
  5799. @item mode
  5800. Define the drawing mode.
  5801. @table @samp
  5802. @item wires
  5803. Draw white/gray wires on black background.
  5804. @item colormix
  5805. Mix the colors to create a paint/cartoon effect.
  5806. @end table
  5807. Default value is @var{wires}.
  5808. @end table
  5809. @subsection Examples
  5810. @itemize
  5811. @item
  5812. Standard edge detection with custom values for the hysteresis thresholding:
  5813. @example
  5814. edgedetect=low=0.1:high=0.4
  5815. @end example
  5816. @item
  5817. Painting effect without thresholding:
  5818. @example
  5819. edgedetect=mode=colormix:high=0
  5820. @end example
  5821. @end itemize
  5822. @section eq
  5823. Set brightness, contrast, saturation and approximate gamma adjustment.
  5824. The filter accepts the following options:
  5825. @table @option
  5826. @item contrast
  5827. Set the contrast expression. The value must be a float value in range
  5828. @code{-2.0} to @code{2.0}. The default value is "1".
  5829. @item brightness
  5830. Set the brightness expression. The value must be a float value in
  5831. range @code{-1.0} to @code{1.0}. The default value is "0".
  5832. @item saturation
  5833. Set the saturation expression. The value must be a float in
  5834. range @code{0.0} to @code{3.0}. The default value is "1".
  5835. @item gamma
  5836. Set the gamma expression. The value must be a float in range
  5837. @code{0.1} to @code{10.0}. The default value is "1".
  5838. @item gamma_r
  5839. Set the gamma expression for red. The value must be a float in
  5840. range @code{0.1} to @code{10.0}. The default value is "1".
  5841. @item gamma_g
  5842. Set the gamma expression for green. The value must be a float in range
  5843. @code{0.1} to @code{10.0}. The default value is "1".
  5844. @item gamma_b
  5845. Set the gamma expression for blue. The value must be a float in range
  5846. @code{0.1} to @code{10.0}. The default value is "1".
  5847. @item gamma_weight
  5848. Set the gamma weight expression. It can be used to reduce the effect
  5849. of a high gamma value on bright image areas, e.g. keep them from
  5850. getting overamplified and just plain white. The value must be a float
  5851. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5852. gamma correction all the way down while @code{1.0} leaves it at its
  5853. full strength. Default is "1".
  5854. @item eval
  5855. Set when the expressions for brightness, contrast, saturation and
  5856. gamma expressions are evaluated.
  5857. It accepts the following values:
  5858. @table @samp
  5859. @item init
  5860. only evaluate expressions once during the filter initialization or
  5861. when a command is processed
  5862. @item frame
  5863. evaluate expressions for each incoming frame
  5864. @end table
  5865. Default value is @samp{init}.
  5866. @end table
  5867. The expressions accept the following parameters:
  5868. @table @option
  5869. @item n
  5870. frame count of the input frame starting from 0
  5871. @item pos
  5872. byte position of the corresponding packet in the input file, NAN if
  5873. unspecified
  5874. @item r
  5875. frame rate of the input video, NAN if the input frame rate is unknown
  5876. @item t
  5877. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5878. @end table
  5879. @subsection Commands
  5880. The filter supports the following commands:
  5881. @table @option
  5882. @item contrast
  5883. Set the contrast expression.
  5884. @item brightness
  5885. Set the brightness expression.
  5886. @item saturation
  5887. Set the saturation expression.
  5888. @item gamma
  5889. Set the gamma expression.
  5890. @item gamma_r
  5891. Set the gamma_r expression.
  5892. @item gamma_g
  5893. Set gamma_g expression.
  5894. @item gamma_b
  5895. Set gamma_b expression.
  5896. @item gamma_weight
  5897. Set gamma_weight expression.
  5898. The command accepts the same syntax of the corresponding option.
  5899. If the specified expression is not valid, it is kept at its current
  5900. value.
  5901. @end table
  5902. @section erosion
  5903. Apply erosion effect to the video.
  5904. This filter replaces the pixel by the local(3x3) minimum.
  5905. It accepts the following options:
  5906. @table @option
  5907. @item threshold0
  5908. @item threshold1
  5909. @item threshold2
  5910. @item threshold3
  5911. Limit the maximum change for each plane, default is 65535.
  5912. If 0, plane will remain unchanged.
  5913. @item coordinates
  5914. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5915. pixels are used.
  5916. Flags to local 3x3 coordinates maps like this:
  5917. 1 2 3
  5918. 4 5
  5919. 6 7 8
  5920. @end table
  5921. @section extractplanes
  5922. Extract color channel components from input video stream into
  5923. separate grayscale video streams.
  5924. The filter accepts the following option:
  5925. @table @option
  5926. @item planes
  5927. Set plane(s) to extract.
  5928. Available values for planes are:
  5929. @table @samp
  5930. @item y
  5931. @item u
  5932. @item v
  5933. @item a
  5934. @item r
  5935. @item g
  5936. @item b
  5937. @end table
  5938. Choosing planes not available in the input will result in an error.
  5939. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5940. with @code{y}, @code{u}, @code{v} planes at same time.
  5941. @end table
  5942. @subsection Examples
  5943. @itemize
  5944. @item
  5945. Extract luma, u and v color channel component from input video frame
  5946. into 3 grayscale outputs:
  5947. @example
  5948. 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
  5949. @end example
  5950. @end itemize
  5951. @section elbg
  5952. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5953. For each input image, the filter will compute the optimal mapping from
  5954. the input to the output given the codebook length, that is the number
  5955. of distinct output colors.
  5956. This filter accepts the following options.
  5957. @table @option
  5958. @item codebook_length, l
  5959. Set codebook length. The value must be a positive integer, and
  5960. represents the number of distinct output colors. Default value is 256.
  5961. @item nb_steps, n
  5962. Set the maximum number of iterations to apply for computing the optimal
  5963. mapping. The higher the value the better the result and the higher the
  5964. computation time. Default value is 1.
  5965. @item seed, s
  5966. Set a random seed, must be an integer included between 0 and
  5967. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5968. will try to use a good random seed on a best effort basis.
  5969. @item pal8
  5970. Set pal8 output pixel format. This option does not work with codebook
  5971. length greater than 256.
  5972. @end table
  5973. @section fade
  5974. Apply a fade-in/out effect to the input video.
  5975. It accepts the following parameters:
  5976. @table @option
  5977. @item type, t
  5978. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5979. effect.
  5980. Default is @code{in}.
  5981. @item start_frame, s
  5982. Specify the number of the frame to start applying the fade
  5983. effect at. Default is 0.
  5984. @item nb_frames, n
  5985. The number of frames that the fade effect lasts. At the end of the
  5986. fade-in effect, the output video will have the same intensity as the input video.
  5987. At the end of the fade-out transition, the output video will be filled with the
  5988. selected @option{color}.
  5989. Default is 25.
  5990. @item alpha
  5991. If set to 1, fade only alpha channel, if one exists on the input.
  5992. Default value is 0.
  5993. @item start_time, st
  5994. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5995. effect. If both start_frame and start_time are specified, the fade will start at
  5996. whichever comes last. Default is 0.
  5997. @item duration, d
  5998. The number of seconds for which the fade effect has to last. At the end of the
  5999. fade-in effect the output video will have the same intensity as the input video,
  6000. at the end of the fade-out transition the output video will be filled with the
  6001. selected @option{color}.
  6002. If both duration and nb_frames are specified, duration is used. Default is 0
  6003. (nb_frames is used by default).
  6004. @item color, c
  6005. Specify the color of the fade. Default is "black".
  6006. @end table
  6007. @subsection Examples
  6008. @itemize
  6009. @item
  6010. Fade in the first 30 frames of video:
  6011. @example
  6012. fade=in:0:30
  6013. @end example
  6014. The command above is equivalent to:
  6015. @example
  6016. fade=t=in:s=0:n=30
  6017. @end example
  6018. @item
  6019. Fade out the last 45 frames of a 200-frame video:
  6020. @example
  6021. fade=out:155:45
  6022. fade=type=out:start_frame=155:nb_frames=45
  6023. @end example
  6024. @item
  6025. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6026. @example
  6027. fade=in:0:25, fade=out:975:25
  6028. @end example
  6029. @item
  6030. Make the first 5 frames yellow, then fade in from frame 5-24:
  6031. @example
  6032. fade=in:5:20:color=yellow
  6033. @end example
  6034. @item
  6035. Fade in alpha over first 25 frames of video:
  6036. @example
  6037. fade=in:0:25:alpha=1
  6038. @end example
  6039. @item
  6040. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6041. @example
  6042. fade=t=in:st=5.5:d=0.5
  6043. @end example
  6044. @end itemize
  6045. @section fftfilt
  6046. Apply arbitrary expressions to samples in frequency domain
  6047. @table @option
  6048. @item dc_Y
  6049. Adjust the dc value (gain) of the luma plane of the image. The filter
  6050. accepts an integer value in range @code{0} to @code{1000}. The default
  6051. value is set to @code{0}.
  6052. @item dc_U
  6053. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6054. filter accepts an integer value in range @code{0} to @code{1000}. The
  6055. default value is set to @code{0}.
  6056. @item dc_V
  6057. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6058. filter accepts an integer value in range @code{0} to @code{1000}. The
  6059. default value is set to @code{0}.
  6060. @item weight_Y
  6061. Set the frequency domain weight expression for the luma plane.
  6062. @item weight_U
  6063. Set the frequency domain weight expression for the 1st chroma plane.
  6064. @item weight_V
  6065. Set the frequency domain weight expression for the 2nd chroma plane.
  6066. The filter accepts the following variables:
  6067. @item X
  6068. @item Y
  6069. The coordinates of the current sample.
  6070. @item W
  6071. @item H
  6072. The width and height of the image.
  6073. @end table
  6074. @subsection Examples
  6075. @itemize
  6076. @item
  6077. High-pass:
  6078. @example
  6079. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6080. @end example
  6081. @item
  6082. Low-pass:
  6083. @example
  6084. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6085. @end example
  6086. @item
  6087. Sharpen:
  6088. @example
  6089. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6090. @end example
  6091. @item
  6092. Blur:
  6093. @example
  6094. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6095. @end example
  6096. @end itemize
  6097. @section field
  6098. Extract a single field from an interlaced image using stride
  6099. arithmetic to avoid wasting CPU time. The output frames are marked as
  6100. non-interlaced.
  6101. The filter accepts the following options:
  6102. @table @option
  6103. @item type
  6104. Specify whether to extract the top (if the value is @code{0} or
  6105. @code{top}) or the bottom field (if the value is @code{1} or
  6106. @code{bottom}).
  6107. @end table
  6108. @section fieldhint
  6109. Create new frames by copying the top and bottom fields from surrounding frames
  6110. supplied as numbers by the hint file.
  6111. @table @option
  6112. @item hint
  6113. Set file containing hints: absolute/relative frame numbers.
  6114. There must be one line for each frame in a clip. Each line must contain two
  6115. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6116. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6117. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6118. for @code{relative} mode. First number tells from which frame to pick up top
  6119. field and second number tells from which frame to pick up bottom field.
  6120. If optionally followed by @code{+} output frame will be marked as interlaced,
  6121. else if followed by @code{-} output frame will be marked as progressive, else
  6122. it will be marked same as input frame.
  6123. If line starts with @code{#} or @code{;} that line is skipped.
  6124. @item mode
  6125. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6126. @end table
  6127. Example of first several lines of @code{hint} file for @code{relative} mode:
  6128. @example
  6129. 0,0 - # first frame
  6130. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6131. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6132. 1,0 -
  6133. 0,0 -
  6134. 0,0 -
  6135. 1,0 -
  6136. 1,0 -
  6137. 1,0 -
  6138. 0,0 -
  6139. 0,0 -
  6140. 1,0 -
  6141. 1,0 -
  6142. 1,0 -
  6143. 0,0 -
  6144. @end example
  6145. @section fieldmatch
  6146. Field matching filter for inverse telecine. It is meant to reconstruct the
  6147. progressive frames from a telecined stream. The filter does not drop duplicated
  6148. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6149. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6150. The separation of the field matching and the decimation is notably motivated by
  6151. the possibility of inserting a de-interlacing filter fallback between the two.
  6152. If the source has mixed telecined and real interlaced content,
  6153. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6154. But these remaining combed frames will be marked as interlaced, and thus can be
  6155. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6156. In addition to the various configuration options, @code{fieldmatch} can take an
  6157. optional second stream, activated through the @option{ppsrc} option. If
  6158. enabled, the frames reconstruction will be based on the fields and frames from
  6159. this second stream. This allows the first input to be pre-processed in order to
  6160. help the various algorithms of the filter, while keeping the output lossless
  6161. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6162. or brightness/contrast adjustments can help.
  6163. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6164. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6165. which @code{fieldmatch} is based on. While the semantic and usage are very
  6166. close, some behaviour and options names can differ.
  6167. The @ref{decimate} filter currently only works for constant frame rate input.
  6168. If your input has mixed telecined (30fps) and progressive content with a lower
  6169. framerate like 24fps use the following filterchain to produce the necessary cfr
  6170. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6171. The filter accepts the following options:
  6172. @table @option
  6173. @item order
  6174. Specify the assumed field order of the input stream. Available values are:
  6175. @table @samp
  6176. @item auto
  6177. Auto detect parity (use FFmpeg's internal parity value).
  6178. @item bff
  6179. Assume bottom field first.
  6180. @item tff
  6181. Assume top field first.
  6182. @end table
  6183. Note that it is sometimes recommended not to trust the parity announced by the
  6184. stream.
  6185. Default value is @var{auto}.
  6186. @item mode
  6187. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6188. sense that it won't risk creating jerkiness due to duplicate frames when
  6189. possible, but if there are bad edits or blended fields it will end up
  6190. outputting combed frames when a good match might actually exist. On the other
  6191. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6192. but will almost always find a good frame if there is one. The other values are
  6193. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6194. jerkiness and creating duplicate frames versus finding good matches in sections
  6195. with bad edits, orphaned fields, blended fields, etc.
  6196. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6197. Available values are:
  6198. @table @samp
  6199. @item pc
  6200. 2-way matching (p/c)
  6201. @item pc_n
  6202. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6203. @item pc_u
  6204. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6205. @item pc_n_ub
  6206. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6207. still combed (p/c + n + u/b)
  6208. @item pcn
  6209. 3-way matching (p/c/n)
  6210. @item pcn_ub
  6211. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6212. detected as combed (p/c/n + u/b)
  6213. @end table
  6214. The parenthesis at the end indicate the matches that would be used for that
  6215. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6216. @var{top}).
  6217. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6218. the slowest.
  6219. Default value is @var{pc_n}.
  6220. @item ppsrc
  6221. Mark the main input stream as a pre-processed input, and enable the secondary
  6222. input stream as the clean source to pick the fields from. See the filter
  6223. introduction for more details. It is similar to the @option{clip2} feature from
  6224. VFM/TFM.
  6225. Default value is @code{0} (disabled).
  6226. @item field
  6227. Set the field to match from. It is recommended to set this to the same value as
  6228. @option{order} unless you experience matching failures with that setting. In
  6229. certain circumstances changing the field that is used to match from can have a
  6230. large impact on matching performance. Available values are:
  6231. @table @samp
  6232. @item auto
  6233. Automatic (same value as @option{order}).
  6234. @item bottom
  6235. Match from the bottom field.
  6236. @item top
  6237. Match from the top field.
  6238. @end table
  6239. Default value is @var{auto}.
  6240. @item mchroma
  6241. Set whether or not chroma is included during the match comparisons. In most
  6242. cases it is recommended to leave this enabled. You should set this to @code{0}
  6243. only if your clip has bad chroma problems such as heavy rainbowing or other
  6244. artifacts. Setting this to @code{0} could also be used to speed things up at
  6245. the cost of some accuracy.
  6246. Default value is @code{1}.
  6247. @item y0
  6248. @item y1
  6249. These define an exclusion band which excludes the lines between @option{y0} and
  6250. @option{y1} from being included in the field matching decision. An exclusion
  6251. band can be used to ignore subtitles, a logo, or other things that may
  6252. interfere with the matching. @option{y0} sets the starting scan line and
  6253. @option{y1} sets the ending line; all lines in between @option{y0} and
  6254. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6255. @option{y0} and @option{y1} to the same value will disable the feature.
  6256. @option{y0} and @option{y1} defaults to @code{0}.
  6257. @item scthresh
  6258. Set the scene change detection threshold as a percentage of maximum change on
  6259. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6260. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6261. @option{scthresh} is @code{[0.0, 100.0]}.
  6262. Default value is @code{12.0}.
  6263. @item combmatch
  6264. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6265. account the combed scores of matches when deciding what match to use as the
  6266. final match. Available values are:
  6267. @table @samp
  6268. @item none
  6269. No final matching based on combed scores.
  6270. @item sc
  6271. Combed scores are only used when a scene change is detected.
  6272. @item full
  6273. Use combed scores all the time.
  6274. @end table
  6275. Default is @var{sc}.
  6276. @item combdbg
  6277. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6278. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6279. Available values are:
  6280. @table @samp
  6281. @item none
  6282. No forced calculation.
  6283. @item pcn
  6284. Force p/c/n calculations.
  6285. @item pcnub
  6286. Force p/c/n/u/b calculations.
  6287. @end table
  6288. Default value is @var{none}.
  6289. @item cthresh
  6290. This is the area combing threshold used for combed frame detection. This
  6291. essentially controls how "strong" or "visible" combing must be to be detected.
  6292. Larger values mean combing must be more visible and smaller values mean combing
  6293. can be less visible or strong and still be detected. Valid settings are from
  6294. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6295. be detected as combed). This is basically a pixel difference value. A good
  6296. range is @code{[8, 12]}.
  6297. Default value is @code{9}.
  6298. @item chroma
  6299. Sets whether or not chroma is considered in the combed frame decision. Only
  6300. disable this if your source has chroma problems (rainbowing, etc.) that are
  6301. causing problems for the combed frame detection with chroma enabled. Actually,
  6302. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6303. where there is chroma only combing in the source.
  6304. Default value is @code{0}.
  6305. @item blockx
  6306. @item blocky
  6307. Respectively set the x-axis and y-axis size of the window used during combed
  6308. frame detection. This has to do with the size of the area in which
  6309. @option{combpel} pixels are required to be detected as combed for a frame to be
  6310. declared combed. See the @option{combpel} parameter description for more info.
  6311. Possible values are any number that is a power of 2 starting at 4 and going up
  6312. to 512.
  6313. Default value is @code{16}.
  6314. @item combpel
  6315. The number of combed pixels inside any of the @option{blocky} by
  6316. @option{blockx} size blocks on the frame for the frame to be detected as
  6317. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6318. setting controls "how much" combing there must be in any localized area (a
  6319. window defined by the @option{blockx} and @option{blocky} settings) on the
  6320. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6321. which point no frames will ever be detected as combed). This setting is known
  6322. as @option{MI} in TFM/VFM vocabulary.
  6323. Default value is @code{80}.
  6324. @end table
  6325. @anchor{p/c/n/u/b meaning}
  6326. @subsection p/c/n/u/b meaning
  6327. @subsubsection p/c/n
  6328. We assume the following telecined stream:
  6329. @example
  6330. Top fields: 1 2 2 3 4
  6331. Bottom fields: 1 2 3 4 4
  6332. @end example
  6333. The numbers correspond to the progressive frame the fields relate to. Here, the
  6334. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6335. When @code{fieldmatch} is configured to run a matching from bottom
  6336. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6337. @example
  6338. Input stream:
  6339. T 1 2 2 3 4
  6340. B 1 2 3 4 4 <-- matching reference
  6341. Matches: c c n n c
  6342. Output stream:
  6343. T 1 2 3 4 4
  6344. B 1 2 3 4 4
  6345. @end example
  6346. As a result of the field matching, we can see that some frames get duplicated.
  6347. To perform a complete inverse telecine, you need to rely on a decimation filter
  6348. after this operation. See for instance the @ref{decimate} filter.
  6349. The same operation now matching from top fields (@option{field}=@var{top})
  6350. looks like this:
  6351. @example
  6352. Input stream:
  6353. T 1 2 2 3 4 <-- matching reference
  6354. B 1 2 3 4 4
  6355. Matches: c c p p c
  6356. Output stream:
  6357. T 1 2 2 3 4
  6358. B 1 2 2 3 4
  6359. @end example
  6360. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6361. basically, they refer to the frame and field of the opposite parity:
  6362. @itemize
  6363. @item @var{p} matches the field of the opposite parity in the previous frame
  6364. @item @var{c} matches the field of the opposite parity in the current frame
  6365. @item @var{n} matches the field of the opposite parity in the next frame
  6366. @end itemize
  6367. @subsubsection u/b
  6368. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6369. from the opposite parity flag. In the following examples, we assume that we are
  6370. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6371. 'x' is placed above and below each matched fields.
  6372. With bottom matching (@option{field}=@var{bottom}):
  6373. @example
  6374. Match: c p n b u
  6375. x x x x x
  6376. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6377. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6378. x x x x x
  6379. Output frames:
  6380. 2 1 2 2 2
  6381. 2 2 2 1 3
  6382. @end example
  6383. With top matching (@option{field}=@var{top}):
  6384. @example
  6385. Match: c p n b u
  6386. x x x x x
  6387. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6388. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6389. x x x x x
  6390. Output frames:
  6391. 2 2 2 1 2
  6392. 2 1 3 2 2
  6393. @end example
  6394. @subsection Examples
  6395. Simple IVTC of a top field first telecined stream:
  6396. @example
  6397. fieldmatch=order=tff:combmatch=none, decimate
  6398. @end example
  6399. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6400. @example
  6401. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6402. @end example
  6403. @section fieldorder
  6404. Transform the field order of the input video.
  6405. It accepts the following parameters:
  6406. @table @option
  6407. @item order
  6408. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6409. for bottom field first.
  6410. @end table
  6411. The default value is @samp{tff}.
  6412. The transformation is done by shifting the picture content up or down
  6413. by one line, and filling the remaining line with appropriate picture content.
  6414. This method is consistent with most broadcast field order converters.
  6415. If the input video is not flagged as being interlaced, or it is already
  6416. flagged as being of the required output field order, then this filter does
  6417. not alter the incoming video.
  6418. It is very useful when converting to or from PAL DV material,
  6419. which is bottom field first.
  6420. For example:
  6421. @example
  6422. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6423. @end example
  6424. @section fifo, afifo
  6425. Buffer input images and send them when they are requested.
  6426. It is mainly useful when auto-inserted by the libavfilter
  6427. framework.
  6428. It does not take parameters.
  6429. @section find_rect
  6430. Find a rectangular object
  6431. It accepts the following options:
  6432. @table @option
  6433. @item object
  6434. Filepath of the object image, needs to be in gray8.
  6435. @item threshold
  6436. Detection threshold, default is 0.5.
  6437. @item mipmaps
  6438. Number of mipmaps, default is 3.
  6439. @item xmin, ymin, xmax, ymax
  6440. Specifies the rectangle in which to search.
  6441. @end table
  6442. @subsection Examples
  6443. @itemize
  6444. @item
  6445. Generate a representative palette of a given video using @command{ffmpeg}:
  6446. @example
  6447. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6448. @end example
  6449. @end itemize
  6450. @section cover_rect
  6451. Cover a rectangular object
  6452. It accepts the following options:
  6453. @table @option
  6454. @item cover
  6455. Filepath of the optional cover image, needs to be in yuv420.
  6456. @item mode
  6457. Set covering mode.
  6458. It accepts the following values:
  6459. @table @samp
  6460. @item cover
  6461. cover it by the supplied image
  6462. @item blur
  6463. cover it by interpolating the surrounding pixels
  6464. @end table
  6465. Default value is @var{blur}.
  6466. @end table
  6467. @subsection Examples
  6468. @itemize
  6469. @item
  6470. Generate a representative palette of a given video using @command{ffmpeg}:
  6471. @example
  6472. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6473. @end example
  6474. @end itemize
  6475. @anchor{format}
  6476. @section format
  6477. Convert the input video to one of the specified pixel formats.
  6478. Libavfilter will try to pick one that is suitable as input to
  6479. the next filter.
  6480. It accepts the following parameters:
  6481. @table @option
  6482. @item pix_fmts
  6483. A '|'-separated list of pixel format names, such as
  6484. "pix_fmts=yuv420p|monow|rgb24".
  6485. @end table
  6486. @subsection Examples
  6487. @itemize
  6488. @item
  6489. Convert the input video to the @var{yuv420p} format
  6490. @example
  6491. format=pix_fmts=yuv420p
  6492. @end example
  6493. Convert the input video to any of the formats in the list
  6494. @example
  6495. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6496. @end example
  6497. @end itemize
  6498. @anchor{fps}
  6499. @section fps
  6500. Convert the video to specified constant frame rate by duplicating or dropping
  6501. frames as necessary.
  6502. It accepts the following parameters:
  6503. @table @option
  6504. @item fps
  6505. The desired output frame rate. The default is @code{25}.
  6506. @item round
  6507. Rounding method.
  6508. Possible values are:
  6509. @table @option
  6510. @item zero
  6511. zero round towards 0
  6512. @item inf
  6513. round away from 0
  6514. @item down
  6515. round towards -infinity
  6516. @item up
  6517. round towards +infinity
  6518. @item near
  6519. round to nearest
  6520. @end table
  6521. The default is @code{near}.
  6522. @item start_time
  6523. Assume the first PTS should be the given value, in seconds. This allows for
  6524. padding/trimming at the start of stream. By default, no assumption is made
  6525. about the first frame's expected PTS, so no padding or trimming is done.
  6526. For example, this could be set to 0 to pad the beginning with duplicates of
  6527. the first frame if a video stream starts after the audio stream or to trim any
  6528. frames with a negative PTS.
  6529. @end table
  6530. Alternatively, the options can be specified as a flat string:
  6531. @var{fps}[:@var{round}].
  6532. See also the @ref{setpts} filter.
  6533. @subsection Examples
  6534. @itemize
  6535. @item
  6536. A typical usage in order to set the fps to 25:
  6537. @example
  6538. fps=fps=25
  6539. @end example
  6540. @item
  6541. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6542. @example
  6543. fps=fps=film:round=near
  6544. @end example
  6545. @end itemize
  6546. @section framepack
  6547. Pack two different video streams into a stereoscopic video, setting proper
  6548. metadata on supported codecs. The two views should have the same size and
  6549. framerate and processing will stop when the shorter video ends. Please note
  6550. that you may conveniently adjust view properties with the @ref{scale} and
  6551. @ref{fps} filters.
  6552. It accepts the following parameters:
  6553. @table @option
  6554. @item format
  6555. The desired packing format. Supported values are:
  6556. @table @option
  6557. @item sbs
  6558. The views are next to each other (default).
  6559. @item tab
  6560. The views are on top of each other.
  6561. @item lines
  6562. The views are packed by line.
  6563. @item columns
  6564. The views are packed by column.
  6565. @item frameseq
  6566. The views are temporally interleaved.
  6567. @end table
  6568. @end table
  6569. Some examples:
  6570. @example
  6571. # Convert left and right views into a frame-sequential video
  6572. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6573. # Convert views into a side-by-side video with the same output resolution as the input
  6574. 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
  6575. @end example
  6576. @section framerate
  6577. Change the frame rate by interpolating new video output frames from the source
  6578. frames.
  6579. This filter is not designed to function correctly with interlaced media. If
  6580. you wish to change the frame rate of interlaced media then you are required
  6581. to deinterlace before this filter and re-interlace after this filter.
  6582. A description of the accepted options follows.
  6583. @table @option
  6584. @item fps
  6585. Specify the output frames per second. This option can also be specified
  6586. as a value alone. The default is @code{50}.
  6587. @item interp_start
  6588. Specify the start of a range where the output frame will be created as a
  6589. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6590. the default is @code{15}.
  6591. @item interp_end
  6592. Specify the end of a range where the output frame will be created as a
  6593. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6594. the default is @code{240}.
  6595. @item scene
  6596. Specify the level at which a scene change is detected as a value between
  6597. 0 and 100 to indicate a new scene; a low value reflects a low
  6598. probability for the current frame to introduce a new scene, while a higher
  6599. value means the current frame is more likely to be one.
  6600. The default is @code{7}.
  6601. @item flags
  6602. Specify flags influencing the filter process.
  6603. Available value for @var{flags} is:
  6604. @table @option
  6605. @item scene_change_detect, scd
  6606. Enable scene change detection using the value of the option @var{scene}.
  6607. This flag is enabled by default.
  6608. @end table
  6609. @end table
  6610. @section framestep
  6611. Select one frame every N-th frame.
  6612. This filter accepts the following option:
  6613. @table @option
  6614. @item step
  6615. Select frame after every @code{step} frames.
  6616. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6617. @end table
  6618. @anchor{frei0r}
  6619. @section frei0r
  6620. Apply a frei0r effect to the input video.
  6621. To enable the compilation of this filter, you need to install the frei0r
  6622. header and configure FFmpeg with @code{--enable-frei0r}.
  6623. It accepts the following parameters:
  6624. @table @option
  6625. @item filter_name
  6626. The name of the frei0r effect to load. If the environment variable
  6627. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6628. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6629. Otherwise, the standard frei0r paths are searched, in this order:
  6630. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6631. @file{/usr/lib/frei0r-1/}.
  6632. @item filter_params
  6633. A '|'-separated list of parameters to pass to the frei0r effect.
  6634. @end table
  6635. A frei0r effect parameter can be a boolean (its value is either
  6636. "y" or "n"), a double, a color (specified as
  6637. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6638. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6639. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6640. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6641. The number and types of parameters depend on the loaded effect. If an
  6642. effect parameter is not specified, the default value is set.
  6643. @subsection Examples
  6644. @itemize
  6645. @item
  6646. Apply the distort0r effect, setting the first two double parameters:
  6647. @example
  6648. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6649. @end example
  6650. @item
  6651. Apply the colordistance effect, taking a color as the first parameter:
  6652. @example
  6653. frei0r=colordistance:0.2/0.3/0.4
  6654. frei0r=colordistance:violet
  6655. frei0r=colordistance:0x112233
  6656. @end example
  6657. @item
  6658. Apply the perspective effect, specifying the top left and top right image
  6659. positions:
  6660. @example
  6661. frei0r=perspective:0.2/0.2|0.8/0.2
  6662. @end example
  6663. @end itemize
  6664. For more information, see
  6665. @url{http://frei0r.dyne.org}
  6666. @section fspp
  6667. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6668. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6669. processing filter, one of them is performed once per block, not per pixel.
  6670. This allows for much higher speed.
  6671. The filter accepts the following options:
  6672. @table @option
  6673. @item quality
  6674. Set quality. This option defines the number of levels for averaging. It accepts
  6675. an integer in the range 4-5. Default value is @code{4}.
  6676. @item qp
  6677. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6678. If not set, the filter will use the QP from the video stream (if available).
  6679. @item strength
  6680. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6681. more details but also more artifacts, while higher values make the image smoother
  6682. but also blurrier. Default value is @code{0} − PSNR optimal.
  6683. @item use_bframe_qp
  6684. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6685. option may cause flicker since the B-Frames have often larger QP. Default is
  6686. @code{0} (not enabled).
  6687. @end table
  6688. @section gblur
  6689. Apply Gaussian blur filter.
  6690. The filter accepts the following options:
  6691. @table @option
  6692. @item sigma
  6693. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6694. @item steps
  6695. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6696. @item planes
  6697. Set which planes to filter. By default all planes are filtered.
  6698. @item sigmaV
  6699. Set vertical sigma, if negative it will be same as @code{sigma}.
  6700. Default is @code{-1}.
  6701. @end table
  6702. @section geq
  6703. The filter accepts the following options:
  6704. @table @option
  6705. @item lum_expr, lum
  6706. Set the luminance expression.
  6707. @item cb_expr, cb
  6708. Set the chrominance blue expression.
  6709. @item cr_expr, cr
  6710. Set the chrominance red expression.
  6711. @item alpha_expr, a
  6712. Set the alpha expression.
  6713. @item red_expr, r
  6714. Set the red expression.
  6715. @item green_expr, g
  6716. Set the green expression.
  6717. @item blue_expr, b
  6718. Set the blue expression.
  6719. @end table
  6720. The colorspace is selected according to the specified options. If one
  6721. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6722. options is specified, the filter will automatically select a YCbCr
  6723. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6724. @option{blue_expr} options is specified, it will select an RGB
  6725. colorspace.
  6726. If one of the chrominance expression is not defined, it falls back on the other
  6727. one. If no alpha expression is specified it will evaluate to opaque value.
  6728. If none of chrominance expressions are specified, they will evaluate
  6729. to the luminance expression.
  6730. The expressions can use the following variables and functions:
  6731. @table @option
  6732. @item N
  6733. The sequential number of the filtered frame, starting from @code{0}.
  6734. @item X
  6735. @item Y
  6736. The coordinates of the current sample.
  6737. @item W
  6738. @item H
  6739. The width and height of the image.
  6740. @item SW
  6741. @item SH
  6742. Width and height scale depending on the currently filtered plane. It is the
  6743. ratio between the corresponding luma plane number of pixels and the current
  6744. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6745. @code{0.5,0.5} for chroma planes.
  6746. @item T
  6747. Time of the current frame, expressed in seconds.
  6748. @item p(x, y)
  6749. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6750. plane.
  6751. @item lum(x, y)
  6752. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6753. plane.
  6754. @item cb(x, y)
  6755. Return the value of the pixel at location (@var{x},@var{y}) of the
  6756. blue-difference chroma plane. Return 0 if there is no such plane.
  6757. @item cr(x, y)
  6758. Return the value of the pixel at location (@var{x},@var{y}) of the
  6759. red-difference chroma plane. Return 0 if there is no such plane.
  6760. @item r(x, y)
  6761. @item g(x, y)
  6762. @item b(x, y)
  6763. Return the value of the pixel at location (@var{x},@var{y}) of the
  6764. red/green/blue component. Return 0 if there is no such component.
  6765. @item alpha(x, y)
  6766. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6767. plane. Return 0 if there is no such plane.
  6768. @end table
  6769. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6770. automatically clipped to the closer edge.
  6771. @subsection Examples
  6772. @itemize
  6773. @item
  6774. Flip the image horizontally:
  6775. @example
  6776. geq=p(W-X\,Y)
  6777. @end example
  6778. @item
  6779. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6780. wavelength of 100 pixels:
  6781. @example
  6782. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6783. @end example
  6784. @item
  6785. Generate a fancy enigmatic moving light:
  6786. @example
  6787. 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
  6788. @end example
  6789. @item
  6790. Generate a quick emboss effect:
  6791. @example
  6792. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6793. @end example
  6794. @item
  6795. Modify RGB components depending on pixel position:
  6796. @example
  6797. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6798. @end example
  6799. @item
  6800. Create a radial gradient that is the same size as the input (also see
  6801. the @ref{vignette} filter):
  6802. @example
  6803. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6804. @end example
  6805. @end itemize
  6806. @section gradfun
  6807. Fix the banding artifacts that are sometimes introduced into nearly flat
  6808. regions by truncation to 8-bit color depth.
  6809. Interpolate the gradients that should go where the bands are, and
  6810. dither them.
  6811. It is designed for playback only. Do not use it prior to
  6812. lossy compression, because compression tends to lose the dither and
  6813. bring back the bands.
  6814. It accepts the following parameters:
  6815. @table @option
  6816. @item strength
  6817. The maximum amount by which the filter will change any one pixel. This is also
  6818. the threshold for detecting nearly flat regions. Acceptable values range from
  6819. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6820. valid range.
  6821. @item radius
  6822. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6823. gradients, but also prevents the filter from modifying the pixels near detailed
  6824. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6825. values will be clipped to the valid range.
  6826. @end table
  6827. Alternatively, the options can be specified as a flat string:
  6828. @var{strength}[:@var{radius}]
  6829. @subsection Examples
  6830. @itemize
  6831. @item
  6832. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6833. @example
  6834. gradfun=3.5:8
  6835. @end example
  6836. @item
  6837. Specify radius, omitting the strength (which will fall-back to the default
  6838. value):
  6839. @example
  6840. gradfun=radius=8
  6841. @end example
  6842. @end itemize
  6843. @anchor{haldclut}
  6844. @section haldclut
  6845. Apply a Hald CLUT to a video stream.
  6846. First input is the video stream to process, and second one is the Hald CLUT.
  6847. The Hald CLUT input can be a simple picture or a complete video stream.
  6848. The filter accepts the following options:
  6849. @table @option
  6850. @item shortest
  6851. Force termination when the shortest input terminates. Default is @code{0}.
  6852. @item repeatlast
  6853. Continue applying the last CLUT after the end of the stream. A value of
  6854. @code{0} disable the filter after the last frame of the CLUT is reached.
  6855. Default is @code{1}.
  6856. @end table
  6857. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6858. filters share the same internals).
  6859. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6860. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6861. @subsection Workflow examples
  6862. @subsubsection Hald CLUT video stream
  6863. Generate an identity Hald CLUT stream altered with various effects:
  6864. @example
  6865. 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
  6866. @end example
  6867. Note: make sure you use a lossless codec.
  6868. Then use it with @code{haldclut} to apply it on some random stream:
  6869. @example
  6870. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6871. @end example
  6872. The Hald CLUT will be applied to the 10 first seconds (duration of
  6873. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6874. to the remaining frames of the @code{mandelbrot} stream.
  6875. @subsubsection Hald CLUT with preview
  6876. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6877. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6878. biggest possible square starting at the top left of the picture. The remaining
  6879. padding pixels (bottom or right) will be ignored. This area can be used to add
  6880. a preview of the Hald CLUT.
  6881. Typically, the following generated Hald CLUT will be supported by the
  6882. @code{haldclut} filter:
  6883. @example
  6884. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6885. pad=iw+320 [padded_clut];
  6886. smptebars=s=320x256, split [a][b];
  6887. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6888. [main][b] overlay=W-320" -frames:v 1 clut.png
  6889. @end example
  6890. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6891. bars are displayed on the right-top, and below the same color bars processed by
  6892. the color changes.
  6893. Then, the effect of this Hald CLUT can be visualized with:
  6894. @example
  6895. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6896. @end example
  6897. @section hflip
  6898. Flip the input video horizontally.
  6899. For example, to horizontally flip the input video with @command{ffmpeg}:
  6900. @example
  6901. ffmpeg -i in.avi -vf "hflip" out.avi
  6902. @end example
  6903. @section histeq
  6904. This filter applies a global color histogram equalization on a
  6905. per-frame basis.
  6906. It can be used to correct video that has a compressed range of pixel
  6907. intensities. The filter redistributes the pixel intensities to
  6908. equalize their distribution across the intensity range. It may be
  6909. viewed as an "automatically adjusting contrast filter". This filter is
  6910. useful only for correcting degraded or poorly captured source
  6911. video.
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item strength
  6915. Determine the amount of equalization to be applied. As the strength
  6916. is reduced, the distribution of pixel intensities more-and-more
  6917. approaches that of the input frame. The value must be a float number
  6918. in the range [0,1] and defaults to 0.200.
  6919. @item intensity
  6920. Set the maximum intensity that can generated and scale the output
  6921. values appropriately. The strength should be set as desired and then
  6922. the intensity can be limited if needed to avoid washing-out. The value
  6923. must be a float number in the range [0,1] and defaults to 0.210.
  6924. @item antibanding
  6925. Set the antibanding level. If enabled the filter will randomly vary
  6926. the luminance of output pixels by a small amount to avoid banding of
  6927. the histogram. Possible values are @code{none}, @code{weak} or
  6928. @code{strong}. It defaults to @code{none}.
  6929. @end table
  6930. @section histogram
  6931. Compute and draw a color distribution histogram for the input video.
  6932. The computed histogram is a representation of the color component
  6933. distribution in an image.
  6934. Standard histogram displays the color components distribution in an image.
  6935. Displays color graph for each color component. Shows distribution of
  6936. the Y, U, V, A or R, G, B components, depending on input format, in the
  6937. current frame. Below each graph a color component scale meter is shown.
  6938. The filter accepts the following options:
  6939. @table @option
  6940. @item level_height
  6941. Set height of level. Default value is @code{200}.
  6942. Allowed range is [50, 2048].
  6943. @item scale_height
  6944. Set height of color scale. Default value is @code{12}.
  6945. Allowed range is [0, 40].
  6946. @item display_mode
  6947. Set display mode.
  6948. It accepts the following values:
  6949. @table @samp
  6950. @item stack
  6951. Per color component graphs are placed below each other.
  6952. @item parade
  6953. Per color component graphs are placed side by side.
  6954. @item overlay
  6955. Presents information identical to that in the @code{parade}, except
  6956. that the graphs representing color components are superimposed directly
  6957. over one another.
  6958. @end table
  6959. Default is @code{stack}.
  6960. @item levels_mode
  6961. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6962. Default is @code{linear}.
  6963. @item components
  6964. Set what color components to display.
  6965. Default is @code{7}.
  6966. @item fgopacity
  6967. Set foreground opacity. Default is @code{0.7}.
  6968. @item bgopacity
  6969. Set background opacity. Default is @code{0.5}.
  6970. @end table
  6971. @subsection Examples
  6972. @itemize
  6973. @item
  6974. Calculate and draw histogram:
  6975. @example
  6976. ffplay -i input -vf histogram
  6977. @end example
  6978. @end itemize
  6979. @anchor{hqdn3d}
  6980. @section hqdn3d
  6981. This is a high precision/quality 3d denoise filter. It aims to reduce
  6982. image noise, producing smooth images and making still images really
  6983. still. It should enhance compressibility.
  6984. It accepts the following optional parameters:
  6985. @table @option
  6986. @item luma_spatial
  6987. A non-negative floating point number which specifies spatial luma strength.
  6988. It defaults to 4.0.
  6989. @item chroma_spatial
  6990. A non-negative floating point number which specifies spatial chroma strength.
  6991. It defaults to 3.0*@var{luma_spatial}/4.0.
  6992. @item luma_tmp
  6993. A floating point number which specifies luma temporal strength. It defaults to
  6994. 6.0*@var{luma_spatial}/4.0.
  6995. @item chroma_tmp
  6996. A floating point number which specifies chroma temporal strength. It defaults to
  6997. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6998. @end table
  6999. @section hwdownload
  7000. Download hardware frames to system memory.
  7001. The input must be in hardware frames, and the output a non-hardware format.
  7002. Not all formats will be supported on the output - it may be necessary to insert
  7003. an additional @option{format} filter immediately following in the graph to get
  7004. the output in a supported format.
  7005. @section hwmap
  7006. Map hardware frames to system memory or to another device.
  7007. This filter has several different modes of operation; which one is used depends
  7008. on the input and output formats:
  7009. @itemize
  7010. @item
  7011. Hardware frame input, normal frame output
  7012. Map the input frames to system memory and pass them to the output. If the
  7013. original hardware frame is later required (for example, after overlaying
  7014. something else on part of it), the @option{hwmap} filter can be used again
  7015. in the next mode to retrieve it.
  7016. @item
  7017. Normal frame input, hardware frame output
  7018. If the input is actually a software-mapped hardware frame, then unmap it -
  7019. that is, return the original hardware frame.
  7020. Otherwise, a device must be provided. Create new hardware surfaces on that
  7021. device for the output, then map them back to the software format at the input
  7022. and give those frames to the preceding filter. This will then act like the
  7023. @option{hwupload} filter, but may be able to avoid an additional copy when
  7024. the input is already in a compatible format.
  7025. @item
  7026. Hardware frame input and output
  7027. A device must be supplied for the output, either directly or with the
  7028. @option{derive_device} option. The input and output devices must be of
  7029. different types and compatible - the exact meaning of this is
  7030. system-dependent, but typically it means that they must refer to the same
  7031. underlying hardware context (for example, refer to the same graphics card).
  7032. If the input frames were originally created on the output device, then unmap
  7033. to retrieve the original frames.
  7034. Otherwise, map the frames to the output device - create new hardware frames
  7035. on the output corresponding to the frames on the input.
  7036. @end itemize
  7037. The following additional parameters are accepted:
  7038. @table @option
  7039. @item mode
  7040. Set the frame mapping mode. Some combination of:
  7041. @table @var
  7042. @item read
  7043. The mapped frame should be readable.
  7044. @item write
  7045. The mapped frame should be writeable.
  7046. @item overwrite
  7047. The mapping will always overwrite the entire frame.
  7048. This may improve performance in some cases, as the original contents of the
  7049. frame need not be loaded.
  7050. @item direct
  7051. The mapping must not involve any copying.
  7052. Indirect mappings to copies of frames are created in some cases where either
  7053. direct mapping is not possible or it would have unexpected properties.
  7054. Setting this flag ensures that the mapping is direct and will fail if that is
  7055. not possible.
  7056. @end table
  7057. Defaults to @var{read+write} if not specified.
  7058. @item derive_device @var{type}
  7059. Rather than using the device supplied at initialisation, instead derive a new
  7060. device of type @var{type} from the device the input frames exist on.
  7061. @item reverse
  7062. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7063. and map them back to the source. This may be necessary in some cases where
  7064. a mapping in one direction is required but only the opposite direction is
  7065. supported by the devices being used.
  7066. This option is dangerous - it may break the preceding filter in undefined
  7067. ways if there are any additional constraints on that filter's output.
  7068. Do not use it without fully understanding the implications of its use.
  7069. @end table
  7070. @section hwupload
  7071. Upload system memory frames to hardware surfaces.
  7072. The device to upload to must be supplied when the filter is initialised. If
  7073. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7074. option.
  7075. @anchor{hwupload_cuda}
  7076. @section hwupload_cuda
  7077. Upload system memory frames to a CUDA device.
  7078. It accepts the following optional parameters:
  7079. @table @option
  7080. @item device
  7081. The number of the CUDA device to use
  7082. @end table
  7083. @section hqx
  7084. Apply a high-quality magnification filter designed for pixel art. This filter
  7085. was originally created by Maxim Stepin.
  7086. It accepts the following option:
  7087. @table @option
  7088. @item n
  7089. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7090. @code{hq3x} and @code{4} for @code{hq4x}.
  7091. Default is @code{3}.
  7092. @end table
  7093. @section hstack
  7094. Stack input videos horizontally.
  7095. All streams must be of same pixel format and of same height.
  7096. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7097. to create same output.
  7098. The filter accept the following option:
  7099. @table @option
  7100. @item inputs
  7101. Set number of input streams. Default is 2.
  7102. @item shortest
  7103. If set to 1, force the output to terminate when the shortest input
  7104. terminates. Default value is 0.
  7105. @end table
  7106. @section hue
  7107. Modify the hue and/or the saturation of the input.
  7108. It accepts the following parameters:
  7109. @table @option
  7110. @item h
  7111. Specify the hue angle as a number of degrees. It accepts an expression,
  7112. and defaults to "0".
  7113. @item s
  7114. Specify the saturation in the [-10,10] range. It accepts an expression and
  7115. defaults to "1".
  7116. @item H
  7117. Specify the hue angle as a number of radians. It accepts an
  7118. expression, and defaults to "0".
  7119. @item b
  7120. Specify the brightness in the [-10,10] range. It accepts an expression and
  7121. defaults to "0".
  7122. @end table
  7123. @option{h} and @option{H} are mutually exclusive, and can't be
  7124. specified at the same time.
  7125. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7126. expressions containing the following constants:
  7127. @table @option
  7128. @item n
  7129. frame count of the input frame starting from 0
  7130. @item pts
  7131. presentation timestamp of the input frame expressed in time base units
  7132. @item r
  7133. frame rate of the input video, NAN if the input frame rate is unknown
  7134. @item t
  7135. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7136. @item tb
  7137. time base of the input video
  7138. @end table
  7139. @subsection Examples
  7140. @itemize
  7141. @item
  7142. Set the hue to 90 degrees and the saturation to 1.0:
  7143. @example
  7144. hue=h=90:s=1
  7145. @end example
  7146. @item
  7147. Same command but expressing the hue in radians:
  7148. @example
  7149. hue=H=PI/2:s=1
  7150. @end example
  7151. @item
  7152. Rotate hue and make the saturation swing between 0
  7153. and 2 over a period of 1 second:
  7154. @example
  7155. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7156. @end example
  7157. @item
  7158. Apply a 3 seconds saturation fade-in effect starting at 0:
  7159. @example
  7160. hue="s=min(t/3\,1)"
  7161. @end example
  7162. The general fade-in expression can be written as:
  7163. @example
  7164. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7165. @end example
  7166. @item
  7167. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7168. @example
  7169. hue="s=max(0\, min(1\, (8-t)/3))"
  7170. @end example
  7171. The general fade-out expression can be written as:
  7172. @example
  7173. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7174. @end example
  7175. @end itemize
  7176. @subsection Commands
  7177. This filter supports the following commands:
  7178. @table @option
  7179. @item b
  7180. @item s
  7181. @item h
  7182. @item H
  7183. Modify the hue and/or the saturation and/or brightness of the input video.
  7184. The command accepts the same syntax of the corresponding option.
  7185. If the specified expression is not valid, it is kept at its current
  7186. value.
  7187. @end table
  7188. @section hysteresis
  7189. Grow first stream into second stream by connecting components.
  7190. This makes it possible to build more robust edge masks.
  7191. This filter accepts the following options:
  7192. @table @option
  7193. @item planes
  7194. Set which planes will be processed as bitmap, unprocessed planes will be
  7195. copied from first stream.
  7196. By default value 0xf, all planes will be processed.
  7197. @item threshold
  7198. Set threshold which is used in filtering. If pixel component value is higher than
  7199. this value filter algorithm for connecting components is activated.
  7200. By default value is 0.
  7201. @end table
  7202. @section idet
  7203. Detect video interlacing type.
  7204. This filter tries to detect if the input frames are interlaced, progressive,
  7205. top or bottom field first. It will also try to detect fields that are
  7206. repeated between adjacent frames (a sign of telecine).
  7207. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7208. Multiple frame detection incorporates the classification history of previous frames.
  7209. The filter will log these metadata values:
  7210. @table @option
  7211. @item single.current_frame
  7212. Detected type of current frame using single-frame detection. One of:
  7213. ``tff'' (top field first), ``bff'' (bottom field first),
  7214. ``progressive'', or ``undetermined''
  7215. @item single.tff
  7216. Cumulative number of frames detected as top field first using single-frame detection.
  7217. @item multiple.tff
  7218. Cumulative number of frames detected as top field first using multiple-frame detection.
  7219. @item single.bff
  7220. Cumulative number of frames detected as bottom field first using single-frame detection.
  7221. @item multiple.current_frame
  7222. Detected type of current frame using multiple-frame detection. One of:
  7223. ``tff'' (top field first), ``bff'' (bottom field first),
  7224. ``progressive'', or ``undetermined''
  7225. @item multiple.bff
  7226. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7227. @item single.progressive
  7228. Cumulative number of frames detected as progressive using single-frame detection.
  7229. @item multiple.progressive
  7230. Cumulative number of frames detected as progressive using multiple-frame detection.
  7231. @item single.undetermined
  7232. Cumulative number of frames that could not be classified using single-frame detection.
  7233. @item multiple.undetermined
  7234. Cumulative number of frames that could not be classified using multiple-frame detection.
  7235. @item repeated.current_frame
  7236. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7237. @item repeated.neither
  7238. Cumulative number of frames with no repeated field.
  7239. @item repeated.top
  7240. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7241. @item repeated.bottom
  7242. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7243. @end table
  7244. The filter accepts the following options:
  7245. @table @option
  7246. @item intl_thres
  7247. Set interlacing threshold.
  7248. @item prog_thres
  7249. Set progressive threshold.
  7250. @item rep_thres
  7251. Threshold for repeated field detection.
  7252. @item half_life
  7253. Number of frames after which a given frame's contribution to the
  7254. statistics is halved (i.e., it contributes only 0.5 to its
  7255. classification). The default of 0 means that all frames seen are given
  7256. full weight of 1.0 forever.
  7257. @item analyze_interlaced_flag
  7258. When this is not 0 then idet will use the specified number of frames to determine
  7259. if the interlaced flag is accurate, it will not count undetermined frames.
  7260. If the flag is found to be accurate it will be used without any further
  7261. computations, if it is found to be inaccurate it will be cleared without any
  7262. further computations. This allows inserting the idet filter as a low computational
  7263. method to clean up the interlaced flag
  7264. @end table
  7265. @section il
  7266. Deinterleave or interleave fields.
  7267. This filter allows one to process interlaced images fields without
  7268. deinterlacing them. Deinterleaving splits the input frame into 2
  7269. fields (so called half pictures). Odd lines are moved to the top
  7270. half of the output image, even lines to the bottom half.
  7271. You can process (filter) them independently and then re-interleave them.
  7272. The filter accepts the following options:
  7273. @table @option
  7274. @item luma_mode, l
  7275. @item chroma_mode, c
  7276. @item alpha_mode, a
  7277. Available values for @var{luma_mode}, @var{chroma_mode} and
  7278. @var{alpha_mode} are:
  7279. @table @samp
  7280. @item none
  7281. Do nothing.
  7282. @item deinterleave, d
  7283. Deinterleave fields, placing one above the other.
  7284. @item interleave, i
  7285. Interleave fields. Reverse the effect of deinterleaving.
  7286. @end table
  7287. Default value is @code{none}.
  7288. @item luma_swap, ls
  7289. @item chroma_swap, cs
  7290. @item alpha_swap, as
  7291. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7292. @end table
  7293. @section inflate
  7294. Apply inflate effect to the video.
  7295. This filter replaces the pixel by the local(3x3) average by taking into account
  7296. only values higher than the pixel.
  7297. It accepts the following options:
  7298. @table @option
  7299. @item threshold0
  7300. @item threshold1
  7301. @item threshold2
  7302. @item threshold3
  7303. Limit the maximum change for each plane, default is 65535.
  7304. If 0, plane will remain unchanged.
  7305. @end table
  7306. @section interlace
  7307. Simple interlacing filter from progressive contents. This interleaves upper (or
  7308. lower) lines from odd frames with lower (or upper) lines from even frames,
  7309. halving the frame rate and preserving image height.
  7310. @example
  7311. Original Original New Frame
  7312. Frame 'j' Frame 'j+1' (tff)
  7313. ========== =========== ==================
  7314. Line 0 --------------------> Frame 'j' Line 0
  7315. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7316. Line 2 ---------------------> Frame 'j' Line 2
  7317. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7318. ... ... ...
  7319. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7320. @end example
  7321. It accepts the following optional parameters:
  7322. @table @option
  7323. @item scan
  7324. This determines whether the interlaced frame is taken from the even
  7325. (tff - default) or odd (bff) lines of the progressive frame.
  7326. @item lowpass
  7327. Vertical lowpass filter to avoid twitter interlacing and
  7328. reduce moire patterns.
  7329. @table @samp
  7330. @item 0, off
  7331. Disable vertical lowpass filter
  7332. @item 1, linear
  7333. Enable linear filter (default)
  7334. @item 2, complex
  7335. Enable complex filter. This will slightly less reduce twitter and moire
  7336. but better retain detail and subjective sharpness impression.
  7337. @end table
  7338. @end table
  7339. @section kerndeint
  7340. Deinterlace input video by applying Donald Graft's adaptive kernel
  7341. deinterling. Work on interlaced parts of a video to produce
  7342. progressive frames.
  7343. The description of the accepted parameters follows.
  7344. @table @option
  7345. @item thresh
  7346. Set the threshold which affects the filter's tolerance when
  7347. determining if a pixel line must be processed. It must be an integer
  7348. in the range [0,255] and defaults to 10. A value of 0 will result in
  7349. applying the process on every pixels.
  7350. @item map
  7351. Paint pixels exceeding the threshold value to white if set to 1.
  7352. Default is 0.
  7353. @item order
  7354. Set the fields order. Swap fields if set to 1, leave fields alone if
  7355. 0. Default is 0.
  7356. @item sharp
  7357. Enable additional sharpening if set to 1. Default is 0.
  7358. @item twoway
  7359. Enable twoway sharpening if set to 1. Default is 0.
  7360. @end table
  7361. @subsection Examples
  7362. @itemize
  7363. @item
  7364. Apply default values:
  7365. @example
  7366. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7367. @end example
  7368. @item
  7369. Enable additional sharpening:
  7370. @example
  7371. kerndeint=sharp=1
  7372. @end example
  7373. @item
  7374. Paint processed pixels in white:
  7375. @example
  7376. kerndeint=map=1
  7377. @end example
  7378. @end itemize
  7379. @section lenscorrection
  7380. Correct radial lens distortion
  7381. This filter can be used to correct for radial distortion as can result from the use
  7382. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7383. one can use tools available for example as part of opencv or simply trial-and-error.
  7384. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7385. and extract the k1 and k2 coefficients from the resulting matrix.
  7386. Note that effectively the same filter is available in the open-source tools Krita and
  7387. Digikam from the KDE project.
  7388. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7389. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7390. brightness distribution, so you may want to use both filters together in certain
  7391. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7392. be applied before or after lens correction.
  7393. @subsection Options
  7394. The filter accepts the following options:
  7395. @table @option
  7396. @item cx
  7397. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7398. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7399. width.
  7400. @item cy
  7401. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7402. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7403. height.
  7404. @item k1
  7405. Coefficient of the quadratic correction term. 0.5 means no correction.
  7406. @item k2
  7407. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7408. @end table
  7409. The formula that generates the correction is:
  7410. @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)
  7411. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7412. distances from the focal point in the source and target images, respectively.
  7413. @section libvmaf
  7414. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7415. score between two input videos.
  7416. This filter takes two input videos.
  7417. Both video inputs must have the same resolution and pixel format for
  7418. this filter to work correctly. Also it assumes that both inputs
  7419. have the same number of frames, which are compared one by one.
  7420. The obtained average VMAF score is printed through the logging system.
  7421. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7422. After installing the library it can be enabled using:
  7423. @code{./configure --enable-libvmaf}.
  7424. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7425. On the below examples the input file @file{main.mpg} being processed is
  7426. compared with the reference file @file{ref.mpg}.
  7427. The filter has following options:
  7428. @table @option
  7429. @item model_path
  7430. Set the model path which is to be used for SVM.
  7431. Default value: @code{"vmaf_v0.6.1.pkl"}
  7432. @item log_path
  7433. Set the file path to be used to store logs.
  7434. @item log_fmt
  7435. Set the format of the log file (xml or json).
  7436. @item enable_transform
  7437. Enables transform for computing vmaf.
  7438. @item phone_model
  7439. Invokes the phone model which will generate VMAF scores higher than in the
  7440. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7441. @item psnr
  7442. Enables computing psnr along with vmaf.
  7443. @item ssim
  7444. Enables computing ssim along with vmaf.
  7445. @item ms_ssim
  7446. Enables computing ms_ssim along with vmaf.
  7447. @item pool
  7448. Set the pool method to be used for computing vmaf.
  7449. @end table
  7450. For example:
  7451. @example
  7452. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7453. @end example
  7454. Example with options:
  7455. @example
  7456. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7457. @end example
  7458. @section limiter
  7459. Limits the pixel components values to the specified range [min, max].
  7460. The filter accepts the following options:
  7461. @table @option
  7462. @item min
  7463. Lower bound. Defaults to the lowest allowed value for the input.
  7464. @item max
  7465. Upper bound. Defaults to the highest allowed value for the input.
  7466. @item planes
  7467. Specify which planes will be processed. Defaults to all available.
  7468. @end table
  7469. @section loop
  7470. Loop video frames.
  7471. The filter accepts the following options:
  7472. @table @option
  7473. @item loop
  7474. Set the number of loops.
  7475. @item size
  7476. Set maximal size in number of frames.
  7477. @item start
  7478. Set first frame of loop.
  7479. @end table
  7480. @anchor{lut3d}
  7481. @section lut3d
  7482. Apply a 3D LUT to an input video.
  7483. The filter accepts the following options:
  7484. @table @option
  7485. @item file
  7486. Set the 3D LUT file name.
  7487. Currently supported formats:
  7488. @table @samp
  7489. @item 3dl
  7490. AfterEffects
  7491. @item cube
  7492. Iridas
  7493. @item dat
  7494. DaVinci
  7495. @item m3d
  7496. Pandora
  7497. @end table
  7498. @item interp
  7499. Select interpolation mode.
  7500. Available values are:
  7501. @table @samp
  7502. @item nearest
  7503. Use values from the nearest defined point.
  7504. @item trilinear
  7505. Interpolate values using the 8 points defining a cube.
  7506. @item tetrahedral
  7507. Interpolate values using a tetrahedron.
  7508. @end table
  7509. @end table
  7510. @section lumakey
  7511. Turn certain luma values into transparency.
  7512. The filter accepts the following options:
  7513. @table @option
  7514. @item threshold
  7515. Set the luma which will be used as base for transparency.
  7516. Default value is @code{0}.
  7517. @item tolerance
  7518. Set the range of luma values to be keyed out.
  7519. Default value is @code{0}.
  7520. @item softness
  7521. Set the range of softness. Default value is @code{0}.
  7522. Use this to control gradual transition from zero to full transparency.
  7523. @end table
  7524. @section lut, lutrgb, lutyuv
  7525. Compute a look-up table for binding each pixel component input value
  7526. to an output value, and apply it to the input video.
  7527. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7528. to an RGB input video.
  7529. These filters accept the following parameters:
  7530. @table @option
  7531. @item c0
  7532. set first pixel component expression
  7533. @item c1
  7534. set second pixel component expression
  7535. @item c2
  7536. set third pixel component expression
  7537. @item c3
  7538. set fourth pixel component expression, corresponds to the alpha component
  7539. @item r
  7540. set red component expression
  7541. @item g
  7542. set green component expression
  7543. @item b
  7544. set blue component expression
  7545. @item a
  7546. alpha component expression
  7547. @item y
  7548. set Y/luminance component expression
  7549. @item u
  7550. set U/Cb component expression
  7551. @item v
  7552. set V/Cr component expression
  7553. @end table
  7554. Each of them specifies the expression to use for computing the lookup table for
  7555. the corresponding pixel component values.
  7556. The exact component associated to each of the @var{c*} options depends on the
  7557. format in input.
  7558. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7559. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7560. The expressions can contain the following constants and functions:
  7561. @table @option
  7562. @item w
  7563. @item h
  7564. The input width and height.
  7565. @item val
  7566. The input value for the pixel component.
  7567. @item clipval
  7568. The input value, clipped to the @var{minval}-@var{maxval} range.
  7569. @item maxval
  7570. The maximum value for the pixel component.
  7571. @item minval
  7572. The minimum value for the pixel component.
  7573. @item negval
  7574. The negated value for the pixel component value, clipped to the
  7575. @var{minval}-@var{maxval} range; it corresponds to the expression
  7576. "maxval-clipval+minval".
  7577. @item clip(val)
  7578. The computed value in @var{val}, clipped to the
  7579. @var{minval}-@var{maxval} range.
  7580. @item gammaval(gamma)
  7581. The computed gamma correction value of the pixel component value,
  7582. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7583. expression
  7584. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7585. @end table
  7586. All expressions default to "val".
  7587. @subsection Examples
  7588. @itemize
  7589. @item
  7590. Negate input video:
  7591. @example
  7592. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7593. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7594. @end example
  7595. The above is the same as:
  7596. @example
  7597. lutrgb="r=negval:g=negval:b=negval"
  7598. lutyuv="y=negval:u=negval:v=negval"
  7599. @end example
  7600. @item
  7601. Negate luminance:
  7602. @example
  7603. lutyuv=y=negval
  7604. @end example
  7605. @item
  7606. Remove chroma components, turning the video into a graytone image:
  7607. @example
  7608. lutyuv="u=128:v=128"
  7609. @end example
  7610. @item
  7611. Apply a luma burning effect:
  7612. @example
  7613. lutyuv="y=2*val"
  7614. @end example
  7615. @item
  7616. Remove green and blue components:
  7617. @example
  7618. lutrgb="g=0:b=0"
  7619. @end example
  7620. @item
  7621. Set a constant alpha channel value on input:
  7622. @example
  7623. format=rgba,lutrgb=a="maxval-minval/2"
  7624. @end example
  7625. @item
  7626. Correct luminance gamma by a factor of 0.5:
  7627. @example
  7628. lutyuv=y=gammaval(0.5)
  7629. @end example
  7630. @item
  7631. Discard least significant bits of luma:
  7632. @example
  7633. lutyuv=y='bitand(val, 128+64+32)'
  7634. @end example
  7635. @item
  7636. Technicolor like effect:
  7637. @example
  7638. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7639. @end example
  7640. @end itemize
  7641. @section lut2
  7642. Compute and apply a lookup table from two video inputs.
  7643. This filter accepts the following parameters:
  7644. @table @option
  7645. @item c0
  7646. set first pixel component expression
  7647. @item c1
  7648. set second pixel component expression
  7649. @item c2
  7650. set third pixel component expression
  7651. @item c3
  7652. set fourth pixel component expression, corresponds to the alpha component
  7653. @end table
  7654. Each of them specifies the expression to use for computing the lookup table for
  7655. the corresponding pixel component values.
  7656. The exact component associated to each of the @var{c*} options depends on the
  7657. format in inputs.
  7658. The expressions can contain the following constants:
  7659. @table @option
  7660. @item w
  7661. @item h
  7662. The input width and height.
  7663. @item x
  7664. The first input value for the pixel component.
  7665. @item y
  7666. The second input value for the pixel component.
  7667. @item bdx
  7668. The first input video bit depth.
  7669. @item bdy
  7670. The second input video bit depth.
  7671. @end table
  7672. All expressions default to "x".
  7673. @subsection Examples
  7674. @itemize
  7675. @item
  7676. Highlight differences between two RGB video streams:
  7677. @example
  7678. 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)'
  7679. @end example
  7680. @item
  7681. Highlight differences between two YUV video streams:
  7682. @example
  7683. 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)'
  7684. @end example
  7685. @item
  7686. Show max difference between two video streams:
  7687. @example
  7688. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  7689. @end example
  7690. @end itemize
  7691. @section maskedclamp
  7692. Clamp the first input stream with the second input and third input stream.
  7693. Returns the value of first stream to be between second input
  7694. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7695. This filter accepts the following options:
  7696. @table @option
  7697. @item undershoot
  7698. Default value is @code{0}.
  7699. @item overshoot
  7700. Default value is @code{0}.
  7701. @item planes
  7702. Set which planes will be processed as bitmap, unprocessed planes will be
  7703. copied from first stream.
  7704. By default value 0xf, all planes will be processed.
  7705. @end table
  7706. @section maskedmerge
  7707. Merge the first input stream with the second input stream using per pixel
  7708. weights in the third input stream.
  7709. A value of 0 in the third stream pixel component means that pixel component
  7710. from first stream is returned unchanged, while maximum value (eg. 255 for
  7711. 8-bit videos) means that pixel component from second stream is returned
  7712. unchanged. Intermediate values define the amount of merging between both
  7713. input stream's pixel components.
  7714. This filter accepts the following options:
  7715. @table @option
  7716. @item planes
  7717. Set which planes will be processed as bitmap, unprocessed planes will be
  7718. copied from first stream.
  7719. By default value 0xf, all planes will be processed.
  7720. @end table
  7721. @section mcdeint
  7722. Apply motion-compensation deinterlacing.
  7723. It needs one field per frame as input and must thus be used together
  7724. with yadif=1/3 or equivalent.
  7725. This filter accepts the following options:
  7726. @table @option
  7727. @item mode
  7728. Set the deinterlacing mode.
  7729. It accepts one of the following values:
  7730. @table @samp
  7731. @item fast
  7732. @item medium
  7733. @item slow
  7734. use iterative motion estimation
  7735. @item extra_slow
  7736. like @samp{slow}, but use multiple reference frames.
  7737. @end table
  7738. Default value is @samp{fast}.
  7739. @item parity
  7740. Set the picture field parity assumed for the input video. It must be
  7741. one of the following values:
  7742. @table @samp
  7743. @item 0, tff
  7744. assume top field first
  7745. @item 1, bff
  7746. assume bottom field first
  7747. @end table
  7748. Default value is @samp{bff}.
  7749. @item qp
  7750. Set per-block quantization parameter (QP) used by the internal
  7751. encoder.
  7752. Higher values should result in a smoother motion vector field but less
  7753. optimal individual vectors. Default value is 1.
  7754. @end table
  7755. @section mergeplanes
  7756. Merge color channel components from several video streams.
  7757. The filter accepts up to 4 input streams, and merge selected input
  7758. planes to the output video.
  7759. This filter accepts the following options:
  7760. @table @option
  7761. @item mapping
  7762. Set input to output plane mapping. Default is @code{0}.
  7763. The mappings is specified as a bitmap. It should be specified as a
  7764. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7765. mapping for the first plane of the output stream. 'A' sets the number of
  7766. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7767. corresponding input to use (from 0 to 3). The rest of the mappings is
  7768. similar, 'Bb' describes the mapping for the output stream second
  7769. plane, 'Cc' describes the mapping for the output stream third plane and
  7770. 'Dd' describes the mapping for the output stream fourth plane.
  7771. @item format
  7772. Set output pixel format. Default is @code{yuva444p}.
  7773. @end table
  7774. @subsection Examples
  7775. @itemize
  7776. @item
  7777. Merge three gray video streams of same width and height into single video stream:
  7778. @example
  7779. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7780. @end example
  7781. @item
  7782. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7783. @example
  7784. [a0][a1]mergeplanes=0x00010210:yuva444p
  7785. @end example
  7786. @item
  7787. Swap Y and A plane in yuva444p stream:
  7788. @example
  7789. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7790. @end example
  7791. @item
  7792. Swap U and V plane in yuv420p stream:
  7793. @example
  7794. format=yuv420p,mergeplanes=0x000201:yuv420p
  7795. @end example
  7796. @item
  7797. Cast a rgb24 clip to yuv444p:
  7798. @example
  7799. format=rgb24,mergeplanes=0x000102:yuv444p
  7800. @end example
  7801. @end itemize
  7802. @section mestimate
  7803. Estimate and export motion vectors using block matching algorithms.
  7804. Motion vectors are stored in frame side data to be used by other filters.
  7805. This filter accepts the following options:
  7806. @table @option
  7807. @item method
  7808. Specify the motion estimation method. Accepts one of the following values:
  7809. @table @samp
  7810. @item esa
  7811. Exhaustive search algorithm.
  7812. @item tss
  7813. Three step search algorithm.
  7814. @item tdls
  7815. Two dimensional logarithmic search algorithm.
  7816. @item ntss
  7817. New three step search algorithm.
  7818. @item fss
  7819. Four step search algorithm.
  7820. @item ds
  7821. Diamond search algorithm.
  7822. @item hexbs
  7823. Hexagon-based search algorithm.
  7824. @item epzs
  7825. Enhanced predictive zonal search algorithm.
  7826. @item umh
  7827. Uneven multi-hexagon search algorithm.
  7828. @end table
  7829. Default value is @samp{esa}.
  7830. @item mb_size
  7831. Macroblock size. Default @code{16}.
  7832. @item search_param
  7833. Search parameter. Default @code{7}.
  7834. @end table
  7835. @section midequalizer
  7836. Apply Midway Image Equalization effect using two video streams.
  7837. Midway Image Equalization adjusts a pair of images to have the same
  7838. histogram, while maintaining their dynamics as much as possible. It's
  7839. useful for e.g. matching exposures from a pair of stereo cameras.
  7840. This filter has two inputs and one output, which must be of same pixel format, but
  7841. may be of different sizes. The output of filter is first input adjusted with
  7842. midway histogram of both inputs.
  7843. This filter accepts the following option:
  7844. @table @option
  7845. @item planes
  7846. Set which planes to process. Default is @code{15}, which is all available planes.
  7847. @end table
  7848. @section minterpolate
  7849. Convert the video to specified frame rate using motion interpolation.
  7850. This filter accepts the following options:
  7851. @table @option
  7852. @item fps
  7853. 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}.
  7854. @item mi_mode
  7855. Motion interpolation mode. Following values are accepted:
  7856. @table @samp
  7857. @item dup
  7858. Duplicate previous or next frame for interpolating new ones.
  7859. @item blend
  7860. Blend source frames. Interpolated frame is mean of previous and next frames.
  7861. @item mci
  7862. Motion compensated interpolation. Following options are effective when this mode is selected:
  7863. @table @samp
  7864. @item mc_mode
  7865. Motion compensation mode. Following values are accepted:
  7866. @table @samp
  7867. @item obmc
  7868. Overlapped block motion compensation.
  7869. @item aobmc
  7870. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7871. @end table
  7872. Default mode is @samp{obmc}.
  7873. @item me_mode
  7874. Motion estimation mode. Following values are accepted:
  7875. @table @samp
  7876. @item bidir
  7877. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7878. @item bilat
  7879. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7880. @end table
  7881. Default mode is @samp{bilat}.
  7882. @item me
  7883. The algorithm to be used for motion estimation. Following values are accepted:
  7884. @table @samp
  7885. @item esa
  7886. Exhaustive search algorithm.
  7887. @item tss
  7888. Three step search algorithm.
  7889. @item tdls
  7890. Two dimensional logarithmic search algorithm.
  7891. @item ntss
  7892. New three step search algorithm.
  7893. @item fss
  7894. Four step search algorithm.
  7895. @item ds
  7896. Diamond search algorithm.
  7897. @item hexbs
  7898. Hexagon-based search algorithm.
  7899. @item epzs
  7900. Enhanced predictive zonal search algorithm.
  7901. @item umh
  7902. Uneven multi-hexagon search algorithm.
  7903. @end table
  7904. Default algorithm is @samp{epzs}.
  7905. @item mb_size
  7906. Macroblock size. Default @code{16}.
  7907. @item search_param
  7908. Motion estimation search parameter. Default @code{32}.
  7909. @item vsbmc
  7910. 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).
  7911. @end table
  7912. @end table
  7913. @item scd
  7914. 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:
  7915. @table @samp
  7916. @item none
  7917. Disable scene change detection.
  7918. @item fdiff
  7919. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7920. @end table
  7921. Default method is @samp{fdiff}.
  7922. @item scd_threshold
  7923. Scene change detection threshold. Default is @code{5.0}.
  7924. @end table
  7925. @section mpdecimate
  7926. Drop frames that do not differ greatly from the previous frame in
  7927. order to reduce frame rate.
  7928. The main use of this filter is for very-low-bitrate encoding
  7929. (e.g. streaming over dialup modem), but it could in theory be used for
  7930. fixing movies that were inverse-telecined incorrectly.
  7931. A description of the accepted options follows.
  7932. @table @option
  7933. @item max
  7934. Set the maximum number of consecutive frames which can be dropped (if
  7935. positive), or the minimum interval between dropped frames (if
  7936. negative). If the value is 0, the frame is dropped unregarding the
  7937. number of previous sequentially dropped frames.
  7938. Default value is 0.
  7939. @item hi
  7940. @item lo
  7941. @item frac
  7942. Set the dropping threshold values.
  7943. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7944. represent actual pixel value differences, so a threshold of 64
  7945. corresponds to 1 unit of difference for each pixel, or the same spread
  7946. out differently over the block.
  7947. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7948. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7949. meaning the whole image) differ by more than a threshold of @option{lo}.
  7950. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7951. 64*5, and default value for @option{frac} is 0.33.
  7952. @end table
  7953. @section negate
  7954. Negate input video.
  7955. It accepts an integer in input; if non-zero it negates the
  7956. alpha component (if available). The default value in input is 0.
  7957. @section nlmeans
  7958. Denoise frames using Non-Local Means algorithm.
  7959. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7960. context similarity is defined by comparing their surrounding patches of size
  7961. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7962. around the pixel.
  7963. Note that the research area defines centers for patches, which means some
  7964. patches will be made of pixels outside that research area.
  7965. The filter accepts the following options.
  7966. @table @option
  7967. @item s
  7968. Set denoising strength.
  7969. @item p
  7970. Set patch size.
  7971. @item pc
  7972. Same as @option{p} but for chroma planes.
  7973. The default value is @var{0} and means automatic.
  7974. @item r
  7975. Set research size.
  7976. @item rc
  7977. Same as @option{r} but for chroma planes.
  7978. The default value is @var{0} and means automatic.
  7979. @end table
  7980. @section nnedi
  7981. Deinterlace video using neural network edge directed interpolation.
  7982. This filter accepts the following options:
  7983. @table @option
  7984. @item weights
  7985. Mandatory option, without binary file filter can not work.
  7986. Currently file can be found here:
  7987. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7988. @item deint
  7989. Set which frames to deinterlace, by default it is @code{all}.
  7990. Can be @code{all} or @code{interlaced}.
  7991. @item field
  7992. Set mode of operation.
  7993. Can be one of the following:
  7994. @table @samp
  7995. @item af
  7996. Use frame flags, both fields.
  7997. @item a
  7998. Use frame flags, single field.
  7999. @item t
  8000. Use top field only.
  8001. @item b
  8002. Use bottom field only.
  8003. @item tf
  8004. Use both fields, top first.
  8005. @item bf
  8006. Use both fields, bottom first.
  8007. @end table
  8008. @item planes
  8009. Set which planes to process, by default filter process all frames.
  8010. @item nsize
  8011. Set size of local neighborhood around each pixel, used by the predictor neural
  8012. network.
  8013. Can be one of the following:
  8014. @table @samp
  8015. @item s8x6
  8016. @item s16x6
  8017. @item s32x6
  8018. @item s48x6
  8019. @item s8x4
  8020. @item s16x4
  8021. @item s32x4
  8022. @end table
  8023. @item nns
  8024. Set the number of neurons in predicctor neural network.
  8025. Can be one of the following:
  8026. @table @samp
  8027. @item n16
  8028. @item n32
  8029. @item n64
  8030. @item n128
  8031. @item n256
  8032. @end table
  8033. @item qual
  8034. Controls the number of different neural network predictions that are blended
  8035. together to compute the final output value. Can be @code{fast}, default or
  8036. @code{slow}.
  8037. @item etype
  8038. Set which set of weights to use in the predictor.
  8039. Can be one of the following:
  8040. @table @samp
  8041. @item a
  8042. weights trained to minimize absolute error
  8043. @item s
  8044. weights trained to minimize squared error
  8045. @end table
  8046. @item pscrn
  8047. Controls whether or not the prescreener neural network is used to decide
  8048. which pixels should be processed by the predictor neural network and which
  8049. can be handled by simple cubic interpolation.
  8050. The prescreener is trained to know whether cubic interpolation will be
  8051. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8052. The computational complexity of the prescreener nn is much less than that of
  8053. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8054. using the prescreener generally results in much faster processing.
  8055. The prescreener is pretty accurate, so the difference between using it and not
  8056. using it is almost always unnoticeable.
  8057. Can be one of the following:
  8058. @table @samp
  8059. @item none
  8060. @item original
  8061. @item new
  8062. @end table
  8063. Default is @code{new}.
  8064. @item fapprox
  8065. Set various debugging flags.
  8066. @end table
  8067. @section noformat
  8068. Force libavfilter not to use any of the specified pixel formats for the
  8069. input to the next filter.
  8070. It accepts the following parameters:
  8071. @table @option
  8072. @item pix_fmts
  8073. A '|'-separated list of pixel format names, such as
  8074. apix_fmts=yuv420p|monow|rgb24".
  8075. @end table
  8076. @subsection Examples
  8077. @itemize
  8078. @item
  8079. Force libavfilter to use a format different from @var{yuv420p} for the
  8080. input to the vflip filter:
  8081. @example
  8082. noformat=pix_fmts=yuv420p,vflip
  8083. @end example
  8084. @item
  8085. Convert the input video to any of the formats not contained in the list:
  8086. @example
  8087. noformat=yuv420p|yuv444p|yuv410p
  8088. @end example
  8089. @end itemize
  8090. @section noise
  8091. Add noise on video input frame.
  8092. The filter accepts the following options:
  8093. @table @option
  8094. @item all_seed
  8095. @item c0_seed
  8096. @item c1_seed
  8097. @item c2_seed
  8098. @item c3_seed
  8099. Set noise seed for specific pixel component or all pixel components in case
  8100. of @var{all_seed}. Default value is @code{123457}.
  8101. @item all_strength, alls
  8102. @item c0_strength, c0s
  8103. @item c1_strength, c1s
  8104. @item c2_strength, c2s
  8105. @item c3_strength, c3s
  8106. Set noise strength for specific pixel component or all pixel components in case
  8107. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8108. @item all_flags, allf
  8109. @item c0_flags, c0f
  8110. @item c1_flags, c1f
  8111. @item c2_flags, c2f
  8112. @item c3_flags, c3f
  8113. Set pixel component flags or set flags for all components if @var{all_flags}.
  8114. Available values for component flags are:
  8115. @table @samp
  8116. @item a
  8117. averaged temporal noise (smoother)
  8118. @item p
  8119. mix random noise with a (semi)regular pattern
  8120. @item t
  8121. temporal noise (noise pattern changes between frames)
  8122. @item u
  8123. uniform noise (gaussian otherwise)
  8124. @end table
  8125. @end table
  8126. @subsection Examples
  8127. Add temporal and uniform noise to input video:
  8128. @example
  8129. noise=alls=20:allf=t+u
  8130. @end example
  8131. @section null
  8132. Pass the video source unchanged to the output.
  8133. @section ocr
  8134. Optical Character Recognition
  8135. This filter uses Tesseract for optical character recognition.
  8136. It accepts the following options:
  8137. @table @option
  8138. @item datapath
  8139. Set datapath to tesseract data. Default is to use whatever was
  8140. set at installation.
  8141. @item language
  8142. Set language, default is "eng".
  8143. @item whitelist
  8144. Set character whitelist.
  8145. @item blacklist
  8146. Set character blacklist.
  8147. @end table
  8148. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8149. @section ocv
  8150. Apply a video transform using libopencv.
  8151. To enable this filter, install the libopencv library and headers and
  8152. configure FFmpeg with @code{--enable-libopencv}.
  8153. It accepts the following parameters:
  8154. @table @option
  8155. @item filter_name
  8156. The name of the libopencv filter to apply.
  8157. @item filter_params
  8158. The parameters to pass to the libopencv filter. If not specified, the default
  8159. values are assumed.
  8160. @end table
  8161. Refer to the official libopencv documentation for more precise
  8162. information:
  8163. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8164. Several libopencv filters are supported; see the following subsections.
  8165. @anchor{dilate}
  8166. @subsection dilate
  8167. Dilate an image by using a specific structuring element.
  8168. It corresponds to the libopencv function @code{cvDilate}.
  8169. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8170. @var{struct_el} represents a structuring element, and has the syntax:
  8171. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8172. @var{cols} and @var{rows} represent the number of columns and rows of
  8173. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8174. point, and @var{shape} the shape for the structuring element. @var{shape}
  8175. must be "rect", "cross", "ellipse", or "custom".
  8176. If the value for @var{shape} is "custom", it must be followed by a
  8177. string of the form "=@var{filename}". The file with name
  8178. @var{filename} is assumed to represent a binary image, with each
  8179. printable character corresponding to a bright pixel. When a custom
  8180. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8181. or columns and rows of the read file are assumed instead.
  8182. The default value for @var{struct_el} is "3x3+0x0/rect".
  8183. @var{nb_iterations} specifies the number of times the transform is
  8184. applied to the image, and defaults to 1.
  8185. Some examples:
  8186. @example
  8187. # Use the default values
  8188. ocv=dilate
  8189. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8190. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8191. # Read the shape from the file diamond.shape, iterating two times.
  8192. # The file diamond.shape may contain a pattern of characters like this
  8193. # *
  8194. # ***
  8195. # *****
  8196. # ***
  8197. # *
  8198. # The specified columns and rows are ignored
  8199. # but the anchor point coordinates are not
  8200. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8201. @end example
  8202. @subsection erode
  8203. Erode an image by using a specific structuring element.
  8204. It corresponds to the libopencv function @code{cvErode}.
  8205. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8206. with the same syntax and semantics as the @ref{dilate} filter.
  8207. @subsection smooth
  8208. Smooth the input video.
  8209. The filter takes the following parameters:
  8210. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8211. @var{type} is the type of smooth filter to apply, and must be one of
  8212. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8213. or "bilateral". The default value is "gaussian".
  8214. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8215. depend on the smooth type. @var{param1} and
  8216. @var{param2} accept integer positive values or 0. @var{param3} and
  8217. @var{param4} accept floating point values.
  8218. The default value for @var{param1} is 3. The default value for the
  8219. other parameters is 0.
  8220. These parameters correspond to the parameters assigned to the
  8221. libopencv function @code{cvSmooth}.
  8222. @section oscilloscope
  8223. 2D Video Oscilloscope.
  8224. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8225. It accepts the following parameters:
  8226. @table @option
  8227. @item x
  8228. Set scope center x position.
  8229. @item y
  8230. Set scope center y position.
  8231. @item s
  8232. Set scope size, relative to frame diagonal.
  8233. @item t
  8234. Set scope tilt/rotation.
  8235. @item o
  8236. Set trace opacity.
  8237. @item tx
  8238. Set trace center x position.
  8239. @item ty
  8240. Set trace center y position.
  8241. @item tw
  8242. Set trace width, relative to width of frame.
  8243. @item th
  8244. Set trace height, relative to height of frame.
  8245. @item c
  8246. Set which components to trace. By default it traces first three components.
  8247. @item g
  8248. Draw trace grid. By default is enabled.
  8249. @item st
  8250. Draw some statistics. By default is enabled.
  8251. @item sc
  8252. Draw scope. By default is enabled.
  8253. @end table
  8254. @subsection Examples
  8255. @itemize
  8256. @item
  8257. Inspect full first row of video frame.
  8258. @example
  8259. oscilloscope=x=0.5:y=0:s=1
  8260. @end example
  8261. @item
  8262. Inspect full last row of video frame.
  8263. @example
  8264. oscilloscope=x=0.5:y=1:s=1
  8265. @end example
  8266. @item
  8267. Inspect full 5th line of video frame of height 1080.
  8268. @example
  8269. oscilloscope=x=0.5:y=5/1080:s=1
  8270. @end example
  8271. @item
  8272. Inspect full last column of video frame.
  8273. @example
  8274. oscilloscope=x=1:y=0.5:s=1:t=1
  8275. @end example
  8276. @end itemize
  8277. @anchor{overlay}
  8278. @section overlay
  8279. Overlay one video on top of another.
  8280. It takes two inputs and has one output. The first input is the "main"
  8281. video on which the second input is overlaid.
  8282. It accepts the following parameters:
  8283. A description of the accepted options follows.
  8284. @table @option
  8285. @item x
  8286. @item y
  8287. Set the expression for the x and y coordinates of the overlaid video
  8288. on the main video. Default value is "0" for both expressions. In case
  8289. the expression is invalid, it is set to a huge value (meaning that the
  8290. overlay will not be displayed within the output visible area).
  8291. @item eof_action
  8292. The action to take when EOF is encountered on the secondary input; it accepts
  8293. one of the following values:
  8294. @table @option
  8295. @item repeat
  8296. Repeat the last frame (the default).
  8297. @item endall
  8298. End both streams.
  8299. @item pass
  8300. Pass the main input through.
  8301. @end table
  8302. @item eval
  8303. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8304. It accepts the following values:
  8305. @table @samp
  8306. @item init
  8307. only evaluate expressions once during the filter initialization or
  8308. when a command is processed
  8309. @item frame
  8310. evaluate expressions for each incoming frame
  8311. @end table
  8312. Default value is @samp{frame}.
  8313. @item shortest
  8314. If set to 1, force the output to terminate when the shortest input
  8315. terminates. Default value is 0.
  8316. @item format
  8317. Set the format for the output video.
  8318. It accepts the following values:
  8319. @table @samp
  8320. @item yuv420
  8321. force YUV420 output
  8322. @item yuv422
  8323. force YUV422 output
  8324. @item yuv444
  8325. force YUV444 output
  8326. @item rgb
  8327. force packed RGB output
  8328. @item gbrp
  8329. force planar RGB output
  8330. @item auto
  8331. automatically pick format
  8332. @end table
  8333. Default value is @samp{yuv420}.
  8334. @item repeatlast
  8335. If set to 1, force the filter to draw the last overlay frame over the
  8336. main input until the end of the stream. A value of 0 disables this
  8337. behavior. Default value is 1.
  8338. @end table
  8339. The @option{x}, and @option{y} expressions can contain the following
  8340. parameters.
  8341. @table @option
  8342. @item main_w, W
  8343. @item main_h, H
  8344. The main input width and height.
  8345. @item overlay_w, w
  8346. @item overlay_h, h
  8347. The overlay input width and height.
  8348. @item x
  8349. @item y
  8350. The computed values for @var{x} and @var{y}. They are evaluated for
  8351. each new frame.
  8352. @item hsub
  8353. @item vsub
  8354. horizontal and vertical chroma subsample values of the output
  8355. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8356. @var{vsub} is 1.
  8357. @item n
  8358. the number of input frame, starting from 0
  8359. @item pos
  8360. the position in the file of the input frame, NAN if unknown
  8361. @item t
  8362. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8363. @end table
  8364. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8365. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8366. when @option{eval} is set to @samp{init}.
  8367. Be aware that frames are taken from each input video in timestamp
  8368. order, hence, if their initial timestamps differ, it is a good idea
  8369. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8370. have them begin in the same zero timestamp, as the example for
  8371. the @var{movie} filter does.
  8372. You can chain together more overlays but you should test the
  8373. efficiency of such approach.
  8374. @subsection Commands
  8375. This filter supports the following commands:
  8376. @table @option
  8377. @item x
  8378. @item y
  8379. Modify the x and y of the overlay input.
  8380. The command accepts the same syntax of the corresponding option.
  8381. If the specified expression is not valid, it is kept at its current
  8382. value.
  8383. @end table
  8384. @subsection Examples
  8385. @itemize
  8386. @item
  8387. Draw the overlay at 10 pixels from the bottom right corner of the main
  8388. video:
  8389. @example
  8390. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8391. @end example
  8392. Using named options the example above becomes:
  8393. @example
  8394. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8395. @end example
  8396. @item
  8397. Insert a transparent PNG logo in the bottom left corner of the input,
  8398. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8399. @example
  8400. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8401. @end example
  8402. @item
  8403. Insert 2 different transparent PNG logos (second logo on bottom
  8404. right corner) using the @command{ffmpeg} tool:
  8405. @example
  8406. 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
  8407. @end example
  8408. @item
  8409. Add a transparent color layer on top of the main video; @code{WxH}
  8410. must specify the size of the main input to the overlay filter:
  8411. @example
  8412. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8413. @end example
  8414. @item
  8415. Play an original video and a filtered version (here with the deshake
  8416. filter) side by side using the @command{ffplay} tool:
  8417. @example
  8418. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8419. @end example
  8420. The above command is the same as:
  8421. @example
  8422. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8423. @end example
  8424. @item
  8425. Make a sliding overlay appearing from the left to the right top part of the
  8426. screen starting since time 2:
  8427. @example
  8428. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8429. @end example
  8430. @item
  8431. Compose output by putting two input videos side to side:
  8432. @example
  8433. ffmpeg -i left.avi -i right.avi -filter_complex "
  8434. nullsrc=size=200x100 [background];
  8435. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8436. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8437. [background][left] overlay=shortest=1 [background+left];
  8438. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8439. "
  8440. @end example
  8441. @item
  8442. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8443. @example
  8444. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8445. -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]'
  8446. masked.avi
  8447. @end example
  8448. @item
  8449. Chain several overlays in cascade:
  8450. @example
  8451. nullsrc=s=200x200 [bg];
  8452. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8453. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8454. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8455. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8456. [in3] null, [mid2] overlay=100:100 [out0]
  8457. @end example
  8458. @end itemize
  8459. @section owdenoise
  8460. Apply Overcomplete Wavelet denoiser.
  8461. The filter accepts the following options:
  8462. @table @option
  8463. @item depth
  8464. Set depth.
  8465. Larger depth values will denoise lower frequency components more, but
  8466. slow down filtering.
  8467. Must be an int in the range 8-16, default is @code{8}.
  8468. @item luma_strength, ls
  8469. Set luma strength.
  8470. Must be a double value in the range 0-1000, default is @code{1.0}.
  8471. @item chroma_strength, cs
  8472. Set chroma strength.
  8473. Must be a double value in the range 0-1000, default is @code{1.0}.
  8474. @end table
  8475. @anchor{pad}
  8476. @section pad
  8477. Add paddings to the input image, and place the original input at the
  8478. provided @var{x}, @var{y} coordinates.
  8479. It accepts the following parameters:
  8480. @table @option
  8481. @item width, w
  8482. @item height, h
  8483. Specify an expression for the size of the output image with the
  8484. paddings added. If the value for @var{width} or @var{height} is 0, the
  8485. corresponding input size is used for the output.
  8486. The @var{width} expression can reference the value set by the
  8487. @var{height} expression, and vice versa.
  8488. The default value of @var{width} and @var{height} is 0.
  8489. @item x
  8490. @item y
  8491. Specify the offsets to place the input image at within the padded area,
  8492. with respect to the top/left border of the output image.
  8493. The @var{x} expression can reference the value set by the @var{y}
  8494. expression, and vice versa.
  8495. The default value of @var{x} and @var{y} is 0.
  8496. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8497. so the input image is centered on the padded area.
  8498. @item color
  8499. Specify the color of the padded area. For the syntax of this option,
  8500. check the "Color" section in the ffmpeg-utils manual.
  8501. The default value of @var{color} is "black".
  8502. @item eval
  8503. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8504. It accepts the following values:
  8505. @table @samp
  8506. @item init
  8507. Only evaluate expressions once during the filter initialization or when
  8508. a command is processed.
  8509. @item frame
  8510. Evaluate expressions for each incoming frame.
  8511. @end table
  8512. Default value is @samp{init}.
  8513. @item aspect
  8514. Pad to aspect instead to a resolution.
  8515. @end table
  8516. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8517. options are expressions containing the following constants:
  8518. @table @option
  8519. @item in_w
  8520. @item in_h
  8521. The input video width and height.
  8522. @item iw
  8523. @item ih
  8524. These are the same as @var{in_w} and @var{in_h}.
  8525. @item out_w
  8526. @item out_h
  8527. The output width and height (the size of the padded area), as
  8528. specified by the @var{width} and @var{height} expressions.
  8529. @item ow
  8530. @item oh
  8531. These are the same as @var{out_w} and @var{out_h}.
  8532. @item x
  8533. @item y
  8534. The x and y offsets as specified by the @var{x} and @var{y}
  8535. expressions, or NAN if not yet specified.
  8536. @item a
  8537. same as @var{iw} / @var{ih}
  8538. @item sar
  8539. input sample aspect ratio
  8540. @item dar
  8541. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8542. @item hsub
  8543. @item vsub
  8544. The horizontal and vertical chroma subsample values. For example for the
  8545. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8546. @end table
  8547. @subsection Examples
  8548. @itemize
  8549. @item
  8550. Add paddings with the color "violet" to the input video. The output video
  8551. size is 640x480, and the top-left corner of the input video is placed at
  8552. column 0, row 40
  8553. @example
  8554. pad=640:480:0:40:violet
  8555. @end example
  8556. The example above is equivalent to the following command:
  8557. @example
  8558. pad=width=640:height=480:x=0:y=40:color=violet
  8559. @end example
  8560. @item
  8561. Pad the input to get an output with dimensions increased by 3/2,
  8562. and put the input video at the center of the padded area:
  8563. @example
  8564. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8565. @end example
  8566. @item
  8567. Pad the input to get a squared output with size equal to the maximum
  8568. value between the input width and height, and put the input video at
  8569. the center of the padded area:
  8570. @example
  8571. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8572. @end example
  8573. @item
  8574. Pad the input to get a final w/h ratio of 16:9:
  8575. @example
  8576. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8577. @end example
  8578. @item
  8579. In case of anamorphic video, in order to set the output display aspect
  8580. correctly, it is necessary to use @var{sar} in the expression,
  8581. according to the relation:
  8582. @example
  8583. (ih * X / ih) * sar = output_dar
  8584. X = output_dar / sar
  8585. @end example
  8586. Thus the previous example needs to be modified to:
  8587. @example
  8588. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8589. @end example
  8590. @item
  8591. Double the output size and put the input video in the bottom-right
  8592. corner of the output padded area:
  8593. @example
  8594. pad="2*iw:2*ih:ow-iw:oh-ih"
  8595. @end example
  8596. @end itemize
  8597. @anchor{palettegen}
  8598. @section palettegen
  8599. Generate one palette for a whole video stream.
  8600. It accepts the following options:
  8601. @table @option
  8602. @item max_colors
  8603. Set the maximum number of colors to quantize in the palette.
  8604. Note: the palette will still contain 256 colors; the unused palette entries
  8605. will be black.
  8606. @item reserve_transparent
  8607. Create a palette of 255 colors maximum and reserve the last one for
  8608. transparency. Reserving the transparency color is useful for GIF optimization.
  8609. If not set, the maximum of colors in the palette will be 256. You probably want
  8610. to disable this option for a standalone image.
  8611. Set by default.
  8612. @item stats_mode
  8613. Set statistics mode.
  8614. It accepts the following values:
  8615. @table @samp
  8616. @item full
  8617. Compute full frame histograms.
  8618. @item diff
  8619. Compute histograms only for the part that differs from previous frame. This
  8620. might be relevant to give more importance to the moving part of your input if
  8621. the background is static.
  8622. @item single
  8623. Compute new histogram for each frame.
  8624. @end table
  8625. Default value is @var{full}.
  8626. @end table
  8627. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8628. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8629. color quantization of the palette. This information is also visible at
  8630. @var{info} logging level.
  8631. @subsection Examples
  8632. @itemize
  8633. @item
  8634. Generate a representative palette of a given video using @command{ffmpeg}:
  8635. @example
  8636. ffmpeg -i input.mkv -vf palettegen palette.png
  8637. @end example
  8638. @end itemize
  8639. @section paletteuse
  8640. Use a palette to downsample an input video stream.
  8641. The filter takes two inputs: one video stream and a palette. The palette must
  8642. be a 256 pixels image.
  8643. It accepts the following options:
  8644. @table @option
  8645. @item dither
  8646. Select dithering mode. Available algorithms are:
  8647. @table @samp
  8648. @item bayer
  8649. Ordered 8x8 bayer dithering (deterministic)
  8650. @item heckbert
  8651. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8652. Note: this dithering is sometimes considered "wrong" and is included as a
  8653. reference.
  8654. @item floyd_steinberg
  8655. Floyd and Steingberg dithering (error diffusion)
  8656. @item sierra2
  8657. Frankie Sierra dithering v2 (error diffusion)
  8658. @item sierra2_4a
  8659. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8660. @end table
  8661. Default is @var{sierra2_4a}.
  8662. @item bayer_scale
  8663. When @var{bayer} dithering is selected, this option defines the scale of the
  8664. pattern (how much the crosshatch pattern is visible). A low value means more
  8665. visible pattern for less banding, and higher value means less visible pattern
  8666. at the cost of more banding.
  8667. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8668. @item diff_mode
  8669. If set, define the zone to process
  8670. @table @samp
  8671. @item rectangle
  8672. Only the changing rectangle will be reprocessed. This is similar to GIF
  8673. cropping/offsetting compression mechanism. This option can be useful for speed
  8674. if only a part of the image is changing, and has use cases such as limiting the
  8675. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8676. moving scene (it leads to more deterministic output if the scene doesn't change
  8677. much, and as a result less moving noise and better GIF compression).
  8678. @end table
  8679. Default is @var{none}.
  8680. @item new
  8681. Take new palette for each output frame.
  8682. @end table
  8683. @subsection Examples
  8684. @itemize
  8685. @item
  8686. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8687. using @command{ffmpeg}:
  8688. @example
  8689. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8690. @end example
  8691. @end itemize
  8692. @section perspective
  8693. Correct perspective of video not recorded perpendicular to the screen.
  8694. A description of the accepted parameters follows.
  8695. @table @option
  8696. @item x0
  8697. @item y0
  8698. @item x1
  8699. @item y1
  8700. @item x2
  8701. @item y2
  8702. @item x3
  8703. @item y3
  8704. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8705. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8706. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8707. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8708. then the corners of the source will be sent to the specified coordinates.
  8709. The expressions can use the following variables:
  8710. @table @option
  8711. @item W
  8712. @item H
  8713. the width and height of video frame.
  8714. @item in
  8715. Input frame count.
  8716. @item on
  8717. Output frame count.
  8718. @end table
  8719. @item interpolation
  8720. Set interpolation for perspective correction.
  8721. It accepts the following values:
  8722. @table @samp
  8723. @item linear
  8724. @item cubic
  8725. @end table
  8726. Default value is @samp{linear}.
  8727. @item sense
  8728. Set interpretation of coordinate options.
  8729. It accepts the following values:
  8730. @table @samp
  8731. @item 0, source
  8732. Send point in the source specified by the given coordinates to
  8733. the corners of the destination.
  8734. @item 1, destination
  8735. Send the corners of the source to the point in the destination specified
  8736. by the given coordinates.
  8737. Default value is @samp{source}.
  8738. @end table
  8739. @item eval
  8740. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8741. It accepts the following values:
  8742. @table @samp
  8743. @item init
  8744. only evaluate expressions once during the filter initialization or
  8745. when a command is processed
  8746. @item frame
  8747. evaluate expressions for each incoming frame
  8748. @end table
  8749. Default value is @samp{init}.
  8750. @end table
  8751. @section phase
  8752. Delay interlaced video by one field time so that the field order changes.
  8753. The intended use is to fix PAL movies that have been captured with the
  8754. opposite field order to the film-to-video transfer.
  8755. A description of the accepted parameters follows.
  8756. @table @option
  8757. @item mode
  8758. Set phase mode.
  8759. It accepts the following values:
  8760. @table @samp
  8761. @item t
  8762. Capture field order top-first, transfer bottom-first.
  8763. Filter will delay the bottom field.
  8764. @item b
  8765. Capture field order bottom-first, transfer top-first.
  8766. Filter will delay the top field.
  8767. @item p
  8768. Capture and transfer with the same field order. This mode only exists
  8769. for the documentation of the other options to refer to, but if you
  8770. actually select it, the filter will faithfully do nothing.
  8771. @item a
  8772. Capture field order determined automatically by field flags, transfer
  8773. opposite.
  8774. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8775. basis using field flags. If no field information is available,
  8776. then this works just like @samp{u}.
  8777. @item u
  8778. Capture unknown or varying, transfer opposite.
  8779. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8780. analyzing the images and selecting the alternative that produces best
  8781. match between the fields.
  8782. @item T
  8783. Capture top-first, transfer unknown or varying.
  8784. Filter selects among @samp{t} and @samp{p} using image analysis.
  8785. @item B
  8786. Capture bottom-first, transfer unknown or varying.
  8787. Filter selects among @samp{b} and @samp{p} using image analysis.
  8788. @item A
  8789. Capture determined by field flags, transfer unknown or varying.
  8790. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8791. image analysis. If no field information is available, then this works just
  8792. like @samp{U}. This is the default mode.
  8793. @item U
  8794. Both capture and transfer unknown or varying.
  8795. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8796. @end table
  8797. @end table
  8798. @section pixdesctest
  8799. Pixel format descriptor test filter, mainly useful for internal
  8800. testing. The output video should be equal to the input video.
  8801. For example:
  8802. @example
  8803. format=monow, pixdesctest
  8804. @end example
  8805. can be used to test the monowhite pixel format descriptor definition.
  8806. @section pixscope
  8807. Display sample values of color channels. Mainly useful for checking color and levels.
  8808. The filters accept the following options:
  8809. @table @option
  8810. @item x
  8811. Set scope X position, offset on X axis.
  8812. @item y
  8813. Set scope Y position, offset on Y axis.
  8814. @item w
  8815. Set scope width.
  8816. @item h
  8817. Set scope height.
  8818. @item o
  8819. Set window opacity. This window also holds statistics about pixel area.
  8820. @end table
  8821. @section pp
  8822. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8823. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8824. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8825. Each subfilter and some options have a short and a long name that can be used
  8826. interchangeably, i.e. dr/dering are the same.
  8827. The filters accept the following options:
  8828. @table @option
  8829. @item subfilters
  8830. Set postprocessing subfilters string.
  8831. @end table
  8832. All subfilters share common options to determine their scope:
  8833. @table @option
  8834. @item a/autoq
  8835. Honor the quality commands for this subfilter.
  8836. @item c/chrom
  8837. Do chrominance filtering, too (default).
  8838. @item y/nochrom
  8839. Do luminance filtering only (no chrominance).
  8840. @item n/noluma
  8841. Do chrominance filtering only (no luminance).
  8842. @end table
  8843. These options can be appended after the subfilter name, separated by a '|'.
  8844. Available subfilters are:
  8845. @table @option
  8846. @item hb/hdeblock[|difference[|flatness]]
  8847. Horizontal deblocking filter
  8848. @table @option
  8849. @item difference
  8850. Difference factor where higher values mean more deblocking (default: @code{32}).
  8851. @item flatness
  8852. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8853. @end table
  8854. @item vb/vdeblock[|difference[|flatness]]
  8855. Vertical deblocking filter
  8856. @table @option
  8857. @item difference
  8858. Difference factor where higher values mean more deblocking (default: @code{32}).
  8859. @item flatness
  8860. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8861. @end table
  8862. @item ha/hadeblock[|difference[|flatness]]
  8863. Accurate horizontal deblocking filter
  8864. @table @option
  8865. @item difference
  8866. Difference factor where higher values mean more deblocking (default: @code{32}).
  8867. @item flatness
  8868. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8869. @end table
  8870. @item va/vadeblock[|difference[|flatness]]
  8871. Accurate vertical deblocking filter
  8872. @table @option
  8873. @item difference
  8874. Difference factor where higher values mean more deblocking (default: @code{32}).
  8875. @item flatness
  8876. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8877. @end table
  8878. @end table
  8879. The horizontal and vertical deblocking filters share the difference and
  8880. flatness values so you cannot set different horizontal and vertical
  8881. thresholds.
  8882. @table @option
  8883. @item h1/x1hdeblock
  8884. Experimental horizontal deblocking filter
  8885. @item v1/x1vdeblock
  8886. Experimental vertical deblocking filter
  8887. @item dr/dering
  8888. Deringing filter
  8889. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8890. @table @option
  8891. @item threshold1
  8892. larger -> stronger filtering
  8893. @item threshold2
  8894. larger -> stronger filtering
  8895. @item threshold3
  8896. larger -> stronger filtering
  8897. @end table
  8898. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8899. @table @option
  8900. @item f/fullyrange
  8901. Stretch luminance to @code{0-255}.
  8902. @end table
  8903. @item lb/linblenddeint
  8904. Linear blend deinterlacing filter that deinterlaces the given block by
  8905. filtering all lines with a @code{(1 2 1)} filter.
  8906. @item li/linipoldeint
  8907. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8908. linearly interpolating every second line.
  8909. @item ci/cubicipoldeint
  8910. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8911. cubically interpolating every second line.
  8912. @item md/mediandeint
  8913. Median deinterlacing filter that deinterlaces the given block by applying a
  8914. median filter to every second line.
  8915. @item fd/ffmpegdeint
  8916. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8917. second line with a @code{(-1 4 2 4 -1)} filter.
  8918. @item l5/lowpass5
  8919. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8920. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8921. @item fq/forceQuant[|quantizer]
  8922. Overrides the quantizer table from the input with the constant quantizer you
  8923. specify.
  8924. @table @option
  8925. @item quantizer
  8926. Quantizer to use
  8927. @end table
  8928. @item de/default
  8929. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8930. @item fa/fast
  8931. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8932. @item ac
  8933. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8934. @end table
  8935. @subsection Examples
  8936. @itemize
  8937. @item
  8938. Apply horizontal and vertical deblocking, deringing and automatic
  8939. brightness/contrast:
  8940. @example
  8941. pp=hb/vb/dr/al
  8942. @end example
  8943. @item
  8944. Apply default filters without brightness/contrast correction:
  8945. @example
  8946. pp=de/-al
  8947. @end example
  8948. @item
  8949. Apply default filters and temporal denoiser:
  8950. @example
  8951. pp=default/tmpnoise|1|2|3
  8952. @end example
  8953. @item
  8954. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8955. automatically depending on available CPU time:
  8956. @example
  8957. pp=hb|y/vb|a
  8958. @end example
  8959. @end itemize
  8960. @section pp7
  8961. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8962. similar to spp = 6 with 7 point DCT, where only the center sample is
  8963. used after IDCT.
  8964. The filter accepts the following options:
  8965. @table @option
  8966. @item qp
  8967. Force a constant quantization parameter. It accepts an integer in range
  8968. 0 to 63. If not set, the filter will use the QP from the video stream
  8969. (if available).
  8970. @item mode
  8971. Set thresholding mode. Available modes are:
  8972. @table @samp
  8973. @item hard
  8974. Set hard thresholding.
  8975. @item soft
  8976. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8977. @item medium
  8978. Set medium thresholding (good results, default).
  8979. @end table
  8980. @end table
  8981. @section premultiply
  8982. Apply alpha premultiply effect to input video stream using first plane
  8983. of second stream as alpha.
  8984. Both streams must have same dimensions and same pixel format.
  8985. The filter accepts the following option:
  8986. @table @option
  8987. @item planes
  8988. Set which planes will be processed, unprocessed planes will be copied.
  8989. By default value 0xf, all planes will be processed.
  8990. @end table
  8991. @section prewitt
  8992. Apply prewitt operator to input video stream.
  8993. The filter accepts the following option:
  8994. @table @option
  8995. @item planes
  8996. Set which planes will be processed, unprocessed planes will be copied.
  8997. By default value 0xf, all planes will be processed.
  8998. @item scale
  8999. Set value which will be multiplied with filtered result.
  9000. @item delta
  9001. Set value which will be added to filtered result.
  9002. @end table
  9003. @section psnr
  9004. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9005. Ratio) between two input videos.
  9006. This filter takes in input two input videos, the first input is
  9007. considered the "main" source and is passed unchanged to the
  9008. output. The second input is used as a "reference" video for computing
  9009. the PSNR.
  9010. Both video inputs must have the same resolution and pixel format for
  9011. this filter to work correctly. Also it assumes that both inputs
  9012. have the same number of frames, which are compared one by one.
  9013. The obtained average PSNR is printed through the logging system.
  9014. The filter stores the accumulated MSE (mean squared error) of each
  9015. frame, and at the end of the processing it is averaged across all frames
  9016. equally, and the following formula is applied to obtain the PSNR:
  9017. @example
  9018. PSNR = 10*log10(MAX^2/MSE)
  9019. @end example
  9020. Where MAX is the average of the maximum values of each component of the
  9021. image.
  9022. The description of the accepted parameters follows.
  9023. @table @option
  9024. @item stats_file, f
  9025. If specified the filter will use the named file to save the PSNR of
  9026. each individual frame. When filename equals "-" the data is sent to
  9027. standard output.
  9028. @item stats_version
  9029. Specifies which version of the stats file format to use. Details of
  9030. each format are written below.
  9031. Default value is 1.
  9032. @item stats_add_max
  9033. Determines whether the max value is output to the stats log.
  9034. Default value is 0.
  9035. Requires stats_version >= 2. If this is set and stats_version < 2,
  9036. the filter will return an error.
  9037. @end table
  9038. The file printed if @var{stats_file} is selected, contains a sequence of
  9039. key/value pairs of the form @var{key}:@var{value} for each compared
  9040. couple of frames.
  9041. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9042. the list of per-frame-pair stats, with key value pairs following the frame
  9043. format with the following parameters:
  9044. @table @option
  9045. @item psnr_log_version
  9046. The version of the log file format. Will match @var{stats_version}.
  9047. @item fields
  9048. A comma separated list of the per-frame-pair parameters included in
  9049. the log.
  9050. @end table
  9051. A description of each shown per-frame-pair parameter follows:
  9052. @table @option
  9053. @item n
  9054. sequential number of the input frame, starting from 1
  9055. @item mse_avg
  9056. Mean Square Error pixel-by-pixel average difference of the compared
  9057. frames, averaged over all the image components.
  9058. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9059. Mean Square Error pixel-by-pixel average difference of the compared
  9060. frames for the component specified by the suffix.
  9061. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9062. Peak Signal to Noise ratio of the compared frames for the component
  9063. specified by the suffix.
  9064. @item max_avg, max_y, max_u, max_v
  9065. Maximum allowed value for each channel, and average over all
  9066. channels.
  9067. @end table
  9068. For example:
  9069. @example
  9070. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9071. [main][ref] psnr="stats_file=stats.log" [out]
  9072. @end example
  9073. On this example the input file being processed is compared with the
  9074. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9075. is stored in @file{stats.log}.
  9076. @anchor{pullup}
  9077. @section pullup
  9078. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9079. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9080. content.
  9081. The pullup filter is designed to take advantage of future context in making
  9082. its decisions. This filter is stateless in the sense that it does not lock
  9083. onto a pattern to follow, but it instead looks forward to the following
  9084. fields in order to identify matches and rebuild progressive frames.
  9085. To produce content with an even framerate, insert the fps filter after
  9086. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9087. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9088. The filter accepts the following options:
  9089. @table @option
  9090. @item jl
  9091. @item jr
  9092. @item jt
  9093. @item jb
  9094. These options set the amount of "junk" to ignore at the left, right, top, and
  9095. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9096. while top and bottom are in units of 2 lines.
  9097. The default is 8 pixels on each side.
  9098. @item sb
  9099. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9100. filter generating an occasional mismatched frame, but it may also cause an
  9101. excessive number of frames to be dropped during high motion sequences.
  9102. Conversely, setting it to -1 will make filter match fields more easily.
  9103. This may help processing of video where there is slight blurring between
  9104. the fields, but may also cause there to be interlaced frames in the output.
  9105. Default value is @code{0}.
  9106. @item mp
  9107. Set the metric plane to use. It accepts the following values:
  9108. @table @samp
  9109. @item l
  9110. Use luma plane.
  9111. @item u
  9112. Use chroma blue plane.
  9113. @item v
  9114. Use chroma red plane.
  9115. @end table
  9116. This option may be set to use chroma plane instead of the default luma plane
  9117. for doing filter's computations. This may improve accuracy on very clean
  9118. source material, but more likely will decrease accuracy, especially if there
  9119. is chroma noise (rainbow effect) or any grayscale video.
  9120. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9121. load and make pullup usable in realtime on slow machines.
  9122. @end table
  9123. For best results (without duplicated frames in the output file) it is
  9124. necessary to change the output frame rate. For example, to inverse
  9125. telecine NTSC input:
  9126. @example
  9127. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9128. @end example
  9129. @section qp
  9130. Change video quantization parameters (QP).
  9131. The filter accepts the following option:
  9132. @table @option
  9133. @item qp
  9134. Set expression for quantization parameter.
  9135. @end table
  9136. The expression is evaluated through the eval API and can contain, among others,
  9137. the following constants:
  9138. @table @var
  9139. @item known
  9140. 1 if index is not 129, 0 otherwise.
  9141. @item qp
  9142. Sequentional index starting from -129 to 128.
  9143. @end table
  9144. @subsection Examples
  9145. @itemize
  9146. @item
  9147. Some equation like:
  9148. @example
  9149. qp=2+2*sin(PI*qp)
  9150. @end example
  9151. @end itemize
  9152. @section random
  9153. Flush video frames from internal cache of frames into a random order.
  9154. No frame is discarded.
  9155. Inspired by @ref{frei0r} nervous filter.
  9156. @table @option
  9157. @item frames
  9158. Set size in number of frames of internal cache, in range from @code{2} to
  9159. @code{512}. Default is @code{30}.
  9160. @item seed
  9161. Set seed for random number generator, must be an integer included between
  9162. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9163. less than @code{0}, the filter will try to use a good random seed on a
  9164. best effort basis.
  9165. @end table
  9166. @section readeia608
  9167. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9168. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9169. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9170. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9171. @table @option
  9172. @item lavfi.readeia608.X.cc
  9173. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9174. @item lavfi.readeia608.X.line
  9175. The number of the line on which the EIA-608 data was identified and read.
  9176. @end table
  9177. This filter accepts the following options:
  9178. @table @option
  9179. @item scan_min
  9180. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9181. @item scan_max
  9182. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9183. @item mac
  9184. Set minimal acceptable amplitude change for sync codes detection.
  9185. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9186. @item spw
  9187. Set the ratio of width reserved for sync code detection.
  9188. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9189. @item mhd
  9190. Set the max peaks height difference for sync code detection.
  9191. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9192. @item mpd
  9193. Set max peaks period difference for sync code detection.
  9194. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9195. @item msd
  9196. Set the first two max start code bits differences.
  9197. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9198. @item bhd
  9199. Set the minimum ratio of bits height compared to 3rd start code bit.
  9200. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9201. @item th_w
  9202. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9203. @item th_b
  9204. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9205. @item chp
  9206. Enable checking the parity bit. In the event of a parity error, the filter will output
  9207. @code{0x00} for that character. Default is false.
  9208. @end table
  9209. @subsection Examples
  9210. @itemize
  9211. @item
  9212. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9213. @example
  9214. 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
  9215. @end example
  9216. @end itemize
  9217. @section readvitc
  9218. Read vertical interval timecode (VITC) information from the top lines of a
  9219. video frame.
  9220. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9221. timecode value, if a valid timecode has been detected. Further metadata key
  9222. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9223. timecode data has been found or not.
  9224. This filter accepts the following options:
  9225. @table @option
  9226. @item scan_max
  9227. Set the maximum number of lines to scan for VITC data. If the value is set to
  9228. @code{-1} the full video frame is scanned. Default is @code{45}.
  9229. @item thr_b
  9230. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9231. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9232. @item thr_w
  9233. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9234. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9235. @end table
  9236. @subsection Examples
  9237. @itemize
  9238. @item
  9239. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9240. draw @code{--:--:--:--} as a placeholder:
  9241. @example
  9242. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9243. @end example
  9244. @end itemize
  9245. @section remap
  9246. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9247. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9248. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9249. value for pixel will be used for destination pixel.
  9250. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9251. will have Xmap/Ymap video stream dimensions.
  9252. Xmap and Ymap input video streams are 16bit depth, single channel.
  9253. @section removegrain
  9254. The removegrain filter is a spatial denoiser for progressive video.
  9255. @table @option
  9256. @item m0
  9257. Set mode for the first plane.
  9258. @item m1
  9259. Set mode for the second plane.
  9260. @item m2
  9261. Set mode for the third plane.
  9262. @item m3
  9263. Set mode for the fourth plane.
  9264. @end table
  9265. Range of mode is from 0 to 24. Description of each mode follows:
  9266. @table @var
  9267. @item 0
  9268. Leave input plane unchanged. Default.
  9269. @item 1
  9270. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9271. @item 2
  9272. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9273. @item 3
  9274. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9275. @item 4
  9276. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9277. This is equivalent to a median filter.
  9278. @item 5
  9279. Line-sensitive clipping giving the minimal change.
  9280. @item 6
  9281. Line-sensitive clipping, intermediate.
  9282. @item 7
  9283. Line-sensitive clipping, intermediate.
  9284. @item 8
  9285. Line-sensitive clipping, intermediate.
  9286. @item 9
  9287. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9288. @item 10
  9289. Replaces the target pixel with the closest neighbour.
  9290. @item 11
  9291. [1 2 1] horizontal and vertical kernel blur.
  9292. @item 12
  9293. Same as mode 11.
  9294. @item 13
  9295. Bob mode, interpolates top field from the line where the neighbours
  9296. pixels are the closest.
  9297. @item 14
  9298. Bob mode, interpolates bottom field from the line where the neighbours
  9299. pixels are the closest.
  9300. @item 15
  9301. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9302. interpolation formula.
  9303. @item 16
  9304. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9305. interpolation formula.
  9306. @item 17
  9307. Clips the pixel with the minimum and maximum of respectively the maximum and
  9308. minimum of each pair of opposite neighbour pixels.
  9309. @item 18
  9310. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9311. the current pixel is minimal.
  9312. @item 19
  9313. Replaces the pixel with the average of its 8 neighbours.
  9314. @item 20
  9315. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9316. @item 21
  9317. Clips pixels using the averages of opposite neighbour.
  9318. @item 22
  9319. Same as mode 21 but simpler and faster.
  9320. @item 23
  9321. Small edge and halo removal, but reputed useless.
  9322. @item 24
  9323. Similar as 23.
  9324. @end table
  9325. @section removelogo
  9326. Suppress a TV station logo, using an image file to determine which
  9327. pixels comprise the logo. It works by filling in the pixels that
  9328. comprise the logo with neighboring pixels.
  9329. The filter accepts the following options:
  9330. @table @option
  9331. @item filename, f
  9332. Set the filter bitmap file, which can be any image format supported by
  9333. libavformat. The width and height of the image file must match those of the
  9334. video stream being processed.
  9335. @end table
  9336. Pixels in the provided bitmap image with a value of zero are not
  9337. considered part of the logo, non-zero pixels are considered part of
  9338. the logo. If you use white (255) for the logo and black (0) for the
  9339. rest, you will be safe. For making the filter bitmap, it is
  9340. recommended to take a screen capture of a black frame with the logo
  9341. visible, and then using a threshold filter followed by the erode
  9342. filter once or twice.
  9343. If needed, little splotches can be fixed manually. Remember that if
  9344. logo pixels are not covered, the filter quality will be much
  9345. reduced. Marking too many pixels as part of the logo does not hurt as
  9346. much, but it will increase the amount of blurring needed to cover over
  9347. the image and will destroy more information than necessary, and extra
  9348. pixels will slow things down on a large logo.
  9349. @section repeatfields
  9350. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9351. fields based on its value.
  9352. @section reverse
  9353. Reverse a video clip.
  9354. Warning: This filter requires memory to buffer the entire clip, so trimming
  9355. is suggested.
  9356. @subsection Examples
  9357. @itemize
  9358. @item
  9359. Take the first 5 seconds of a clip, and reverse it.
  9360. @example
  9361. trim=end=5,reverse
  9362. @end example
  9363. @end itemize
  9364. @section roberts
  9365. Apply roberts cross operator to input video stream.
  9366. The filter accepts the following option:
  9367. @table @option
  9368. @item planes
  9369. Set which planes will be processed, unprocessed planes will be copied.
  9370. By default value 0xf, all planes will be processed.
  9371. @item scale
  9372. Set value which will be multiplied with filtered result.
  9373. @item delta
  9374. Set value which will be added to filtered result.
  9375. @end table
  9376. @section rotate
  9377. Rotate video by an arbitrary angle expressed in radians.
  9378. The filter accepts the following options:
  9379. A description of the optional parameters follows.
  9380. @table @option
  9381. @item angle, a
  9382. Set an expression for the angle by which to rotate the input video
  9383. clockwise, expressed as a number of radians. A negative value will
  9384. result in a counter-clockwise rotation. By default it is set to "0".
  9385. This expression is evaluated for each frame.
  9386. @item out_w, ow
  9387. Set the output width expression, default value is "iw".
  9388. This expression is evaluated just once during configuration.
  9389. @item out_h, oh
  9390. Set the output height expression, default value is "ih".
  9391. This expression is evaluated just once during configuration.
  9392. @item bilinear
  9393. Enable bilinear interpolation if set to 1, a value of 0 disables
  9394. it. Default value is 1.
  9395. @item fillcolor, c
  9396. Set the color used to fill the output area not covered by the rotated
  9397. image. For the general syntax of this option, check the "Color" section in the
  9398. ffmpeg-utils manual. If the special value "none" is selected then no
  9399. background is printed (useful for example if the background is never shown).
  9400. Default value is "black".
  9401. @end table
  9402. The expressions for the angle and the output size can contain the
  9403. following constants and functions:
  9404. @table @option
  9405. @item n
  9406. sequential number of the input frame, starting from 0. It is always NAN
  9407. before the first frame is filtered.
  9408. @item t
  9409. time in seconds of the input frame, it is set to 0 when the filter is
  9410. configured. It is always NAN before the first frame is filtered.
  9411. @item hsub
  9412. @item vsub
  9413. horizontal and vertical chroma subsample values. For example for the
  9414. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9415. @item in_w, iw
  9416. @item in_h, ih
  9417. the input video width and height
  9418. @item out_w, ow
  9419. @item out_h, oh
  9420. the output width and height, that is the size of the padded area as
  9421. specified by the @var{width} and @var{height} expressions
  9422. @item rotw(a)
  9423. @item roth(a)
  9424. the minimal width/height required for completely containing the input
  9425. video rotated by @var{a} radians.
  9426. These are only available when computing the @option{out_w} and
  9427. @option{out_h} expressions.
  9428. @end table
  9429. @subsection Examples
  9430. @itemize
  9431. @item
  9432. Rotate the input by PI/6 radians clockwise:
  9433. @example
  9434. rotate=PI/6
  9435. @end example
  9436. @item
  9437. Rotate the input by PI/6 radians counter-clockwise:
  9438. @example
  9439. rotate=-PI/6
  9440. @end example
  9441. @item
  9442. Rotate the input by 45 degrees clockwise:
  9443. @example
  9444. rotate=45*PI/180
  9445. @end example
  9446. @item
  9447. Apply a constant rotation with period T, starting from an angle of PI/3:
  9448. @example
  9449. rotate=PI/3+2*PI*t/T
  9450. @end example
  9451. @item
  9452. Make the input video rotation oscillating with a period of T
  9453. seconds and an amplitude of A radians:
  9454. @example
  9455. rotate=A*sin(2*PI/T*t)
  9456. @end example
  9457. @item
  9458. Rotate the video, output size is chosen so that the whole rotating
  9459. input video is always completely contained in the output:
  9460. @example
  9461. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9462. @end example
  9463. @item
  9464. Rotate the video, reduce the output size so that no background is ever
  9465. shown:
  9466. @example
  9467. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9468. @end example
  9469. @end itemize
  9470. @subsection Commands
  9471. The filter supports the following commands:
  9472. @table @option
  9473. @item a, angle
  9474. Set the angle expression.
  9475. The command accepts the same syntax of the corresponding option.
  9476. If the specified expression is not valid, it is kept at its current
  9477. value.
  9478. @end table
  9479. @section sab
  9480. Apply Shape Adaptive Blur.
  9481. The filter accepts the following options:
  9482. @table @option
  9483. @item luma_radius, lr
  9484. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9485. value is 1.0. A greater value will result in a more blurred image, and
  9486. in slower processing.
  9487. @item luma_pre_filter_radius, lpfr
  9488. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9489. value is 1.0.
  9490. @item luma_strength, ls
  9491. Set luma maximum difference between pixels to still be considered, must
  9492. be a value in the 0.1-100.0 range, default value is 1.0.
  9493. @item chroma_radius, cr
  9494. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9495. greater value will result in a more blurred image, and in slower
  9496. processing.
  9497. @item chroma_pre_filter_radius, cpfr
  9498. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9499. @item chroma_strength, cs
  9500. Set chroma maximum difference between pixels to still be considered,
  9501. must be a value in the -0.9-100.0 range.
  9502. @end table
  9503. Each chroma option value, if not explicitly specified, is set to the
  9504. corresponding luma option value.
  9505. @anchor{scale}
  9506. @section scale
  9507. Scale (resize) the input video, using the libswscale library.
  9508. The scale filter forces the output display aspect ratio to be the same
  9509. of the input, by changing the output sample aspect ratio.
  9510. If the input image format is different from the format requested by
  9511. the next filter, the scale filter will convert the input to the
  9512. requested format.
  9513. @subsection Options
  9514. The filter accepts the following options, or any of the options
  9515. supported by the libswscale scaler.
  9516. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9517. the complete list of scaler options.
  9518. @table @option
  9519. @item width, w
  9520. @item height, h
  9521. Set the output video dimension expression. Default value is the input
  9522. dimension.
  9523. If the @var{width} or @var{w} value is 0, the input width is used for
  9524. the output. If the @var{height} or @var{h} value is 0, the input height
  9525. is used for the output.
  9526. If one and only one of the values is -n with n >= 1, the scale filter
  9527. will use a value that maintains the aspect ratio of the input image,
  9528. calculated from the other specified dimension. After that it will,
  9529. however, make sure that the calculated dimension is divisible by n and
  9530. adjust the value if necessary.
  9531. If both values are -n with n >= 1, the behavior will be identical to
  9532. both values being set to 0 as previously detailed.
  9533. See below for the list of accepted constants for use in the dimension
  9534. expression.
  9535. @item eval
  9536. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9537. @table @samp
  9538. @item init
  9539. Only evaluate expressions once during the filter initialization or when a command is processed.
  9540. @item frame
  9541. Evaluate expressions for each incoming frame.
  9542. @end table
  9543. Default value is @samp{init}.
  9544. @item interl
  9545. Set the interlacing mode. It accepts the following values:
  9546. @table @samp
  9547. @item 1
  9548. Force interlaced aware scaling.
  9549. @item 0
  9550. Do not apply interlaced scaling.
  9551. @item -1
  9552. Select interlaced aware scaling depending on whether the source frames
  9553. are flagged as interlaced or not.
  9554. @end table
  9555. Default value is @samp{0}.
  9556. @item flags
  9557. Set libswscale scaling flags. See
  9558. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9559. complete list of values. If not explicitly specified the filter applies
  9560. the default flags.
  9561. @item param0, param1
  9562. Set libswscale input parameters for scaling algorithms that need them. See
  9563. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9564. complete documentation. If not explicitly specified the filter applies
  9565. empty parameters.
  9566. @item size, s
  9567. Set the video size. For the syntax of this option, check the
  9568. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9569. @item in_color_matrix
  9570. @item out_color_matrix
  9571. Set in/output YCbCr color space type.
  9572. This allows the autodetected value to be overridden as well as allows forcing
  9573. a specific value used for the output and encoder.
  9574. If not specified, the color space type depends on the pixel format.
  9575. Possible values:
  9576. @table @samp
  9577. @item auto
  9578. Choose automatically.
  9579. @item bt709
  9580. Format conforming to International Telecommunication Union (ITU)
  9581. Recommendation BT.709.
  9582. @item fcc
  9583. Set color space conforming to the United States Federal Communications
  9584. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9585. @item bt601
  9586. Set color space conforming to:
  9587. @itemize
  9588. @item
  9589. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9590. @item
  9591. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9592. @item
  9593. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9594. @end itemize
  9595. @item smpte240m
  9596. Set color space conforming to SMPTE ST 240:1999.
  9597. @end table
  9598. @item in_range
  9599. @item out_range
  9600. Set in/output YCbCr sample range.
  9601. This allows the autodetected value to be overridden as well as allows forcing
  9602. a specific value used for the output and encoder. If not specified, the
  9603. range depends on the pixel format. Possible values:
  9604. @table @samp
  9605. @item auto
  9606. Choose automatically.
  9607. @item jpeg/full/pc
  9608. Set full range (0-255 in case of 8-bit luma).
  9609. @item mpeg/tv
  9610. Set "MPEG" range (16-235 in case of 8-bit luma).
  9611. @end table
  9612. @item force_original_aspect_ratio
  9613. Enable decreasing or increasing output video width or height if necessary to
  9614. keep the original aspect ratio. Possible values:
  9615. @table @samp
  9616. @item disable
  9617. Scale the video as specified and disable this feature.
  9618. @item decrease
  9619. The output video dimensions will automatically be decreased if needed.
  9620. @item increase
  9621. The output video dimensions will automatically be increased if needed.
  9622. @end table
  9623. One useful instance of this option is that when you know a specific device's
  9624. maximum allowed resolution, you can use this to limit the output video to
  9625. that, while retaining the aspect ratio. For example, device A allows
  9626. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9627. decrease) and specifying 1280x720 to the command line makes the output
  9628. 1280x533.
  9629. Please note that this is a different thing than specifying -1 for @option{w}
  9630. or @option{h}, you still need to specify the output resolution for this option
  9631. to work.
  9632. @end table
  9633. The values of the @option{w} and @option{h} options are expressions
  9634. containing the following constants:
  9635. @table @var
  9636. @item in_w
  9637. @item in_h
  9638. The input width and height
  9639. @item iw
  9640. @item ih
  9641. These are the same as @var{in_w} and @var{in_h}.
  9642. @item out_w
  9643. @item out_h
  9644. The output (scaled) width and height
  9645. @item ow
  9646. @item oh
  9647. These are the same as @var{out_w} and @var{out_h}
  9648. @item a
  9649. The same as @var{iw} / @var{ih}
  9650. @item sar
  9651. input sample aspect ratio
  9652. @item dar
  9653. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9654. @item hsub
  9655. @item vsub
  9656. horizontal and vertical input chroma subsample values. For example for the
  9657. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9658. @item ohsub
  9659. @item ovsub
  9660. horizontal and vertical output chroma subsample values. For example for the
  9661. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9662. @end table
  9663. @subsection Examples
  9664. @itemize
  9665. @item
  9666. Scale the input video to a size of 200x100
  9667. @example
  9668. scale=w=200:h=100
  9669. @end example
  9670. This is equivalent to:
  9671. @example
  9672. scale=200:100
  9673. @end example
  9674. or:
  9675. @example
  9676. scale=200x100
  9677. @end example
  9678. @item
  9679. Specify a size abbreviation for the output size:
  9680. @example
  9681. scale=qcif
  9682. @end example
  9683. which can also be written as:
  9684. @example
  9685. scale=size=qcif
  9686. @end example
  9687. @item
  9688. Scale the input to 2x:
  9689. @example
  9690. scale=w=2*iw:h=2*ih
  9691. @end example
  9692. @item
  9693. The above is the same as:
  9694. @example
  9695. scale=2*in_w:2*in_h
  9696. @end example
  9697. @item
  9698. Scale the input to 2x with forced interlaced scaling:
  9699. @example
  9700. scale=2*iw:2*ih:interl=1
  9701. @end example
  9702. @item
  9703. Scale the input to half size:
  9704. @example
  9705. scale=w=iw/2:h=ih/2
  9706. @end example
  9707. @item
  9708. Increase the width, and set the height to the same size:
  9709. @example
  9710. scale=3/2*iw:ow
  9711. @end example
  9712. @item
  9713. Seek Greek harmony:
  9714. @example
  9715. scale=iw:1/PHI*iw
  9716. scale=ih*PHI:ih
  9717. @end example
  9718. @item
  9719. Increase the height, and set the width to 3/2 of the height:
  9720. @example
  9721. scale=w=3/2*oh:h=3/5*ih
  9722. @end example
  9723. @item
  9724. Increase the size, making the size a multiple of the chroma
  9725. subsample values:
  9726. @example
  9727. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9728. @end example
  9729. @item
  9730. Increase the width to a maximum of 500 pixels,
  9731. keeping the same aspect ratio as the input:
  9732. @example
  9733. scale=w='min(500\, iw*3/2):h=-1'
  9734. @end example
  9735. @end itemize
  9736. @subsection Commands
  9737. This filter supports the following commands:
  9738. @table @option
  9739. @item width, w
  9740. @item height, h
  9741. Set the output video dimension expression.
  9742. The command accepts the same syntax of the corresponding option.
  9743. If the specified expression is not valid, it is kept at its current
  9744. value.
  9745. @end table
  9746. @section scale_npp
  9747. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9748. format conversion on CUDA video frames. Setting the output width and height
  9749. works in the same way as for the @var{scale} filter.
  9750. The following additional options are accepted:
  9751. @table @option
  9752. @item format
  9753. The pixel format of the output CUDA frames. If set to the string "same" (the
  9754. default), the input format will be kept. Note that automatic format negotiation
  9755. and conversion is not yet supported for hardware frames
  9756. @item interp_algo
  9757. The interpolation algorithm used for resizing. One of the following:
  9758. @table @option
  9759. @item nn
  9760. Nearest neighbour.
  9761. @item linear
  9762. @item cubic
  9763. @item cubic2p_bspline
  9764. 2-parameter cubic (B=1, C=0)
  9765. @item cubic2p_catmullrom
  9766. 2-parameter cubic (B=0, C=1/2)
  9767. @item cubic2p_b05c03
  9768. 2-parameter cubic (B=1/2, C=3/10)
  9769. @item super
  9770. Supersampling
  9771. @item lanczos
  9772. @end table
  9773. @end table
  9774. @section scale2ref
  9775. Scale (resize) the input video, based on a reference video.
  9776. See the scale filter for available options, scale2ref supports the same but
  9777. uses the reference video instead of the main input as basis. scale2ref also
  9778. supports the following additional constants for the @option{w} and
  9779. @option{h} options:
  9780. @table @var
  9781. @item main_w
  9782. @item main_h
  9783. The main input video's width and height
  9784. @item main_a
  9785. The same as @var{main_w} / @var{main_h}
  9786. @item main_sar
  9787. The main input video's sample aspect ratio
  9788. @item main_dar, mdar
  9789. The main input video's display aspect ratio. Calculated from
  9790. @code{(main_w / main_h) * main_sar}.
  9791. @item main_hsub
  9792. @item main_vsub
  9793. The main input video's horizontal and vertical chroma subsample values.
  9794. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9795. is 1.
  9796. @end table
  9797. @subsection Examples
  9798. @itemize
  9799. @item
  9800. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9801. @example
  9802. 'scale2ref[b][a];[a][b]overlay'
  9803. @end example
  9804. @end itemize
  9805. @anchor{selectivecolor}
  9806. @section selectivecolor
  9807. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9808. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9809. by the "purity" of the color (that is, how saturated it already is).
  9810. This filter is similar to the Adobe Photoshop Selective Color tool.
  9811. The filter accepts the following options:
  9812. @table @option
  9813. @item correction_method
  9814. Select color correction method.
  9815. Available values are:
  9816. @table @samp
  9817. @item absolute
  9818. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9819. component value).
  9820. @item relative
  9821. Specified adjustments are relative to the original component value.
  9822. @end table
  9823. Default is @code{absolute}.
  9824. @item reds
  9825. Adjustments for red pixels (pixels where the red component is the maximum)
  9826. @item yellows
  9827. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9828. @item greens
  9829. Adjustments for green pixels (pixels where the green component is the maximum)
  9830. @item cyans
  9831. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9832. @item blues
  9833. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9834. @item magentas
  9835. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9836. @item whites
  9837. Adjustments for white pixels (pixels where all components are greater than 128)
  9838. @item neutrals
  9839. Adjustments for all pixels except pure black and pure white
  9840. @item blacks
  9841. Adjustments for black pixels (pixels where all components are lesser than 128)
  9842. @item psfile
  9843. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9844. @end table
  9845. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9846. 4 space separated floating point adjustment values in the [-1,1] range,
  9847. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9848. pixels of its range.
  9849. @subsection Examples
  9850. @itemize
  9851. @item
  9852. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9853. increase magenta by 27% in blue areas:
  9854. @example
  9855. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9856. @end example
  9857. @item
  9858. Use a Photoshop selective color preset:
  9859. @example
  9860. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9861. @end example
  9862. @end itemize
  9863. @anchor{separatefields}
  9864. @section separatefields
  9865. The @code{separatefields} takes a frame-based video input and splits
  9866. each frame into its components fields, producing a new half height clip
  9867. with twice the frame rate and twice the frame count.
  9868. This filter use field-dominance information in frame to decide which
  9869. of each pair of fields to place first in the output.
  9870. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9871. @section setdar, setsar
  9872. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9873. output video.
  9874. This is done by changing the specified Sample (aka Pixel) Aspect
  9875. Ratio, according to the following equation:
  9876. @example
  9877. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9878. @end example
  9879. Keep in mind that the @code{setdar} filter does not modify the pixel
  9880. dimensions of the video frame. Also, the display aspect ratio set by
  9881. this filter may be changed by later filters in the filterchain,
  9882. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9883. applied.
  9884. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9885. the filter output video.
  9886. Note that as a consequence of the application of this filter, the
  9887. output display aspect ratio will change according to the equation
  9888. above.
  9889. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9890. filter may be changed by later filters in the filterchain, e.g. if
  9891. another "setsar" or a "setdar" filter is applied.
  9892. It accepts the following parameters:
  9893. @table @option
  9894. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9895. Set the aspect ratio used by the filter.
  9896. The parameter can be a floating point number string, an expression, or
  9897. a string of the form @var{num}:@var{den}, where @var{num} and
  9898. @var{den} are the numerator and denominator of the aspect ratio. If
  9899. the parameter is not specified, it is assumed the value "0".
  9900. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9901. should be escaped.
  9902. @item max
  9903. Set the maximum integer value to use for expressing numerator and
  9904. denominator when reducing the expressed aspect ratio to a rational.
  9905. Default value is @code{100}.
  9906. @end table
  9907. The parameter @var{sar} is an expression containing
  9908. the following constants:
  9909. @table @option
  9910. @item E, PI, PHI
  9911. These are approximated values for the mathematical constants e
  9912. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9913. @item w, h
  9914. The input width and height.
  9915. @item a
  9916. These are the same as @var{w} / @var{h}.
  9917. @item sar
  9918. The input sample aspect ratio.
  9919. @item dar
  9920. The input display aspect ratio. It is the same as
  9921. (@var{w} / @var{h}) * @var{sar}.
  9922. @item hsub, vsub
  9923. Horizontal and vertical chroma subsample values. For example, for the
  9924. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9925. @end table
  9926. @subsection Examples
  9927. @itemize
  9928. @item
  9929. To change the display aspect ratio to 16:9, specify one of the following:
  9930. @example
  9931. setdar=dar=1.77777
  9932. setdar=dar=16/9
  9933. @end example
  9934. @item
  9935. To change the sample aspect ratio to 10:11, specify:
  9936. @example
  9937. setsar=sar=10/11
  9938. @end example
  9939. @item
  9940. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9941. 1000 in the aspect ratio reduction, use the command:
  9942. @example
  9943. setdar=ratio=16/9:max=1000
  9944. @end example
  9945. @end itemize
  9946. @anchor{setfield}
  9947. @section setfield
  9948. Force field for the output video frame.
  9949. The @code{setfield} filter marks the interlace type field for the
  9950. output frames. It does not change the input frame, but only sets the
  9951. corresponding property, which affects how the frame is treated by
  9952. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9953. The filter accepts the following options:
  9954. @table @option
  9955. @item mode
  9956. Available values are:
  9957. @table @samp
  9958. @item auto
  9959. Keep the same field property.
  9960. @item bff
  9961. Mark the frame as bottom-field-first.
  9962. @item tff
  9963. Mark the frame as top-field-first.
  9964. @item prog
  9965. Mark the frame as progressive.
  9966. @end table
  9967. @end table
  9968. @section showinfo
  9969. Show a line containing various information for each input video frame.
  9970. The input video is not modified.
  9971. The shown line contains a sequence of key/value pairs of the form
  9972. @var{key}:@var{value}.
  9973. The following values are shown in the output:
  9974. @table @option
  9975. @item n
  9976. The (sequential) number of the input frame, starting from 0.
  9977. @item pts
  9978. The Presentation TimeStamp of the input frame, expressed as a number of
  9979. time base units. The time base unit depends on the filter input pad.
  9980. @item pts_time
  9981. The Presentation TimeStamp of the input frame, expressed as a number of
  9982. seconds.
  9983. @item pos
  9984. The position of the frame in the input stream, or -1 if this information is
  9985. unavailable and/or meaningless (for example in case of synthetic video).
  9986. @item fmt
  9987. The pixel format name.
  9988. @item sar
  9989. The sample aspect ratio of the input frame, expressed in the form
  9990. @var{num}/@var{den}.
  9991. @item s
  9992. The size of the input frame. For the syntax of this option, check the
  9993. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9994. @item i
  9995. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9996. for bottom field first).
  9997. @item iskey
  9998. This is 1 if the frame is a key frame, 0 otherwise.
  9999. @item type
  10000. The picture type of the input frame ("I" for an I-frame, "P" for a
  10001. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10002. Also refer to the documentation of the @code{AVPictureType} enum and of
  10003. the @code{av_get_picture_type_char} function defined in
  10004. @file{libavutil/avutil.h}.
  10005. @item checksum
  10006. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10007. @item plane_checksum
  10008. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10009. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10010. @end table
  10011. @section showpalette
  10012. Displays the 256 colors palette of each frame. This filter is only relevant for
  10013. @var{pal8} pixel format frames.
  10014. It accepts the following option:
  10015. @table @option
  10016. @item s
  10017. Set the size of the box used to represent one palette color entry. Default is
  10018. @code{30} (for a @code{30x30} pixel box).
  10019. @end table
  10020. @section shuffleframes
  10021. Reorder and/or duplicate and/or drop video frames.
  10022. It accepts the following parameters:
  10023. @table @option
  10024. @item mapping
  10025. Set the destination indexes of input frames.
  10026. This is space or '|' separated list of indexes that maps input frames to output
  10027. frames. Number of indexes also sets maximal value that each index may have.
  10028. '-1' index have special meaning and that is to drop frame.
  10029. @end table
  10030. The first frame has the index 0. The default is to keep the input unchanged.
  10031. @subsection Examples
  10032. @itemize
  10033. @item
  10034. Swap second and third frame of every three frames of the input:
  10035. @example
  10036. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10037. @end example
  10038. @item
  10039. Swap 10th and 1st frame of every ten frames of the input:
  10040. @example
  10041. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10042. @end example
  10043. @end itemize
  10044. @section shuffleplanes
  10045. Reorder and/or duplicate video planes.
  10046. It accepts the following parameters:
  10047. @table @option
  10048. @item map0
  10049. The index of the input plane to be used as the first output plane.
  10050. @item map1
  10051. The index of the input plane to be used as the second output plane.
  10052. @item map2
  10053. The index of the input plane to be used as the third output plane.
  10054. @item map3
  10055. The index of the input plane to be used as the fourth output plane.
  10056. @end table
  10057. The first plane has the index 0. The default is to keep the input unchanged.
  10058. @subsection Examples
  10059. @itemize
  10060. @item
  10061. Swap the second and third planes of the input:
  10062. @example
  10063. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10064. @end example
  10065. @end itemize
  10066. @anchor{signalstats}
  10067. @section signalstats
  10068. Evaluate various visual metrics that assist in determining issues associated
  10069. with the digitization of analog video media.
  10070. By default the filter will log these metadata values:
  10071. @table @option
  10072. @item YMIN
  10073. Display the minimal Y value contained within the input frame. Expressed in
  10074. range of [0-255].
  10075. @item YLOW
  10076. Display the Y value at the 10% percentile within the input frame. Expressed in
  10077. range of [0-255].
  10078. @item YAVG
  10079. Display the average Y value within the input frame. Expressed in range of
  10080. [0-255].
  10081. @item YHIGH
  10082. Display the Y value at the 90% percentile within the input frame. Expressed in
  10083. range of [0-255].
  10084. @item YMAX
  10085. Display the maximum Y value contained within the input frame. Expressed in
  10086. range of [0-255].
  10087. @item UMIN
  10088. Display the minimal U value contained within the input frame. Expressed in
  10089. range of [0-255].
  10090. @item ULOW
  10091. Display the U value at the 10% percentile within the input frame. Expressed in
  10092. range of [0-255].
  10093. @item UAVG
  10094. Display the average U value within the input frame. Expressed in range of
  10095. [0-255].
  10096. @item UHIGH
  10097. Display the U value at the 90% percentile within the input frame. Expressed in
  10098. range of [0-255].
  10099. @item UMAX
  10100. Display the maximum U value contained within the input frame. Expressed in
  10101. range of [0-255].
  10102. @item VMIN
  10103. Display the minimal V value contained within the input frame. Expressed in
  10104. range of [0-255].
  10105. @item VLOW
  10106. Display the V value at the 10% percentile within the input frame. Expressed in
  10107. range of [0-255].
  10108. @item VAVG
  10109. Display the average V value within the input frame. Expressed in range of
  10110. [0-255].
  10111. @item VHIGH
  10112. Display the V value at the 90% percentile within the input frame. Expressed in
  10113. range of [0-255].
  10114. @item VMAX
  10115. Display the maximum V value contained within the input frame. Expressed in
  10116. range of [0-255].
  10117. @item SATMIN
  10118. Display the minimal saturation value contained within the input frame.
  10119. Expressed in range of [0-~181.02].
  10120. @item SATLOW
  10121. Display the saturation value at the 10% percentile within the input frame.
  10122. Expressed in range of [0-~181.02].
  10123. @item SATAVG
  10124. Display the average saturation value within the input frame. Expressed in range
  10125. of [0-~181.02].
  10126. @item SATHIGH
  10127. Display the saturation value at the 90% percentile within the input frame.
  10128. Expressed in range of [0-~181.02].
  10129. @item SATMAX
  10130. Display the maximum saturation value contained within the input frame.
  10131. Expressed in range of [0-~181.02].
  10132. @item HUEMED
  10133. Display the median value for hue within the input frame. Expressed in range of
  10134. [0-360].
  10135. @item HUEAVG
  10136. Display the average value for hue within the input frame. Expressed in range of
  10137. [0-360].
  10138. @item YDIF
  10139. Display the average of sample value difference between all values of the Y
  10140. plane in the current frame and corresponding values of the previous input frame.
  10141. Expressed in range of [0-255].
  10142. @item UDIF
  10143. Display the average of sample value difference between all values of the U
  10144. plane in the current frame and corresponding values of the previous input frame.
  10145. Expressed in range of [0-255].
  10146. @item VDIF
  10147. Display the average of sample value difference between all values of the V
  10148. plane in the current frame and corresponding values of the previous input frame.
  10149. Expressed in range of [0-255].
  10150. @item YBITDEPTH
  10151. Display bit depth of Y plane in current frame.
  10152. Expressed in range of [0-16].
  10153. @item UBITDEPTH
  10154. Display bit depth of U plane in current frame.
  10155. Expressed in range of [0-16].
  10156. @item VBITDEPTH
  10157. Display bit depth of V plane in current frame.
  10158. Expressed in range of [0-16].
  10159. @end table
  10160. The filter accepts the following options:
  10161. @table @option
  10162. @item stat
  10163. @item out
  10164. @option{stat} specify an additional form of image analysis.
  10165. @option{out} output video with the specified type of pixel highlighted.
  10166. Both options accept the following values:
  10167. @table @samp
  10168. @item tout
  10169. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10170. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10171. include the results of video dropouts, head clogs, or tape tracking issues.
  10172. @item vrep
  10173. Identify @var{vertical line repetition}. Vertical line repetition includes
  10174. similar rows of pixels within a frame. In born-digital video vertical line
  10175. repetition is common, but this pattern is uncommon in video digitized from an
  10176. analog source. When it occurs in video that results from the digitization of an
  10177. analog source it can indicate concealment from a dropout compensator.
  10178. @item brng
  10179. Identify pixels that fall outside of legal broadcast range.
  10180. @end table
  10181. @item color, c
  10182. Set the highlight color for the @option{out} option. The default color is
  10183. yellow.
  10184. @end table
  10185. @subsection Examples
  10186. @itemize
  10187. @item
  10188. Output data of various video metrics:
  10189. @example
  10190. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10191. @end example
  10192. @item
  10193. Output specific data about the minimum and maximum values of the Y plane per frame:
  10194. @example
  10195. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10196. @end example
  10197. @item
  10198. Playback video while highlighting pixels that are outside of broadcast range in red.
  10199. @example
  10200. ffplay example.mov -vf signalstats="out=brng:color=red"
  10201. @end example
  10202. @item
  10203. Playback video with signalstats metadata drawn over the frame.
  10204. @example
  10205. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10206. @end example
  10207. The contents of signalstat_drawtext.txt used in the command are:
  10208. @example
  10209. time %@{pts:hms@}
  10210. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10211. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10212. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10213. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10214. @end example
  10215. @end itemize
  10216. @anchor{signature}
  10217. @section signature
  10218. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10219. input. In this case the matching between the inputs can be calculated additionally.
  10220. The filter always passes through the first input. The signature of each stream can
  10221. be written into a file.
  10222. It accepts the following options:
  10223. @table @option
  10224. @item detectmode
  10225. Enable or disable the matching process.
  10226. Available values are:
  10227. @table @samp
  10228. @item off
  10229. Disable the calculation of a matching (default).
  10230. @item full
  10231. Calculate the matching for the whole video and output whether the whole video
  10232. matches or only parts.
  10233. @item fast
  10234. Calculate only until a matching is found or the video ends. Should be faster in
  10235. some cases.
  10236. @end table
  10237. @item nb_inputs
  10238. Set the number of inputs. The option value must be a non negative integer.
  10239. Default value is 1.
  10240. @item filename
  10241. Set the path to which the output is written. If there is more than one input,
  10242. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10243. integer), that will be replaced with the input number. If no filename is
  10244. specified, no output will be written. This is the default.
  10245. @item format
  10246. Choose the output format.
  10247. Available values are:
  10248. @table @samp
  10249. @item binary
  10250. Use the specified binary representation (default).
  10251. @item xml
  10252. Use the specified xml representation.
  10253. @end table
  10254. @item th_d
  10255. Set threshold to detect one word as similar. The option value must be an integer
  10256. greater than zero. The default value is 9000.
  10257. @item th_dc
  10258. Set threshold to detect all words as similar. The option value must be an integer
  10259. greater than zero. The default value is 60000.
  10260. @item th_xh
  10261. Set threshold to detect frames as similar. The option value must be an integer
  10262. greater than zero. The default value is 116.
  10263. @item th_di
  10264. Set the minimum length of a sequence in frames to recognize it as matching
  10265. sequence. The option value must be a non negative integer value.
  10266. The default value is 0.
  10267. @item th_it
  10268. Set the minimum relation, that matching frames to all frames must have.
  10269. The option value must be a double value between 0 and 1. The default value is 0.5.
  10270. @end table
  10271. @subsection Examples
  10272. @itemize
  10273. @item
  10274. To calculate the signature of an input video and store it in signature.bin:
  10275. @example
  10276. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10277. @end example
  10278. @item
  10279. To detect whether two videos match and store the signatures in XML format in
  10280. signature0.xml and signature1.xml:
  10281. @example
  10282. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10283. @end example
  10284. @end itemize
  10285. @anchor{smartblur}
  10286. @section smartblur
  10287. Blur the input video without impacting the outlines.
  10288. It accepts the following options:
  10289. @table @option
  10290. @item luma_radius, lr
  10291. Set the luma radius. The option value must be a float number in
  10292. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10293. used to blur the image (slower if larger). Default value is 1.0.
  10294. @item luma_strength, ls
  10295. Set the luma strength. The option value must be a float number
  10296. in the range [-1.0,1.0] that configures the blurring. A value included
  10297. in [0.0,1.0] will blur the image whereas a value included in
  10298. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10299. @item luma_threshold, lt
  10300. Set the luma threshold used as a coefficient to determine
  10301. whether a pixel should be blurred or not. The option value must be an
  10302. integer in the range [-30,30]. A value of 0 will filter all the image,
  10303. a value included in [0,30] will filter flat areas and a value included
  10304. in [-30,0] will filter edges. Default value is 0.
  10305. @item chroma_radius, cr
  10306. Set the chroma radius. The option value must be a float number in
  10307. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10308. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10309. @item chroma_strength, cs
  10310. Set the chroma strength. The option value must be a float number
  10311. in the range [-1.0,1.0] that configures the blurring. A value included
  10312. in [0.0,1.0] will blur the image whereas a value included in
  10313. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10314. @item chroma_threshold, ct
  10315. Set the chroma threshold used as a coefficient to determine
  10316. whether a pixel should be blurred or not. The option value must be an
  10317. integer in the range [-30,30]. A value of 0 will filter all the image,
  10318. a value included in [0,30] will filter flat areas and a value included
  10319. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10320. @end table
  10321. If a chroma option is not explicitly set, the corresponding luma value
  10322. is set.
  10323. @section ssim
  10324. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10325. This filter takes in input two input videos, the first input is
  10326. considered the "main" source and is passed unchanged to the
  10327. output. The second input is used as a "reference" video for computing
  10328. the SSIM.
  10329. Both video inputs must have the same resolution and pixel format for
  10330. this filter to work correctly. Also it assumes that both inputs
  10331. have the same number of frames, which are compared one by one.
  10332. The filter stores the calculated SSIM of each frame.
  10333. The description of the accepted parameters follows.
  10334. @table @option
  10335. @item stats_file, f
  10336. If specified the filter will use the named file to save the SSIM of
  10337. each individual frame. When filename equals "-" the data is sent to
  10338. standard output.
  10339. @end table
  10340. The file printed if @var{stats_file} is selected, contains a sequence of
  10341. key/value pairs of the form @var{key}:@var{value} for each compared
  10342. couple of frames.
  10343. A description of each shown parameter follows:
  10344. @table @option
  10345. @item n
  10346. sequential number of the input frame, starting from 1
  10347. @item Y, U, V, R, G, B
  10348. SSIM of the compared frames for the component specified by the suffix.
  10349. @item All
  10350. SSIM of the compared frames for the whole frame.
  10351. @item dB
  10352. Same as above but in dB representation.
  10353. @end table
  10354. For example:
  10355. @example
  10356. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10357. [main][ref] ssim="stats_file=stats.log" [out]
  10358. @end example
  10359. On this example the input file being processed is compared with the
  10360. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10361. is stored in @file{stats.log}.
  10362. Another example with both psnr and ssim at same time:
  10363. @example
  10364. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10365. @end example
  10366. @section stereo3d
  10367. Convert between different stereoscopic image formats.
  10368. The filters accept the following options:
  10369. @table @option
  10370. @item in
  10371. Set stereoscopic image format of input.
  10372. Available values for input image formats are:
  10373. @table @samp
  10374. @item sbsl
  10375. side by side parallel (left eye left, right eye right)
  10376. @item sbsr
  10377. side by side crosseye (right eye left, left eye right)
  10378. @item sbs2l
  10379. side by side parallel with half width resolution
  10380. (left eye left, right eye right)
  10381. @item sbs2r
  10382. side by side crosseye with half width resolution
  10383. (right eye left, left eye right)
  10384. @item abl
  10385. above-below (left eye above, right eye below)
  10386. @item abr
  10387. above-below (right eye above, left eye below)
  10388. @item ab2l
  10389. above-below with half height resolution
  10390. (left eye above, right eye below)
  10391. @item ab2r
  10392. above-below with half height resolution
  10393. (right eye above, left eye below)
  10394. @item al
  10395. alternating frames (left eye first, right eye second)
  10396. @item ar
  10397. alternating frames (right eye first, left eye second)
  10398. @item irl
  10399. interleaved rows (left eye has top row, right eye starts on next row)
  10400. @item irr
  10401. interleaved rows (right eye has top row, left eye starts on next row)
  10402. @item icl
  10403. interleaved columns, left eye first
  10404. @item icr
  10405. interleaved columns, right eye first
  10406. Default value is @samp{sbsl}.
  10407. @end table
  10408. @item out
  10409. Set stereoscopic image format of output.
  10410. @table @samp
  10411. @item sbsl
  10412. side by side parallel (left eye left, right eye right)
  10413. @item sbsr
  10414. side by side crosseye (right eye left, left eye right)
  10415. @item sbs2l
  10416. side by side parallel with half width resolution
  10417. (left eye left, right eye right)
  10418. @item sbs2r
  10419. side by side crosseye with half width resolution
  10420. (right eye left, left eye right)
  10421. @item abl
  10422. above-below (left eye above, right eye below)
  10423. @item abr
  10424. above-below (right eye above, left eye below)
  10425. @item ab2l
  10426. above-below with half height resolution
  10427. (left eye above, right eye below)
  10428. @item ab2r
  10429. above-below with half height resolution
  10430. (right eye above, left eye below)
  10431. @item al
  10432. alternating frames (left eye first, right eye second)
  10433. @item ar
  10434. alternating frames (right eye first, left eye second)
  10435. @item irl
  10436. interleaved rows (left eye has top row, right eye starts on next row)
  10437. @item irr
  10438. interleaved rows (right eye has top row, left eye starts on next row)
  10439. @item arbg
  10440. anaglyph red/blue gray
  10441. (red filter on left eye, blue filter on right eye)
  10442. @item argg
  10443. anaglyph red/green gray
  10444. (red filter on left eye, green filter on right eye)
  10445. @item arcg
  10446. anaglyph red/cyan gray
  10447. (red filter on left eye, cyan filter on right eye)
  10448. @item arch
  10449. anaglyph red/cyan half colored
  10450. (red filter on left eye, cyan filter on right eye)
  10451. @item arcc
  10452. anaglyph red/cyan color
  10453. (red filter on left eye, cyan filter on right eye)
  10454. @item arcd
  10455. anaglyph red/cyan color optimized with the least squares projection of dubois
  10456. (red filter on left eye, cyan filter on right eye)
  10457. @item agmg
  10458. anaglyph green/magenta gray
  10459. (green filter on left eye, magenta filter on right eye)
  10460. @item agmh
  10461. anaglyph green/magenta half colored
  10462. (green filter on left eye, magenta filter on right eye)
  10463. @item agmc
  10464. anaglyph green/magenta colored
  10465. (green filter on left eye, magenta filter on right eye)
  10466. @item agmd
  10467. anaglyph green/magenta color optimized with the least squares projection of dubois
  10468. (green filter on left eye, magenta filter on right eye)
  10469. @item aybg
  10470. anaglyph yellow/blue gray
  10471. (yellow filter on left eye, blue filter on right eye)
  10472. @item aybh
  10473. anaglyph yellow/blue half colored
  10474. (yellow filter on left eye, blue filter on right eye)
  10475. @item aybc
  10476. anaglyph yellow/blue colored
  10477. (yellow filter on left eye, blue filter on right eye)
  10478. @item aybd
  10479. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10480. (yellow filter on left eye, blue filter on right eye)
  10481. @item ml
  10482. mono output (left eye only)
  10483. @item mr
  10484. mono output (right eye only)
  10485. @item chl
  10486. checkerboard, left eye first
  10487. @item chr
  10488. checkerboard, right eye first
  10489. @item icl
  10490. interleaved columns, left eye first
  10491. @item icr
  10492. interleaved columns, right eye first
  10493. @item hdmi
  10494. HDMI frame pack
  10495. @end table
  10496. Default value is @samp{arcd}.
  10497. @end table
  10498. @subsection Examples
  10499. @itemize
  10500. @item
  10501. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10502. @example
  10503. stereo3d=sbsl:aybd
  10504. @end example
  10505. @item
  10506. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10507. @example
  10508. stereo3d=abl:sbsr
  10509. @end example
  10510. @end itemize
  10511. @section streamselect, astreamselect
  10512. Select video or audio streams.
  10513. The filter accepts the following options:
  10514. @table @option
  10515. @item inputs
  10516. Set number of inputs. Default is 2.
  10517. @item map
  10518. Set input indexes to remap to outputs.
  10519. @end table
  10520. @subsection Commands
  10521. The @code{streamselect} and @code{astreamselect} filter supports the following
  10522. commands:
  10523. @table @option
  10524. @item map
  10525. Set input indexes to remap to outputs.
  10526. @end table
  10527. @subsection Examples
  10528. @itemize
  10529. @item
  10530. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10531. @example
  10532. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10533. @end example
  10534. @item
  10535. Same as above, but for audio:
  10536. @example
  10537. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10538. @end example
  10539. @end itemize
  10540. @section sobel
  10541. Apply sobel operator to input video stream.
  10542. The filter accepts the following option:
  10543. @table @option
  10544. @item planes
  10545. Set which planes will be processed, unprocessed planes will be copied.
  10546. By default value 0xf, all planes will be processed.
  10547. @item scale
  10548. Set value which will be multiplied with filtered result.
  10549. @item delta
  10550. Set value which will be added to filtered result.
  10551. @end table
  10552. @anchor{spp}
  10553. @section spp
  10554. Apply a simple postprocessing filter that compresses and decompresses the image
  10555. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10556. and average the results.
  10557. The filter accepts the following options:
  10558. @table @option
  10559. @item quality
  10560. Set quality. This option defines the number of levels for averaging. It accepts
  10561. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10562. effect. A value of @code{6} means the higher quality. For each increment of
  10563. that value the speed drops by a factor of approximately 2. Default value is
  10564. @code{3}.
  10565. @item qp
  10566. Force a constant quantization parameter. If not set, the filter will use the QP
  10567. from the video stream (if available).
  10568. @item mode
  10569. Set thresholding mode. Available modes are:
  10570. @table @samp
  10571. @item hard
  10572. Set hard thresholding (default).
  10573. @item soft
  10574. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10575. @end table
  10576. @item use_bframe_qp
  10577. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10578. option may cause flicker since the B-Frames have often larger QP. Default is
  10579. @code{0} (not enabled).
  10580. @end table
  10581. @anchor{subtitles}
  10582. @section subtitles
  10583. Draw subtitles on top of input video using the libass library.
  10584. To enable compilation of this filter you need to configure FFmpeg with
  10585. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10586. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10587. Alpha) subtitles format.
  10588. The filter accepts the following options:
  10589. @table @option
  10590. @item filename, f
  10591. Set the filename of the subtitle file to read. It must be specified.
  10592. @item original_size
  10593. Specify the size of the original video, the video for which the ASS file
  10594. was composed. For the syntax of this option, check the
  10595. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10596. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10597. correctly scale the fonts if the aspect ratio has been changed.
  10598. @item fontsdir
  10599. Set a directory path containing fonts that can be used by the filter.
  10600. These fonts will be used in addition to whatever the font provider uses.
  10601. @item charenc
  10602. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10603. useful if not UTF-8.
  10604. @item stream_index, si
  10605. Set subtitles stream index. @code{subtitles} filter only.
  10606. @item force_style
  10607. Override default style or script info parameters of the subtitles. It accepts a
  10608. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10609. @end table
  10610. If the first key is not specified, it is assumed that the first value
  10611. specifies the @option{filename}.
  10612. For example, to render the file @file{sub.srt} on top of the input
  10613. video, use the command:
  10614. @example
  10615. subtitles=sub.srt
  10616. @end example
  10617. which is equivalent to:
  10618. @example
  10619. subtitles=filename=sub.srt
  10620. @end example
  10621. To render the default subtitles stream from file @file{video.mkv}, use:
  10622. @example
  10623. subtitles=video.mkv
  10624. @end example
  10625. To render the second subtitles stream from that file, use:
  10626. @example
  10627. subtitles=video.mkv:si=1
  10628. @end example
  10629. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10630. @code{DejaVu Serif}, use:
  10631. @example
  10632. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10633. @end example
  10634. @section super2xsai
  10635. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10636. Interpolate) pixel art scaling algorithm.
  10637. Useful for enlarging pixel art images without reducing sharpness.
  10638. @section swaprect
  10639. Swap two rectangular objects in video.
  10640. This filter accepts the following options:
  10641. @table @option
  10642. @item w
  10643. Set object width.
  10644. @item h
  10645. Set object height.
  10646. @item x1
  10647. Set 1st rect x coordinate.
  10648. @item y1
  10649. Set 1st rect y coordinate.
  10650. @item x2
  10651. Set 2nd rect x coordinate.
  10652. @item y2
  10653. Set 2nd rect y coordinate.
  10654. All expressions are evaluated once for each frame.
  10655. @end table
  10656. The all options are expressions containing the following constants:
  10657. @table @option
  10658. @item w
  10659. @item h
  10660. The input width and height.
  10661. @item a
  10662. same as @var{w} / @var{h}
  10663. @item sar
  10664. input sample aspect ratio
  10665. @item dar
  10666. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10667. @item n
  10668. The number of the input frame, starting from 0.
  10669. @item t
  10670. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10671. @item pos
  10672. the position in the file of the input frame, NAN if unknown
  10673. @end table
  10674. @section swapuv
  10675. Swap U & V plane.
  10676. @section telecine
  10677. Apply telecine process to the video.
  10678. This filter accepts the following options:
  10679. @table @option
  10680. @item first_field
  10681. @table @samp
  10682. @item top, t
  10683. top field first
  10684. @item bottom, b
  10685. bottom field first
  10686. The default value is @code{top}.
  10687. @end table
  10688. @item pattern
  10689. A string of numbers representing the pulldown pattern you wish to apply.
  10690. The default value is @code{23}.
  10691. @end table
  10692. @example
  10693. Some typical patterns:
  10694. NTSC output (30i):
  10695. 27.5p: 32222
  10696. 24p: 23 (classic)
  10697. 24p: 2332 (preferred)
  10698. 20p: 33
  10699. 18p: 334
  10700. 16p: 3444
  10701. PAL output (25i):
  10702. 27.5p: 12222
  10703. 24p: 222222222223 ("Euro pulldown")
  10704. 16.67p: 33
  10705. 16p: 33333334
  10706. @end example
  10707. @section threshold
  10708. Apply threshold effect to video stream.
  10709. This filter needs four video streams to perform thresholding.
  10710. First stream is stream we are filtering.
  10711. Second stream is holding threshold values, third stream is holding min values,
  10712. and last, fourth stream is holding max values.
  10713. The filter accepts the following option:
  10714. @table @option
  10715. @item planes
  10716. Set which planes will be processed, unprocessed planes will be copied.
  10717. By default value 0xf, all planes will be processed.
  10718. @end table
  10719. For example if first stream pixel's component value is less then threshold value
  10720. of pixel component from 2nd threshold stream, third stream value will picked,
  10721. otherwise fourth stream pixel component value will be picked.
  10722. Using color source filter one can perform various types of thresholding:
  10723. @subsection Examples
  10724. @itemize
  10725. @item
  10726. Binary threshold, using gray color as threshold:
  10727. @example
  10728. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10729. @end example
  10730. @item
  10731. Inverted binary threshold, using gray color as threshold:
  10732. @example
  10733. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10734. @end example
  10735. @item
  10736. Truncate binary threshold, using gray color as threshold:
  10737. @example
  10738. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10739. @end example
  10740. @item
  10741. Threshold to zero, using gray color as threshold:
  10742. @example
  10743. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10744. @end example
  10745. @item
  10746. Inverted threshold to zero, using gray color as threshold:
  10747. @example
  10748. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10749. @end example
  10750. @end itemize
  10751. @section thumbnail
  10752. Select the most representative frame in a given sequence of consecutive frames.
  10753. The filter accepts the following options:
  10754. @table @option
  10755. @item n
  10756. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10757. will pick one of them, and then handle the next batch of @var{n} frames until
  10758. the end. Default is @code{100}.
  10759. @end table
  10760. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10761. value will result in a higher memory usage, so a high value is not recommended.
  10762. @subsection Examples
  10763. @itemize
  10764. @item
  10765. Extract one picture each 50 frames:
  10766. @example
  10767. thumbnail=50
  10768. @end example
  10769. @item
  10770. Complete example of a thumbnail creation with @command{ffmpeg}:
  10771. @example
  10772. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10773. @end example
  10774. @end itemize
  10775. @section tile
  10776. Tile several successive frames together.
  10777. The filter accepts the following options:
  10778. @table @option
  10779. @item layout
  10780. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10781. this option, check the
  10782. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10783. @item nb_frames
  10784. Set the maximum number of frames to render in the given area. It must be less
  10785. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10786. the area will be used.
  10787. @item margin
  10788. Set the outer border margin in pixels.
  10789. @item padding
  10790. Set the inner border thickness (i.e. the number of pixels between frames). For
  10791. more advanced padding options (such as having different values for the edges),
  10792. refer to the pad video filter.
  10793. @item color
  10794. Specify the color of the unused area. For the syntax of this option, check the
  10795. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10796. is "black".
  10797. @end table
  10798. @subsection Examples
  10799. @itemize
  10800. @item
  10801. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10802. @example
  10803. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10804. @end example
  10805. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10806. duplicating each output frame to accommodate the originally detected frame
  10807. rate.
  10808. @item
  10809. Display @code{5} pictures in an area of @code{3x2} frames,
  10810. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10811. mixed flat and named options:
  10812. @example
  10813. tile=3x2:nb_frames=5:padding=7:margin=2
  10814. @end example
  10815. @end itemize
  10816. @section tinterlace
  10817. Perform various types of temporal field interlacing.
  10818. Frames are counted starting from 1, so the first input frame is
  10819. considered odd.
  10820. The filter accepts the following options:
  10821. @table @option
  10822. @item mode
  10823. Specify the mode of the interlacing. This option can also be specified
  10824. as a value alone. See below for a list of values for this option.
  10825. Available values are:
  10826. @table @samp
  10827. @item merge, 0
  10828. Move odd frames into the upper field, even into the lower field,
  10829. generating a double height frame at half frame rate.
  10830. @example
  10831. ------> time
  10832. Input:
  10833. Frame 1 Frame 2 Frame 3 Frame 4
  10834. 11111 22222 33333 44444
  10835. 11111 22222 33333 44444
  10836. 11111 22222 33333 44444
  10837. 11111 22222 33333 44444
  10838. Output:
  10839. 11111 33333
  10840. 22222 44444
  10841. 11111 33333
  10842. 22222 44444
  10843. 11111 33333
  10844. 22222 44444
  10845. 11111 33333
  10846. 22222 44444
  10847. @end example
  10848. @item drop_even, 1
  10849. Only output odd frames, even frames are dropped, generating a frame with
  10850. unchanged height at half frame rate.
  10851. @example
  10852. ------> time
  10853. Input:
  10854. Frame 1 Frame 2 Frame 3 Frame 4
  10855. 11111 22222 33333 44444
  10856. 11111 22222 33333 44444
  10857. 11111 22222 33333 44444
  10858. 11111 22222 33333 44444
  10859. Output:
  10860. 11111 33333
  10861. 11111 33333
  10862. 11111 33333
  10863. 11111 33333
  10864. @end example
  10865. @item drop_odd, 2
  10866. Only output even frames, odd frames are dropped, generating a frame with
  10867. unchanged height at half frame rate.
  10868. @example
  10869. ------> time
  10870. Input:
  10871. Frame 1 Frame 2 Frame 3 Frame 4
  10872. 11111 22222 33333 44444
  10873. 11111 22222 33333 44444
  10874. 11111 22222 33333 44444
  10875. 11111 22222 33333 44444
  10876. Output:
  10877. 22222 44444
  10878. 22222 44444
  10879. 22222 44444
  10880. 22222 44444
  10881. @end example
  10882. @item pad, 3
  10883. Expand each frame to full height, but pad alternate lines with black,
  10884. generating a frame with double height at the same input frame rate.
  10885. @example
  10886. ------> time
  10887. Input:
  10888. Frame 1 Frame 2 Frame 3 Frame 4
  10889. 11111 22222 33333 44444
  10890. 11111 22222 33333 44444
  10891. 11111 22222 33333 44444
  10892. 11111 22222 33333 44444
  10893. Output:
  10894. 11111 ..... 33333 .....
  10895. ..... 22222 ..... 44444
  10896. 11111 ..... 33333 .....
  10897. ..... 22222 ..... 44444
  10898. 11111 ..... 33333 .....
  10899. ..... 22222 ..... 44444
  10900. 11111 ..... 33333 .....
  10901. ..... 22222 ..... 44444
  10902. @end example
  10903. @item interleave_top, 4
  10904. Interleave the upper field from odd frames with the lower field from
  10905. even frames, generating a frame with unchanged height at half frame rate.
  10906. @example
  10907. ------> time
  10908. Input:
  10909. Frame 1 Frame 2 Frame 3 Frame 4
  10910. 11111<- 22222 33333<- 44444
  10911. 11111 22222<- 33333 44444<-
  10912. 11111<- 22222 33333<- 44444
  10913. 11111 22222<- 33333 44444<-
  10914. Output:
  10915. 11111 33333
  10916. 22222 44444
  10917. 11111 33333
  10918. 22222 44444
  10919. @end example
  10920. @item interleave_bottom, 5
  10921. Interleave the lower field from odd frames with the upper field from
  10922. even frames, generating a frame with unchanged height at half frame rate.
  10923. @example
  10924. ------> time
  10925. Input:
  10926. Frame 1 Frame 2 Frame 3 Frame 4
  10927. 11111 22222<- 33333 44444<-
  10928. 11111<- 22222 33333<- 44444
  10929. 11111 22222<- 33333 44444<-
  10930. 11111<- 22222 33333<- 44444
  10931. Output:
  10932. 22222 44444
  10933. 11111 33333
  10934. 22222 44444
  10935. 11111 33333
  10936. @end example
  10937. @item interlacex2, 6
  10938. Double frame rate with unchanged height. Frames are inserted each
  10939. containing the second temporal field from the previous input frame and
  10940. the first temporal field from the next input frame. This mode relies on
  10941. the top_field_first flag. Useful for interlaced video displays with no
  10942. field synchronisation.
  10943. @example
  10944. ------> time
  10945. Input:
  10946. Frame 1 Frame 2 Frame 3 Frame 4
  10947. 11111 22222 33333 44444
  10948. 11111 22222 33333 44444
  10949. 11111 22222 33333 44444
  10950. 11111 22222 33333 44444
  10951. Output:
  10952. 11111 22222 22222 33333 33333 44444 44444
  10953. 11111 11111 22222 22222 33333 33333 44444
  10954. 11111 22222 22222 33333 33333 44444 44444
  10955. 11111 11111 22222 22222 33333 33333 44444
  10956. @end example
  10957. @item mergex2, 7
  10958. Move odd frames into the upper field, even into the lower field,
  10959. generating a double height frame at same frame rate.
  10960. @example
  10961. ------> time
  10962. Input:
  10963. Frame 1 Frame 2 Frame 3 Frame 4
  10964. 11111 22222 33333 44444
  10965. 11111 22222 33333 44444
  10966. 11111 22222 33333 44444
  10967. 11111 22222 33333 44444
  10968. Output:
  10969. 11111 33333 33333 55555
  10970. 22222 22222 44444 44444
  10971. 11111 33333 33333 55555
  10972. 22222 22222 44444 44444
  10973. 11111 33333 33333 55555
  10974. 22222 22222 44444 44444
  10975. 11111 33333 33333 55555
  10976. 22222 22222 44444 44444
  10977. @end example
  10978. @end table
  10979. Numeric values are deprecated but are accepted for backward
  10980. compatibility reasons.
  10981. Default mode is @code{merge}.
  10982. @item flags
  10983. Specify flags influencing the filter process.
  10984. Available value for @var{flags} is:
  10985. @table @option
  10986. @item low_pass_filter, vlfp
  10987. Enable linear vertical low-pass filtering in the filter.
  10988. Vertical low-pass filtering is required when creating an interlaced
  10989. destination from a progressive source which contains high-frequency
  10990. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10991. patterning.
  10992. @item complex_filter, cvlfp
  10993. Enable complex vertical low-pass filtering.
  10994. This will slightly less reduce interlace 'twitter' and Moire
  10995. patterning but better retain detail and subjective sharpness impression.
  10996. @end table
  10997. Vertical low-pass filtering can only be enabled for @option{mode}
  10998. @var{interleave_top} and @var{interleave_bottom}.
  10999. @end table
  11000. @section transpose
  11001. Transpose rows with columns in the input video and optionally flip it.
  11002. It accepts the following parameters:
  11003. @table @option
  11004. @item dir
  11005. Specify the transposition direction.
  11006. Can assume the following values:
  11007. @table @samp
  11008. @item 0, 4, cclock_flip
  11009. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11010. @example
  11011. L.R L.l
  11012. . . -> . .
  11013. l.r R.r
  11014. @end example
  11015. @item 1, 5, clock
  11016. Rotate by 90 degrees clockwise, that is:
  11017. @example
  11018. L.R l.L
  11019. . . -> . .
  11020. l.r r.R
  11021. @end example
  11022. @item 2, 6, cclock
  11023. Rotate by 90 degrees counterclockwise, that is:
  11024. @example
  11025. L.R R.r
  11026. . . -> . .
  11027. l.r L.l
  11028. @end example
  11029. @item 3, 7, clock_flip
  11030. Rotate by 90 degrees clockwise and vertically flip, that is:
  11031. @example
  11032. L.R r.R
  11033. . . -> . .
  11034. l.r l.L
  11035. @end example
  11036. @end table
  11037. For values between 4-7, the transposition is only done if the input
  11038. video geometry is portrait and not landscape. These values are
  11039. deprecated, the @code{passthrough} option should be used instead.
  11040. Numerical values are deprecated, and should be dropped in favor of
  11041. symbolic constants.
  11042. @item passthrough
  11043. Do not apply the transposition if the input geometry matches the one
  11044. specified by the specified value. It accepts the following values:
  11045. @table @samp
  11046. @item none
  11047. Always apply transposition.
  11048. @item portrait
  11049. Preserve portrait geometry (when @var{height} >= @var{width}).
  11050. @item landscape
  11051. Preserve landscape geometry (when @var{width} >= @var{height}).
  11052. @end table
  11053. Default value is @code{none}.
  11054. @end table
  11055. For example to rotate by 90 degrees clockwise and preserve portrait
  11056. layout:
  11057. @example
  11058. transpose=dir=1:passthrough=portrait
  11059. @end example
  11060. The command above can also be specified as:
  11061. @example
  11062. transpose=1:portrait
  11063. @end example
  11064. @section trim
  11065. Trim the input so that the output contains one continuous subpart of the input.
  11066. It accepts the following parameters:
  11067. @table @option
  11068. @item start
  11069. Specify the time of the start of the kept section, i.e. the frame with the
  11070. timestamp @var{start} will be the first frame in the output.
  11071. @item end
  11072. Specify the time of the first frame that will be dropped, i.e. the frame
  11073. immediately preceding the one with the timestamp @var{end} will be the last
  11074. frame in the output.
  11075. @item start_pts
  11076. This is the same as @var{start}, except this option sets the start timestamp
  11077. in timebase units instead of seconds.
  11078. @item end_pts
  11079. This is the same as @var{end}, except this option sets the end timestamp
  11080. in timebase units instead of seconds.
  11081. @item duration
  11082. The maximum duration of the output in seconds.
  11083. @item start_frame
  11084. The number of the first frame that should be passed to the output.
  11085. @item end_frame
  11086. The number of the first frame that should be dropped.
  11087. @end table
  11088. @option{start}, @option{end}, and @option{duration} are expressed as time
  11089. duration specifications; see
  11090. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11091. for the accepted syntax.
  11092. Note that the first two sets of the start/end options and the @option{duration}
  11093. option look at the frame timestamp, while the _frame variants simply count the
  11094. frames that pass through the filter. Also note that this filter does not modify
  11095. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11096. setpts filter after the trim filter.
  11097. If multiple start or end options are set, this filter tries to be greedy and
  11098. keep all the frames that match at least one of the specified constraints. To keep
  11099. only the part that matches all the constraints at once, chain multiple trim
  11100. filters.
  11101. The defaults are such that all the input is kept. So it is possible to set e.g.
  11102. just the end values to keep everything before the specified time.
  11103. Examples:
  11104. @itemize
  11105. @item
  11106. Drop everything except the second minute of input:
  11107. @example
  11108. ffmpeg -i INPUT -vf trim=60:120
  11109. @end example
  11110. @item
  11111. Keep only the first second:
  11112. @example
  11113. ffmpeg -i INPUT -vf trim=duration=1
  11114. @end example
  11115. @end itemize
  11116. @anchor{unsharp}
  11117. @section unsharp
  11118. Sharpen or blur the input video.
  11119. It accepts the following parameters:
  11120. @table @option
  11121. @item luma_msize_x, lx
  11122. Set the luma matrix horizontal size. It must be an odd integer between
  11123. 3 and 23. The default value is 5.
  11124. @item luma_msize_y, ly
  11125. Set the luma matrix vertical size. It must be an odd integer between 3
  11126. and 23. The default value is 5.
  11127. @item luma_amount, la
  11128. Set the luma effect strength. It must be a floating point number, reasonable
  11129. values lay between -1.5 and 1.5.
  11130. Negative values will blur the input video, while positive values will
  11131. sharpen it, a value of zero will disable the effect.
  11132. Default value is 1.0.
  11133. @item chroma_msize_x, cx
  11134. Set the chroma matrix horizontal size. It must be an odd integer
  11135. between 3 and 23. The default value is 5.
  11136. @item chroma_msize_y, cy
  11137. Set the chroma matrix vertical size. It must be an odd integer
  11138. between 3 and 23. The default value is 5.
  11139. @item chroma_amount, ca
  11140. Set the chroma effect strength. It must be a floating point number, reasonable
  11141. values lay between -1.5 and 1.5.
  11142. Negative values will blur the input video, while positive values will
  11143. sharpen it, a value of zero will disable the effect.
  11144. Default value is 0.0.
  11145. @item opencl
  11146. If set to 1, specify using OpenCL capabilities, only available if
  11147. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11148. @end table
  11149. All parameters are optional and default to the equivalent of the
  11150. string '5:5:1.0:5:5:0.0'.
  11151. @subsection Examples
  11152. @itemize
  11153. @item
  11154. Apply strong luma sharpen effect:
  11155. @example
  11156. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11157. @end example
  11158. @item
  11159. Apply a strong blur of both luma and chroma parameters:
  11160. @example
  11161. unsharp=7:7:-2:7:7:-2
  11162. @end example
  11163. @end itemize
  11164. @section uspp
  11165. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11166. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11167. shifts and average the results.
  11168. The way this differs from the behavior of spp is that uspp actually encodes &
  11169. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11170. DCT similar to MJPEG.
  11171. The filter accepts the following options:
  11172. @table @option
  11173. @item quality
  11174. Set quality. This option defines the number of levels for averaging. It accepts
  11175. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11176. effect. A value of @code{8} means the higher quality. For each increment of
  11177. that value the speed drops by a factor of approximately 2. Default value is
  11178. @code{3}.
  11179. @item qp
  11180. Force a constant quantization parameter. If not set, the filter will use the QP
  11181. from the video stream (if available).
  11182. @end table
  11183. @section vaguedenoiser
  11184. Apply a wavelet based denoiser.
  11185. It transforms each frame from the video input into the wavelet domain,
  11186. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11187. the obtained coefficients. It does an inverse wavelet transform after.
  11188. Due to wavelet properties, it should give a nice smoothed result, and
  11189. reduced noise, without blurring picture features.
  11190. This filter accepts the following options:
  11191. @table @option
  11192. @item threshold
  11193. The filtering strength. The higher, the more filtered the video will be.
  11194. Hard thresholding can use a higher threshold than soft thresholding
  11195. before the video looks overfiltered.
  11196. @item method
  11197. The filtering method the filter will use.
  11198. It accepts the following values:
  11199. @table @samp
  11200. @item hard
  11201. All values under the threshold will be zeroed.
  11202. @item soft
  11203. All values under the threshold will be zeroed. All values above will be
  11204. reduced by the threshold.
  11205. @item garrote
  11206. Scales or nullifies coefficients - intermediary between (more) soft and
  11207. (less) hard thresholding.
  11208. @end table
  11209. @item nsteps
  11210. Number of times, the wavelet will decompose the picture. Picture can't
  11211. be decomposed beyond a particular point (typically, 8 for a 640x480
  11212. frame - as 2^9 = 512 > 480)
  11213. @item percent
  11214. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11215. @item planes
  11216. A list of the planes to process. By default all planes are processed.
  11217. @end table
  11218. @section vectorscope
  11219. Display 2 color component values in the two dimensional graph (which is called
  11220. a vectorscope).
  11221. This filter accepts the following options:
  11222. @table @option
  11223. @item mode, m
  11224. Set vectorscope mode.
  11225. It accepts the following values:
  11226. @table @samp
  11227. @item gray
  11228. Gray values are displayed on graph, higher brightness means more pixels have
  11229. same component color value on location in graph. This is the default mode.
  11230. @item color
  11231. Gray values are displayed on graph. Surrounding pixels values which are not
  11232. present in video frame are drawn in gradient of 2 color components which are
  11233. set by option @code{x} and @code{y}. The 3rd color component is static.
  11234. @item color2
  11235. Actual color components values present in video frame are displayed on graph.
  11236. @item color3
  11237. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11238. on graph increases value of another color component, which is luminance by
  11239. default values of @code{x} and @code{y}.
  11240. @item color4
  11241. Actual colors present in video frame are displayed on graph. If two different
  11242. colors map to same position on graph then color with higher value of component
  11243. not present in graph is picked.
  11244. @item color5
  11245. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11246. component picked from radial gradient.
  11247. @end table
  11248. @item x
  11249. Set which color component will be represented on X-axis. Default is @code{1}.
  11250. @item y
  11251. Set which color component will be represented on Y-axis. Default is @code{2}.
  11252. @item intensity, i
  11253. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11254. of color component which represents frequency of (X, Y) location in graph.
  11255. @item envelope, e
  11256. @table @samp
  11257. @item none
  11258. No envelope, this is default.
  11259. @item instant
  11260. Instant envelope, even darkest single pixel will be clearly highlighted.
  11261. @item peak
  11262. Hold maximum and minimum values presented in graph over time. This way you
  11263. can still spot out of range values without constantly looking at vectorscope.
  11264. @item peak+instant
  11265. Peak and instant envelope combined together.
  11266. @end table
  11267. @item graticule, g
  11268. Set what kind of graticule to draw.
  11269. @table @samp
  11270. @item none
  11271. @item green
  11272. @item color
  11273. @end table
  11274. @item opacity, o
  11275. Set graticule opacity.
  11276. @item flags, f
  11277. Set graticule flags.
  11278. @table @samp
  11279. @item white
  11280. Draw graticule for white point.
  11281. @item black
  11282. Draw graticule for black point.
  11283. @item name
  11284. Draw color points short names.
  11285. @end table
  11286. @item bgopacity, b
  11287. Set background opacity.
  11288. @item lthreshold, l
  11289. Set low threshold for color component not represented on X or Y axis.
  11290. Values lower than this value will be ignored. Default is 0.
  11291. Note this value is multiplied with actual max possible value one pixel component
  11292. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11293. is 0.1 * 255 = 25.
  11294. @item hthreshold, h
  11295. Set high threshold for color component not represented on X or Y axis.
  11296. Values higher than this value will be ignored. Default is 1.
  11297. Note this value is multiplied with actual max possible value one pixel component
  11298. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11299. is 0.9 * 255 = 230.
  11300. @item colorspace, c
  11301. Set what kind of colorspace to use when drawing graticule.
  11302. @table @samp
  11303. @item auto
  11304. @item 601
  11305. @item 709
  11306. @end table
  11307. Default is auto.
  11308. @end table
  11309. @anchor{vidstabdetect}
  11310. @section vidstabdetect
  11311. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11312. @ref{vidstabtransform} for pass 2.
  11313. This filter generates a file with relative translation and rotation
  11314. transform information about subsequent frames, which is then used by
  11315. the @ref{vidstabtransform} filter.
  11316. To enable compilation of this filter you need to configure FFmpeg with
  11317. @code{--enable-libvidstab}.
  11318. This filter accepts the following options:
  11319. @table @option
  11320. @item result
  11321. Set the path to the file used to write the transforms information.
  11322. Default value is @file{transforms.trf}.
  11323. @item shakiness
  11324. Set how shaky the video is and how quick the camera is. It accepts an
  11325. integer in the range 1-10, a value of 1 means little shakiness, a
  11326. value of 10 means strong shakiness. Default value is 5.
  11327. @item accuracy
  11328. Set the accuracy of the detection process. It must be a value in the
  11329. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11330. accuracy. Default value is 15.
  11331. @item stepsize
  11332. Set stepsize of the search process. The region around minimum is
  11333. scanned with 1 pixel resolution. Default value is 6.
  11334. @item mincontrast
  11335. Set minimum contrast. Below this value a local measurement field is
  11336. discarded. Must be a floating point value in the range 0-1. Default
  11337. value is 0.3.
  11338. @item tripod
  11339. Set reference frame number for tripod mode.
  11340. If enabled, the motion of the frames is compared to a reference frame
  11341. in the filtered stream, identified by the specified number. The idea
  11342. is to compensate all movements in a more-or-less static scene and keep
  11343. the camera view absolutely still.
  11344. If set to 0, it is disabled. The frames are counted starting from 1.
  11345. @item show
  11346. Show fields and transforms in the resulting frames. It accepts an
  11347. integer in the range 0-2. Default value is 0, which disables any
  11348. visualization.
  11349. @end table
  11350. @subsection Examples
  11351. @itemize
  11352. @item
  11353. Use default values:
  11354. @example
  11355. vidstabdetect
  11356. @end example
  11357. @item
  11358. Analyze strongly shaky movie and put the results in file
  11359. @file{mytransforms.trf}:
  11360. @example
  11361. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11362. @end example
  11363. @item
  11364. Visualize the result of internal transformations in the resulting
  11365. video:
  11366. @example
  11367. vidstabdetect=show=1
  11368. @end example
  11369. @item
  11370. Analyze a video with medium shakiness using @command{ffmpeg}:
  11371. @example
  11372. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11373. @end example
  11374. @end itemize
  11375. @anchor{vidstabtransform}
  11376. @section vidstabtransform
  11377. Video stabilization/deshaking: pass 2 of 2,
  11378. see @ref{vidstabdetect} for pass 1.
  11379. Read a file with transform information for each frame and
  11380. apply/compensate them. Together with the @ref{vidstabdetect}
  11381. filter this can be used to deshake videos. See also
  11382. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11383. the @ref{unsharp} filter, see below.
  11384. To enable compilation of this filter you need to configure FFmpeg with
  11385. @code{--enable-libvidstab}.
  11386. @subsection Options
  11387. @table @option
  11388. @item input
  11389. Set path to the file used to read the transforms. Default value is
  11390. @file{transforms.trf}.
  11391. @item smoothing
  11392. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11393. camera movements. Default value is 10.
  11394. For example a number of 10 means that 21 frames are used (10 in the
  11395. past and 10 in the future) to smoothen the motion in the video. A
  11396. larger value leads to a smoother video, but limits the acceleration of
  11397. the camera (pan/tilt movements). 0 is a special case where a static
  11398. camera is simulated.
  11399. @item optalgo
  11400. Set the camera path optimization algorithm.
  11401. Accepted values are:
  11402. @table @samp
  11403. @item gauss
  11404. gaussian kernel low-pass filter on camera motion (default)
  11405. @item avg
  11406. averaging on transformations
  11407. @end table
  11408. @item maxshift
  11409. Set maximal number of pixels to translate frames. Default value is -1,
  11410. meaning no limit.
  11411. @item maxangle
  11412. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11413. value is -1, meaning no limit.
  11414. @item crop
  11415. Specify how to deal with borders that may be visible due to movement
  11416. compensation.
  11417. Available values are:
  11418. @table @samp
  11419. @item keep
  11420. keep image information from previous frame (default)
  11421. @item black
  11422. fill the border black
  11423. @end table
  11424. @item invert
  11425. Invert transforms if set to 1. Default value is 0.
  11426. @item relative
  11427. Consider transforms as relative to previous frame if set to 1,
  11428. absolute if set to 0. Default value is 0.
  11429. @item zoom
  11430. Set percentage to zoom. A positive value will result in a zoom-in
  11431. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11432. zoom).
  11433. @item optzoom
  11434. Set optimal zooming to avoid borders.
  11435. Accepted values are:
  11436. @table @samp
  11437. @item 0
  11438. disabled
  11439. @item 1
  11440. optimal static zoom value is determined (only very strong movements
  11441. will lead to visible borders) (default)
  11442. @item 2
  11443. optimal adaptive zoom value is determined (no borders will be
  11444. visible), see @option{zoomspeed}
  11445. @end table
  11446. Note that the value given at zoom is added to the one calculated here.
  11447. @item zoomspeed
  11448. Set percent to zoom maximally each frame (enabled when
  11449. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11450. 0.25.
  11451. @item interpol
  11452. Specify type of interpolation.
  11453. Available values are:
  11454. @table @samp
  11455. @item no
  11456. no interpolation
  11457. @item linear
  11458. linear only horizontal
  11459. @item bilinear
  11460. linear in both directions (default)
  11461. @item bicubic
  11462. cubic in both directions (slow)
  11463. @end table
  11464. @item tripod
  11465. Enable virtual tripod mode if set to 1, which is equivalent to
  11466. @code{relative=0:smoothing=0}. Default value is 0.
  11467. Use also @code{tripod} option of @ref{vidstabdetect}.
  11468. @item debug
  11469. Increase log verbosity if set to 1. Also the detected global motions
  11470. are written to the temporary file @file{global_motions.trf}. Default
  11471. value is 0.
  11472. @end table
  11473. @subsection Examples
  11474. @itemize
  11475. @item
  11476. Use @command{ffmpeg} for a typical stabilization with default values:
  11477. @example
  11478. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11479. @end example
  11480. Note the use of the @ref{unsharp} filter which is always recommended.
  11481. @item
  11482. Zoom in a bit more and load transform data from a given file:
  11483. @example
  11484. vidstabtransform=zoom=5:input="mytransforms.trf"
  11485. @end example
  11486. @item
  11487. Smoothen the video even more:
  11488. @example
  11489. vidstabtransform=smoothing=30
  11490. @end example
  11491. @end itemize
  11492. @section vflip
  11493. Flip the input video vertically.
  11494. For example, to vertically flip a video with @command{ffmpeg}:
  11495. @example
  11496. ffmpeg -i in.avi -vf "vflip" out.avi
  11497. @end example
  11498. @anchor{vignette}
  11499. @section vignette
  11500. Make or reverse a natural vignetting effect.
  11501. The filter accepts the following options:
  11502. @table @option
  11503. @item angle, a
  11504. Set lens angle expression as a number of radians.
  11505. The value is clipped in the @code{[0,PI/2]} range.
  11506. Default value: @code{"PI/5"}
  11507. @item x0
  11508. @item y0
  11509. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11510. by default.
  11511. @item mode
  11512. Set forward/backward mode.
  11513. Available modes are:
  11514. @table @samp
  11515. @item forward
  11516. The larger the distance from the central point, the darker the image becomes.
  11517. @item backward
  11518. The larger the distance from the central point, the brighter the image becomes.
  11519. This can be used to reverse a vignette effect, though there is no automatic
  11520. detection to extract the lens @option{angle} and other settings (yet). It can
  11521. also be used to create a burning effect.
  11522. @end table
  11523. Default value is @samp{forward}.
  11524. @item eval
  11525. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11526. It accepts the following values:
  11527. @table @samp
  11528. @item init
  11529. Evaluate expressions only once during the filter initialization.
  11530. @item frame
  11531. Evaluate expressions for each incoming frame. This is way slower than the
  11532. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11533. allows advanced dynamic expressions.
  11534. @end table
  11535. Default value is @samp{init}.
  11536. @item dither
  11537. Set dithering to reduce the circular banding effects. Default is @code{1}
  11538. (enabled).
  11539. @item aspect
  11540. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11541. Setting this value to the SAR of the input will make a rectangular vignetting
  11542. following the dimensions of the video.
  11543. Default is @code{1/1}.
  11544. @end table
  11545. @subsection Expressions
  11546. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11547. following parameters.
  11548. @table @option
  11549. @item w
  11550. @item h
  11551. input width and height
  11552. @item n
  11553. the number of input frame, starting from 0
  11554. @item pts
  11555. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11556. @var{TB} units, NAN if undefined
  11557. @item r
  11558. frame rate of the input video, NAN if the input frame rate is unknown
  11559. @item t
  11560. the PTS (Presentation TimeStamp) of the filtered video frame,
  11561. expressed in seconds, NAN if undefined
  11562. @item tb
  11563. time base of the input video
  11564. @end table
  11565. @subsection Examples
  11566. @itemize
  11567. @item
  11568. Apply simple strong vignetting effect:
  11569. @example
  11570. vignette=PI/4
  11571. @end example
  11572. @item
  11573. Make a flickering vignetting:
  11574. @example
  11575. vignette='PI/4+random(1)*PI/50':eval=frame
  11576. @end example
  11577. @end itemize
  11578. @section vstack
  11579. Stack input videos vertically.
  11580. All streams must be of same pixel format and of same width.
  11581. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11582. to create same output.
  11583. The filter accept the following option:
  11584. @table @option
  11585. @item inputs
  11586. Set number of input streams. Default is 2.
  11587. @item shortest
  11588. If set to 1, force the output to terminate when the shortest input
  11589. terminates. Default value is 0.
  11590. @end table
  11591. @section w3fdif
  11592. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11593. Deinterlacing Filter").
  11594. Based on the process described by Martin Weston for BBC R&D, and
  11595. implemented based on the de-interlace algorithm written by Jim
  11596. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11597. uses filter coefficients calculated by BBC R&D.
  11598. There are two sets of filter coefficients, so called "simple":
  11599. and "complex". Which set of filter coefficients is used can
  11600. be set by passing an optional parameter:
  11601. @table @option
  11602. @item filter
  11603. Set the interlacing filter coefficients. Accepts one of the following values:
  11604. @table @samp
  11605. @item simple
  11606. Simple filter coefficient set.
  11607. @item complex
  11608. More-complex filter coefficient set.
  11609. @end table
  11610. Default value is @samp{complex}.
  11611. @item deint
  11612. Specify which frames to deinterlace. Accept one of the following values:
  11613. @table @samp
  11614. @item all
  11615. Deinterlace all frames,
  11616. @item interlaced
  11617. Only deinterlace frames marked as interlaced.
  11618. @end table
  11619. Default value is @samp{all}.
  11620. @end table
  11621. @section waveform
  11622. Video waveform monitor.
  11623. The waveform monitor plots color component intensity. By default luminance
  11624. only. Each column of the waveform corresponds to a column of pixels in the
  11625. source video.
  11626. It accepts the following options:
  11627. @table @option
  11628. @item mode, m
  11629. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11630. In row mode, the graph on the left side represents color component value 0 and
  11631. the right side represents value = 255. In column mode, the top side represents
  11632. color component value = 0 and bottom side represents value = 255.
  11633. @item intensity, i
  11634. Set intensity. Smaller values are useful to find out how many values of the same
  11635. luminance are distributed across input rows/columns.
  11636. Default value is @code{0.04}. Allowed range is [0, 1].
  11637. @item mirror, r
  11638. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11639. In mirrored mode, higher values will be represented on the left
  11640. side for @code{row} mode and at the top for @code{column} mode. Default is
  11641. @code{1} (mirrored).
  11642. @item display, d
  11643. Set display mode.
  11644. It accepts the following values:
  11645. @table @samp
  11646. @item overlay
  11647. Presents information identical to that in the @code{parade}, except
  11648. that the graphs representing color components are superimposed directly
  11649. over one another.
  11650. This display mode makes it easier to spot relative differences or similarities
  11651. in overlapping areas of the color components that are supposed to be identical,
  11652. such as neutral whites, grays, or blacks.
  11653. @item stack
  11654. Display separate graph for the color components side by side in
  11655. @code{row} mode or one below the other in @code{column} mode.
  11656. @item parade
  11657. Display separate graph for the color components side by side in
  11658. @code{column} mode or one below the other in @code{row} mode.
  11659. Using this display mode makes it easy to spot color casts in the highlights
  11660. and shadows of an image, by comparing the contours of the top and the bottom
  11661. graphs of each waveform. Since whites, grays, and blacks are characterized
  11662. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11663. should display three waveforms of roughly equal width/height. If not, the
  11664. correction is easy to perform by making level adjustments the three waveforms.
  11665. @end table
  11666. Default is @code{stack}.
  11667. @item components, c
  11668. Set which color components to display. Default is 1, which means only luminance
  11669. or red color component if input is in RGB colorspace. If is set for example to
  11670. 7 it will display all 3 (if) available color components.
  11671. @item envelope, e
  11672. @table @samp
  11673. @item none
  11674. No envelope, this is default.
  11675. @item instant
  11676. Instant envelope, minimum and maximum values presented in graph will be easily
  11677. visible even with small @code{step} value.
  11678. @item peak
  11679. Hold minimum and maximum values presented in graph across time. This way you
  11680. can still spot out of range values without constantly looking at waveforms.
  11681. @item peak+instant
  11682. Peak and instant envelope combined together.
  11683. @end table
  11684. @item filter, f
  11685. @table @samp
  11686. @item lowpass
  11687. No filtering, this is default.
  11688. @item flat
  11689. Luma and chroma combined together.
  11690. @item aflat
  11691. Similar as above, but shows difference between blue and red chroma.
  11692. @item chroma
  11693. Displays only chroma.
  11694. @item color
  11695. Displays actual color value on waveform.
  11696. @item acolor
  11697. Similar as above, but with luma showing frequency of chroma values.
  11698. @end table
  11699. @item graticule, g
  11700. Set which graticule to display.
  11701. @table @samp
  11702. @item none
  11703. Do not display graticule.
  11704. @item green
  11705. Display green graticule showing legal broadcast ranges.
  11706. @end table
  11707. @item opacity, o
  11708. Set graticule opacity.
  11709. @item flags, fl
  11710. Set graticule flags.
  11711. @table @samp
  11712. @item numbers
  11713. Draw numbers above lines. By default enabled.
  11714. @item dots
  11715. Draw dots instead of lines.
  11716. @end table
  11717. @item scale, s
  11718. Set scale used for displaying graticule.
  11719. @table @samp
  11720. @item digital
  11721. @item millivolts
  11722. @item ire
  11723. @end table
  11724. Default is digital.
  11725. @item bgopacity, b
  11726. Set background opacity.
  11727. @end table
  11728. @section weave, doubleweave
  11729. The @code{weave} takes a field-based video input and join
  11730. each two sequential fields into single frame, producing a new double
  11731. height clip with half the frame rate and half the frame count.
  11732. The @code{doubleweave} works same as @code{weave} but without
  11733. halving frame rate and frame count.
  11734. It accepts the following option:
  11735. @table @option
  11736. @item first_field
  11737. Set first field. Available values are:
  11738. @table @samp
  11739. @item top, t
  11740. Set the frame as top-field-first.
  11741. @item bottom, b
  11742. Set the frame as bottom-field-first.
  11743. @end table
  11744. @end table
  11745. @subsection Examples
  11746. @itemize
  11747. @item
  11748. Interlace video using @ref{select} and @ref{separatefields} filter:
  11749. @example
  11750. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11751. @end example
  11752. @end itemize
  11753. @section xbr
  11754. Apply the xBR high-quality magnification filter which is designed for pixel
  11755. art. It follows a set of edge-detection rules, see
  11756. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11757. It accepts the following option:
  11758. @table @option
  11759. @item n
  11760. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11761. @code{3xBR} and @code{4} for @code{4xBR}.
  11762. Default is @code{3}.
  11763. @end table
  11764. @anchor{yadif}
  11765. @section yadif
  11766. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11767. filter").
  11768. It accepts the following parameters:
  11769. @table @option
  11770. @item mode
  11771. The interlacing mode to adopt. It accepts one of the following values:
  11772. @table @option
  11773. @item 0, send_frame
  11774. Output one frame for each frame.
  11775. @item 1, send_field
  11776. Output one frame for each field.
  11777. @item 2, send_frame_nospatial
  11778. Like @code{send_frame}, but it skips the spatial interlacing check.
  11779. @item 3, send_field_nospatial
  11780. Like @code{send_field}, but it skips the spatial interlacing check.
  11781. @end table
  11782. The default value is @code{send_frame}.
  11783. @item parity
  11784. The picture field parity assumed for the input interlaced video. It accepts one
  11785. of the following values:
  11786. @table @option
  11787. @item 0, tff
  11788. Assume the top field is first.
  11789. @item 1, bff
  11790. Assume the bottom field is first.
  11791. @item -1, auto
  11792. Enable automatic detection of field parity.
  11793. @end table
  11794. The default value is @code{auto}.
  11795. If the interlacing is unknown or the decoder does not export this information,
  11796. top field first will be assumed.
  11797. @item deint
  11798. Specify which frames to deinterlace. Accept one of the following
  11799. values:
  11800. @table @option
  11801. @item 0, all
  11802. Deinterlace all frames.
  11803. @item 1, interlaced
  11804. Only deinterlace frames marked as interlaced.
  11805. @end table
  11806. The default value is @code{all}.
  11807. @end table
  11808. @section zoompan
  11809. Apply Zoom & Pan effect.
  11810. This filter accepts the following options:
  11811. @table @option
  11812. @item zoom, z
  11813. Set the zoom expression. Default is 1.
  11814. @item x
  11815. @item y
  11816. Set the x and y expression. Default is 0.
  11817. @item d
  11818. Set the duration expression in number of frames.
  11819. This sets for how many number of frames effect will last for
  11820. single input image.
  11821. @item s
  11822. Set the output image size, default is 'hd720'.
  11823. @item fps
  11824. Set the output frame rate, default is '25'.
  11825. @end table
  11826. Each expression can contain the following constants:
  11827. @table @option
  11828. @item in_w, iw
  11829. Input width.
  11830. @item in_h, ih
  11831. Input height.
  11832. @item out_w, ow
  11833. Output width.
  11834. @item out_h, oh
  11835. Output height.
  11836. @item in
  11837. Input frame count.
  11838. @item on
  11839. Output frame count.
  11840. @item x
  11841. @item y
  11842. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11843. for current input frame.
  11844. @item px
  11845. @item py
  11846. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11847. not yet such frame (first input frame).
  11848. @item zoom
  11849. Last calculated zoom from 'z' expression for current input frame.
  11850. @item pzoom
  11851. Last calculated zoom of last output frame of previous input frame.
  11852. @item duration
  11853. Number of output frames for current input frame. Calculated from 'd' expression
  11854. for each input frame.
  11855. @item pduration
  11856. number of output frames created for previous input frame
  11857. @item a
  11858. Rational number: input width / input height
  11859. @item sar
  11860. sample aspect ratio
  11861. @item dar
  11862. display aspect ratio
  11863. @end table
  11864. @subsection Examples
  11865. @itemize
  11866. @item
  11867. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11868. @example
  11869. 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
  11870. @end example
  11871. @item
  11872. Zoom-in up to 1.5 and pan always at center of picture:
  11873. @example
  11874. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11875. @end example
  11876. @item
  11877. Same as above but without pausing:
  11878. @example
  11879. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11880. @end example
  11881. @end itemize
  11882. @section zscale
  11883. Scale (resize) the input video, using the z.lib library:
  11884. https://github.com/sekrit-twc/zimg.
  11885. The zscale filter forces the output display aspect ratio to be the same
  11886. as the input, by changing the output sample aspect ratio.
  11887. If the input image format is different from the format requested by
  11888. the next filter, the zscale filter will convert the input to the
  11889. requested format.
  11890. @subsection Options
  11891. The filter accepts the following options.
  11892. @table @option
  11893. @item width, w
  11894. @item height, h
  11895. Set the output video dimension expression. Default value is the input
  11896. dimension.
  11897. If the @var{width} or @var{w} value is 0, the input width is used for
  11898. the output. If the @var{height} or @var{h} value is 0, the input height
  11899. is used for the output.
  11900. If one and only one of the values is -n with n >= 1, the zscale filter
  11901. will use a value that maintains the aspect ratio of the input image,
  11902. calculated from the other specified dimension. After that it will,
  11903. however, make sure that the calculated dimension is divisible by n and
  11904. adjust the value if necessary.
  11905. If both values are -n with n >= 1, the behavior will be identical to
  11906. both values being set to 0 as previously detailed.
  11907. See below for the list of accepted constants for use in the dimension
  11908. expression.
  11909. @item size, s
  11910. Set the video size. For the syntax of this option, check the
  11911. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11912. @item dither, d
  11913. Set the dither type.
  11914. Possible values are:
  11915. @table @var
  11916. @item none
  11917. @item ordered
  11918. @item random
  11919. @item error_diffusion
  11920. @end table
  11921. Default is none.
  11922. @item filter, f
  11923. Set the resize filter type.
  11924. Possible values are:
  11925. @table @var
  11926. @item point
  11927. @item bilinear
  11928. @item bicubic
  11929. @item spline16
  11930. @item spline36
  11931. @item lanczos
  11932. @end table
  11933. Default is bilinear.
  11934. @item range, r
  11935. Set the color range.
  11936. Possible values are:
  11937. @table @var
  11938. @item input
  11939. @item limited
  11940. @item full
  11941. @end table
  11942. Default is same as input.
  11943. @item primaries, p
  11944. Set the color primaries.
  11945. Possible values are:
  11946. @table @var
  11947. @item input
  11948. @item 709
  11949. @item unspecified
  11950. @item 170m
  11951. @item 240m
  11952. @item 2020
  11953. @end table
  11954. Default is same as input.
  11955. @item transfer, t
  11956. Set the transfer characteristics.
  11957. Possible values are:
  11958. @table @var
  11959. @item input
  11960. @item 709
  11961. @item unspecified
  11962. @item 601
  11963. @item linear
  11964. @item 2020_10
  11965. @item 2020_12
  11966. @item smpte2084
  11967. @item iec61966-2-1
  11968. @item arib-std-b67
  11969. @end table
  11970. Default is same as input.
  11971. @item matrix, m
  11972. Set the colorspace matrix.
  11973. Possible value are:
  11974. @table @var
  11975. @item input
  11976. @item 709
  11977. @item unspecified
  11978. @item 470bg
  11979. @item 170m
  11980. @item 2020_ncl
  11981. @item 2020_cl
  11982. @end table
  11983. Default is same as input.
  11984. @item rangein, rin
  11985. Set the input color range.
  11986. Possible values are:
  11987. @table @var
  11988. @item input
  11989. @item limited
  11990. @item full
  11991. @end table
  11992. Default is same as input.
  11993. @item primariesin, pin
  11994. Set the input color primaries.
  11995. Possible values are:
  11996. @table @var
  11997. @item input
  11998. @item 709
  11999. @item unspecified
  12000. @item 170m
  12001. @item 240m
  12002. @item 2020
  12003. @end table
  12004. Default is same as input.
  12005. @item transferin, tin
  12006. Set the input transfer characteristics.
  12007. Possible values are:
  12008. @table @var
  12009. @item input
  12010. @item 709
  12011. @item unspecified
  12012. @item 601
  12013. @item linear
  12014. @item 2020_10
  12015. @item 2020_12
  12016. @end table
  12017. Default is same as input.
  12018. @item matrixin, min
  12019. Set the input colorspace matrix.
  12020. Possible value are:
  12021. @table @var
  12022. @item input
  12023. @item 709
  12024. @item unspecified
  12025. @item 470bg
  12026. @item 170m
  12027. @item 2020_ncl
  12028. @item 2020_cl
  12029. @end table
  12030. @item chromal, c
  12031. Set the output chroma location.
  12032. Possible values are:
  12033. @table @var
  12034. @item input
  12035. @item left
  12036. @item center
  12037. @item topleft
  12038. @item top
  12039. @item bottomleft
  12040. @item bottom
  12041. @end table
  12042. @item chromalin, cin
  12043. Set the input chroma location.
  12044. Possible values are:
  12045. @table @var
  12046. @item input
  12047. @item left
  12048. @item center
  12049. @item topleft
  12050. @item top
  12051. @item bottomleft
  12052. @item bottom
  12053. @end table
  12054. @item npl
  12055. Set the nominal peak luminance.
  12056. @end table
  12057. The values of the @option{w} and @option{h} options are expressions
  12058. containing the following constants:
  12059. @table @var
  12060. @item in_w
  12061. @item in_h
  12062. The input width and height
  12063. @item iw
  12064. @item ih
  12065. These are the same as @var{in_w} and @var{in_h}.
  12066. @item out_w
  12067. @item out_h
  12068. The output (scaled) width and height
  12069. @item ow
  12070. @item oh
  12071. These are the same as @var{out_w} and @var{out_h}
  12072. @item a
  12073. The same as @var{iw} / @var{ih}
  12074. @item sar
  12075. input sample aspect ratio
  12076. @item dar
  12077. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12078. @item hsub
  12079. @item vsub
  12080. horizontal and vertical input chroma subsample values. For example for the
  12081. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12082. @item ohsub
  12083. @item ovsub
  12084. horizontal and vertical output chroma subsample values. For example for the
  12085. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12086. @end table
  12087. @table @option
  12088. @end table
  12089. @c man end VIDEO FILTERS
  12090. @chapter Video Sources
  12091. @c man begin VIDEO SOURCES
  12092. Below is a description of the currently available video sources.
  12093. @section buffer
  12094. Buffer video frames, and make them available to the filter chain.
  12095. This source is mainly intended for a programmatic use, in particular
  12096. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12097. It accepts the following parameters:
  12098. @table @option
  12099. @item video_size
  12100. Specify the size (width and height) of the buffered video frames. For the
  12101. syntax of this option, check the
  12102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12103. @item width
  12104. The input video width.
  12105. @item height
  12106. The input video height.
  12107. @item pix_fmt
  12108. A string representing the pixel format of the buffered video frames.
  12109. It may be a number corresponding to a pixel format, or a pixel format
  12110. name.
  12111. @item time_base
  12112. Specify the timebase assumed by the timestamps of the buffered frames.
  12113. @item frame_rate
  12114. Specify the frame rate expected for the video stream.
  12115. @item pixel_aspect, sar
  12116. The sample (pixel) aspect ratio of the input video.
  12117. @item sws_param
  12118. Specify the optional parameters to be used for the scale filter which
  12119. is automatically inserted when an input change is detected in the
  12120. input size or format.
  12121. @item hw_frames_ctx
  12122. When using a hardware pixel format, this should be a reference to an
  12123. AVHWFramesContext describing input frames.
  12124. @end table
  12125. For example:
  12126. @example
  12127. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12128. @end example
  12129. will instruct the source to accept video frames with size 320x240 and
  12130. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12131. square pixels (1:1 sample aspect ratio).
  12132. Since the pixel format with name "yuv410p" corresponds to the number 6
  12133. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12134. this example corresponds to:
  12135. @example
  12136. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12137. @end example
  12138. Alternatively, the options can be specified as a flat string, but this
  12139. syntax is deprecated:
  12140. @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}]
  12141. @section cellauto
  12142. Create a pattern generated by an elementary cellular automaton.
  12143. The initial state of the cellular automaton can be defined through the
  12144. @option{filename} and @option{pattern} options. If such options are
  12145. not specified an initial state is created randomly.
  12146. At each new frame a new row in the video is filled with the result of
  12147. the cellular automaton next generation. The behavior when the whole
  12148. frame is filled is defined by the @option{scroll} option.
  12149. This source accepts the following options:
  12150. @table @option
  12151. @item filename, f
  12152. Read the initial cellular automaton state, i.e. the starting row, from
  12153. the specified file.
  12154. In the file, each non-whitespace character is considered an alive
  12155. cell, a newline will terminate the row, and further characters in the
  12156. file will be ignored.
  12157. @item pattern, p
  12158. Read the initial cellular automaton state, i.e. the starting row, from
  12159. the specified string.
  12160. Each non-whitespace character in the string is considered an alive
  12161. cell, a newline will terminate the row, and further characters in the
  12162. string will be ignored.
  12163. @item rate, r
  12164. Set the video rate, that is the number of frames generated per second.
  12165. Default is 25.
  12166. @item random_fill_ratio, ratio
  12167. Set the random fill ratio for the initial cellular automaton row. It
  12168. is a floating point number value ranging from 0 to 1, defaults to
  12169. 1/PHI.
  12170. This option is ignored when a file or a pattern is specified.
  12171. @item random_seed, seed
  12172. Set the seed for filling randomly the initial row, must be an integer
  12173. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12174. set to -1, the filter will try to use a good random seed on a best
  12175. effort basis.
  12176. @item rule
  12177. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12178. Default value is 110.
  12179. @item size, s
  12180. Set the size of the output video. For the syntax of this option, check the
  12181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12182. If @option{filename} or @option{pattern} is specified, the size is set
  12183. by default to the width of the specified initial state row, and the
  12184. height is set to @var{width} * PHI.
  12185. If @option{size} is set, it must contain the width of the specified
  12186. pattern string, and the specified pattern will be centered in the
  12187. larger row.
  12188. If a filename or a pattern string is not specified, the size value
  12189. defaults to "320x518" (used for a randomly generated initial state).
  12190. @item scroll
  12191. If set to 1, scroll the output upward when all the rows in the output
  12192. have been already filled. If set to 0, the new generated row will be
  12193. written over the top row just after the bottom row is filled.
  12194. Defaults to 1.
  12195. @item start_full, full
  12196. If set to 1, completely fill the output with generated rows before
  12197. outputting the first frame.
  12198. This is the default behavior, for disabling set the value to 0.
  12199. @item stitch
  12200. If set to 1, stitch the left and right row edges together.
  12201. This is the default behavior, for disabling set the value to 0.
  12202. @end table
  12203. @subsection Examples
  12204. @itemize
  12205. @item
  12206. Read the initial state from @file{pattern}, and specify an output of
  12207. size 200x400.
  12208. @example
  12209. cellauto=f=pattern:s=200x400
  12210. @end example
  12211. @item
  12212. Generate a random initial row with a width of 200 cells, with a fill
  12213. ratio of 2/3:
  12214. @example
  12215. cellauto=ratio=2/3:s=200x200
  12216. @end example
  12217. @item
  12218. Create a pattern generated by rule 18 starting by a single alive cell
  12219. centered on an initial row with width 100:
  12220. @example
  12221. cellauto=p=@@:s=100x400:full=0:rule=18
  12222. @end example
  12223. @item
  12224. Specify a more elaborated initial pattern:
  12225. @example
  12226. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12227. @end example
  12228. @end itemize
  12229. @anchor{coreimagesrc}
  12230. @section coreimagesrc
  12231. Video source generated on GPU using Apple's CoreImage API on OSX.
  12232. This video source is a specialized version of the @ref{coreimage} video filter.
  12233. Use a core image generator at the beginning of the applied filterchain to
  12234. generate the content.
  12235. The coreimagesrc video source accepts the following options:
  12236. @table @option
  12237. @item list_generators
  12238. List all available generators along with all their respective options as well as
  12239. possible minimum and maximum values along with the default values.
  12240. @example
  12241. list_generators=true
  12242. @end example
  12243. @item size, s
  12244. Specify the size of the sourced video. For the syntax of this option, check the
  12245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12246. The default value is @code{320x240}.
  12247. @item rate, r
  12248. Specify the frame rate of the sourced video, as the number of frames
  12249. generated per second. It has to be a string in the format
  12250. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12251. number or a valid video frame rate abbreviation. The default value is
  12252. "25".
  12253. @item sar
  12254. Set the sample aspect ratio of the sourced video.
  12255. @item duration, d
  12256. Set the duration of the sourced video. See
  12257. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12258. for the accepted syntax.
  12259. If not specified, or the expressed duration is negative, the video is
  12260. supposed to be generated forever.
  12261. @end table
  12262. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12263. A complete filterchain can be used for further processing of the
  12264. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12265. and examples for details.
  12266. @subsection Examples
  12267. @itemize
  12268. @item
  12269. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12270. given as complete and escaped command-line for Apple's standard bash shell:
  12271. @example
  12272. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12273. @end example
  12274. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12275. need for a nullsrc video source.
  12276. @end itemize
  12277. @section mandelbrot
  12278. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12279. point specified with @var{start_x} and @var{start_y}.
  12280. This source accepts the following options:
  12281. @table @option
  12282. @item end_pts
  12283. Set the terminal pts value. Default value is 400.
  12284. @item end_scale
  12285. Set the terminal scale value.
  12286. Must be a floating point value. Default value is 0.3.
  12287. @item inner
  12288. Set the inner coloring mode, that is the algorithm used to draw the
  12289. Mandelbrot fractal internal region.
  12290. It shall assume one of the following values:
  12291. @table @option
  12292. @item black
  12293. Set black mode.
  12294. @item convergence
  12295. Show time until convergence.
  12296. @item mincol
  12297. Set color based on point closest to the origin of the iterations.
  12298. @item period
  12299. Set period mode.
  12300. @end table
  12301. Default value is @var{mincol}.
  12302. @item bailout
  12303. Set the bailout value. Default value is 10.0.
  12304. @item maxiter
  12305. Set the maximum of iterations performed by the rendering
  12306. algorithm. Default value is 7189.
  12307. @item outer
  12308. Set outer coloring mode.
  12309. It shall assume one of following values:
  12310. @table @option
  12311. @item iteration_count
  12312. Set iteration cound mode.
  12313. @item normalized_iteration_count
  12314. set normalized iteration count mode.
  12315. @end table
  12316. Default value is @var{normalized_iteration_count}.
  12317. @item rate, r
  12318. Set frame rate, expressed as number of frames per second. Default
  12319. value is "25".
  12320. @item size, s
  12321. Set frame size. For the syntax of this option, check the "Video
  12322. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12323. @item start_scale
  12324. Set the initial scale value. Default value is 3.0.
  12325. @item start_x
  12326. Set the initial x position. Must be a floating point value between
  12327. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12328. @item start_y
  12329. Set the initial y position. Must be a floating point value between
  12330. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12331. @end table
  12332. @section mptestsrc
  12333. Generate various test patterns, as generated by the MPlayer test filter.
  12334. The size of the generated video is fixed, and is 256x256.
  12335. This source is useful in particular for testing encoding features.
  12336. This source accepts the following options:
  12337. @table @option
  12338. @item rate, r
  12339. Specify the frame rate of the sourced video, as the number of frames
  12340. generated per second. It has to be a string in the format
  12341. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12342. number or a valid video frame rate abbreviation. The default value is
  12343. "25".
  12344. @item duration, d
  12345. Set the duration of the sourced video. See
  12346. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12347. for the accepted syntax.
  12348. If not specified, or the expressed duration is negative, the video is
  12349. supposed to be generated forever.
  12350. @item test, t
  12351. Set the number or the name of the test to perform. Supported tests are:
  12352. @table @option
  12353. @item dc_luma
  12354. @item dc_chroma
  12355. @item freq_luma
  12356. @item freq_chroma
  12357. @item amp_luma
  12358. @item amp_chroma
  12359. @item cbp
  12360. @item mv
  12361. @item ring1
  12362. @item ring2
  12363. @item all
  12364. @end table
  12365. Default value is "all", which will cycle through the list of all tests.
  12366. @end table
  12367. Some examples:
  12368. @example
  12369. mptestsrc=t=dc_luma
  12370. @end example
  12371. will generate a "dc_luma" test pattern.
  12372. @section frei0r_src
  12373. Provide a frei0r source.
  12374. To enable compilation of this filter you need to install the frei0r
  12375. header and configure FFmpeg with @code{--enable-frei0r}.
  12376. This source accepts the following parameters:
  12377. @table @option
  12378. @item size
  12379. The size of the video to generate. For the syntax of this option, check the
  12380. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12381. @item framerate
  12382. The framerate of the generated video. It may be a string of the form
  12383. @var{num}/@var{den} or a frame rate abbreviation.
  12384. @item filter_name
  12385. The name to the frei0r source to load. For more information regarding frei0r and
  12386. how to set the parameters, read the @ref{frei0r} section in the video filters
  12387. documentation.
  12388. @item filter_params
  12389. A '|'-separated list of parameters to pass to the frei0r source.
  12390. @end table
  12391. For example, to generate a frei0r partik0l source with size 200x200
  12392. and frame rate 10 which is overlaid on the overlay filter main input:
  12393. @example
  12394. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12395. @end example
  12396. @section life
  12397. Generate a life pattern.
  12398. This source is based on a generalization of John Conway's life game.
  12399. The sourced input represents a life grid, each pixel represents a cell
  12400. which can be in one of two possible states, alive or dead. Every cell
  12401. interacts with its eight neighbours, which are the cells that are
  12402. horizontally, vertically, or diagonally adjacent.
  12403. At each interaction the grid evolves according to the adopted rule,
  12404. which specifies the number of neighbor alive cells which will make a
  12405. cell stay alive or born. The @option{rule} option allows one to specify
  12406. the rule to adopt.
  12407. This source accepts the following options:
  12408. @table @option
  12409. @item filename, f
  12410. Set the file from which to read the initial grid state. In the file,
  12411. each non-whitespace character is considered an alive cell, and newline
  12412. is used to delimit the end of each row.
  12413. If this option is not specified, the initial grid is generated
  12414. randomly.
  12415. @item rate, r
  12416. Set the video rate, that is the number of frames generated per second.
  12417. Default is 25.
  12418. @item random_fill_ratio, ratio
  12419. Set the random fill ratio for the initial random grid. It is a
  12420. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12421. It is ignored when a file is specified.
  12422. @item random_seed, seed
  12423. Set the seed for filling the initial random grid, must be an integer
  12424. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12425. set to -1, the filter will try to use a good random seed on a best
  12426. effort basis.
  12427. @item rule
  12428. Set the life rule.
  12429. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12430. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12431. @var{NS} specifies the number of alive neighbor cells which make a
  12432. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12433. which make a dead cell to become alive (i.e. to "born").
  12434. "s" and "b" can be used in place of "S" and "B", respectively.
  12435. Alternatively a rule can be specified by an 18-bits integer. The 9
  12436. high order bits are used to encode the next cell state if it is alive
  12437. for each number of neighbor alive cells, the low order bits specify
  12438. the rule for "borning" new cells. Higher order bits encode for an
  12439. higher number of neighbor cells.
  12440. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12441. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12442. Default value is "S23/B3", which is the original Conway's game of life
  12443. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12444. cells, and will born a new cell if there are three alive cells around
  12445. a dead cell.
  12446. @item size, s
  12447. Set the size of the output video. For the syntax of this option, check the
  12448. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12449. If @option{filename} is specified, the size is set by default to the
  12450. same size of the input file. If @option{size} is set, it must contain
  12451. the size specified in the input file, and the initial grid defined in
  12452. that file is centered in the larger resulting area.
  12453. If a filename is not specified, the size value defaults to "320x240"
  12454. (used for a randomly generated initial grid).
  12455. @item stitch
  12456. If set to 1, stitch the left and right grid edges together, and the
  12457. top and bottom edges also. Defaults to 1.
  12458. @item mold
  12459. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12460. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12461. value from 0 to 255.
  12462. @item life_color
  12463. Set the color of living (or new born) cells.
  12464. @item death_color
  12465. Set the color of dead cells. If @option{mold} is set, this is the first color
  12466. used to represent a dead cell.
  12467. @item mold_color
  12468. Set mold color, for definitely dead and moldy cells.
  12469. For the syntax of these 3 color options, check the "Color" section in the
  12470. ffmpeg-utils manual.
  12471. @end table
  12472. @subsection Examples
  12473. @itemize
  12474. @item
  12475. Read a grid from @file{pattern}, and center it on a grid of size
  12476. 300x300 pixels:
  12477. @example
  12478. life=f=pattern:s=300x300
  12479. @end example
  12480. @item
  12481. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12482. @example
  12483. life=ratio=2/3:s=200x200
  12484. @end example
  12485. @item
  12486. Specify a custom rule for evolving a randomly generated grid:
  12487. @example
  12488. life=rule=S14/B34
  12489. @end example
  12490. @item
  12491. Full example with slow death effect (mold) using @command{ffplay}:
  12492. @example
  12493. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12494. @end example
  12495. @end itemize
  12496. @anchor{allrgb}
  12497. @anchor{allyuv}
  12498. @anchor{color}
  12499. @anchor{haldclutsrc}
  12500. @anchor{nullsrc}
  12501. @anchor{rgbtestsrc}
  12502. @anchor{smptebars}
  12503. @anchor{smptehdbars}
  12504. @anchor{testsrc}
  12505. @anchor{testsrc2}
  12506. @anchor{yuvtestsrc}
  12507. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12508. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12509. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12510. The @code{color} source provides an uniformly colored input.
  12511. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12512. @ref{haldclut} filter.
  12513. The @code{nullsrc} source returns unprocessed video frames. It is
  12514. mainly useful to be employed in analysis / debugging tools, or as the
  12515. source for filters which ignore the input data.
  12516. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12517. detecting RGB vs BGR issues. You should see a red, green and blue
  12518. stripe from top to bottom.
  12519. The @code{smptebars} source generates a color bars pattern, based on
  12520. the SMPTE Engineering Guideline EG 1-1990.
  12521. The @code{smptehdbars} source generates a color bars pattern, based on
  12522. the SMPTE RP 219-2002.
  12523. The @code{testsrc} source generates a test video pattern, showing a
  12524. color pattern, a scrolling gradient and a timestamp. This is mainly
  12525. intended for testing purposes.
  12526. The @code{testsrc2} source is similar to testsrc, but supports more
  12527. pixel formats instead of just @code{rgb24}. This allows using it as an
  12528. input for other tests without requiring a format conversion.
  12529. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12530. see a y, cb and cr stripe from top to bottom.
  12531. The sources accept the following parameters:
  12532. @table @option
  12533. @item alpha
  12534. Specify the alpha (opacity) of the background, only available in the
  12535. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12536. 255 (fully opaque, the default).
  12537. @item color, c
  12538. Specify the color of the source, only available in the @code{color}
  12539. source. For the syntax of this option, check the "Color" section in the
  12540. ffmpeg-utils manual.
  12541. @item level
  12542. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12543. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12544. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12545. coded on a @code{1/(N*N)} scale.
  12546. @item size, s
  12547. Specify the size of the sourced video. For the syntax of this option, check the
  12548. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12549. The default value is @code{320x240}.
  12550. This option is not available with the @code{haldclutsrc} filter.
  12551. @item rate, r
  12552. Specify the frame rate of the sourced video, as the number of frames
  12553. generated per second. It has to be a string in the format
  12554. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12555. number or a valid video frame rate abbreviation. The default value is
  12556. "25".
  12557. @item sar
  12558. Set the sample aspect ratio of the sourced video.
  12559. @item duration, d
  12560. Set the duration of the sourced video. See
  12561. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12562. for the accepted syntax.
  12563. If not specified, or the expressed duration is negative, the video is
  12564. supposed to be generated forever.
  12565. @item decimals, n
  12566. Set the number of decimals to show in the timestamp, only available in the
  12567. @code{testsrc} source.
  12568. The displayed timestamp value will correspond to the original
  12569. timestamp value multiplied by the power of 10 of the specified
  12570. value. Default value is 0.
  12571. @end table
  12572. For example the following:
  12573. @example
  12574. testsrc=duration=5.3:size=qcif:rate=10
  12575. @end example
  12576. will generate a video with a duration of 5.3 seconds, with size
  12577. 176x144 and a frame rate of 10 frames per second.
  12578. The following graph description will generate a red source
  12579. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12580. frames per second.
  12581. @example
  12582. color=c=red@@0.2:s=qcif:r=10
  12583. @end example
  12584. If the input content is to be ignored, @code{nullsrc} can be used. The
  12585. following command generates noise in the luminance plane by employing
  12586. the @code{geq} filter:
  12587. @example
  12588. nullsrc=s=256x256, geq=random(1)*255:128:128
  12589. @end example
  12590. @subsection Commands
  12591. The @code{color} source supports the following commands:
  12592. @table @option
  12593. @item c, color
  12594. Set the color of the created image. Accepts the same syntax of the
  12595. corresponding @option{color} option.
  12596. @end table
  12597. @c man end VIDEO SOURCES
  12598. @chapter Video Sinks
  12599. @c man begin VIDEO SINKS
  12600. Below is a description of the currently available video sinks.
  12601. @section buffersink
  12602. Buffer video frames, and make them available to the end of the filter
  12603. graph.
  12604. This sink is mainly intended for programmatic use, in particular
  12605. through the interface defined in @file{libavfilter/buffersink.h}
  12606. or the options system.
  12607. It accepts a pointer to an AVBufferSinkContext structure, which
  12608. defines the incoming buffers' formats, to be passed as the opaque
  12609. parameter to @code{avfilter_init_filter} for initialization.
  12610. @section nullsink
  12611. Null video sink: do absolutely nothing with the input video. It is
  12612. mainly useful as a template and for use in analysis / debugging
  12613. tools.
  12614. @c man end VIDEO SINKS
  12615. @chapter Multimedia Filters
  12616. @c man begin MULTIMEDIA FILTERS
  12617. Below is a description of the currently available multimedia filters.
  12618. @section abitscope
  12619. Convert input audio to a video output, displaying the audio bit scope.
  12620. The filter accepts the following options:
  12621. @table @option
  12622. @item rate, r
  12623. Set frame rate, expressed as number of frames per second. Default
  12624. value is "25".
  12625. @item size, s
  12626. Specify the video size for the output. For the syntax of this option, check the
  12627. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12628. Default value is @code{1024x256}.
  12629. @item colors
  12630. Specify list of colors separated by space or by '|' which will be used to
  12631. draw channels. Unrecognized or missing colors will be replaced
  12632. by white color.
  12633. @end table
  12634. @section ahistogram
  12635. Convert input audio to a video output, displaying the volume histogram.
  12636. The filter accepts the following options:
  12637. @table @option
  12638. @item dmode
  12639. Specify how histogram is calculated.
  12640. It accepts the following values:
  12641. @table @samp
  12642. @item single
  12643. Use single histogram for all channels.
  12644. @item separate
  12645. Use separate histogram for each channel.
  12646. @end table
  12647. Default is @code{single}.
  12648. @item rate, r
  12649. Set frame rate, expressed as number of frames per second. Default
  12650. value is "25".
  12651. @item size, s
  12652. Specify the video size for the output. For the syntax of this option, check the
  12653. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12654. Default value is @code{hd720}.
  12655. @item scale
  12656. Set display scale.
  12657. It accepts the following values:
  12658. @table @samp
  12659. @item log
  12660. logarithmic
  12661. @item sqrt
  12662. square root
  12663. @item cbrt
  12664. cubic root
  12665. @item lin
  12666. linear
  12667. @item rlog
  12668. reverse logarithmic
  12669. @end table
  12670. Default is @code{log}.
  12671. @item ascale
  12672. Set amplitude scale.
  12673. It accepts the following values:
  12674. @table @samp
  12675. @item log
  12676. logarithmic
  12677. @item lin
  12678. linear
  12679. @end table
  12680. Default is @code{log}.
  12681. @item acount
  12682. Set how much frames to accumulate in histogram.
  12683. Defauls is 1. Setting this to -1 accumulates all frames.
  12684. @item rheight
  12685. Set histogram ratio of window height.
  12686. @item slide
  12687. Set sonogram sliding.
  12688. It accepts the following values:
  12689. @table @samp
  12690. @item replace
  12691. replace old rows with new ones.
  12692. @item scroll
  12693. scroll from top to bottom.
  12694. @end table
  12695. Default is @code{replace}.
  12696. @end table
  12697. @section aphasemeter
  12698. Convert input audio to a video output, displaying the audio phase.
  12699. The filter accepts the following options:
  12700. @table @option
  12701. @item rate, r
  12702. Set the output frame rate. Default value is @code{25}.
  12703. @item size, s
  12704. Set the video size for the output. For the syntax of this option, check the
  12705. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12706. Default value is @code{800x400}.
  12707. @item rc
  12708. @item gc
  12709. @item bc
  12710. Specify the red, green, blue contrast. Default values are @code{2},
  12711. @code{7} and @code{1}.
  12712. Allowed range is @code{[0, 255]}.
  12713. @item mpc
  12714. Set color which will be used for drawing median phase. If color is
  12715. @code{none} which is default, no median phase value will be drawn.
  12716. @item video
  12717. Enable video output. Default is enabled.
  12718. @end table
  12719. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12720. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12721. The @code{-1} means left and right channels are completely out of phase and
  12722. @code{1} means channels are in phase.
  12723. @section avectorscope
  12724. Convert input audio to a video output, representing the audio vector
  12725. scope.
  12726. The filter is used to measure the difference between channels of stereo
  12727. audio stream. A monoaural signal, consisting of identical left and right
  12728. signal, results in straight vertical line. Any stereo separation is visible
  12729. as a deviation from this line, creating a Lissajous figure.
  12730. If the straight (or deviation from it) but horizontal line appears this
  12731. indicates that the left and right channels are out of phase.
  12732. The filter accepts the following options:
  12733. @table @option
  12734. @item mode, m
  12735. Set the vectorscope mode.
  12736. Available values are:
  12737. @table @samp
  12738. @item lissajous
  12739. Lissajous rotated by 45 degrees.
  12740. @item lissajous_xy
  12741. Same as above but not rotated.
  12742. @item polar
  12743. Shape resembling half of circle.
  12744. @end table
  12745. Default value is @samp{lissajous}.
  12746. @item size, s
  12747. Set the video size for the output. For the syntax of this option, check the
  12748. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12749. Default value is @code{400x400}.
  12750. @item rate, r
  12751. Set the output frame rate. Default value is @code{25}.
  12752. @item rc
  12753. @item gc
  12754. @item bc
  12755. @item ac
  12756. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12757. @code{160}, @code{80} and @code{255}.
  12758. Allowed range is @code{[0, 255]}.
  12759. @item rf
  12760. @item gf
  12761. @item bf
  12762. @item af
  12763. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12764. @code{10}, @code{5} and @code{5}.
  12765. Allowed range is @code{[0, 255]}.
  12766. @item zoom
  12767. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12768. @item draw
  12769. Set the vectorscope drawing mode.
  12770. Available values are:
  12771. @table @samp
  12772. @item dot
  12773. Draw dot for each sample.
  12774. @item line
  12775. Draw line between previous and current sample.
  12776. @end table
  12777. Default value is @samp{dot}.
  12778. @item scale
  12779. Specify amplitude scale of audio samples.
  12780. Available values are:
  12781. @table @samp
  12782. @item lin
  12783. Linear.
  12784. @item sqrt
  12785. Square root.
  12786. @item cbrt
  12787. Cubic root.
  12788. @item log
  12789. Logarithmic.
  12790. @end table
  12791. @end table
  12792. @subsection Examples
  12793. @itemize
  12794. @item
  12795. Complete example using @command{ffplay}:
  12796. @example
  12797. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12798. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12799. @end example
  12800. @end itemize
  12801. @section bench, abench
  12802. Benchmark part of a filtergraph.
  12803. The filter accepts the following options:
  12804. @table @option
  12805. @item action
  12806. Start or stop a timer.
  12807. Available values are:
  12808. @table @samp
  12809. @item start
  12810. Get the current time, set it as frame metadata (using the key
  12811. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12812. @item stop
  12813. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12814. the input frame metadata to get the time difference. Time difference, average,
  12815. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12816. @code{min}) are then printed. The timestamps are expressed in seconds.
  12817. @end table
  12818. @end table
  12819. @subsection Examples
  12820. @itemize
  12821. @item
  12822. Benchmark @ref{selectivecolor} filter:
  12823. @example
  12824. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12825. @end example
  12826. @end itemize
  12827. @section concat
  12828. Concatenate audio and video streams, joining them together one after the
  12829. other.
  12830. The filter works on segments of synchronized video and audio streams. All
  12831. segments must have the same number of streams of each type, and that will
  12832. also be the number of streams at output.
  12833. The filter accepts the following options:
  12834. @table @option
  12835. @item n
  12836. Set the number of segments. Default is 2.
  12837. @item v
  12838. Set the number of output video streams, that is also the number of video
  12839. streams in each segment. Default is 1.
  12840. @item a
  12841. Set the number of output audio streams, that is also the number of audio
  12842. streams in each segment. Default is 0.
  12843. @item unsafe
  12844. Activate unsafe mode: do not fail if segments have a different format.
  12845. @end table
  12846. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12847. @var{a} audio outputs.
  12848. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12849. segment, in the same order as the outputs, then the inputs for the second
  12850. segment, etc.
  12851. Related streams do not always have exactly the same duration, for various
  12852. reasons including codec frame size or sloppy authoring. For that reason,
  12853. related synchronized streams (e.g. a video and its audio track) should be
  12854. concatenated at once. The concat filter will use the duration of the longest
  12855. stream in each segment (except the last one), and if necessary pad shorter
  12856. audio streams with silence.
  12857. For this filter to work correctly, all segments must start at timestamp 0.
  12858. All corresponding streams must have the same parameters in all segments; the
  12859. filtering system will automatically select a common pixel format for video
  12860. streams, and a common sample format, sample rate and channel layout for
  12861. audio streams, but other settings, such as resolution, must be converted
  12862. explicitly by the user.
  12863. Different frame rates are acceptable but will result in variable frame rate
  12864. at output; be sure to configure the output file to handle it.
  12865. @subsection Examples
  12866. @itemize
  12867. @item
  12868. Concatenate an opening, an episode and an ending, all in bilingual version
  12869. (video in stream 0, audio in streams 1 and 2):
  12870. @example
  12871. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12872. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12873. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12874. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12875. @end example
  12876. @item
  12877. Concatenate two parts, handling audio and video separately, using the
  12878. (a)movie sources, and adjusting the resolution:
  12879. @example
  12880. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12881. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12882. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12883. @end example
  12884. Note that a desync will happen at the stitch if the audio and video streams
  12885. do not have exactly the same duration in the first file.
  12886. @end itemize
  12887. @section drawgraph, adrawgraph
  12888. Draw a graph using input video or audio metadata.
  12889. It accepts the following parameters:
  12890. @table @option
  12891. @item m1
  12892. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12893. @item fg1
  12894. Set 1st foreground color expression.
  12895. @item m2
  12896. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12897. @item fg2
  12898. Set 2nd foreground color expression.
  12899. @item m3
  12900. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12901. @item fg3
  12902. Set 3rd foreground color expression.
  12903. @item m4
  12904. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12905. @item fg4
  12906. Set 4th foreground color expression.
  12907. @item min
  12908. Set minimal value of metadata value.
  12909. @item max
  12910. Set maximal value of metadata value.
  12911. @item bg
  12912. Set graph background color. Default is white.
  12913. @item mode
  12914. Set graph mode.
  12915. Available values for mode is:
  12916. @table @samp
  12917. @item bar
  12918. @item dot
  12919. @item line
  12920. @end table
  12921. Default is @code{line}.
  12922. @item slide
  12923. Set slide mode.
  12924. Available values for slide is:
  12925. @table @samp
  12926. @item frame
  12927. Draw new frame when right border is reached.
  12928. @item replace
  12929. Replace old columns with new ones.
  12930. @item scroll
  12931. Scroll from right to left.
  12932. @item rscroll
  12933. Scroll from left to right.
  12934. @item picture
  12935. Draw single picture.
  12936. @end table
  12937. Default is @code{frame}.
  12938. @item size
  12939. Set size of graph video. For the syntax of this option, check the
  12940. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12941. The default value is @code{900x256}.
  12942. The foreground color expressions can use the following variables:
  12943. @table @option
  12944. @item MIN
  12945. Minimal value of metadata value.
  12946. @item MAX
  12947. Maximal value of metadata value.
  12948. @item VAL
  12949. Current metadata key value.
  12950. @end table
  12951. The color is defined as 0xAABBGGRR.
  12952. @end table
  12953. Example using metadata from @ref{signalstats} filter:
  12954. @example
  12955. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12956. @end example
  12957. Example using metadata from @ref{ebur128} filter:
  12958. @example
  12959. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12960. @end example
  12961. @anchor{ebur128}
  12962. @section ebur128
  12963. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12964. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12965. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12966. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12967. The filter also has a video output (see the @var{video} option) with a real
  12968. time graph to observe the loudness evolution. The graphic contains the logged
  12969. message mentioned above, so it is not printed anymore when this option is set,
  12970. unless the verbose logging is set. The main graphing area contains the
  12971. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12972. the momentary loudness (400 milliseconds).
  12973. More information about the Loudness Recommendation EBU R128 on
  12974. @url{http://tech.ebu.ch/loudness}.
  12975. The filter accepts the following options:
  12976. @table @option
  12977. @item video
  12978. Activate the video output. The audio stream is passed unchanged whether this
  12979. option is set or no. The video stream will be the first output stream if
  12980. activated. Default is @code{0}.
  12981. @item size
  12982. Set the video size. This option is for video only. For the syntax of this
  12983. option, check the
  12984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12985. Default and minimum resolution is @code{640x480}.
  12986. @item meter
  12987. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12988. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12989. other integer value between this range is allowed.
  12990. @item metadata
  12991. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12992. into 100ms output frames, each of them containing various loudness information
  12993. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12994. Default is @code{0}.
  12995. @item framelog
  12996. Force the frame logging level.
  12997. Available values are:
  12998. @table @samp
  12999. @item info
  13000. information logging level
  13001. @item verbose
  13002. verbose logging level
  13003. @end table
  13004. By default, the logging level is set to @var{info}. If the @option{video} or
  13005. the @option{metadata} options are set, it switches to @var{verbose}.
  13006. @item peak
  13007. Set peak mode(s).
  13008. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13009. values are:
  13010. @table @samp
  13011. @item none
  13012. Disable any peak mode (default).
  13013. @item sample
  13014. Enable sample-peak mode.
  13015. Simple peak mode looking for the higher sample value. It logs a message
  13016. for sample-peak (identified by @code{SPK}).
  13017. @item true
  13018. Enable true-peak mode.
  13019. If enabled, the peak lookup is done on an over-sampled version of the input
  13020. stream for better peak accuracy. It logs a message for true-peak.
  13021. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13022. This mode requires a build with @code{libswresample}.
  13023. @end table
  13024. @item dualmono
  13025. Treat mono input files as "dual mono". If a mono file is intended for playback
  13026. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13027. If set to @code{true}, this option will compensate for this effect.
  13028. Multi-channel input files are not affected by this option.
  13029. @item panlaw
  13030. Set a specific pan law to be used for the measurement of dual mono files.
  13031. This parameter is optional, and has a default value of -3.01dB.
  13032. @end table
  13033. @subsection Examples
  13034. @itemize
  13035. @item
  13036. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13037. @example
  13038. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13039. @end example
  13040. @item
  13041. Run an analysis with @command{ffmpeg}:
  13042. @example
  13043. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13044. @end example
  13045. @end itemize
  13046. @section interleave, ainterleave
  13047. Temporally interleave frames from several inputs.
  13048. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13049. These filters read frames from several inputs and send the oldest
  13050. queued frame to the output.
  13051. Input streams must have well defined, monotonically increasing frame
  13052. timestamp values.
  13053. In order to submit one frame to output, these filters need to enqueue
  13054. at least one frame for each input, so they cannot work in case one
  13055. input is not yet terminated and will not receive incoming frames.
  13056. For example consider the case when one input is a @code{select} filter
  13057. which always drops input frames. The @code{interleave} filter will keep
  13058. reading from that input, but it will never be able to send new frames
  13059. to output until the input sends an end-of-stream signal.
  13060. Also, depending on inputs synchronization, the filters will drop
  13061. frames in case one input receives more frames than the other ones, and
  13062. the queue is already filled.
  13063. These filters accept the following options:
  13064. @table @option
  13065. @item nb_inputs, n
  13066. Set the number of different inputs, it is 2 by default.
  13067. @end table
  13068. @subsection Examples
  13069. @itemize
  13070. @item
  13071. Interleave frames belonging to different streams using @command{ffmpeg}:
  13072. @example
  13073. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13074. @end example
  13075. @item
  13076. Add flickering blur effect:
  13077. @example
  13078. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13079. @end example
  13080. @end itemize
  13081. @section metadata, ametadata
  13082. Manipulate frame metadata.
  13083. This filter accepts the following options:
  13084. @table @option
  13085. @item mode
  13086. Set mode of operation of the filter.
  13087. Can be one of the following:
  13088. @table @samp
  13089. @item select
  13090. If both @code{value} and @code{key} is set, select frames
  13091. which have such metadata. If only @code{key} is set, select
  13092. every frame that has such key in metadata.
  13093. @item add
  13094. Add new metadata @code{key} and @code{value}. If key is already available
  13095. do nothing.
  13096. @item modify
  13097. Modify value of already present key.
  13098. @item delete
  13099. If @code{value} is set, delete only keys that have such value.
  13100. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13101. the frame.
  13102. @item print
  13103. Print key and its value if metadata was found. If @code{key} is not set print all
  13104. metadata values available in frame.
  13105. @end table
  13106. @item key
  13107. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13108. @item value
  13109. Set metadata value which will be used. This option is mandatory for
  13110. @code{modify} and @code{add} mode.
  13111. @item function
  13112. Which function to use when comparing metadata value and @code{value}.
  13113. Can be one of following:
  13114. @table @samp
  13115. @item same_str
  13116. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13117. @item starts_with
  13118. Values are interpreted as strings, returns true if metadata value starts with
  13119. the @code{value} option string.
  13120. @item less
  13121. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13122. @item equal
  13123. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13124. @item greater
  13125. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13126. @item expr
  13127. Values are interpreted as floats, returns true if expression from option @code{expr}
  13128. evaluates to true.
  13129. @end table
  13130. @item expr
  13131. Set expression which is used when @code{function} is set to @code{expr}.
  13132. The expression is evaluated through the eval API and can contain the following
  13133. constants:
  13134. @table @option
  13135. @item VALUE1
  13136. Float representation of @code{value} from metadata key.
  13137. @item VALUE2
  13138. Float representation of @code{value} as supplied by user in @code{value} option.
  13139. @end table
  13140. @item file
  13141. If specified in @code{print} mode, output is written to the named file. Instead of
  13142. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13143. for standard output. If @code{file} option is not set, output is written to the log
  13144. with AV_LOG_INFO loglevel.
  13145. @end table
  13146. @subsection Examples
  13147. @itemize
  13148. @item
  13149. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13150. between 0 and 1.
  13151. @example
  13152. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13153. @end example
  13154. @item
  13155. Print silencedetect output to file @file{metadata.txt}.
  13156. @example
  13157. silencedetect,ametadata=mode=print:file=metadata.txt
  13158. @end example
  13159. @item
  13160. Direct all metadata to a pipe with file descriptor 4.
  13161. @example
  13162. metadata=mode=print:file='pipe\:4'
  13163. @end example
  13164. @end itemize
  13165. @section perms, aperms
  13166. Set read/write permissions for the output frames.
  13167. These filters are mainly aimed at developers to test direct path in the
  13168. following filter in the filtergraph.
  13169. The filters accept the following options:
  13170. @table @option
  13171. @item mode
  13172. Select the permissions mode.
  13173. It accepts the following values:
  13174. @table @samp
  13175. @item none
  13176. Do nothing. This is the default.
  13177. @item ro
  13178. Set all the output frames read-only.
  13179. @item rw
  13180. Set all the output frames directly writable.
  13181. @item toggle
  13182. Make the frame read-only if writable, and writable if read-only.
  13183. @item random
  13184. Set each output frame read-only or writable randomly.
  13185. @end table
  13186. @item seed
  13187. Set the seed for the @var{random} mode, must be an integer included between
  13188. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13189. @code{-1}, the filter will try to use a good random seed on a best effort
  13190. basis.
  13191. @end table
  13192. Note: in case of auto-inserted filter between the permission filter and the
  13193. following one, the permission might not be received as expected in that
  13194. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13195. perms/aperms filter can avoid this problem.
  13196. @section realtime, arealtime
  13197. Slow down filtering to match real time approximatively.
  13198. These filters will pause the filtering for a variable amount of time to
  13199. match the output rate with the input timestamps.
  13200. They are similar to the @option{re} option to @code{ffmpeg}.
  13201. They accept the following options:
  13202. @table @option
  13203. @item limit
  13204. Time limit for the pauses. Any pause longer than that will be considered
  13205. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13206. @end table
  13207. @anchor{select}
  13208. @section select, aselect
  13209. Select frames to pass in output.
  13210. This filter accepts the following options:
  13211. @table @option
  13212. @item expr, e
  13213. Set expression, which is evaluated for each input frame.
  13214. If the expression is evaluated to zero, the frame is discarded.
  13215. If the evaluation result is negative or NaN, the frame is sent to the
  13216. first output; otherwise it is sent to the output with index
  13217. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13218. For example a value of @code{1.2} corresponds to the output with index
  13219. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13220. @item outputs, n
  13221. Set the number of outputs. The output to which to send the selected
  13222. frame is based on the result of the evaluation. Default value is 1.
  13223. @end table
  13224. The expression can contain the following constants:
  13225. @table @option
  13226. @item n
  13227. The (sequential) number of the filtered frame, starting from 0.
  13228. @item selected_n
  13229. The (sequential) number of the selected frame, starting from 0.
  13230. @item prev_selected_n
  13231. The sequential number of the last selected frame. It's NAN if undefined.
  13232. @item TB
  13233. The timebase of the input timestamps.
  13234. @item pts
  13235. The PTS (Presentation TimeStamp) of the filtered video frame,
  13236. expressed in @var{TB} units. It's NAN if undefined.
  13237. @item t
  13238. The PTS of the filtered video frame,
  13239. expressed in seconds. It's NAN if undefined.
  13240. @item prev_pts
  13241. The PTS of the previously filtered video frame. It's NAN if undefined.
  13242. @item prev_selected_pts
  13243. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13244. @item prev_selected_t
  13245. The PTS of the last previously selected video frame. It's NAN if undefined.
  13246. @item start_pts
  13247. The PTS of the first video frame in the video. It's NAN if undefined.
  13248. @item start_t
  13249. The time of the first video frame in the video. It's NAN if undefined.
  13250. @item pict_type @emph{(video only)}
  13251. The type of the filtered frame. It can assume one of the following
  13252. values:
  13253. @table @option
  13254. @item I
  13255. @item P
  13256. @item B
  13257. @item S
  13258. @item SI
  13259. @item SP
  13260. @item BI
  13261. @end table
  13262. @item interlace_type @emph{(video only)}
  13263. The frame interlace type. It can assume one of the following values:
  13264. @table @option
  13265. @item PROGRESSIVE
  13266. The frame is progressive (not interlaced).
  13267. @item TOPFIRST
  13268. The frame is top-field-first.
  13269. @item BOTTOMFIRST
  13270. The frame is bottom-field-first.
  13271. @end table
  13272. @item consumed_sample_n @emph{(audio only)}
  13273. the number of selected samples before the current frame
  13274. @item samples_n @emph{(audio only)}
  13275. the number of samples in the current frame
  13276. @item sample_rate @emph{(audio only)}
  13277. the input sample rate
  13278. @item key
  13279. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13280. @item pos
  13281. the position in the file of the filtered frame, -1 if the information
  13282. is not available (e.g. for synthetic video)
  13283. @item scene @emph{(video only)}
  13284. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13285. probability for the current frame to introduce a new scene, while a higher
  13286. value means the current frame is more likely to be one (see the example below)
  13287. @item concatdec_select
  13288. The concat demuxer can select only part of a concat input file by setting an
  13289. inpoint and an outpoint, but the output packets may not be entirely contained
  13290. in the selected interval. By using this variable, it is possible to skip frames
  13291. generated by the concat demuxer which are not exactly contained in the selected
  13292. interval.
  13293. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13294. and the @var{lavf.concat.duration} packet metadata values which are also
  13295. present in the decoded frames.
  13296. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13297. start_time and either the duration metadata is missing or the frame pts is less
  13298. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13299. missing.
  13300. That basically means that an input frame is selected if its pts is within the
  13301. interval set by the concat demuxer.
  13302. @end table
  13303. The default value of the select expression is "1".
  13304. @subsection Examples
  13305. @itemize
  13306. @item
  13307. Select all frames in input:
  13308. @example
  13309. select
  13310. @end example
  13311. The example above is the same as:
  13312. @example
  13313. select=1
  13314. @end example
  13315. @item
  13316. Skip all frames:
  13317. @example
  13318. select=0
  13319. @end example
  13320. @item
  13321. Select only I-frames:
  13322. @example
  13323. select='eq(pict_type\,I)'
  13324. @end example
  13325. @item
  13326. Select one frame every 100:
  13327. @example
  13328. select='not(mod(n\,100))'
  13329. @end example
  13330. @item
  13331. Select only frames contained in the 10-20 time interval:
  13332. @example
  13333. select=between(t\,10\,20)
  13334. @end example
  13335. @item
  13336. Select only I-frames contained in the 10-20 time interval:
  13337. @example
  13338. select=between(t\,10\,20)*eq(pict_type\,I)
  13339. @end example
  13340. @item
  13341. Select frames with a minimum distance of 10 seconds:
  13342. @example
  13343. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13344. @end example
  13345. @item
  13346. Use aselect to select only audio frames with samples number > 100:
  13347. @example
  13348. aselect='gt(samples_n\,100)'
  13349. @end example
  13350. @item
  13351. Create a mosaic of the first scenes:
  13352. @example
  13353. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13354. @end example
  13355. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13356. choice.
  13357. @item
  13358. Send even and odd frames to separate outputs, and compose them:
  13359. @example
  13360. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13361. @end example
  13362. @item
  13363. Select useful frames from an ffconcat file which is using inpoints and
  13364. outpoints but where the source files are not intra frame only.
  13365. @example
  13366. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13367. @end example
  13368. @end itemize
  13369. @section sendcmd, asendcmd
  13370. Send commands to filters in the filtergraph.
  13371. These filters read commands to be sent to other filters in the
  13372. filtergraph.
  13373. @code{sendcmd} must be inserted between two video filters,
  13374. @code{asendcmd} must be inserted between two audio filters, but apart
  13375. from that they act the same way.
  13376. The specification of commands can be provided in the filter arguments
  13377. with the @var{commands} option, or in a file specified by the
  13378. @var{filename} option.
  13379. These filters accept the following options:
  13380. @table @option
  13381. @item commands, c
  13382. Set the commands to be read and sent to the other filters.
  13383. @item filename, f
  13384. Set the filename of the commands to be read and sent to the other
  13385. filters.
  13386. @end table
  13387. @subsection Commands syntax
  13388. A commands description consists of a sequence of interval
  13389. specifications, comprising a list of commands to be executed when a
  13390. particular event related to that interval occurs. The occurring event
  13391. is typically the current frame time entering or leaving a given time
  13392. interval.
  13393. An interval is specified by the following syntax:
  13394. @example
  13395. @var{START}[-@var{END}] @var{COMMANDS};
  13396. @end example
  13397. The time interval is specified by the @var{START} and @var{END} times.
  13398. @var{END} is optional and defaults to the maximum time.
  13399. The current frame time is considered within the specified interval if
  13400. it is included in the interval [@var{START}, @var{END}), that is when
  13401. the time is greater or equal to @var{START} and is lesser than
  13402. @var{END}.
  13403. @var{COMMANDS} consists of a sequence of one or more command
  13404. specifications, separated by ",", relating to that interval. The
  13405. syntax of a command specification is given by:
  13406. @example
  13407. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13408. @end example
  13409. @var{FLAGS} is optional and specifies the type of events relating to
  13410. the time interval which enable sending the specified command, and must
  13411. be a non-null sequence of identifier flags separated by "+" or "|" and
  13412. enclosed between "[" and "]".
  13413. The following flags are recognized:
  13414. @table @option
  13415. @item enter
  13416. The command is sent when the current frame timestamp enters the
  13417. specified interval. In other words, the command is sent when the
  13418. previous frame timestamp was not in the given interval, and the
  13419. current is.
  13420. @item leave
  13421. The command is sent when the current frame timestamp leaves the
  13422. specified interval. In other words, the command is sent when the
  13423. previous frame timestamp was in the given interval, and the
  13424. current is not.
  13425. @end table
  13426. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13427. assumed.
  13428. @var{TARGET} specifies the target of the command, usually the name of
  13429. the filter class or a specific filter instance name.
  13430. @var{COMMAND} specifies the name of the command for the target filter.
  13431. @var{ARG} is optional and specifies the optional list of argument for
  13432. the given @var{COMMAND}.
  13433. Between one interval specification and another, whitespaces, or
  13434. sequences of characters starting with @code{#} until the end of line,
  13435. are ignored and can be used to annotate comments.
  13436. A simplified BNF description of the commands specification syntax
  13437. follows:
  13438. @example
  13439. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13440. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13441. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13442. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13443. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13444. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13445. @end example
  13446. @subsection Examples
  13447. @itemize
  13448. @item
  13449. Specify audio tempo change at second 4:
  13450. @example
  13451. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13452. @end example
  13453. @item
  13454. Target a specific filter instance:
  13455. @example
  13456. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13457. @end example
  13458. @item
  13459. Specify a list of drawtext and hue commands in a file.
  13460. @example
  13461. # show text in the interval 5-10
  13462. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13463. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13464. # desaturate the image in the interval 15-20
  13465. 15.0-20.0 [enter] hue s 0,
  13466. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13467. [leave] hue s 1,
  13468. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13469. # apply an exponential saturation fade-out effect, starting from time 25
  13470. 25 [enter] hue s exp(25-t)
  13471. @end example
  13472. A filtergraph allowing to read and process the above command list
  13473. stored in a file @file{test.cmd}, can be specified with:
  13474. @example
  13475. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13476. @end example
  13477. @end itemize
  13478. @anchor{setpts}
  13479. @section setpts, asetpts
  13480. Change the PTS (presentation timestamp) of the input frames.
  13481. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13482. This filter accepts the following options:
  13483. @table @option
  13484. @item expr
  13485. The expression which is evaluated for each frame to construct its timestamp.
  13486. @end table
  13487. The expression is evaluated through the eval API and can contain the following
  13488. constants:
  13489. @table @option
  13490. @item FRAME_RATE
  13491. frame rate, only defined for constant frame-rate video
  13492. @item PTS
  13493. The presentation timestamp in input
  13494. @item N
  13495. The count of the input frame for video or the number of consumed samples,
  13496. not including the current frame for audio, starting from 0.
  13497. @item NB_CONSUMED_SAMPLES
  13498. The number of consumed samples, not including the current frame (only
  13499. audio)
  13500. @item NB_SAMPLES, S
  13501. The number of samples in the current frame (only audio)
  13502. @item SAMPLE_RATE, SR
  13503. The audio sample rate.
  13504. @item STARTPTS
  13505. The PTS of the first frame.
  13506. @item STARTT
  13507. the time in seconds of the first frame
  13508. @item INTERLACED
  13509. State whether the current frame is interlaced.
  13510. @item T
  13511. the time in seconds of the current frame
  13512. @item POS
  13513. original position in the file of the frame, or undefined if undefined
  13514. for the current frame
  13515. @item PREV_INPTS
  13516. The previous input PTS.
  13517. @item PREV_INT
  13518. previous input time in seconds
  13519. @item PREV_OUTPTS
  13520. The previous output PTS.
  13521. @item PREV_OUTT
  13522. previous output time in seconds
  13523. @item RTCTIME
  13524. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13525. instead.
  13526. @item RTCSTART
  13527. The wallclock (RTC) time at the start of the movie in microseconds.
  13528. @item TB
  13529. The timebase of the input timestamps.
  13530. @end table
  13531. @subsection Examples
  13532. @itemize
  13533. @item
  13534. Start counting PTS from zero
  13535. @example
  13536. setpts=PTS-STARTPTS
  13537. @end example
  13538. @item
  13539. Apply fast motion effect:
  13540. @example
  13541. setpts=0.5*PTS
  13542. @end example
  13543. @item
  13544. Apply slow motion effect:
  13545. @example
  13546. setpts=2.0*PTS
  13547. @end example
  13548. @item
  13549. Set fixed rate of 25 frames per second:
  13550. @example
  13551. setpts=N/(25*TB)
  13552. @end example
  13553. @item
  13554. Set fixed rate 25 fps with some jitter:
  13555. @example
  13556. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13557. @end example
  13558. @item
  13559. Apply an offset of 10 seconds to the input PTS:
  13560. @example
  13561. setpts=PTS+10/TB
  13562. @end example
  13563. @item
  13564. Generate timestamps from a "live source" and rebase onto the current timebase:
  13565. @example
  13566. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13567. @end example
  13568. @item
  13569. Generate timestamps by counting samples:
  13570. @example
  13571. asetpts=N/SR/TB
  13572. @end example
  13573. @end itemize
  13574. @section settb, asettb
  13575. Set the timebase to use for the output frames timestamps.
  13576. It is mainly useful for testing timebase configuration.
  13577. It accepts the following parameters:
  13578. @table @option
  13579. @item expr, tb
  13580. The expression which is evaluated into the output timebase.
  13581. @end table
  13582. The value for @option{tb} is an arithmetic expression representing a
  13583. rational. The expression can contain the constants "AVTB" (the default
  13584. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13585. audio only). Default value is "intb".
  13586. @subsection Examples
  13587. @itemize
  13588. @item
  13589. Set the timebase to 1/25:
  13590. @example
  13591. settb=expr=1/25
  13592. @end example
  13593. @item
  13594. Set the timebase to 1/10:
  13595. @example
  13596. settb=expr=0.1
  13597. @end example
  13598. @item
  13599. Set the timebase to 1001/1000:
  13600. @example
  13601. settb=1+0.001
  13602. @end example
  13603. @item
  13604. Set the timebase to 2*intb:
  13605. @example
  13606. settb=2*intb
  13607. @end example
  13608. @item
  13609. Set the default timebase value:
  13610. @example
  13611. settb=AVTB
  13612. @end example
  13613. @end itemize
  13614. @section showcqt
  13615. Convert input audio to a video output representing frequency spectrum
  13616. logarithmically using Brown-Puckette constant Q transform algorithm with
  13617. direct frequency domain coefficient calculation (but the transform itself
  13618. is not really constant Q, instead the Q factor is actually variable/clamped),
  13619. with musical tone scale, from E0 to D#10.
  13620. The filter accepts the following options:
  13621. @table @option
  13622. @item size, s
  13623. Specify the video size for the output. It must be even. For the syntax of this option,
  13624. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13625. Default value is @code{1920x1080}.
  13626. @item fps, rate, r
  13627. Set the output frame rate. Default value is @code{25}.
  13628. @item bar_h
  13629. Set the bargraph height. It must be even. Default value is @code{-1} which
  13630. computes the bargraph height automatically.
  13631. @item axis_h
  13632. Set the axis height. It must be even. Default value is @code{-1} which computes
  13633. the axis height automatically.
  13634. @item sono_h
  13635. Set the sonogram height. It must be even. Default value is @code{-1} which
  13636. computes the sonogram height automatically.
  13637. @item fullhd
  13638. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13639. instead. Default value is @code{1}.
  13640. @item sono_v, volume
  13641. Specify the sonogram volume expression. It can contain variables:
  13642. @table @option
  13643. @item bar_v
  13644. the @var{bar_v} evaluated expression
  13645. @item frequency, freq, f
  13646. the frequency where it is evaluated
  13647. @item timeclamp, tc
  13648. the value of @var{timeclamp} option
  13649. @end table
  13650. and functions:
  13651. @table @option
  13652. @item a_weighting(f)
  13653. A-weighting of equal loudness
  13654. @item b_weighting(f)
  13655. B-weighting of equal loudness
  13656. @item c_weighting(f)
  13657. C-weighting of equal loudness.
  13658. @end table
  13659. Default value is @code{16}.
  13660. @item bar_v, volume2
  13661. Specify the bargraph volume expression. It can contain variables:
  13662. @table @option
  13663. @item sono_v
  13664. the @var{sono_v} evaluated expression
  13665. @item frequency, freq, f
  13666. the frequency where it is evaluated
  13667. @item timeclamp, tc
  13668. the value of @var{timeclamp} option
  13669. @end table
  13670. and functions:
  13671. @table @option
  13672. @item a_weighting(f)
  13673. A-weighting of equal loudness
  13674. @item b_weighting(f)
  13675. B-weighting of equal loudness
  13676. @item c_weighting(f)
  13677. C-weighting of equal loudness.
  13678. @end table
  13679. Default value is @code{sono_v}.
  13680. @item sono_g, gamma
  13681. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13682. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13683. Acceptable range is @code{[1, 7]}.
  13684. @item bar_g, gamma2
  13685. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13686. @code{[1, 7]}.
  13687. @item bar_t
  13688. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13689. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13690. @item timeclamp, tc
  13691. Specify the transform timeclamp. At low frequency, there is trade-off between
  13692. accuracy in time domain and frequency domain. If timeclamp is lower,
  13693. event in time domain is represented more accurately (such as fast bass drum),
  13694. otherwise event in frequency domain is represented more accurately
  13695. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13696. @item attack
  13697. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13698. limits future samples by applying asymmetric windowing in time domain, useful
  13699. when low latency is required. Accepted range is @code{[0, 1]}.
  13700. @item basefreq
  13701. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13702. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13703. @item endfreq
  13704. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13705. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13706. @item coeffclamp
  13707. This option is deprecated and ignored.
  13708. @item tlength
  13709. Specify the transform length in time domain. Use this option to control accuracy
  13710. trade-off between time domain and frequency domain at every frequency sample.
  13711. It can contain variables:
  13712. @table @option
  13713. @item frequency, freq, f
  13714. the frequency where it is evaluated
  13715. @item timeclamp, tc
  13716. the value of @var{timeclamp} option.
  13717. @end table
  13718. Default value is @code{384*tc/(384+tc*f)}.
  13719. @item count
  13720. Specify the transform count for every video frame. Default value is @code{6}.
  13721. Acceptable range is @code{[1, 30]}.
  13722. @item fcount
  13723. Specify the transform count for every single pixel. Default value is @code{0},
  13724. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13725. @item fontfile
  13726. Specify font file for use with freetype to draw the axis. If not specified,
  13727. use embedded font. Note that drawing with font file or embedded font is not
  13728. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13729. option instead.
  13730. @item font
  13731. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13732. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13733. @item fontcolor
  13734. Specify font color expression. This is arithmetic expression that should return
  13735. integer value 0xRRGGBB. It can contain variables:
  13736. @table @option
  13737. @item frequency, freq, f
  13738. the frequency where it is evaluated
  13739. @item timeclamp, tc
  13740. the value of @var{timeclamp} option
  13741. @end table
  13742. and functions:
  13743. @table @option
  13744. @item midi(f)
  13745. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13746. @item r(x), g(x), b(x)
  13747. red, green, and blue value of intensity x.
  13748. @end table
  13749. Default value is @code{st(0, (midi(f)-59.5)/12);
  13750. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13751. r(1-ld(1)) + b(ld(1))}.
  13752. @item axisfile
  13753. Specify image file to draw the axis. This option override @var{fontfile} and
  13754. @var{fontcolor} option.
  13755. @item axis, text
  13756. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13757. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13758. Default value is @code{1}.
  13759. @item csp
  13760. Set colorspace. The accepted values are:
  13761. @table @samp
  13762. @item unspecified
  13763. Unspecified (default)
  13764. @item bt709
  13765. BT.709
  13766. @item fcc
  13767. FCC
  13768. @item bt470bg
  13769. BT.470BG or BT.601-6 625
  13770. @item smpte170m
  13771. SMPTE-170M or BT.601-6 525
  13772. @item smpte240m
  13773. SMPTE-240M
  13774. @item bt2020ncl
  13775. BT.2020 with non-constant luminance
  13776. @end table
  13777. @item cscheme
  13778. Set spectrogram color scheme. This is list of floating point values with format
  13779. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13780. The default is @code{1|0.5|0|0|0.5|1}.
  13781. @end table
  13782. @subsection Examples
  13783. @itemize
  13784. @item
  13785. Playing audio while showing the spectrum:
  13786. @example
  13787. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13788. @end example
  13789. @item
  13790. Same as above, but with frame rate 30 fps:
  13791. @example
  13792. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13793. @end example
  13794. @item
  13795. Playing at 1280x720:
  13796. @example
  13797. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13798. @end example
  13799. @item
  13800. Disable sonogram display:
  13801. @example
  13802. sono_h=0
  13803. @end example
  13804. @item
  13805. A1 and its harmonics: A1, A2, (near)E3, A3:
  13806. @example
  13807. 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),
  13808. asplit[a][out1]; [a] showcqt [out0]'
  13809. @end example
  13810. @item
  13811. Same as above, but with more accuracy in frequency domain:
  13812. @example
  13813. 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),
  13814. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13815. @end example
  13816. @item
  13817. Custom volume:
  13818. @example
  13819. bar_v=10:sono_v=bar_v*a_weighting(f)
  13820. @end example
  13821. @item
  13822. Custom gamma, now spectrum is linear to the amplitude.
  13823. @example
  13824. bar_g=2:sono_g=2
  13825. @end example
  13826. @item
  13827. Custom tlength equation:
  13828. @example
  13829. 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)))'
  13830. @end example
  13831. @item
  13832. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13833. @example
  13834. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13835. @end example
  13836. @item
  13837. Custom font using fontconfig:
  13838. @example
  13839. font='Courier New,Monospace,mono|bold'
  13840. @end example
  13841. @item
  13842. Custom frequency range with custom axis using image file:
  13843. @example
  13844. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13845. @end example
  13846. @end itemize
  13847. @section showfreqs
  13848. Convert input audio to video output representing the audio power spectrum.
  13849. Audio amplitude is on Y-axis while frequency is on X-axis.
  13850. The filter accepts the following options:
  13851. @table @option
  13852. @item size, s
  13853. Specify size of video. For the syntax of this option, check the
  13854. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13855. Default is @code{1024x512}.
  13856. @item mode
  13857. Set display mode.
  13858. This set how each frequency bin will be represented.
  13859. It accepts the following values:
  13860. @table @samp
  13861. @item line
  13862. @item bar
  13863. @item dot
  13864. @end table
  13865. Default is @code{bar}.
  13866. @item ascale
  13867. Set amplitude scale.
  13868. It accepts the following values:
  13869. @table @samp
  13870. @item lin
  13871. Linear scale.
  13872. @item sqrt
  13873. Square root scale.
  13874. @item cbrt
  13875. Cubic root scale.
  13876. @item log
  13877. Logarithmic scale.
  13878. @end table
  13879. Default is @code{log}.
  13880. @item fscale
  13881. Set frequency scale.
  13882. It accepts the following values:
  13883. @table @samp
  13884. @item lin
  13885. Linear scale.
  13886. @item log
  13887. Logarithmic scale.
  13888. @item rlog
  13889. Reverse logarithmic scale.
  13890. @end table
  13891. Default is @code{lin}.
  13892. @item win_size
  13893. Set window size.
  13894. It accepts the following values:
  13895. @table @samp
  13896. @item w16
  13897. @item w32
  13898. @item w64
  13899. @item w128
  13900. @item w256
  13901. @item w512
  13902. @item w1024
  13903. @item w2048
  13904. @item w4096
  13905. @item w8192
  13906. @item w16384
  13907. @item w32768
  13908. @item w65536
  13909. @end table
  13910. Default is @code{w2048}
  13911. @item win_func
  13912. Set windowing function.
  13913. It accepts the following values:
  13914. @table @samp
  13915. @item rect
  13916. @item bartlett
  13917. @item hanning
  13918. @item hamming
  13919. @item blackman
  13920. @item welch
  13921. @item flattop
  13922. @item bharris
  13923. @item bnuttall
  13924. @item bhann
  13925. @item sine
  13926. @item nuttall
  13927. @item lanczos
  13928. @item gauss
  13929. @item tukey
  13930. @item dolph
  13931. @item cauchy
  13932. @item parzen
  13933. @item poisson
  13934. @end table
  13935. Default is @code{hanning}.
  13936. @item overlap
  13937. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13938. which means optimal overlap for selected window function will be picked.
  13939. @item averaging
  13940. Set time averaging. Setting this to 0 will display current maximal peaks.
  13941. Default is @code{1}, which means time averaging is disabled.
  13942. @item colors
  13943. Specify list of colors separated by space or by '|' which will be used to
  13944. draw channel frequencies. Unrecognized or missing colors will be replaced
  13945. by white color.
  13946. @item cmode
  13947. Set channel display mode.
  13948. It accepts the following values:
  13949. @table @samp
  13950. @item combined
  13951. @item separate
  13952. @end table
  13953. Default is @code{combined}.
  13954. @item minamp
  13955. Set minimum amplitude used in @code{log} amplitude scaler.
  13956. @end table
  13957. @anchor{showspectrum}
  13958. @section showspectrum
  13959. Convert input audio to a video output, representing the audio frequency
  13960. spectrum.
  13961. The filter accepts the following options:
  13962. @table @option
  13963. @item size, s
  13964. Specify the video size for the output. For the syntax of this option, check the
  13965. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13966. Default value is @code{640x512}.
  13967. @item slide
  13968. Specify how the spectrum should slide along the window.
  13969. It accepts the following values:
  13970. @table @samp
  13971. @item replace
  13972. the samples start again on the left when they reach the right
  13973. @item scroll
  13974. the samples scroll from right to left
  13975. @item fullframe
  13976. frames are only produced when the samples reach the right
  13977. @item rscroll
  13978. the samples scroll from left to right
  13979. @end table
  13980. Default value is @code{replace}.
  13981. @item mode
  13982. Specify display mode.
  13983. It accepts the following values:
  13984. @table @samp
  13985. @item combined
  13986. all channels are displayed in the same row
  13987. @item separate
  13988. all channels are displayed in separate rows
  13989. @end table
  13990. Default value is @samp{combined}.
  13991. @item color
  13992. Specify display color mode.
  13993. It accepts the following values:
  13994. @table @samp
  13995. @item channel
  13996. each channel is displayed in a separate color
  13997. @item intensity
  13998. each channel is displayed using the same color scheme
  13999. @item rainbow
  14000. each channel is displayed using the rainbow color scheme
  14001. @item moreland
  14002. each channel is displayed using the moreland color scheme
  14003. @item nebulae
  14004. each channel is displayed using the nebulae color scheme
  14005. @item fire
  14006. each channel is displayed using the fire color scheme
  14007. @item fiery
  14008. each channel is displayed using the fiery color scheme
  14009. @item fruit
  14010. each channel is displayed using the fruit color scheme
  14011. @item cool
  14012. each channel is displayed using the cool color scheme
  14013. @end table
  14014. Default value is @samp{channel}.
  14015. @item scale
  14016. Specify scale used for calculating intensity color values.
  14017. It accepts the following values:
  14018. @table @samp
  14019. @item lin
  14020. linear
  14021. @item sqrt
  14022. square root, default
  14023. @item cbrt
  14024. cubic root
  14025. @item log
  14026. logarithmic
  14027. @item 4thrt
  14028. 4th root
  14029. @item 5thrt
  14030. 5th root
  14031. @end table
  14032. Default value is @samp{sqrt}.
  14033. @item saturation
  14034. Set saturation modifier for displayed colors. Negative values provide
  14035. alternative color scheme. @code{0} is no saturation at all.
  14036. Saturation must be in [-10.0, 10.0] range.
  14037. Default value is @code{1}.
  14038. @item win_func
  14039. Set window function.
  14040. It accepts the following values:
  14041. @table @samp
  14042. @item rect
  14043. @item bartlett
  14044. @item hann
  14045. @item hanning
  14046. @item hamming
  14047. @item blackman
  14048. @item welch
  14049. @item flattop
  14050. @item bharris
  14051. @item bnuttall
  14052. @item bhann
  14053. @item sine
  14054. @item nuttall
  14055. @item lanczos
  14056. @item gauss
  14057. @item tukey
  14058. @item dolph
  14059. @item cauchy
  14060. @item parzen
  14061. @item poisson
  14062. @end table
  14063. Default value is @code{hann}.
  14064. @item orientation
  14065. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14066. @code{horizontal}. Default is @code{vertical}.
  14067. @item overlap
  14068. Set ratio of overlap window. Default value is @code{0}.
  14069. When value is @code{1} overlap is set to recommended size for specific
  14070. window function currently used.
  14071. @item gain
  14072. Set scale gain for calculating intensity color values.
  14073. Default value is @code{1}.
  14074. @item data
  14075. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14076. @item rotation
  14077. Set color rotation, must be in [-1.0, 1.0] range.
  14078. Default value is @code{0}.
  14079. @end table
  14080. The usage is very similar to the showwaves filter; see the examples in that
  14081. section.
  14082. @subsection Examples
  14083. @itemize
  14084. @item
  14085. Large window with logarithmic color scaling:
  14086. @example
  14087. showspectrum=s=1280x480:scale=log
  14088. @end example
  14089. @item
  14090. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14091. @example
  14092. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14093. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14094. @end example
  14095. @end itemize
  14096. @section showspectrumpic
  14097. Convert input audio to a single video frame, representing the audio frequency
  14098. spectrum.
  14099. The filter accepts the following options:
  14100. @table @option
  14101. @item size, s
  14102. Specify the video size for the output. For the syntax of this option, check the
  14103. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14104. Default value is @code{4096x2048}.
  14105. @item mode
  14106. Specify display mode.
  14107. It accepts the following values:
  14108. @table @samp
  14109. @item combined
  14110. all channels are displayed in the same row
  14111. @item separate
  14112. all channels are displayed in separate rows
  14113. @end table
  14114. Default value is @samp{combined}.
  14115. @item color
  14116. Specify display color mode.
  14117. It accepts the following values:
  14118. @table @samp
  14119. @item channel
  14120. each channel is displayed in a separate color
  14121. @item intensity
  14122. each channel is displayed using the same color scheme
  14123. @item rainbow
  14124. each channel is displayed using the rainbow color scheme
  14125. @item moreland
  14126. each channel is displayed using the moreland color scheme
  14127. @item nebulae
  14128. each channel is displayed using the nebulae color scheme
  14129. @item fire
  14130. each channel is displayed using the fire color scheme
  14131. @item fiery
  14132. each channel is displayed using the fiery color scheme
  14133. @item fruit
  14134. each channel is displayed using the fruit color scheme
  14135. @item cool
  14136. each channel is displayed using the cool color scheme
  14137. @end table
  14138. Default value is @samp{intensity}.
  14139. @item scale
  14140. Specify scale used for calculating intensity color values.
  14141. It accepts the following values:
  14142. @table @samp
  14143. @item lin
  14144. linear
  14145. @item sqrt
  14146. square root, default
  14147. @item cbrt
  14148. cubic root
  14149. @item log
  14150. logarithmic
  14151. @item 4thrt
  14152. 4th root
  14153. @item 5thrt
  14154. 5th root
  14155. @end table
  14156. Default value is @samp{log}.
  14157. @item saturation
  14158. Set saturation modifier for displayed colors. Negative values provide
  14159. alternative color scheme. @code{0} is no saturation at all.
  14160. Saturation must be in [-10.0, 10.0] range.
  14161. Default value is @code{1}.
  14162. @item win_func
  14163. Set window function.
  14164. It accepts the following values:
  14165. @table @samp
  14166. @item rect
  14167. @item bartlett
  14168. @item hann
  14169. @item hanning
  14170. @item hamming
  14171. @item blackman
  14172. @item welch
  14173. @item flattop
  14174. @item bharris
  14175. @item bnuttall
  14176. @item bhann
  14177. @item sine
  14178. @item nuttall
  14179. @item lanczos
  14180. @item gauss
  14181. @item tukey
  14182. @item dolph
  14183. @item cauchy
  14184. @item parzen
  14185. @item poisson
  14186. @end table
  14187. Default value is @code{hann}.
  14188. @item orientation
  14189. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14190. @code{horizontal}. Default is @code{vertical}.
  14191. @item gain
  14192. Set scale gain for calculating intensity color values.
  14193. Default value is @code{1}.
  14194. @item legend
  14195. Draw time and frequency axes and legends. Default is enabled.
  14196. @item rotation
  14197. Set color rotation, must be in [-1.0, 1.0] range.
  14198. Default value is @code{0}.
  14199. @end table
  14200. @subsection Examples
  14201. @itemize
  14202. @item
  14203. Extract an audio spectrogram of a whole audio track
  14204. in a 1024x1024 picture using @command{ffmpeg}:
  14205. @example
  14206. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14207. @end example
  14208. @end itemize
  14209. @section showvolume
  14210. Convert input audio volume to a video output.
  14211. The filter accepts the following options:
  14212. @table @option
  14213. @item rate, r
  14214. Set video rate.
  14215. @item b
  14216. Set border width, allowed range is [0, 5]. Default is 1.
  14217. @item w
  14218. Set channel width, allowed range is [80, 8192]. Default is 400.
  14219. @item h
  14220. Set channel height, allowed range is [1, 900]. Default is 20.
  14221. @item f
  14222. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14223. @item c
  14224. Set volume color expression.
  14225. The expression can use the following variables:
  14226. @table @option
  14227. @item VOLUME
  14228. Current max volume of channel in dB.
  14229. @item PEAK
  14230. Current peak.
  14231. @item CHANNEL
  14232. Current channel number, starting from 0.
  14233. @end table
  14234. @item t
  14235. If set, displays channel names. Default is enabled.
  14236. @item v
  14237. If set, displays volume values. Default is enabled.
  14238. @item o
  14239. Set orientation, can be @code{horizontal} or @code{vertical},
  14240. default is @code{horizontal}.
  14241. @item s
  14242. Set step size, allowed range s [0, 5]. Default is 0, which means
  14243. step is disabled.
  14244. @end table
  14245. @section showwaves
  14246. Convert input audio to a video output, representing the samples waves.
  14247. The filter accepts the following options:
  14248. @table @option
  14249. @item size, s
  14250. Specify the video size for the output. For the syntax of this option, check the
  14251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14252. Default value is @code{600x240}.
  14253. @item mode
  14254. Set display mode.
  14255. Available values are:
  14256. @table @samp
  14257. @item point
  14258. Draw a point for each sample.
  14259. @item line
  14260. Draw a vertical line for each sample.
  14261. @item p2p
  14262. Draw a point for each sample and a line between them.
  14263. @item cline
  14264. Draw a centered vertical line for each sample.
  14265. @end table
  14266. Default value is @code{point}.
  14267. @item n
  14268. Set the number of samples which are printed on the same column. A
  14269. larger value will decrease the frame rate. Must be a positive
  14270. integer. This option can be set only if the value for @var{rate}
  14271. is not explicitly specified.
  14272. @item rate, r
  14273. Set the (approximate) output frame rate. This is done by setting the
  14274. option @var{n}. Default value is "25".
  14275. @item split_channels
  14276. Set if channels should be drawn separately or overlap. Default value is 0.
  14277. @item colors
  14278. Set colors separated by '|' which are going to be used for drawing of each channel.
  14279. @item scale
  14280. Set amplitude scale.
  14281. Available values are:
  14282. @table @samp
  14283. @item lin
  14284. Linear.
  14285. @item log
  14286. Logarithmic.
  14287. @item sqrt
  14288. Square root.
  14289. @item cbrt
  14290. Cubic root.
  14291. @end table
  14292. Default is linear.
  14293. @end table
  14294. @subsection Examples
  14295. @itemize
  14296. @item
  14297. Output the input file audio and the corresponding video representation
  14298. at the same time:
  14299. @example
  14300. amovie=a.mp3,asplit[out0],showwaves[out1]
  14301. @end example
  14302. @item
  14303. Create a synthetic signal and show it with showwaves, forcing a
  14304. frame rate of 30 frames per second:
  14305. @example
  14306. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14307. @end example
  14308. @end itemize
  14309. @section showwavespic
  14310. Convert input audio to a single video frame, representing the samples waves.
  14311. The filter accepts the following options:
  14312. @table @option
  14313. @item size, s
  14314. Specify the video size for the output. For the syntax of this option, check the
  14315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14316. Default value is @code{600x240}.
  14317. @item split_channels
  14318. Set if channels should be drawn separately or overlap. Default value is 0.
  14319. @item colors
  14320. Set colors separated by '|' which are going to be used for drawing of each channel.
  14321. @item scale
  14322. Set amplitude scale.
  14323. Available values are:
  14324. @table @samp
  14325. @item lin
  14326. Linear.
  14327. @item log
  14328. Logarithmic.
  14329. @item sqrt
  14330. Square root.
  14331. @item cbrt
  14332. Cubic root.
  14333. @end table
  14334. Default is linear.
  14335. @end table
  14336. @subsection Examples
  14337. @itemize
  14338. @item
  14339. Extract a channel split representation of the wave form of a whole audio track
  14340. in a 1024x800 picture using @command{ffmpeg}:
  14341. @example
  14342. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14343. @end example
  14344. @end itemize
  14345. @section sidedata, asidedata
  14346. Delete frame side data, or select frames based on it.
  14347. This filter accepts the following options:
  14348. @table @option
  14349. @item mode
  14350. Set mode of operation of the filter.
  14351. Can be one of the following:
  14352. @table @samp
  14353. @item select
  14354. Select every frame with side data of @code{type}.
  14355. @item delete
  14356. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14357. data in the frame.
  14358. @end table
  14359. @item type
  14360. Set side data type used with all modes. Must be set for @code{select} mode. For
  14361. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14362. in @file{libavutil/frame.h}. For example, to choose
  14363. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14364. @end table
  14365. @section spectrumsynth
  14366. Sythesize audio from 2 input video spectrums, first input stream represents
  14367. magnitude across time and second represents phase across time.
  14368. The filter will transform from frequency domain as displayed in videos back
  14369. to time domain as presented in audio output.
  14370. This filter is primarily created for reversing processed @ref{showspectrum}
  14371. filter outputs, but can synthesize sound from other spectrograms too.
  14372. But in such case results are going to be poor if the phase data is not
  14373. available, because in such cases phase data need to be recreated, usually
  14374. its just recreated from random noise.
  14375. For best results use gray only output (@code{channel} color mode in
  14376. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14377. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14378. @code{data} option. Inputs videos should generally use @code{fullframe}
  14379. slide mode as that saves resources needed for decoding video.
  14380. The filter accepts the following options:
  14381. @table @option
  14382. @item sample_rate
  14383. Specify sample rate of output audio, the sample rate of audio from which
  14384. spectrum was generated may differ.
  14385. @item channels
  14386. Set number of channels represented in input video spectrums.
  14387. @item scale
  14388. Set scale which was used when generating magnitude input spectrum.
  14389. Can be @code{lin} or @code{log}. Default is @code{log}.
  14390. @item slide
  14391. Set slide which was used when generating inputs spectrums.
  14392. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14393. Default is @code{fullframe}.
  14394. @item win_func
  14395. Set window function used for resynthesis.
  14396. @item overlap
  14397. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14398. which means optimal overlap for selected window function will be picked.
  14399. @item orientation
  14400. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14401. Default is @code{vertical}.
  14402. @end table
  14403. @subsection Examples
  14404. @itemize
  14405. @item
  14406. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14407. then resynthesize videos back to audio with spectrumsynth:
  14408. @example
  14409. 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
  14410. 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
  14411. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14412. @end example
  14413. @end itemize
  14414. @section split, asplit
  14415. Split input into several identical outputs.
  14416. @code{asplit} works with audio input, @code{split} with video.
  14417. The filter accepts a single parameter which specifies the number of outputs. If
  14418. unspecified, it defaults to 2.
  14419. @subsection Examples
  14420. @itemize
  14421. @item
  14422. Create two separate outputs from the same input:
  14423. @example
  14424. [in] split [out0][out1]
  14425. @end example
  14426. @item
  14427. To create 3 or more outputs, you need to specify the number of
  14428. outputs, like in:
  14429. @example
  14430. [in] asplit=3 [out0][out1][out2]
  14431. @end example
  14432. @item
  14433. Create two separate outputs from the same input, one cropped and
  14434. one padded:
  14435. @example
  14436. [in] split [splitout1][splitout2];
  14437. [splitout1] crop=100:100:0:0 [cropout];
  14438. [splitout2] pad=200:200:100:100 [padout];
  14439. @end example
  14440. @item
  14441. Create 5 copies of the input audio with @command{ffmpeg}:
  14442. @example
  14443. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14444. @end example
  14445. @end itemize
  14446. @section zmq, azmq
  14447. Receive commands sent through a libzmq client, and forward them to
  14448. filters in the filtergraph.
  14449. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14450. must be inserted between two video filters, @code{azmq} between two
  14451. audio filters.
  14452. To enable these filters you need to install the libzmq library and
  14453. headers and configure FFmpeg with @code{--enable-libzmq}.
  14454. For more information about libzmq see:
  14455. @url{http://www.zeromq.org/}
  14456. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14457. receives messages sent through a network interface defined by the
  14458. @option{bind_address} option.
  14459. The received message must be in the form:
  14460. @example
  14461. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14462. @end example
  14463. @var{TARGET} specifies the target of the command, usually the name of
  14464. the filter class or a specific filter instance name.
  14465. @var{COMMAND} specifies the name of the command for the target filter.
  14466. @var{ARG} is optional and specifies the optional argument list for the
  14467. given @var{COMMAND}.
  14468. Upon reception, the message is processed and the corresponding command
  14469. is injected into the filtergraph. Depending on the result, the filter
  14470. will send a reply to the client, adopting the format:
  14471. @example
  14472. @var{ERROR_CODE} @var{ERROR_REASON}
  14473. @var{MESSAGE}
  14474. @end example
  14475. @var{MESSAGE} is optional.
  14476. @subsection Examples
  14477. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14478. be used to send commands processed by these filters.
  14479. Consider the following filtergraph generated by @command{ffplay}
  14480. @example
  14481. ffplay -dumpgraph 1 -f lavfi "
  14482. color=s=100x100:c=red [l];
  14483. color=s=100x100:c=blue [r];
  14484. nullsrc=s=200x100, zmq [bg];
  14485. [bg][l] overlay [bg+l];
  14486. [bg+l][r] overlay=x=100 "
  14487. @end example
  14488. To change the color of the left side of the video, the following
  14489. command can be used:
  14490. @example
  14491. echo Parsed_color_0 c yellow | tools/zmqsend
  14492. @end example
  14493. To change the right side:
  14494. @example
  14495. echo Parsed_color_1 c pink | tools/zmqsend
  14496. @end example
  14497. @c man end MULTIMEDIA FILTERS
  14498. @chapter Multimedia Sources
  14499. @c man begin MULTIMEDIA SOURCES
  14500. Below is a description of the currently available multimedia sources.
  14501. @section amovie
  14502. This is the same as @ref{movie} source, except it selects an audio
  14503. stream by default.
  14504. @anchor{movie}
  14505. @section movie
  14506. Read audio and/or video stream(s) from a movie container.
  14507. It accepts the following parameters:
  14508. @table @option
  14509. @item filename
  14510. The name of the resource to read (not necessarily a file; it can also be a
  14511. device or a stream accessed through some protocol).
  14512. @item format_name, f
  14513. Specifies the format assumed for the movie to read, and can be either
  14514. the name of a container or an input device. If not specified, the
  14515. format is guessed from @var{movie_name} or by probing.
  14516. @item seek_point, sp
  14517. Specifies the seek point in seconds. The frames will be output
  14518. starting from this seek point. The parameter is evaluated with
  14519. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14520. postfix. The default value is "0".
  14521. @item streams, s
  14522. Specifies the streams to read. Several streams can be specified,
  14523. separated by "+". The source will then have as many outputs, in the
  14524. same order. The syntax is explained in the ``Stream specifiers''
  14525. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14526. respectively the default (best suited) video and audio stream. Default
  14527. is "dv", or "da" if the filter is called as "amovie".
  14528. @item stream_index, si
  14529. Specifies the index of the video stream to read. If the value is -1,
  14530. the most suitable video stream will be automatically selected. The default
  14531. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14532. audio instead of video.
  14533. @item loop
  14534. Specifies how many times to read the stream in sequence.
  14535. If the value is 0, the stream will be looped infinitely.
  14536. Default value is "1".
  14537. Note that when the movie is looped the source timestamps are not
  14538. changed, so it will generate non monotonically increasing timestamps.
  14539. @item discontinuity
  14540. Specifies the time difference between frames above which the point is
  14541. considered a timestamp discontinuity which is removed by adjusting the later
  14542. timestamps.
  14543. @end table
  14544. It allows overlaying a second video on top of the main input of
  14545. a filtergraph, as shown in this graph:
  14546. @example
  14547. input -----------> deltapts0 --> overlay --> output
  14548. ^
  14549. |
  14550. movie --> scale--> deltapts1 -------+
  14551. @end example
  14552. @subsection Examples
  14553. @itemize
  14554. @item
  14555. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14556. on top of the input labelled "in":
  14557. @example
  14558. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14559. [in] setpts=PTS-STARTPTS [main];
  14560. [main][over] overlay=16:16 [out]
  14561. @end example
  14562. @item
  14563. Read from a video4linux2 device, and overlay it on top of the input
  14564. labelled "in":
  14565. @example
  14566. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14567. [in] setpts=PTS-STARTPTS [main];
  14568. [main][over] overlay=16:16 [out]
  14569. @end example
  14570. @item
  14571. Read the first video stream and the audio stream with id 0x81 from
  14572. dvd.vob; the video is connected to the pad named "video" and the audio is
  14573. connected to the pad named "audio":
  14574. @example
  14575. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14576. @end example
  14577. @end itemize
  14578. @subsection Commands
  14579. Both movie and amovie support the following commands:
  14580. @table @option
  14581. @item seek
  14582. Perform seek using "av_seek_frame".
  14583. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14584. @itemize
  14585. @item
  14586. @var{stream_index}: If stream_index is -1, a default
  14587. stream is selected, and @var{timestamp} is automatically converted
  14588. from AV_TIME_BASE units to the stream specific time_base.
  14589. @item
  14590. @var{timestamp}: Timestamp in AVStream.time_base units
  14591. or, if no stream is specified, in AV_TIME_BASE units.
  14592. @item
  14593. @var{flags}: Flags which select direction and seeking mode.
  14594. @end itemize
  14595. @item get_duration
  14596. Get movie duration in AV_TIME_BASE units.
  14597. @end table
  14598. @c man end MULTIMEDIA SOURCES