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.

19139 lines
508KB

  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 laplacian edge detector which includes diagonals:
  4545. @example
  4546. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4547. @end example
  4548. @item
  4549. Apply emboss:
  4550. @example
  4551. 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"
  4552. @end example
  4553. @end itemize
  4554. @section copy
  4555. Copy the input video source unchanged to the output. This is mainly useful for
  4556. testing purposes.
  4557. @anchor{coreimage}
  4558. @section coreimage
  4559. Video filtering on GPU using Apple's CoreImage API on OSX.
  4560. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4561. processed by video hardware. However, software-based OpenGL implementations
  4562. exist which means there is no guarantee for hardware processing. It depends on
  4563. the respective OSX.
  4564. There are many filters and image generators provided by Apple that come with a
  4565. large variety of options. The filter has to be referenced by its name along
  4566. with its options.
  4567. The coreimage filter accepts the following options:
  4568. @table @option
  4569. @item list_filters
  4570. List all available filters and generators along with all their respective
  4571. options as well as possible minimum and maximum values along with the default
  4572. values.
  4573. @example
  4574. list_filters=true
  4575. @end example
  4576. @item filter
  4577. Specify all filters by their respective name and options.
  4578. Use @var{list_filters} to determine all valid filter names and options.
  4579. Numerical options are specified by a float value and are automatically clamped
  4580. to their respective value range. Vector and color options have to be specified
  4581. by a list of space separated float values. Character escaping has to be done.
  4582. A special option name @code{default} is available to use default options for a
  4583. filter.
  4584. It is required to specify either @code{default} or at least one of the filter options.
  4585. All omitted options are used with their default values.
  4586. The syntax of the filter string is as follows:
  4587. @example
  4588. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4589. @end example
  4590. @item output_rect
  4591. Specify a rectangle where the output of the filter chain is copied into the
  4592. input image. It is given by a list of space separated float values:
  4593. @example
  4594. output_rect=x\ y\ width\ height
  4595. @end example
  4596. If not given, the output rectangle equals the dimensions of the input image.
  4597. The output rectangle is automatically cropped at the borders of the input
  4598. image. Negative values are valid for each component.
  4599. @example
  4600. output_rect=25\ 25\ 100\ 100
  4601. @end example
  4602. @end table
  4603. Several filters can be chained for successive processing without GPU-HOST
  4604. transfers allowing for fast processing of complex filter chains.
  4605. Currently, only filters with zero (generators) or exactly one (filters) input
  4606. image and one output image are supported. Also, transition filters are not yet
  4607. usable as intended.
  4608. Some filters generate output images with additional padding depending on the
  4609. respective filter kernel. The padding is automatically removed to ensure the
  4610. filter output has the same size as the input image.
  4611. For image generators, the size of the output image is determined by the
  4612. previous output image of the filter chain or the input image of the whole
  4613. filterchain, respectively. The generators do not use the pixel information of
  4614. this image to generate their output. However, the generated output is
  4615. blended onto this image, resulting in partial or complete coverage of the
  4616. output image.
  4617. The @ref{coreimagesrc} video source can be used for generating input images
  4618. which are directly fed into the filter chain. By using it, providing input
  4619. images by another video source or an input video is not required.
  4620. @subsection Examples
  4621. @itemize
  4622. @item
  4623. List all filters available:
  4624. @example
  4625. coreimage=list_filters=true
  4626. @end example
  4627. @item
  4628. Use the CIBoxBlur filter with default options to blur an image:
  4629. @example
  4630. coreimage=filter=CIBoxBlur@@default
  4631. @end example
  4632. @item
  4633. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4634. its center at 100x100 and a radius of 50 pixels:
  4635. @example
  4636. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4637. @end example
  4638. @item
  4639. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4640. given as complete and escaped command-line for Apple's standard bash shell:
  4641. @example
  4642. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4643. @end example
  4644. @end itemize
  4645. @section crop
  4646. Crop the input video to given dimensions.
  4647. It accepts the following parameters:
  4648. @table @option
  4649. @item w, out_w
  4650. The width of the output video. It defaults to @code{iw}.
  4651. This expression is evaluated only once during the filter
  4652. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4653. @item h, out_h
  4654. The height of the output video. It defaults to @code{ih}.
  4655. This expression is evaluated only once during the filter
  4656. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4657. @item x
  4658. The horizontal position, in the input video, of the left edge of the output
  4659. video. It defaults to @code{(in_w-out_w)/2}.
  4660. This expression is evaluated per-frame.
  4661. @item y
  4662. The vertical position, in the input video, of the top edge of the output video.
  4663. It defaults to @code{(in_h-out_h)/2}.
  4664. This expression is evaluated per-frame.
  4665. @item keep_aspect
  4666. If set to 1 will force the output display aspect ratio
  4667. to be the same of the input, by changing the output sample aspect
  4668. ratio. It defaults to 0.
  4669. @item exact
  4670. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4671. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4672. It defaults to 0.
  4673. @end table
  4674. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4675. expressions containing the following constants:
  4676. @table @option
  4677. @item x
  4678. @item y
  4679. The computed values for @var{x} and @var{y}. They are evaluated for
  4680. each new frame.
  4681. @item in_w
  4682. @item in_h
  4683. The input width and height.
  4684. @item iw
  4685. @item ih
  4686. These are the same as @var{in_w} and @var{in_h}.
  4687. @item out_w
  4688. @item out_h
  4689. The output (cropped) width and height.
  4690. @item ow
  4691. @item oh
  4692. These are the same as @var{out_w} and @var{out_h}.
  4693. @item a
  4694. same as @var{iw} / @var{ih}
  4695. @item sar
  4696. input sample aspect ratio
  4697. @item dar
  4698. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4699. @item hsub
  4700. @item vsub
  4701. horizontal and vertical chroma subsample values. For example for the
  4702. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4703. @item n
  4704. The number of the input frame, starting from 0.
  4705. @item pos
  4706. the position in the file of the input frame, NAN if unknown
  4707. @item t
  4708. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4709. @end table
  4710. The expression for @var{out_w} may depend on the value of @var{out_h},
  4711. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4712. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4713. evaluated after @var{out_w} and @var{out_h}.
  4714. The @var{x} and @var{y} parameters specify the expressions for the
  4715. position of the top-left corner of the output (non-cropped) area. They
  4716. are evaluated for each frame. If the evaluated value is not valid, it
  4717. is approximated to the nearest valid value.
  4718. The expression for @var{x} may depend on @var{y}, and the expression
  4719. for @var{y} may depend on @var{x}.
  4720. @subsection Examples
  4721. @itemize
  4722. @item
  4723. Crop area with size 100x100 at position (12,34).
  4724. @example
  4725. crop=100:100:12:34
  4726. @end example
  4727. Using named options, the example above becomes:
  4728. @example
  4729. crop=w=100:h=100:x=12:y=34
  4730. @end example
  4731. @item
  4732. Crop the central input area with size 100x100:
  4733. @example
  4734. crop=100:100
  4735. @end example
  4736. @item
  4737. Crop the central input area with size 2/3 of the input video:
  4738. @example
  4739. crop=2/3*in_w:2/3*in_h
  4740. @end example
  4741. @item
  4742. Crop the input video central square:
  4743. @example
  4744. crop=out_w=in_h
  4745. crop=in_h
  4746. @end example
  4747. @item
  4748. Delimit the rectangle with the top-left corner placed at position
  4749. 100:100 and the right-bottom corner corresponding to the right-bottom
  4750. corner of the input image.
  4751. @example
  4752. crop=in_w-100:in_h-100:100:100
  4753. @end example
  4754. @item
  4755. Crop 10 pixels from the left and right borders, and 20 pixels from
  4756. the top and bottom borders
  4757. @example
  4758. crop=in_w-2*10:in_h-2*20
  4759. @end example
  4760. @item
  4761. Keep only the bottom right quarter of the input image:
  4762. @example
  4763. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4764. @end example
  4765. @item
  4766. Crop height for getting Greek harmony:
  4767. @example
  4768. crop=in_w:1/PHI*in_w
  4769. @end example
  4770. @item
  4771. Apply trembling effect:
  4772. @example
  4773. 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)
  4774. @end example
  4775. @item
  4776. Apply erratic camera effect depending on timestamp:
  4777. @example
  4778. 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)"
  4779. @end example
  4780. @item
  4781. Set x depending on the value of y:
  4782. @example
  4783. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4784. @end example
  4785. @end itemize
  4786. @subsection Commands
  4787. This filter supports the following commands:
  4788. @table @option
  4789. @item w, out_w
  4790. @item h, out_h
  4791. @item x
  4792. @item y
  4793. Set width/height of the output video and the horizontal/vertical position
  4794. in the input video.
  4795. The command accepts the same syntax of the corresponding option.
  4796. If the specified expression is not valid, it is kept at its current
  4797. value.
  4798. @end table
  4799. @section cropdetect
  4800. Auto-detect the crop size.
  4801. It calculates the necessary cropping parameters and prints the
  4802. recommended parameters via the logging system. The detected dimensions
  4803. correspond to the non-black area of the input video.
  4804. It accepts the following parameters:
  4805. @table @option
  4806. @item limit
  4807. Set higher black value threshold, which can be optionally specified
  4808. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4809. value greater to the set value is considered non-black. It defaults to 24.
  4810. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4811. on the bitdepth of the pixel format.
  4812. @item round
  4813. The value which the width/height should be divisible by. It defaults to
  4814. 16. The offset is automatically adjusted to center the video. Use 2 to
  4815. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4816. encoding to most video codecs.
  4817. @item reset_count, reset
  4818. Set the counter that determines after how many frames cropdetect will
  4819. reset the previously detected largest video area and start over to
  4820. detect the current optimal crop area. Default value is 0.
  4821. This can be useful when channel logos distort the video area. 0
  4822. indicates 'never reset', and returns the largest area encountered during
  4823. playback.
  4824. @end table
  4825. @anchor{curves}
  4826. @section curves
  4827. Apply color adjustments using curves.
  4828. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4829. component (red, green and blue) has its values defined by @var{N} key points
  4830. tied from each other using a smooth curve. The x-axis represents the pixel
  4831. values from the input frame, and the y-axis the new pixel values to be set for
  4832. the output frame.
  4833. By default, a component curve is defined by the two points @var{(0;0)} and
  4834. @var{(1;1)}. This creates a straight line where each original pixel value is
  4835. "adjusted" to its own value, which means no change to the image.
  4836. The filter allows you to redefine these two points and add some more. A new
  4837. curve (using a natural cubic spline interpolation) will be define to pass
  4838. smoothly through all these new coordinates. The new defined points needs to be
  4839. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4840. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4841. the vector spaces, the values will be clipped accordingly.
  4842. The filter accepts the following options:
  4843. @table @option
  4844. @item preset
  4845. Select one of the available color presets. This option can be used in addition
  4846. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4847. options takes priority on the preset values.
  4848. Available presets are:
  4849. @table @samp
  4850. @item none
  4851. @item color_negative
  4852. @item cross_process
  4853. @item darker
  4854. @item increase_contrast
  4855. @item lighter
  4856. @item linear_contrast
  4857. @item medium_contrast
  4858. @item negative
  4859. @item strong_contrast
  4860. @item vintage
  4861. @end table
  4862. Default is @code{none}.
  4863. @item master, m
  4864. Set the master key points. These points will define a second pass mapping. It
  4865. is sometimes called a "luminance" or "value" mapping. It can be used with
  4866. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4867. post-processing LUT.
  4868. @item red, r
  4869. Set the key points for the red component.
  4870. @item green, g
  4871. Set the key points for the green component.
  4872. @item blue, b
  4873. Set the key points for the blue component.
  4874. @item all
  4875. Set the key points for all components (not including master).
  4876. Can be used in addition to the other key points component
  4877. options. In this case, the unset component(s) will fallback on this
  4878. @option{all} setting.
  4879. @item psfile
  4880. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4881. @item plot
  4882. Save Gnuplot script of the curves in specified file.
  4883. @end table
  4884. To avoid some filtergraph syntax conflicts, each key points list need to be
  4885. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4886. @subsection Examples
  4887. @itemize
  4888. @item
  4889. Increase slightly the middle level of blue:
  4890. @example
  4891. curves=blue='0/0 0.5/0.58 1/1'
  4892. @end example
  4893. @item
  4894. Vintage effect:
  4895. @example
  4896. 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'
  4897. @end example
  4898. Here we obtain the following coordinates for each components:
  4899. @table @var
  4900. @item red
  4901. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4902. @item green
  4903. @code{(0;0) (0.50;0.48) (1;1)}
  4904. @item blue
  4905. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4906. @end table
  4907. @item
  4908. The previous example can also be achieved with the associated built-in preset:
  4909. @example
  4910. curves=preset=vintage
  4911. @end example
  4912. @item
  4913. Or simply:
  4914. @example
  4915. curves=vintage
  4916. @end example
  4917. @item
  4918. Use a Photoshop preset and redefine the points of the green component:
  4919. @example
  4920. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4921. @end example
  4922. @item
  4923. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4924. and @command{gnuplot}:
  4925. @example
  4926. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4927. gnuplot -p /tmp/curves.plt
  4928. @end example
  4929. @end itemize
  4930. @section datascope
  4931. Video data analysis filter.
  4932. This filter shows hexadecimal pixel values of part of video.
  4933. The filter accepts the following options:
  4934. @table @option
  4935. @item size, s
  4936. Set output video size.
  4937. @item x
  4938. Set x offset from where to pick pixels.
  4939. @item y
  4940. Set y offset from where to pick pixels.
  4941. @item mode
  4942. Set scope mode, can be one of the following:
  4943. @table @samp
  4944. @item mono
  4945. Draw hexadecimal pixel values with white color on black background.
  4946. @item color
  4947. Draw hexadecimal pixel values with input video pixel color on black
  4948. background.
  4949. @item color2
  4950. Draw hexadecimal pixel values on color background picked from input video,
  4951. the text color is picked in such way so its always visible.
  4952. @end table
  4953. @item axis
  4954. Draw rows and columns numbers on left and top of video.
  4955. @item opacity
  4956. Set background opacity.
  4957. @end table
  4958. @section dctdnoiz
  4959. Denoise frames using 2D DCT (frequency domain filtering).
  4960. This filter is not designed for real time.
  4961. The filter accepts the following options:
  4962. @table @option
  4963. @item sigma, s
  4964. Set the noise sigma constant.
  4965. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4966. coefficient (absolute value) below this threshold with be dropped.
  4967. If you need a more advanced filtering, see @option{expr}.
  4968. Default is @code{0}.
  4969. @item overlap
  4970. Set number overlapping pixels for each block. Since the filter can be slow, you
  4971. may want to reduce this value, at the cost of a less effective filter and the
  4972. risk of various artefacts.
  4973. If the overlapping value doesn't permit processing the whole input width or
  4974. height, a warning will be displayed and according borders won't be denoised.
  4975. Default value is @var{blocksize}-1, which is the best possible setting.
  4976. @item expr, e
  4977. Set the coefficient factor expression.
  4978. For each coefficient of a DCT block, this expression will be evaluated as a
  4979. multiplier value for the coefficient.
  4980. If this is option is set, the @option{sigma} option will be ignored.
  4981. The absolute value of the coefficient can be accessed through the @var{c}
  4982. variable.
  4983. @item n
  4984. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4985. @var{blocksize}, which is the width and height of the processed blocks.
  4986. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4987. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4988. on the speed processing. Also, a larger block size does not necessarily means a
  4989. better de-noising.
  4990. @end table
  4991. @subsection Examples
  4992. Apply a denoise with a @option{sigma} of @code{4.5}:
  4993. @example
  4994. dctdnoiz=4.5
  4995. @end example
  4996. The same operation can be achieved using the expression system:
  4997. @example
  4998. dctdnoiz=e='gte(c, 4.5*3)'
  4999. @end example
  5000. Violent denoise using a block size of @code{16x16}:
  5001. @example
  5002. dctdnoiz=15:n=4
  5003. @end example
  5004. @section deband
  5005. Remove banding artifacts from input video.
  5006. It works by replacing banded pixels with average value of referenced pixels.
  5007. The filter accepts the following options:
  5008. @table @option
  5009. @item 1thr
  5010. @item 2thr
  5011. @item 3thr
  5012. @item 4thr
  5013. Set banding detection threshold for each plane. Default is 0.02.
  5014. Valid range is 0.00003 to 0.5.
  5015. If difference between current pixel and reference pixel is less than threshold,
  5016. it will be considered as banded.
  5017. @item range, r
  5018. Banding detection range in pixels. Default is 16. If positive, random number
  5019. in range 0 to set value will be used. If negative, exact absolute value
  5020. will be used.
  5021. The range defines square of four pixels around current pixel.
  5022. @item direction, d
  5023. Set direction in radians from which four pixel will be compared. If positive,
  5024. random direction from 0 to set direction will be picked. If negative, exact of
  5025. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5026. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5027. column.
  5028. @item blur, b
  5029. If enabled, current pixel is compared with average value of all four
  5030. surrounding pixels. The default is enabled. If disabled current pixel is
  5031. compared with all four surrounding pixels. The pixel is considered banded
  5032. if only all four differences with surrounding pixels are less than threshold.
  5033. @item coupling, c
  5034. If enabled, current pixel is changed if and only if all pixel components are banded,
  5035. e.g. banding detection threshold is triggered for all color components.
  5036. The default is disabled.
  5037. @end table
  5038. @anchor{decimate}
  5039. @section decimate
  5040. Drop duplicated frames at regular intervals.
  5041. The filter accepts the following options:
  5042. @table @option
  5043. @item cycle
  5044. Set the number of frames from which one will be dropped. Setting this to
  5045. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5046. Default is @code{5}.
  5047. @item dupthresh
  5048. Set the threshold for duplicate detection. If the difference metric for a frame
  5049. is less than or equal to this value, then it is declared as duplicate. Default
  5050. is @code{1.1}
  5051. @item scthresh
  5052. Set scene change threshold. Default is @code{15}.
  5053. @item blockx
  5054. @item blocky
  5055. Set the size of the x and y-axis blocks used during metric calculations.
  5056. Larger blocks give better noise suppression, but also give worse detection of
  5057. small movements. Must be a power of two. Default is @code{32}.
  5058. @item ppsrc
  5059. Mark main input as a pre-processed input and activate clean source input
  5060. stream. This allows the input to be pre-processed with various filters to help
  5061. the metrics calculation while keeping the frame selection lossless. When set to
  5062. @code{1}, the first stream is for the pre-processed input, and the second
  5063. stream is the clean source from where the kept frames are chosen. Default is
  5064. @code{0}.
  5065. @item chroma
  5066. Set whether or not chroma is considered in the metric calculations. Default is
  5067. @code{1}.
  5068. @end table
  5069. @section deflate
  5070. Apply deflate effect to the video.
  5071. This filter replaces the pixel by the local(3x3) average by taking into account
  5072. only values lower than the pixel.
  5073. It accepts the following options:
  5074. @table @option
  5075. @item threshold0
  5076. @item threshold1
  5077. @item threshold2
  5078. @item threshold3
  5079. Limit the maximum change for each plane, default is 65535.
  5080. If 0, plane will remain unchanged.
  5081. @end table
  5082. @section deflicker
  5083. Remove temporal frame luminance variations.
  5084. It accepts the following options:
  5085. @table @option
  5086. @item size, s
  5087. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5088. @item mode, m
  5089. Set averaging mode to smooth temporal luminance variations.
  5090. Available values are:
  5091. @table @samp
  5092. @item am
  5093. Arithmetic mean
  5094. @item gm
  5095. Geometric mean
  5096. @item hm
  5097. Harmonic mean
  5098. @item qm
  5099. Quadratic mean
  5100. @item cm
  5101. Cubic mean
  5102. @item pm
  5103. Power mean
  5104. @item median
  5105. Median
  5106. @end table
  5107. @item bypass
  5108. Do not actually modify frame. Useful when one only wants metadata.
  5109. @end table
  5110. @section dejudder
  5111. Remove judder produced by partially interlaced telecined content.
  5112. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5113. source was partially telecined content then the output of @code{pullup,dejudder}
  5114. will have a variable frame rate. May change the recorded frame rate of the
  5115. container. Aside from that change, this filter will not affect constant frame
  5116. rate video.
  5117. The option available in this filter is:
  5118. @table @option
  5119. @item cycle
  5120. Specify the length of the window over which the judder repeats.
  5121. Accepts any integer greater than 1. Useful values are:
  5122. @table @samp
  5123. @item 4
  5124. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5125. @item 5
  5126. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5127. @item 20
  5128. If a mixture of the two.
  5129. @end table
  5130. The default is @samp{4}.
  5131. @end table
  5132. @section delogo
  5133. Suppress a TV station logo by a simple interpolation of the surrounding
  5134. pixels. Just set a rectangle covering the logo and watch it disappear
  5135. (and sometimes something even uglier appear - your mileage may vary).
  5136. It accepts the following parameters:
  5137. @table @option
  5138. @item x
  5139. @item y
  5140. Specify the top left corner coordinates of the logo. They must be
  5141. specified.
  5142. @item w
  5143. @item h
  5144. Specify the width and height of the logo to clear. They must be
  5145. specified.
  5146. @item band, t
  5147. Specify the thickness of the fuzzy edge of the rectangle (added to
  5148. @var{w} and @var{h}). The default value is 1. This option is
  5149. deprecated, setting higher values should no longer be necessary and
  5150. is not recommended.
  5151. @item show
  5152. When set to 1, a green rectangle is drawn on the screen to simplify
  5153. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5154. The default value is 0.
  5155. The rectangle is drawn on the outermost pixels which will be (partly)
  5156. replaced with interpolated values. The values of the next pixels
  5157. immediately outside this rectangle in each direction will be used to
  5158. compute the interpolated pixel values inside the rectangle.
  5159. @end table
  5160. @subsection Examples
  5161. @itemize
  5162. @item
  5163. Set a rectangle covering the area with top left corner coordinates 0,0
  5164. and size 100x77, and a band of size 10:
  5165. @example
  5166. delogo=x=0:y=0:w=100:h=77:band=10
  5167. @end example
  5168. @end itemize
  5169. @section deshake
  5170. Attempt to fix small changes in horizontal and/or vertical shift. This
  5171. filter helps remove camera shake from hand-holding a camera, bumping a
  5172. tripod, moving on a vehicle, etc.
  5173. The filter accepts the following options:
  5174. @table @option
  5175. @item x
  5176. @item y
  5177. @item w
  5178. @item h
  5179. Specify a rectangular area where to limit the search for motion
  5180. vectors.
  5181. If desired the search for motion vectors can be limited to a
  5182. rectangular area of the frame defined by its top left corner, width
  5183. and height. These parameters have the same meaning as the drawbox
  5184. filter which can be used to visualise the position of the bounding
  5185. box.
  5186. This is useful when simultaneous movement of subjects within the frame
  5187. might be confused for camera motion by the motion vector search.
  5188. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5189. then the full frame is used. This allows later options to be set
  5190. without specifying the bounding box for the motion vector search.
  5191. Default - search the whole frame.
  5192. @item rx
  5193. @item ry
  5194. Specify the maximum extent of movement in x and y directions in the
  5195. range 0-64 pixels. Default 16.
  5196. @item edge
  5197. Specify how to generate pixels to fill blanks at the edge of the
  5198. frame. Available values are:
  5199. @table @samp
  5200. @item blank, 0
  5201. Fill zeroes at blank locations
  5202. @item original, 1
  5203. Original image at blank locations
  5204. @item clamp, 2
  5205. Extruded edge value at blank locations
  5206. @item mirror, 3
  5207. Mirrored edge at blank locations
  5208. @end table
  5209. Default value is @samp{mirror}.
  5210. @item blocksize
  5211. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5212. default 8.
  5213. @item contrast
  5214. Specify the contrast threshold for blocks. Only blocks with more than
  5215. the specified contrast (difference between darkest and lightest
  5216. pixels) will be considered. Range 1-255, default 125.
  5217. @item search
  5218. Specify the search strategy. Available values are:
  5219. @table @samp
  5220. @item exhaustive, 0
  5221. Set exhaustive search
  5222. @item less, 1
  5223. Set less exhaustive search.
  5224. @end table
  5225. Default value is @samp{exhaustive}.
  5226. @item filename
  5227. If set then a detailed log of the motion search is written to the
  5228. specified file.
  5229. @item opencl
  5230. If set to 1, specify using OpenCL capabilities, only available if
  5231. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5232. @end table
  5233. @section detelecine
  5234. Apply an exact inverse of the telecine operation. It requires a predefined
  5235. pattern specified using the pattern option which must be the same as that passed
  5236. to the telecine filter.
  5237. This filter accepts the following options:
  5238. @table @option
  5239. @item first_field
  5240. @table @samp
  5241. @item top, t
  5242. top field first
  5243. @item bottom, b
  5244. bottom field first
  5245. The default value is @code{top}.
  5246. @end table
  5247. @item pattern
  5248. A string of numbers representing the pulldown pattern you wish to apply.
  5249. The default value is @code{23}.
  5250. @item start_frame
  5251. A number representing position of the first frame with respect to the telecine
  5252. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5253. @end table
  5254. @section dilation
  5255. Apply dilation effect to the video.
  5256. This filter replaces the pixel by the local(3x3) maximum.
  5257. It accepts the following options:
  5258. @table @option
  5259. @item threshold0
  5260. @item threshold1
  5261. @item threshold2
  5262. @item threshold3
  5263. Limit the maximum change for each plane, default is 65535.
  5264. If 0, plane will remain unchanged.
  5265. @item coordinates
  5266. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5267. pixels are used.
  5268. Flags to local 3x3 coordinates maps like this:
  5269. 1 2 3
  5270. 4 5
  5271. 6 7 8
  5272. @end table
  5273. @section displace
  5274. Displace pixels as indicated by second and third input stream.
  5275. It takes three input streams and outputs one stream, the first input is the
  5276. source, and second and third input are displacement maps.
  5277. The second input specifies how much to displace pixels along the
  5278. x-axis, while the third input specifies how much to displace pixels
  5279. along the y-axis.
  5280. If one of displacement map streams terminates, last frame from that
  5281. displacement map will be used.
  5282. Note that once generated, displacements maps can be reused over and over again.
  5283. A description of the accepted options follows.
  5284. @table @option
  5285. @item edge
  5286. Set displace behavior for pixels that are out of range.
  5287. Available values are:
  5288. @table @samp
  5289. @item blank
  5290. Missing pixels are replaced by black pixels.
  5291. @item smear
  5292. Adjacent pixels will spread out to replace missing pixels.
  5293. @item wrap
  5294. Out of range pixels are wrapped so they point to pixels of other side.
  5295. @end table
  5296. Default is @samp{smear}.
  5297. @end table
  5298. @subsection Examples
  5299. @itemize
  5300. @item
  5301. Add ripple effect to rgb input of video size hd720:
  5302. @example
  5303. 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
  5304. @end example
  5305. @item
  5306. Add wave effect to rgb input of video size hd720:
  5307. @example
  5308. 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
  5309. @end example
  5310. @end itemize
  5311. @section drawbox
  5312. Draw a colored box on the input image.
  5313. It accepts the following parameters:
  5314. @table @option
  5315. @item x
  5316. @item y
  5317. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5318. @item width, w
  5319. @item height, h
  5320. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5321. the input width and height. It defaults to 0.
  5322. @item color, c
  5323. Specify the color of the box to write. For the general syntax of this option,
  5324. check the "Color" section in the ffmpeg-utils manual. If the special
  5325. value @code{invert} is used, the box edge color is the same as the
  5326. video with inverted luma.
  5327. @item thickness, t
  5328. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5329. See below for the list of accepted constants.
  5330. @end table
  5331. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5332. following constants:
  5333. @table @option
  5334. @item dar
  5335. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5336. @item hsub
  5337. @item vsub
  5338. horizontal and vertical chroma subsample values. For example for the
  5339. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5340. @item in_h, ih
  5341. @item in_w, iw
  5342. The input width and height.
  5343. @item sar
  5344. The input sample aspect ratio.
  5345. @item x
  5346. @item y
  5347. The x and y offset coordinates where the box is drawn.
  5348. @item w
  5349. @item h
  5350. The width and height of the drawn box.
  5351. @item t
  5352. The thickness of the drawn box.
  5353. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5354. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5355. @end table
  5356. @subsection Examples
  5357. @itemize
  5358. @item
  5359. Draw a black box around the edge of the input image:
  5360. @example
  5361. drawbox
  5362. @end example
  5363. @item
  5364. Draw a box with color red and an opacity of 50%:
  5365. @example
  5366. drawbox=10:20:200:60:red@@0.5
  5367. @end example
  5368. The previous example can be specified as:
  5369. @example
  5370. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5371. @end example
  5372. @item
  5373. Fill the box with pink color:
  5374. @example
  5375. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5376. @end example
  5377. @item
  5378. Draw a 2-pixel red 2.40:1 mask:
  5379. @example
  5380. 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
  5381. @end example
  5382. @end itemize
  5383. @section drawgrid
  5384. Draw a grid on the input image.
  5385. It accepts the following parameters:
  5386. @table @option
  5387. @item x
  5388. @item y
  5389. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5390. @item width, w
  5391. @item height, h
  5392. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5393. input width and height, respectively, minus @code{thickness}, so image gets
  5394. framed. Default to 0.
  5395. @item color, c
  5396. Specify the color of the grid. For the general syntax of this option,
  5397. check the "Color" section in the ffmpeg-utils manual. If the special
  5398. value @code{invert} is used, the grid color is the same as the
  5399. video with inverted luma.
  5400. @item thickness, t
  5401. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5402. See below for the list of accepted constants.
  5403. @end table
  5404. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5405. following constants:
  5406. @table @option
  5407. @item dar
  5408. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5409. @item hsub
  5410. @item vsub
  5411. horizontal and vertical chroma subsample values. For example for the
  5412. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5413. @item in_h, ih
  5414. @item in_w, iw
  5415. The input grid cell width and height.
  5416. @item sar
  5417. The input sample aspect ratio.
  5418. @item x
  5419. @item y
  5420. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5421. @item w
  5422. @item h
  5423. The width and height of the drawn cell.
  5424. @item t
  5425. The thickness of the drawn cell.
  5426. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5427. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5428. @end table
  5429. @subsection Examples
  5430. @itemize
  5431. @item
  5432. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5433. @example
  5434. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5435. @end example
  5436. @item
  5437. Draw a white 3x3 grid with an opacity of 50%:
  5438. @example
  5439. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5440. @end example
  5441. @end itemize
  5442. @anchor{drawtext}
  5443. @section drawtext
  5444. Draw a text string or text from a specified file on top of a video, using the
  5445. libfreetype library.
  5446. To enable compilation of this filter, you need to configure FFmpeg with
  5447. @code{--enable-libfreetype}.
  5448. To enable default font fallback and the @var{font} option you need to
  5449. configure FFmpeg with @code{--enable-libfontconfig}.
  5450. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5451. @code{--enable-libfribidi}.
  5452. @subsection Syntax
  5453. It accepts the following parameters:
  5454. @table @option
  5455. @item box
  5456. Used to draw a box around text using the background color.
  5457. The value must be either 1 (enable) or 0 (disable).
  5458. The default value of @var{box} is 0.
  5459. @item boxborderw
  5460. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5461. The default value of @var{boxborderw} is 0.
  5462. @item boxcolor
  5463. The color to be used for drawing box around text. For the syntax of this
  5464. option, check the "Color" section in the ffmpeg-utils manual.
  5465. The default value of @var{boxcolor} is "white".
  5466. @item line_spacing
  5467. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5468. The default value of @var{line_spacing} is 0.
  5469. @item borderw
  5470. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5471. The default value of @var{borderw} is 0.
  5472. @item bordercolor
  5473. Set the color to be used for drawing border around text. For the syntax of this
  5474. option, check the "Color" section in the ffmpeg-utils manual.
  5475. The default value of @var{bordercolor} is "black".
  5476. @item expansion
  5477. Select how the @var{text} is expanded. Can be either @code{none},
  5478. @code{strftime} (deprecated) or
  5479. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5480. below for details.
  5481. @item basetime
  5482. Set a start time for the count. Value is in microseconds. Only applied
  5483. in the deprecated strftime expansion mode. To emulate in normal expansion
  5484. mode use the @code{pts} function, supplying the start time (in seconds)
  5485. as the second argument.
  5486. @item fix_bounds
  5487. If true, check and fix text coords to avoid clipping.
  5488. @item fontcolor
  5489. The color to be used for drawing fonts. For the syntax of this option, check
  5490. the "Color" section in the ffmpeg-utils manual.
  5491. The default value of @var{fontcolor} is "black".
  5492. @item fontcolor_expr
  5493. String which is expanded the same way as @var{text} to obtain dynamic
  5494. @var{fontcolor} value. By default this option has empty value and is not
  5495. processed. When this option is set, it overrides @var{fontcolor} option.
  5496. @item font
  5497. The font family to be used for drawing text. By default Sans.
  5498. @item fontfile
  5499. The font file to be used for drawing text. The path must be included.
  5500. This parameter is mandatory if the fontconfig support is disabled.
  5501. @item alpha
  5502. Draw the text applying alpha blending. The value can
  5503. be a number between 0.0 and 1.0.
  5504. The expression accepts the same variables @var{x, y} as well.
  5505. The default value is 1.
  5506. Please see @var{fontcolor_expr}.
  5507. @item fontsize
  5508. The font size to be used for drawing text.
  5509. The default value of @var{fontsize} is 16.
  5510. @item text_shaping
  5511. If set to 1, attempt to shape the text (for example, reverse the order of
  5512. right-to-left text and join Arabic characters) before drawing it.
  5513. Otherwise, just draw the text exactly as given.
  5514. By default 1 (if supported).
  5515. @item ft_load_flags
  5516. The flags to be used for loading the fonts.
  5517. The flags map the corresponding flags supported by libfreetype, and are
  5518. a combination of the following values:
  5519. @table @var
  5520. @item default
  5521. @item no_scale
  5522. @item no_hinting
  5523. @item render
  5524. @item no_bitmap
  5525. @item vertical_layout
  5526. @item force_autohint
  5527. @item crop_bitmap
  5528. @item pedantic
  5529. @item ignore_global_advance_width
  5530. @item no_recurse
  5531. @item ignore_transform
  5532. @item monochrome
  5533. @item linear_design
  5534. @item no_autohint
  5535. @end table
  5536. Default value is "default".
  5537. For more information consult the documentation for the FT_LOAD_*
  5538. libfreetype flags.
  5539. @item shadowcolor
  5540. The color to be used for drawing a shadow behind the drawn text. For the
  5541. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5542. The default value of @var{shadowcolor} is "black".
  5543. @item shadowx
  5544. @item shadowy
  5545. The x and y offsets for the text shadow position with respect to the
  5546. position of the text. They can be either positive or negative
  5547. values. The default value for both is "0".
  5548. @item start_number
  5549. The starting frame number for the n/frame_num variable. The default value
  5550. is "0".
  5551. @item tabsize
  5552. The size in number of spaces to use for rendering the tab.
  5553. Default value is 4.
  5554. @item timecode
  5555. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5556. format. It can be used with or without text parameter. @var{timecode_rate}
  5557. option must be specified.
  5558. @item timecode_rate, rate, r
  5559. Set the timecode frame rate (timecode only).
  5560. @item tc24hmax
  5561. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5562. Default is 0 (disabled).
  5563. @item text
  5564. The text string to be drawn. The text must be a sequence of UTF-8
  5565. encoded characters.
  5566. This parameter is mandatory if no file is specified with the parameter
  5567. @var{textfile}.
  5568. @item textfile
  5569. A text file containing text to be drawn. The text must be a sequence
  5570. of UTF-8 encoded characters.
  5571. This parameter is mandatory if no text string is specified with the
  5572. parameter @var{text}.
  5573. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5574. @item reload
  5575. If set to 1, the @var{textfile} will be reloaded before each frame.
  5576. Be sure to update it atomically, or it may be read partially, or even fail.
  5577. @item x
  5578. @item y
  5579. The expressions which specify the offsets where text will be drawn
  5580. within the video frame. They are relative to the top/left border of the
  5581. output image.
  5582. The default value of @var{x} and @var{y} is "0".
  5583. See below for the list of accepted constants and functions.
  5584. @end table
  5585. The parameters for @var{x} and @var{y} are expressions containing the
  5586. following constants and functions:
  5587. @table @option
  5588. @item dar
  5589. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5590. @item hsub
  5591. @item vsub
  5592. horizontal and vertical chroma subsample values. For example for the
  5593. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5594. @item line_h, lh
  5595. the height of each text line
  5596. @item main_h, h, H
  5597. the input height
  5598. @item main_w, w, W
  5599. the input width
  5600. @item max_glyph_a, ascent
  5601. the maximum distance from the baseline to the highest/upper grid
  5602. coordinate used to place a glyph outline point, for all the rendered
  5603. glyphs.
  5604. It is a positive value, due to the grid's orientation with the Y axis
  5605. upwards.
  5606. @item max_glyph_d, descent
  5607. the maximum distance from the baseline to the lowest grid coordinate
  5608. used to place a glyph outline point, for all the rendered glyphs.
  5609. This is a negative value, due to the grid's orientation, with the Y axis
  5610. upwards.
  5611. @item max_glyph_h
  5612. maximum glyph height, that is the maximum height for all the glyphs
  5613. contained in the rendered text, it is equivalent to @var{ascent} -
  5614. @var{descent}.
  5615. @item max_glyph_w
  5616. maximum glyph width, that is the maximum width for all the glyphs
  5617. contained in the rendered text
  5618. @item n
  5619. the number of input frame, starting from 0
  5620. @item rand(min, max)
  5621. return a random number included between @var{min} and @var{max}
  5622. @item sar
  5623. The input sample aspect ratio.
  5624. @item t
  5625. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5626. @item text_h, th
  5627. the height of the rendered text
  5628. @item text_w, tw
  5629. the width of the rendered text
  5630. @item x
  5631. @item y
  5632. the x and y offset coordinates where the text is drawn.
  5633. These parameters allow the @var{x} and @var{y} expressions to refer
  5634. each other, so you can for example specify @code{y=x/dar}.
  5635. @end table
  5636. @anchor{drawtext_expansion}
  5637. @subsection Text expansion
  5638. If @option{expansion} is set to @code{strftime},
  5639. the filter recognizes strftime() sequences in the provided text and
  5640. expands them accordingly. Check the documentation of strftime(). This
  5641. feature is deprecated.
  5642. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5643. If @option{expansion} is set to @code{normal} (which is the default),
  5644. the following expansion mechanism is used.
  5645. The backslash character @samp{\}, followed by any character, always expands to
  5646. the second character.
  5647. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5648. braces is a function name, possibly followed by arguments separated by ':'.
  5649. If the arguments contain special characters or delimiters (':' or '@}'),
  5650. they should be escaped.
  5651. Note that they probably must also be escaped as the value for the
  5652. @option{text} option in the filter argument string and as the filter
  5653. argument in the filtergraph description, and possibly also for the shell,
  5654. that makes up to four levels of escaping; using a text file avoids these
  5655. problems.
  5656. The following functions are available:
  5657. @table @command
  5658. @item expr, e
  5659. The expression evaluation result.
  5660. It must take one argument specifying the expression to be evaluated,
  5661. which accepts the same constants and functions as the @var{x} and
  5662. @var{y} values. Note that not all constants should be used, for
  5663. example the text size is not known when evaluating the expression, so
  5664. the constants @var{text_w} and @var{text_h} will have an undefined
  5665. value.
  5666. @item expr_int_format, eif
  5667. Evaluate the expression's value and output as formatted integer.
  5668. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5669. The second argument specifies the output format. Allowed values are @samp{x},
  5670. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5671. @code{printf} function.
  5672. The third parameter is optional and sets the number of positions taken by the output.
  5673. It can be used to add padding with zeros from the left.
  5674. @item gmtime
  5675. The time at which the filter is running, expressed in UTC.
  5676. It can accept an argument: a strftime() format string.
  5677. @item localtime
  5678. The time at which the filter is running, expressed in the local time zone.
  5679. It can accept an argument: a strftime() format string.
  5680. @item metadata
  5681. Frame metadata. Takes one or two arguments.
  5682. The first argument is mandatory and specifies the metadata key.
  5683. The second argument is optional and specifies a default value, used when the
  5684. metadata key is not found or empty.
  5685. @item n, frame_num
  5686. The frame number, starting from 0.
  5687. @item pict_type
  5688. A 1 character description of the current picture type.
  5689. @item pts
  5690. The timestamp of the current frame.
  5691. It can take up to three arguments.
  5692. The first argument is the format of the timestamp; it defaults to @code{flt}
  5693. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5694. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5695. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5696. @code{localtime} stands for the timestamp of the frame formatted as
  5697. local time zone time.
  5698. The second argument is an offset added to the timestamp.
  5699. If the format is set to @code{localtime} or @code{gmtime},
  5700. a third argument may be supplied: a strftime() format string.
  5701. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5702. @end table
  5703. @subsection Examples
  5704. @itemize
  5705. @item
  5706. Draw "Test Text" with font FreeSerif, using the default values for the
  5707. optional parameters.
  5708. @example
  5709. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5710. @end example
  5711. @item
  5712. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5713. and y=50 (counting from the top-left corner of the screen), text is
  5714. yellow with a red box around it. Both the text and the box have an
  5715. opacity of 20%.
  5716. @example
  5717. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5718. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5719. @end example
  5720. Note that the double quotes are not necessary if spaces are not used
  5721. within the parameter list.
  5722. @item
  5723. Show the text at the center of the video frame:
  5724. @example
  5725. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5726. @end example
  5727. @item
  5728. Show the text at a random position, switching to a new position every 30 seconds:
  5729. @example
  5730. 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)"
  5731. @end example
  5732. @item
  5733. Show a text line sliding from right to left in the last row of the video
  5734. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5735. with no newlines.
  5736. @example
  5737. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5738. @end example
  5739. @item
  5740. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5741. @example
  5742. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5743. @end example
  5744. @item
  5745. Draw a single green letter "g", at the center of the input video.
  5746. The glyph baseline is placed at half screen height.
  5747. @example
  5748. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5749. @end example
  5750. @item
  5751. Show text for 1 second every 3 seconds:
  5752. @example
  5753. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5754. @end example
  5755. @item
  5756. Use fontconfig to set the font. Note that the colons need to be escaped.
  5757. @example
  5758. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5759. @end example
  5760. @item
  5761. Print the date of a real-time encoding (see strftime(3)):
  5762. @example
  5763. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5764. @end example
  5765. @item
  5766. Show text fading in and out (appearing/disappearing):
  5767. @example
  5768. #!/bin/sh
  5769. DS=1.0 # display start
  5770. DE=10.0 # display end
  5771. FID=1.5 # fade in duration
  5772. FOD=5 # fade out duration
  5773. 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 @}"
  5774. @end example
  5775. @item
  5776. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5777. and the @option{fontsize} value are included in the @option{y} offset.
  5778. @example
  5779. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5780. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5781. @end example
  5782. @end itemize
  5783. For more information about libfreetype, check:
  5784. @url{http://www.freetype.org/}.
  5785. For more information about fontconfig, check:
  5786. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5787. For more information about libfribidi, check:
  5788. @url{http://fribidi.org/}.
  5789. @section edgedetect
  5790. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5791. The filter accepts the following options:
  5792. @table @option
  5793. @item low
  5794. @item high
  5795. Set low and high threshold values used by the Canny thresholding
  5796. algorithm.
  5797. The high threshold selects the "strong" edge pixels, which are then
  5798. connected through 8-connectivity with the "weak" edge pixels selected
  5799. by the low threshold.
  5800. @var{low} and @var{high} threshold values must be chosen in the range
  5801. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5802. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5803. is @code{50/255}.
  5804. @item mode
  5805. Define the drawing mode.
  5806. @table @samp
  5807. @item wires
  5808. Draw white/gray wires on black background.
  5809. @item colormix
  5810. Mix the colors to create a paint/cartoon effect.
  5811. @end table
  5812. Default value is @var{wires}.
  5813. @end table
  5814. @subsection Examples
  5815. @itemize
  5816. @item
  5817. Standard edge detection with custom values for the hysteresis thresholding:
  5818. @example
  5819. edgedetect=low=0.1:high=0.4
  5820. @end example
  5821. @item
  5822. Painting effect without thresholding:
  5823. @example
  5824. edgedetect=mode=colormix:high=0
  5825. @end example
  5826. @end itemize
  5827. @section eq
  5828. Set brightness, contrast, saturation and approximate gamma adjustment.
  5829. The filter accepts the following options:
  5830. @table @option
  5831. @item contrast
  5832. Set the contrast expression. The value must be a float value in range
  5833. @code{-2.0} to @code{2.0}. The default value is "1".
  5834. @item brightness
  5835. Set the brightness expression. The value must be a float value in
  5836. range @code{-1.0} to @code{1.0}. The default value is "0".
  5837. @item saturation
  5838. Set the saturation expression. The value must be a float in
  5839. range @code{0.0} to @code{3.0}. The default value is "1".
  5840. @item gamma
  5841. Set the gamma expression. The value must be a float in range
  5842. @code{0.1} to @code{10.0}. The default value is "1".
  5843. @item gamma_r
  5844. Set the gamma expression for red. The value must be a float in
  5845. range @code{0.1} to @code{10.0}. The default value is "1".
  5846. @item gamma_g
  5847. Set the gamma expression for green. The value must be a float in range
  5848. @code{0.1} to @code{10.0}. The default value is "1".
  5849. @item gamma_b
  5850. Set the gamma expression for blue. The value must be a float in range
  5851. @code{0.1} to @code{10.0}. The default value is "1".
  5852. @item gamma_weight
  5853. Set the gamma weight expression. It can be used to reduce the effect
  5854. of a high gamma value on bright image areas, e.g. keep them from
  5855. getting overamplified and just plain white. The value must be a float
  5856. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5857. gamma correction all the way down while @code{1.0} leaves it at its
  5858. full strength. Default is "1".
  5859. @item eval
  5860. Set when the expressions for brightness, contrast, saturation and
  5861. gamma expressions are evaluated.
  5862. It accepts the following values:
  5863. @table @samp
  5864. @item init
  5865. only evaluate expressions once during the filter initialization or
  5866. when a command is processed
  5867. @item frame
  5868. evaluate expressions for each incoming frame
  5869. @end table
  5870. Default value is @samp{init}.
  5871. @end table
  5872. The expressions accept the following parameters:
  5873. @table @option
  5874. @item n
  5875. frame count of the input frame starting from 0
  5876. @item pos
  5877. byte position of the corresponding packet in the input file, NAN if
  5878. unspecified
  5879. @item r
  5880. frame rate of the input video, NAN if the input frame rate is unknown
  5881. @item t
  5882. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5883. @end table
  5884. @subsection Commands
  5885. The filter supports the following commands:
  5886. @table @option
  5887. @item contrast
  5888. Set the contrast expression.
  5889. @item brightness
  5890. Set the brightness expression.
  5891. @item saturation
  5892. Set the saturation expression.
  5893. @item gamma
  5894. Set the gamma expression.
  5895. @item gamma_r
  5896. Set the gamma_r expression.
  5897. @item gamma_g
  5898. Set gamma_g expression.
  5899. @item gamma_b
  5900. Set gamma_b expression.
  5901. @item gamma_weight
  5902. Set gamma_weight expression.
  5903. The command accepts the same syntax of the corresponding option.
  5904. If the specified expression is not valid, it is kept at its current
  5905. value.
  5906. @end table
  5907. @section erosion
  5908. Apply erosion effect to the video.
  5909. This filter replaces the pixel by the local(3x3) minimum.
  5910. It accepts the following options:
  5911. @table @option
  5912. @item threshold0
  5913. @item threshold1
  5914. @item threshold2
  5915. @item threshold3
  5916. Limit the maximum change for each plane, default is 65535.
  5917. If 0, plane will remain unchanged.
  5918. @item coordinates
  5919. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5920. pixels are used.
  5921. Flags to local 3x3 coordinates maps like this:
  5922. 1 2 3
  5923. 4 5
  5924. 6 7 8
  5925. @end table
  5926. @section extractplanes
  5927. Extract color channel components from input video stream into
  5928. separate grayscale video streams.
  5929. The filter accepts the following option:
  5930. @table @option
  5931. @item planes
  5932. Set plane(s) to extract.
  5933. Available values for planes are:
  5934. @table @samp
  5935. @item y
  5936. @item u
  5937. @item v
  5938. @item a
  5939. @item r
  5940. @item g
  5941. @item b
  5942. @end table
  5943. Choosing planes not available in the input will result in an error.
  5944. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5945. with @code{y}, @code{u}, @code{v} planes at same time.
  5946. @end table
  5947. @subsection Examples
  5948. @itemize
  5949. @item
  5950. Extract luma, u and v color channel component from input video frame
  5951. into 3 grayscale outputs:
  5952. @example
  5953. 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
  5954. @end example
  5955. @end itemize
  5956. @section elbg
  5957. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5958. For each input image, the filter will compute the optimal mapping from
  5959. the input to the output given the codebook length, that is the number
  5960. of distinct output colors.
  5961. This filter accepts the following options.
  5962. @table @option
  5963. @item codebook_length, l
  5964. Set codebook length. The value must be a positive integer, and
  5965. represents the number of distinct output colors. Default value is 256.
  5966. @item nb_steps, n
  5967. Set the maximum number of iterations to apply for computing the optimal
  5968. mapping. The higher the value the better the result and the higher the
  5969. computation time. Default value is 1.
  5970. @item seed, s
  5971. Set a random seed, must be an integer included between 0 and
  5972. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5973. will try to use a good random seed on a best effort basis.
  5974. @item pal8
  5975. Set pal8 output pixel format. This option does not work with codebook
  5976. length greater than 256.
  5977. @end table
  5978. @section fade
  5979. Apply a fade-in/out effect to the input video.
  5980. It accepts the following parameters:
  5981. @table @option
  5982. @item type, t
  5983. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5984. effect.
  5985. Default is @code{in}.
  5986. @item start_frame, s
  5987. Specify the number of the frame to start applying the fade
  5988. effect at. Default is 0.
  5989. @item nb_frames, n
  5990. The number of frames that the fade effect lasts. At the end of the
  5991. fade-in effect, the output video will have the same intensity as the input video.
  5992. At the end of the fade-out transition, the output video will be filled with the
  5993. selected @option{color}.
  5994. Default is 25.
  5995. @item alpha
  5996. If set to 1, fade only alpha channel, if one exists on the input.
  5997. Default value is 0.
  5998. @item start_time, st
  5999. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6000. effect. If both start_frame and start_time are specified, the fade will start at
  6001. whichever comes last. Default is 0.
  6002. @item duration, d
  6003. The number of seconds for which the fade effect has to last. At the end of the
  6004. fade-in effect the output video will have the same intensity as the input video,
  6005. at the end of the fade-out transition the output video will be filled with the
  6006. selected @option{color}.
  6007. If both duration and nb_frames are specified, duration is used. Default is 0
  6008. (nb_frames is used by default).
  6009. @item color, c
  6010. Specify the color of the fade. Default is "black".
  6011. @end table
  6012. @subsection Examples
  6013. @itemize
  6014. @item
  6015. Fade in the first 30 frames of video:
  6016. @example
  6017. fade=in:0:30
  6018. @end example
  6019. The command above is equivalent to:
  6020. @example
  6021. fade=t=in:s=0:n=30
  6022. @end example
  6023. @item
  6024. Fade out the last 45 frames of a 200-frame video:
  6025. @example
  6026. fade=out:155:45
  6027. fade=type=out:start_frame=155:nb_frames=45
  6028. @end example
  6029. @item
  6030. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6031. @example
  6032. fade=in:0:25, fade=out:975:25
  6033. @end example
  6034. @item
  6035. Make the first 5 frames yellow, then fade in from frame 5-24:
  6036. @example
  6037. fade=in:5:20:color=yellow
  6038. @end example
  6039. @item
  6040. Fade in alpha over first 25 frames of video:
  6041. @example
  6042. fade=in:0:25:alpha=1
  6043. @end example
  6044. @item
  6045. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6046. @example
  6047. fade=t=in:st=5.5:d=0.5
  6048. @end example
  6049. @end itemize
  6050. @section fftfilt
  6051. Apply arbitrary expressions to samples in frequency domain
  6052. @table @option
  6053. @item dc_Y
  6054. Adjust the dc value (gain) of the luma plane of the image. The filter
  6055. accepts an integer value in range @code{0} to @code{1000}. The default
  6056. value is set to @code{0}.
  6057. @item dc_U
  6058. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6059. filter accepts an integer value in range @code{0} to @code{1000}. The
  6060. default value is set to @code{0}.
  6061. @item dc_V
  6062. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6063. filter accepts an integer value in range @code{0} to @code{1000}. The
  6064. default value is set to @code{0}.
  6065. @item weight_Y
  6066. Set the frequency domain weight expression for the luma plane.
  6067. @item weight_U
  6068. Set the frequency domain weight expression for the 1st chroma plane.
  6069. @item weight_V
  6070. Set the frequency domain weight expression for the 2nd chroma plane.
  6071. The filter accepts the following variables:
  6072. @item X
  6073. @item Y
  6074. The coordinates of the current sample.
  6075. @item W
  6076. @item H
  6077. The width and height of the image.
  6078. @end table
  6079. @subsection Examples
  6080. @itemize
  6081. @item
  6082. High-pass:
  6083. @example
  6084. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6085. @end example
  6086. @item
  6087. Low-pass:
  6088. @example
  6089. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6090. @end example
  6091. @item
  6092. Sharpen:
  6093. @example
  6094. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6095. @end example
  6096. @item
  6097. Blur:
  6098. @example
  6099. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6100. @end example
  6101. @end itemize
  6102. @section field
  6103. Extract a single field from an interlaced image using stride
  6104. arithmetic to avoid wasting CPU time. The output frames are marked as
  6105. non-interlaced.
  6106. The filter accepts the following options:
  6107. @table @option
  6108. @item type
  6109. Specify whether to extract the top (if the value is @code{0} or
  6110. @code{top}) or the bottom field (if the value is @code{1} or
  6111. @code{bottom}).
  6112. @end table
  6113. @section fieldhint
  6114. Create new frames by copying the top and bottom fields from surrounding frames
  6115. supplied as numbers by the hint file.
  6116. @table @option
  6117. @item hint
  6118. Set file containing hints: absolute/relative frame numbers.
  6119. There must be one line for each frame in a clip. Each line must contain two
  6120. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6121. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6122. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6123. for @code{relative} mode. First number tells from which frame to pick up top
  6124. field and second number tells from which frame to pick up bottom field.
  6125. If optionally followed by @code{+} output frame will be marked as interlaced,
  6126. else if followed by @code{-} output frame will be marked as progressive, else
  6127. it will be marked same as input frame.
  6128. If line starts with @code{#} or @code{;} that line is skipped.
  6129. @item mode
  6130. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6131. @end table
  6132. Example of first several lines of @code{hint} file for @code{relative} mode:
  6133. @example
  6134. 0,0 - # first frame
  6135. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6136. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6137. 1,0 -
  6138. 0,0 -
  6139. 0,0 -
  6140. 1,0 -
  6141. 1,0 -
  6142. 1,0 -
  6143. 0,0 -
  6144. 0,0 -
  6145. 1,0 -
  6146. 1,0 -
  6147. 1,0 -
  6148. 0,0 -
  6149. @end example
  6150. @section fieldmatch
  6151. Field matching filter for inverse telecine. It is meant to reconstruct the
  6152. progressive frames from a telecined stream. The filter does not drop duplicated
  6153. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6154. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6155. The separation of the field matching and the decimation is notably motivated by
  6156. the possibility of inserting a de-interlacing filter fallback between the two.
  6157. If the source has mixed telecined and real interlaced content,
  6158. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6159. But these remaining combed frames will be marked as interlaced, and thus can be
  6160. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6161. In addition to the various configuration options, @code{fieldmatch} can take an
  6162. optional second stream, activated through the @option{ppsrc} option. If
  6163. enabled, the frames reconstruction will be based on the fields and frames from
  6164. this second stream. This allows the first input to be pre-processed in order to
  6165. help the various algorithms of the filter, while keeping the output lossless
  6166. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6167. or brightness/contrast adjustments can help.
  6168. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6169. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6170. which @code{fieldmatch} is based on. While the semantic and usage are very
  6171. close, some behaviour and options names can differ.
  6172. The @ref{decimate} filter currently only works for constant frame rate input.
  6173. If your input has mixed telecined (30fps) and progressive content with a lower
  6174. framerate like 24fps use the following filterchain to produce the necessary cfr
  6175. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6176. The filter accepts the following options:
  6177. @table @option
  6178. @item order
  6179. Specify the assumed field order of the input stream. Available values are:
  6180. @table @samp
  6181. @item auto
  6182. Auto detect parity (use FFmpeg's internal parity value).
  6183. @item bff
  6184. Assume bottom field first.
  6185. @item tff
  6186. Assume top field first.
  6187. @end table
  6188. Note that it is sometimes recommended not to trust the parity announced by the
  6189. stream.
  6190. Default value is @var{auto}.
  6191. @item mode
  6192. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6193. sense that it won't risk creating jerkiness due to duplicate frames when
  6194. possible, but if there are bad edits or blended fields it will end up
  6195. outputting combed frames when a good match might actually exist. On the other
  6196. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6197. but will almost always find a good frame if there is one. The other values are
  6198. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6199. jerkiness and creating duplicate frames versus finding good matches in sections
  6200. with bad edits, orphaned fields, blended fields, etc.
  6201. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6202. Available values are:
  6203. @table @samp
  6204. @item pc
  6205. 2-way matching (p/c)
  6206. @item pc_n
  6207. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6208. @item pc_u
  6209. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6210. @item pc_n_ub
  6211. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6212. still combed (p/c + n + u/b)
  6213. @item pcn
  6214. 3-way matching (p/c/n)
  6215. @item pcn_ub
  6216. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6217. detected as combed (p/c/n + u/b)
  6218. @end table
  6219. The parenthesis at the end indicate the matches that would be used for that
  6220. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6221. @var{top}).
  6222. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6223. the slowest.
  6224. Default value is @var{pc_n}.
  6225. @item ppsrc
  6226. Mark the main input stream as a pre-processed input, and enable the secondary
  6227. input stream as the clean source to pick the fields from. See the filter
  6228. introduction for more details. It is similar to the @option{clip2} feature from
  6229. VFM/TFM.
  6230. Default value is @code{0} (disabled).
  6231. @item field
  6232. Set the field to match from. It is recommended to set this to the same value as
  6233. @option{order} unless you experience matching failures with that setting. In
  6234. certain circumstances changing the field that is used to match from can have a
  6235. large impact on matching performance. Available values are:
  6236. @table @samp
  6237. @item auto
  6238. Automatic (same value as @option{order}).
  6239. @item bottom
  6240. Match from the bottom field.
  6241. @item top
  6242. Match from the top field.
  6243. @end table
  6244. Default value is @var{auto}.
  6245. @item mchroma
  6246. Set whether or not chroma is included during the match comparisons. In most
  6247. cases it is recommended to leave this enabled. You should set this to @code{0}
  6248. only if your clip has bad chroma problems such as heavy rainbowing or other
  6249. artifacts. Setting this to @code{0} could also be used to speed things up at
  6250. the cost of some accuracy.
  6251. Default value is @code{1}.
  6252. @item y0
  6253. @item y1
  6254. These define an exclusion band which excludes the lines between @option{y0} and
  6255. @option{y1} from being included in the field matching decision. An exclusion
  6256. band can be used to ignore subtitles, a logo, or other things that may
  6257. interfere with the matching. @option{y0} sets the starting scan line and
  6258. @option{y1} sets the ending line; all lines in between @option{y0} and
  6259. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6260. @option{y0} and @option{y1} to the same value will disable the feature.
  6261. @option{y0} and @option{y1} defaults to @code{0}.
  6262. @item scthresh
  6263. Set the scene change detection threshold as a percentage of maximum change on
  6264. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6265. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6266. @option{scthresh} is @code{[0.0, 100.0]}.
  6267. Default value is @code{12.0}.
  6268. @item combmatch
  6269. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6270. account the combed scores of matches when deciding what match to use as the
  6271. final match. Available values are:
  6272. @table @samp
  6273. @item none
  6274. No final matching based on combed scores.
  6275. @item sc
  6276. Combed scores are only used when a scene change is detected.
  6277. @item full
  6278. Use combed scores all the time.
  6279. @end table
  6280. Default is @var{sc}.
  6281. @item combdbg
  6282. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6283. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6284. Available values are:
  6285. @table @samp
  6286. @item none
  6287. No forced calculation.
  6288. @item pcn
  6289. Force p/c/n calculations.
  6290. @item pcnub
  6291. Force p/c/n/u/b calculations.
  6292. @end table
  6293. Default value is @var{none}.
  6294. @item cthresh
  6295. This is the area combing threshold used for combed frame detection. This
  6296. essentially controls how "strong" or "visible" combing must be to be detected.
  6297. Larger values mean combing must be more visible and smaller values mean combing
  6298. can be less visible or strong and still be detected. Valid settings are from
  6299. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6300. be detected as combed). This is basically a pixel difference value. A good
  6301. range is @code{[8, 12]}.
  6302. Default value is @code{9}.
  6303. @item chroma
  6304. Sets whether or not chroma is considered in the combed frame decision. Only
  6305. disable this if your source has chroma problems (rainbowing, etc.) that are
  6306. causing problems for the combed frame detection with chroma enabled. Actually,
  6307. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6308. where there is chroma only combing in the source.
  6309. Default value is @code{0}.
  6310. @item blockx
  6311. @item blocky
  6312. Respectively set the x-axis and y-axis size of the window used during combed
  6313. frame detection. This has to do with the size of the area in which
  6314. @option{combpel} pixels are required to be detected as combed for a frame to be
  6315. declared combed. See the @option{combpel} parameter description for more info.
  6316. Possible values are any number that is a power of 2 starting at 4 and going up
  6317. to 512.
  6318. Default value is @code{16}.
  6319. @item combpel
  6320. The number of combed pixels inside any of the @option{blocky} by
  6321. @option{blockx} size blocks on the frame for the frame to be detected as
  6322. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6323. setting controls "how much" combing there must be in any localized area (a
  6324. window defined by the @option{blockx} and @option{blocky} settings) on the
  6325. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6326. which point no frames will ever be detected as combed). This setting is known
  6327. as @option{MI} in TFM/VFM vocabulary.
  6328. Default value is @code{80}.
  6329. @end table
  6330. @anchor{p/c/n/u/b meaning}
  6331. @subsection p/c/n/u/b meaning
  6332. @subsubsection p/c/n
  6333. We assume the following telecined stream:
  6334. @example
  6335. Top fields: 1 2 2 3 4
  6336. Bottom fields: 1 2 3 4 4
  6337. @end example
  6338. The numbers correspond to the progressive frame the fields relate to. Here, the
  6339. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6340. When @code{fieldmatch} is configured to run a matching from bottom
  6341. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6342. @example
  6343. Input stream:
  6344. T 1 2 2 3 4
  6345. B 1 2 3 4 4 <-- matching reference
  6346. Matches: c c n n c
  6347. Output stream:
  6348. T 1 2 3 4 4
  6349. B 1 2 3 4 4
  6350. @end example
  6351. As a result of the field matching, we can see that some frames get duplicated.
  6352. To perform a complete inverse telecine, you need to rely on a decimation filter
  6353. after this operation. See for instance the @ref{decimate} filter.
  6354. The same operation now matching from top fields (@option{field}=@var{top})
  6355. looks like this:
  6356. @example
  6357. Input stream:
  6358. T 1 2 2 3 4 <-- matching reference
  6359. B 1 2 3 4 4
  6360. Matches: c c p p c
  6361. Output stream:
  6362. T 1 2 2 3 4
  6363. B 1 2 2 3 4
  6364. @end example
  6365. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6366. basically, they refer to the frame and field of the opposite parity:
  6367. @itemize
  6368. @item @var{p} matches the field of the opposite parity in the previous frame
  6369. @item @var{c} matches the field of the opposite parity in the current frame
  6370. @item @var{n} matches the field of the opposite parity in the next frame
  6371. @end itemize
  6372. @subsubsection u/b
  6373. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6374. from the opposite parity flag. In the following examples, we assume that we are
  6375. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6376. 'x' is placed above and below each matched fields.
  6377. With bottom matching (@option{field}=@var{bottom}):
  6378. @example
  6379. Match: c p n b u
  6380. x x x x x
  6381. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6382. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6383. x x x x x
  6384. Output frames:
  6385. 2 1 2 2 2
  6386. 2 2 2 1 3
  6387. @end example
  6388. With top matching (@option{field}=@var{top}):
  6389. @example
  6390. Match: c p n b u
  6391. x x x x x
  6392. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6393. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6394. x x x x x
  6395. Output frames:
  6396. 2 2 2 1 2
  6397. 2 1 3 2 2
  6398. @end example
  6399. @subsection Examples
  6400. Simple IVTC of a top field first telecined stream:
  6401. @example
  6402. fieldmatch=order=tff:combmatch=none, decimate
  6403. @end example
  6404. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6405. @example
  6406. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6407. @end example
  6408. @section fieldorder
  6409. Transform the field order of the input video.
  6410. It accepts the following parameters:
  6411. @table @option
  6412. @item order
  6413. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6414. for bottom field first.
  6415. @end table
  6416. The default value is @samp{tff}.
  6417. The transformation is done by shifting the picture content up or down
  6418. by one line, and filling the remaining line with appropriate picture content.
  6419. This method is consistent with most broadcast field order converters.
  6420. If the input video is not flagged as being interlaced, or it is already
  6421. flagged as being of the required output field order, then this filter does
  6422. not alter the incoming video.
  6423. It is very useful when converting to or from PAL DV material,
  6424. which is bottom field first.
  6425. For example:
  6426. @example
  6427. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6428. @end example
  6429. @section fifo, afifo
  6430. Buffer input images and send them when they are requested.
  6431. It is mainly useful when auto-inserted by the libavfilter
  6432. framework.
  6433. It does not take parameters.
  6434. @section find_rect
  6435. Find a rectangular object
  6436. It accepts the following options:
  6437. @table @option
  6438. @item object
  6439. Filepath of the object image, needs to be in gray8.
  6440. @item threshold
  6441. Detection threshold, default is 0.5.
  6442. @item mipmaps
  6443. Number of mipmaps, default is 3.
  6444. @item xmin, ymin, xmax, ymax
  6445. Specifies the rectangle in which to search.
  6446. @end table
  6447. @subsection Examples
  6448. @itemize
  6449. @item
  6450. Generate a representative palette of a given video using @command{ffmpeg}:
  6451. @example
  6452. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6453. @end example
  6454. @end itemize
  6455. @section cover_rect
  6456. Cover a rectangular object
  6457. It accepts the following options:
  6458. @table @option
  6459. @item cover
  6460. Filepath of the optional cover image, needs to be in yuv420.
  6461. @item mode
  6462. Set covering mode.
  6463. It accepts the following values:
  6464. @table @samp
  6465. @item cover
  6466. cover it by the supplied image
  6467. @item blur
  6468. cover it by interpolating the surrounding pixels
  6469. @end table
  6470. Default value is @var{blur}.
  6471. @end table
  6472. @subsection Examples
  6473. @itemize
  6474. @item
  6475. Generate a representative palette of a given video using @command{ffmpeg}:
  6476. @example
  6477. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6478. @end example
  6479. @end itemize
  6480. @section floodfill
  6481. Flood area with values of same pixel components with another values.
  6482. It accepts the following options:
  6483. @table @option
  6484. @item x
  6485. Set pixel x coordinate.
  6486. @item y
  6487. Set pixel y coordinate.
  6488. @item s0
  6489. Set source #0 component value.
  6490. @item s1
  6491. Set source #1 component value.
  6492. @item s2
  6493. Set source #2 component value.
  6494. @item s3
  6495. Set source #3 component value.
  6496. @item d0
  6497. Set destination #0 component value.
  6498. @item d1
  6499. Set destination #1 component value.
  6500. @item d2
  6501. Set destination #2 component value.
  6502. @item d3
  6503. Set destination #3 component value.
  6504. @end table
  6505. @anchor{format}
  6506. @section format
  6507. Convert the input video to one of the specified pixel formats.
  6508. Libavfilter will try to pick one that is suitable as input to
  6509. the next filter.
  6510. It accepts the following parameters:
  6511. @table @option
  6512. @item pix_fmts
  6513. A '|'-separated list of pixel format names, such as
  6514. "pix_fmts=yuv420p|monow|rgb24".
  6515. @end table
  6516. @subsection Examples
  6517. @itemize
  6518. @item
  6519. Convert the input video to the @var{yuv420p} format
  6520. @example
  6521. format=pix_fmts=yuv420p
  6522. @end example
  6523. Convert the input video to any of the formats in the list
  6524. @example
  6525. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6526. @end example
  6527. @end itemize
  6528. @anchor{fps}
  6529. @section fps
  6530. Convert the video to specified constant frame rate by duplicating or dropping
  6531. frames as necessary.
  6532. It accepts the following parameters:
  6533. @table @option
  6534. @item fps
  6535. The desired output frame rate. The default is @code{25}.
  6536. @item round
  6537. Rounding method.
  6538. Possible values are:
  6539. @table @option
  6540. @item zero
  6541. zero round towards 0
  6542. @item inf
  6543. round away from 0
  6544. @item down
  6545. round towards -infinity
  6546. @item up
  6547. round towards +infinity
  6548. @item near
  6549. round to nearest
  6550. @end table
  6551. The default is @code{near}.
  6552. @item start_time
  6553. Assume the first PTS should be the given value, in seconds. This allows for
  6554. padding/trimming at the start of stream. By default, no assumption is made
  6555. about the first frame's expected PTS, so no padding or trimming is done.
  6556. For example, this could be set to 0 to pad the beginning with duplicates of
  6557. the first frame if a video stream starts after the audio stream or to trim any
  6558. frames with a negative PTS.
  6559. @end table
  6560. Alternatively, the options can be specified as a flat string:
  6561. @var{fps}[:@var{round}].
  6562. See also the @ref{setpts} filter.
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. A typical usage in order to set the fps to 25:
  6567. @example
  6568. fps=fps=25
  6569. @end example
  6570. @item
  6571. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6572. @example
  6573. fps=fps=film:round=near
  6574. @end example
  6575. @end itemize
  6576. @section framepack
  6577. Pack two different video streams into a stereoscopic video, setting proper
  6578. metadata on supported codecs. The two views should have the same size and
  6579. framerate and processing will stop when the shorter video ends. Please note
  6580. that you may conveniently adjust view properties with the @ref{scale} and
  6581. @ref{fps} filters.
  6582. It accepts the following parameters:
  6583. @table @option
  6584. @item format
  6585. The desired packing format. Supported values are:
  6586. @table @option
  6587. @item sbs
  6588. The views are next to each other (default).
  6589. @item tab
  6590. The views are on top of each other.
  6591. @item lines
  6592. The views are packed by line.
  6593. @item columns
  6594. The views are packed by column.
  6595. @item frameseq
  6596. The views are temporally interleaved.
  6597. @end table
  6598. @end table
  6599. Some examples:
  6600. @example
  6601. # Convert left and right views into a frame-sequential video
  6602. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6603. # Convert views into a side-by-side video with the same output resolution as the input
  6604. 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
  6605. @end example
  6606. @section framerate
  6607. Change the frame rate by interpolating new video output frames from the source
  6608. frames.
  6609. This filter is not designed to function correctly with interlaced media. If
  6610. you wish to change the frame rate of interlaced media then you are required
  6611. to deinterlace before this filter and re-interlace after this filter.
  6612. A description of the accepted options follows.
  6613. @table @option
  6614. @item fps
  6615. Specify the output frames per second. This option can also be specified
  6616. as a value alone. The default is @code{50}.
  6617. @item interp_start
  6618. Specify the start of a range where the output frame will be created as a
  6619. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6620. the default is @code{15}.
  6621. @item interp_end
  6622. Specify the end of a range where the output frame will be created as a
  6623. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6624. the default is @code{240}.
  6625. @item scene
  6626. Specify the level at which a scene change is detected as a value between
  6627. 0 and 100 to indicate a new scene; a low value reflects a low
  6628. probability for the current frame to introduce a new scene, while a higher
  6629. value means the current frame is more likely to be one.
  6630. The default is @code{7}.
  6631. @item flags
  6632. Specify flags influencing the filter process.
  6633. Available value for @var{flags} is:
  6634. @table @option
  6635. @item scene_change_detect, scd
  6636. Enable scene change detection using the value of the option @var{scene}.
  6637. This flag is enabled by default.
  6638. @end table
  6639. @end table
  6640. @section framestep
  6641. Select one frame every N-th frame.
  6642. This filter accepts the following option:
  6643. @table @option
  6644. @item step
  6645. Select frame after every @code{step} frames.
  6646. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6647. @end table
  6648. @anchor{frei0r}
  6649. @section frei0r
  6650. Apply a frei0r effect to the input video.
  6651. To enable the compilation of this filter, you need to install the frei0r
  6652. header and configure FFmpeg with @code{--enable-frei0r}.
  6653. It accepts the following parameters:
  6654. @table @option
  6655. @item filter_name
  6656. The name of the frei0r effect to load. If the environment variable
  6657. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6658. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6659. Otherwise, the standard frei0r paths are searched, in this order:
  6660. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6661. @file{/usr/lib/frei0r-1/}.
  6662. @item filter_params
  6663. A '|'-separated list of parameters to pass to the frei0r effect.
  6664. @end table
  6665. A frei0r effect parameter can be a boolean (its value is either
  6666. "y" or "n"), a double, a color (specified as
  6667. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6668. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6669. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6670. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6671. The number and types of parameters depend on the loaded effect. If an
  6672. effect parameter is not specified, the default value is set.
  6673. @subsection Examples
  6674. @itemize
  6675. @item
  6676. Apply the distort0r effect, setting the first two double parameters:
  6677. @example
  6678. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6679. @end example
  6680. @item
  6681. Apply the colordistance effect, taking a color as the first parameter:
  6682. @example
  6683. frei0r=colordistance:0.2/0.3/0.4
  6684. frei0r=colordistance:violet
  6685. frei0r=colordistance:0x112233
  6686. @end example
  6687. @item
  6688. Apply the perspective effect, specifying the top left and top right image
  6689. positions:
  6690. @example
  6691. frei0r=perspective:0.2/0.2|0.8/0.2
  6692. @end example
  6693. @end itemize
  6694. For more information, see
  6695. @url{http://frei0r.dyne.org}
  6696. @section fspp
  6697. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6698. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6699. processing filter, one of them is performed once per block, not per pixel.
  6700. This allows for much higher speed.
  6701. The filter accepts the following options:
  6702. @table @option
  6703. @item quality
  6704. Set quality. This option defines the number of levels for averaging. It accepts
  6705. an integer in the range 4-5. Default value is @code{4}.
  6706. @item qp
  6707. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6708. If not set, the filter will use the QP from the video stream (if available).
  6709. @item strength
  6710. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6711. more details but also more artifacts, while higher values make the image smoother
  6712. but also blurrier. Default value is @code{0} − PSNR optimal.
  6713. @item use_bframe_qp
  6714. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6715. option may cause flicker since the B-Frames have often larger QP. Default is
  6716. @code{0} (not enabled).
  6717. @end table
  6718. @section gblur
  6719. Apply Gaussian blur filter.
  6720. The filter accepts the following options:
  6721. @table @option
  6722. @item sigma
  6723. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6724. @item steps
  6725. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6726. @item planes
  6727. Set which planes to filter. By default all planes are filtered.
  6728. @item sigmaV
  6729. Set vertical sigma, if negative it will be same as @code{sigma}.
  6730. Default is @code{-1}.
  6731. @end table
  6732. @section geq
  6733. The filter accepts the following options:
  6734. @table @option
  6735. @item lum_expr, lum
  6736. Set the luminance expression.
  6737. @item cb_expr, cb
  6738. Set the chrominance blue expression.
  6739. @item cr_expr, cr
  6740. Set the chrominance red expression.
  6741. @item alpha_expr, a
  6742. Set the alpha expression.
  6743. @item red_expr, r
  6744. Set the red expression.
  6745. @item green_expr, g
  6746. Set the green expression.
  6747. @item blue_expr, b
  6748. Set the blue expression.
  6749. @end table
  6750. The colorspace is selected according to the specified options. If one
  6751. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6752. options is specified, the filter will automatically select a YCbCr
  6753. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6754. @option{blue_expr} options is specified, it will select an RGB
  6755. colorspace.
  6756. If one of the chrominance expression is not defined, it falls back on the other
  6757. one. If no alpha expression is specified it will evaluate to opaque value.
  6758. If none of chrominance expressions are specified, they will evaluate
  6759. to the luminance expression.
  6760. The expressions can use the following variables and functions:
  6761. @table @option
  6762. @item N
  6763. The sequential number of the filtered frame, starting from @code{0}.
  6764. @item X
  6765. @item Y
  6766. The coordinates of the current sample.
  6767. @item W
  6768. @item H
  6769. The width and height of the image.
  6770. @item SW
  6771. @item SH
  6772. Width and height scale depending on the currently filtered plane. It is the
  6773. ratio between the corresponding luma plane number of pixels and the current
  6774. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6775. @code{0.5,0.5} for chroma planes.
  6776. @item T
  6777. Time of the current frame, expressed in seconds.
  6778. @item p(x, y)
  6779. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6780. plane.
  6781. @item lum(x, y)
  6782. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6783. plane.
  6784. @item cb(x, y)
  6785. Return the value of the pixel at location (@var{x},@var{y}) of the
  6786. blue-difference chroma plane. Return 0 if there is no such plane.
  6787. @item cr(x, y)
  6788. Return the value of the pixel at location (@var{x},@var{y}) of the
  6789. red-difference chroma plane. Return 0 if there is no such plane.
  6790. @item r(x, y)
  6791. @item g(x, y)
  6792. @item b(x, y)
  6793. Return the value of the pixel at location (@var{x},@var{y}) of the
  6794. red/green/blue component. Return 0 if there is no such component.
  6795. @item alpha(x, y)
  6796. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6797. plane. Return 0 if there is no such plane.
  6798. @end table
  6799. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6800. automatically clipped to the closer edge.
  6801. @subsection Examples
  6802. @itemize
  6803. @item
  6804. Flip the image horizontally:
  6805. @example
  6806. geq=p(W-X\,Y)
  6807. @end example
  6808. @item
  6809. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6810. wavelength of 100 pixels:
  6811. @example
  6812. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6813. @end example
  6814. @item
  6815. Generate a fancy enigmatic moving light:
  6816. @example
  6817. 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
  6818. @end example
  6819. @item
  6820. Generate a quick emboss effect:
  6821. @example
  6822. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6823. @end example
  6824. @item
  6825. Modify RGB components depending on pixel position:
  6826. @example
  6827. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6828. @end example
  6829. @item
  6830. Create a radial gradient that is the same size as the input (also see
  6831. the @ref{vignette} filter):
  6832. @example
  6833. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6834. @end example
  6835. @end itemize
  6836. @section gradfun
  6837. Fix the banding artifacts that are sometimes introduced into nearly flat
  6838. regions by truncation to 8-bit color depth.
  6839. Interpolate the gradients that should go where the bands are, and
  6840. dither them.
  6841. It is designed for playback only. Do not use it prior to
  6842. lossy compression, because compression tends to lose the dither and
  6843. bring back the bands.
  6844. It accepts the following parameters:
  6845. @table @option
  6846. @item strength
  6847. The maximum amount by which the filter will change any one pixel. This is also
  6848. the threshold for detecting nearly flat regions. Acceptable values range from
  6849. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6850. valid range.
  6851. @item radius
  6852. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6853. gradients, but also prevents the filter from modifying the pixels near detailed
  6854. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6855. values will be clipped to the valid range.
  6856. @end table
  6857. Alternatively, the options can be specified as a flat string:
  6858. @var{strength}[:@var{radius}]
  6859. @subsection Examples
  6860. @itemize
  6861. @item
  6862. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6863. @example
  6864. gradfun=3.5:8
  6865. @end example
  6866. @item
  6867. Specify radius, omitting the strength (which will fall-back to the default
  6868. value):
  6869. @example
  6870. gradfun=radius=8
  6871. @end example
  6872. @end itemize
  6873. @anchor{haldclut}
  6874. @section haldclut
  6875. Apply a Hald CLUT to a video stream.
  6876. First input is the video stream to process, and second one is the Hald CLUT.
  6877. The Hald CLUT input can be a simple picture or a complete video stream.
  6878. The filter accepts the following options:
  6879. @table @option
  6880. @item shortest
  6881. Force termination when the shortest input terminates. Default is @code{0}.
  6882. @item repeatlast
  6883. Continue applying the last CLUT after the end of the stream. A value of
  6884. @code{0} disable the filter after the last frame of the CLUT is reached.
  6885. Default is @code{1}.
  6886. @end table
  6887. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6888. filters share the same internals).
  6889. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6890. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6891. @subsection Workflow examples
  6892. @subsubsection Hald CLUT video stream
  6893. Generate an identity Hald CLUT stream altered with various effects:
  6894. @example
  6895. 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
  6896. @end example
  6897. Note: make sure you use a lossless codec.
  6898. Then use it with @code{haldclut} to apply it on some random stream:
  6899. @example
  6900. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6901. @end example
  6902. The Hald CLUT will be applied to the 10 first seconds (duration of
  6903. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6904. to the remaining frames of the @code{mandelbrot} stream.
  6905. @subsubsection Hald CLUT with preview
  6906. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6907. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6908. biggest possible square starting at the top left of the picture. The remaining
  6909. padding pixels (bottom or right) will be ignored. This area can be used to add
  6910. a preview of the Hald CLUT.
  6911. Typically, the following generated Hald CLUT will be supported by the
  6912. @code{haldclut} filter:
  6913. @example
  6914. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6915. pad=iw+320 [padded_clut];
  6916. smptebars=s=320x256, split [a][b];
  6917. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6918. [main][b] overlay=W-320" -frames:v 1 clut.png
  6919. @end example
  6920. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6921. bars are displayed on the right-top, and below the same color bars processed by
  6922. the color changes.
  6923. Then, the effect of this Hald CLUT can be visualized with:
  6924. @example
  6925. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6926. @end example
  6927. @section hflip
  6928. Flip the input video horizontally.
  6929. For example, to horizontally flip the input video with @command{ffmpeg}:
  6930. @example
  6931. ffmpeg -i in.avi -vf "hflip" out.avi
  6932. @end example
  6933. @section histeq
  6934. This filter applies a global color histogram equalization on a
  6935. per-frame basis.
  6936. It can be used to correct video that has a compressed range of pixel
  6937. intensities. The filter redistributes the pixel intensities to
  6938. equalize their distribution across the intensity range. It may be
  6939. viewed as an "automatically adjusting contrast filter". This filter is
  6940. useful only for correcting degraded or poorly captured source
  6941. video.
  6942. The filter accepts the following options:
  6943. @table @option
  6944. @item strength
  6945. Determine the amount of equalization to be applied. As the strength
  6946. is reduced, the distribution of pixel intensities more-and-more
  6947. approaches that of the input frame. The value must be a float number
  6948. in the range [0,1] and defaults to 0.200.
  6949. @item intensity
  6950. Set the maximum intensity that can generated and scale the output
  6951. values appropriately. The strength should be set as desired and then
  6952. the intensity can be limited if needed to avoid washing-out. The value
  6953. must be a float number in the range [0,1] and defaults to 0.210.
  6954. @item antibanding
  6955. Set the antibanding level. If enabled the filter will randomly vary
  6956. the luminance of output pixels by a small amount to avoid banding of
  6957. the histogram. Possible values are @code{none}, @code{weak} or
  6958. @code{strong}. It defaults to @code{none}.
  6959. @end table
  6960. @section histogram
  6961. Compute and draw a color distribution histogram for the input video.
  6962. The computed histogram is a representation of the color component
  6963. distribution in an image.
  6964. Standard histogram displays the color components distribution in an image.
  6965. Displays color graph for each color component. Shows distribution of
  6966. the Y, U, V, A or R, G, B components, depending on input format, in the
  6967. current frame. Below each graph a color component scale meter is shown.
  6968. The filter accepts the following options:
  6969. @table @option
  6970. @item level_height
  6971. Set height of level. Default value is @code{200}.
  6972. Allowed range is [50, 2048].
  6973. @item scale_height
  6974. Set height of color scale. Default value is @code{12}.
  6975. Allowed range is [0, 40].
  6976. @item display_mode
  6977. Set display mode.
  6978. It accepts the following values:
  6979. @table @samp
  6980. @item stack
  6981. Per color component graphs are placed below each other.
  6982. @item parade
  6983. Per color component graphs are placed side by side.
  6984. @item overlay
  6985. Presents information identical to that in the @code{parade}, except
  6986. that the graphs representing color components are superimposed directly
  6987. over one another.
  6988. @end table
  6989. Default is @code{stack}.
  6990. @item levels_mode
  6991. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6992. Default is @code{linear}.
  6993. @item components
  6994. Set what color components to display.
  6995. Default is @code{7}.
  6996. @item fgopacity
  6997. Set foreground opacity. Default is @code{0.7}.
  6998. @item bgopacity
  6999. Set background opacity. Default is @code{0.5}.
  7000. @end table
  7001. @subsection Examples
  7002. @itemize
  7003. @item
  7004. Calculate and draw histogram:
  7005. @example
  7006. ffplay -i input -vf histogram
  7007. @end example
  7008. @end itemize
  7009. @anchor{hqdn3d}
  7010. @section hqdn3d
  7011. This is a high precision/quality 3d denoise filter. It aims to reduce
  7012. image noise, producing smooth images and making still images really
  7013. still. It should enhance compressibility.
  7014. It accepts the following optional parameters:
  7015. @table @option
  7016. @item luma_spatial
  7017. A non-negative floating point number which specifies spatial luma strength.
  7018. It defaults to 4.0.
  7019. @item chroma_spatial
  7020. A non-negative floating point number which specifies spatial chroma strength.
  7021. It defaults to 3.0*@var{luma_spatial}/4.0.
  7022. @item luma_tmp
  7023. A floating point number which specifies luma temporal strength. It defaults to
  7024. 6.0*@var{luma_spatial}/4.0.
  7025. @item chroma_tmp
  7026. A floating point number which specifies chroma temporal strength. It defaults to
  7027. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7028. @end table
  7029. @section hwdownload
  7030. Download hardware frames to system memory.
  7031. The input must be in hardware frames, and the output a non-hardware format.
  7032. Not all formats will be supported on the output - it may be necessary to insert
  7033. an additional @option{format} filter immediately following in the graph to get
  7034. the output in a supported format.
  7035. @section hwmap
  7036. Map hardware frames to system memory or to another device.
  7037. This filter has several different modes of operation; which one is used depends
  7038. on the input and output formats:
  7039. @itemize
  7040. @item
  7041. Hardware frame input, normal frame output
  7042. Map the input frames to system memory and pass them to the output. If the
  7043. original hardware frame is later required (for example, after overlaying
  7044. something else on part of it), the @option{hwmap} filter can be used again
  7045. in the next mode to retrieve it.
  7046. @item
  7047. Normal frame input, hardware frame output
  7048. If the input is actually a software-mapped hardware frame, then unmap it -
  7049. that is, return the original hardware frame.
  7050. Otherwise, a device must be provided. Create new hardware surfaces on that
  7051. device for the output, then map them back to the software format at the input
  7052. and give those frames to the preceding filter. This will then act like the
  7053. @option{hwupload} filter, but may be able to avoid an additional copy when
  7054. the input is already in a compatible format.
  7055. @item
  7056. Hardware frame input and output
  7057. A device must be supplied for the output, either directly or with the
  7058. @option{derive_device} option. The input and output devices must be of
  7059. different types and compatible - the exact meaning of this is
  7060. system-dependent, but typically it means that they must refer to the same
  7061. underlying hardware context (for example, refer to the same graphics card).
  7062. If the input frames were originally created on the output device, then unmap
  7063. to retrieve the original frames.
  7064. Otherwise, map the frames to the output device - create new hardware frames
  7065. on the output corresponding to the frames on the input.
  7066. @end itemize
  7067. The following additional parameters are accepted:
  7068. @table @option
  7069. @item mode
  7070. Set the frame mapping mode. Some combination of:
  7071. @table @var
  7072. @item read
  7073. The mapped frame should be readable.
  7074. @item write
  7075. The mapped frame should be writeable.
  7076. @item overwrite
  7077. The mapping will always overwrite the entire frame.
  7078. This may improve performance in some cases, as the original contents of the
  7079. frame need not be loaded.
  7080. @item direct
  7081. The mapping must not involve any copying.
  7082. Indirect mappings to copies of frames are created in some cases where either
  7083. direct mapping is not possible or it would have unexpected properties.
  7084. Setting this flag ensures that the mapping is direct and will fail if that is
  7085. not possible.
  7086. @end table
  7087. Defaults to @var{read+write} if not specified.
  7088. @item derive_device @var{type}
  7089. Rather than using the device supplied at initialisation, instead derive a new
  7090. device of type @var{type} from the device the input frames exist on.
  7091. @item reverse
  7092. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7093. and map them back to the source. This may be necessary in some cases where
  7094. a mapping in one direction is required but only the opposite direction is
  7095. supported by the devices being used.
  7096. This option is dangerous - it may break the preceding filter in undefined
  7097. ways if there are any additional constraints on that filter's output.
  7098. Do not use it without fully understanding the implications of its use.
  7099. @end table
  7100. @section hwupload
  7101. Upload system memory frames to hardware surfaces.
  7102. The device to upload to must be supplied when the filter is initialised. If
  7103. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7104. option.
  7105. @anchor{hwupload_cuda}
  7106. @section hwupload_cuda
  7107. Upload system memory frames to a CUDA device.
  7108. It accepts the following optional parameters:
  7109. @table @option
  7110. @item device
  7111. The number of the CUDA device to use
  7112. @end table
  7113. @section hqx
  7114. Apply a high-quality magnification filter designed for pixel art. This filter
  7115. was originally created by Maxim Stepin.
  7116. It accepts the following option:
  7117. @table @option
  7118. @item n
  7119. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7120. @code{hq3x} and @code{4} for @code{hq4x}.
  7121. Default is @code{3}.
  7122. @end table
  7123. @section hstack
  7124. Stack input videos horizontally.
  7125. All streams must be of same pixel format and of same height.
  7126. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7127. to create same output.
  7128. The filter accept the following option:
  7129. @table @option
  7130. @item inputs
  7131. Set number of input streams. Default is 2.
  7132. @item shortest
  7133. If set to 1, force the output to terminate when the shortest input
  7134. terminates. Default value is 0.
  7135. @end table
  7136. @section hue
  7137. Modify the hue and/or the saturation of the input.
  7138. It accepts the following parameters:
  7139. @table @option
  7140. @item h
  7141. Specify the hue angle as a number of degrees. It accepts an expression,
  7142. and defaults to "0".
  7143. @item s
  7144. Specify the saturation in the [-10,10] range. It accepts an expression and
  7145. defaults to "1".
  7146. @item H
  7147. Specify the hue angle as a number of radians. It accepts an
  7148. expression, and defaults to "0".
  7149. @item b
  7150. Specify the brightness in the [-10,10] range. It accepts an expression and
  7151. defaults to "0".
  7152. @end table
  7153. @option{h} and @option{H} are mutually exclusive, and can't be
  7154. specified at the same time.
  7155. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7156. expressions containing the following constants:
  7157. @table @option
  7158. @item n
  7159. frame count of the input frame starting from 0
  7160. @item pts
  7161. presentation timestamp of the input frame expressed in time base units
  7162. @item r
  7163. frame rate of the input video, NAN if the input frame rate is unknown
  7164. @item t
  7165. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7166. @item tb
  7167. time base of the input video
  7168. @end table
  7169. @subsection Examples
  7170. @itemize
  7171. @item
  7172. Set the hue to 90 degrees and the saturation to 1.0:
  7173. @example
  7174. hue=h=90:s=1
  7175. @end example
  7176. @item
  7177. Same command but expressing the hue in radians:
  7178. @example
  7179. hue=H=PI/2:s=1
  7180. @end example
  7181. @item
  7182. Rotate hue and make the saturation swing between 0
  7183. and 2 over a period of 1 second:
  7184. @example
  7185. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7186. @end example
  7187. @item
  7188. Apply a 3 seconds saturation fade-in effect starting at 0:
  7189. @example
  7190. hue="s=min(t/3\,1)"
  7191. @end example
  7192. The general fade-in expression can be written as:
  7193. @example
  7194. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7195. @end example
  7196. @item
  7197. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7198. @example
  7199. hue="s=max(0\, min(1\, (8-t)/3))"
  7200. @end example
  7201. The general fade-out expression can be written as:
  7202. @example
  7203. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7204. @end example
  7205. @end itemize
  7206. @subsection Commands
  7207. This filter supports the following commands:
  7208. @table @option
  7209. @item b
  7210. @item s
  7211. @item h
  7212. @item H
  7213. Modify the hue and/or the saturation and/or brightness of the input video.
  7214. The command accepts the same syntax of the corresponding option.
  7215. If the specified expression is not valid, it is kept at its current
  7216. value.
  7217. @end table
  7218. @section hysteresis
  7219. Grow first stream into second stream by connecting components.
  7220. This makes it possible to build more robust edge masks.
  7221. This filter accepts the following options:
  7222. @table @option
  7223. @item planes
  7224. Set which planes will be processed as bitmap, unprocessed planes will be
  7225. copied from first stream.
  7226. By default value 0xf, all planes will be processed.
  7227. @item threshold
  7228. Set threshold which is used in filtering. If pixel component value is higher than
  7229. this value filter algorithm for connecting components is activated.
  7230. By default value is 0.
  7231. @end table
  7232. @section idet
  7233. Detect video interlacing type.
  7234. This filter tries to detect if the input frames are interlaced, progressive,
  7235. top or bottom field first. It will also try to detect fields that are
  7236. repeated between adjacent frames (a sign of telecine).
  7237. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7238. Multiple frame detection incorporates the classification history of previous frames.
  7239. The filter will log these metadata values:
  7240. @table @option
  7241. @item single.current_frame
  7242. Detected type of current frame using single-frame detection. One of:
  7243. ``tff'' (top field first), ``bff'' (bottom field first),
  7244. ``progressive'', or ``undetermined''
  7245. @item single.tff
  7246. Cumulative number of frames detected as top field first using single-frame detection.
  7247. @item multiple.tff
  7248. Cumulative number of frames detected as top field first using multiple-frame detection.
  7249. @item single.bff
  7250. Cumulative number of frames detected as bottom field first using single-frame detection.
  7251. @item multiple.current_frame
  7252. Detected type of current frame using multiple-frame detection. One of:
  7253. ``tff'' (top field first), ``bff'' (bottom field first),
  7254. ``progressive'', or ``undetermined''
  7255. @item multiple.bff
  7256. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7257. @item single.progressive
  7258. Cumulative number of frames detected as progressive using single-frame detection.
  7259. @item multiple.progressive
  7260. Cumulative number of frames detected as progressive using multiple-frame detection.
  7261. @item single.undetermined
  7262. Cumulative number of frames that could not be classified using single-frame detection.
  7263. @item multiple.undetermined
  7264. Cumulative number of frames that could not be classified using multiple-frame detection.
  7265. @item repeated.current_frame
  7266. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7267. @item repeated.neither
  7268. Cumulative number of frames with no repeated field.
  7269. @item repeated.top
  7270. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7271. @item repeated.bottom
  7272. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7273. @end table
  7274. The filter accepts the following options:
  7275. @table @option
  7276. @item intl_thres
  7277. Set interlacing threshold.
  7278. @item prog_thres
  7279. Set progressive threshold.
  7280. @item rep_thres
  7281. Threshold for repeated field detection.
  7282. @item half_life
  7283. Number of frames after which a given frame's contribution to the
  7284. statistics is halved (i.e., it contributes only 0.5 to its
  7285. classification). The default of 0 means that all frames seen are given
  7286. full weight of 1.0 forever.
  7287. @item analyze_interlaced_flag
  7288. When this is not 0 then idet will use the specified number of frames to determine
  7289. if the interlaced flag is accurate, it will not count undetermined frames.
  7290. If the flag is found to be accurate it will be used without any further
  7291. computations, if it is found to be inaccurate it will be cleared without any
  7292. further computations. This allows inserting the idet filter as a low computational
  7293. method to clean up the interlaced flag
  7294. @end table
  7295. @section il
  7296. Deinterleave or interleave fields.
  7297. This filter allows one to process interlaced images fields without
  7298. deinterlacing them. Deinterleaving splits the input frame into 2
  7299. fields (so called half pictures). Odd lines are moved to the top
  7300. half of the output image, even lines to the bottom half.
  7301. You can process (filter) them independently and then re-interleave them.
  7302. The filter accepts the following options:
  7303. @table @option
  7304. @item luma_mode, l
  7305. @item chroma_mode, c
  7306. @item alpha_mode, a
  7307. Available values for @var{luma_mode}, @var{chroma_mode} and
  7308. @var{alpha_mode} are:
  7309. @table @samp
  7310. @item none
  7311. Do nothing.
  7312. @item deinterleave, d
  7313. Deinterleave fields, placing one above the other.
  7314. @item interleave, i
  7315. Interleave fields. Reverse the effect of deinterleaving.
  7316. @end table
  7317. Default value is @code{none}.
  7318. @item luma_swap, ls
  7319. @item chroma_swap, cs
  7320. @item alpha_swap, as
  7321. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7322. @end table
  7323. @section inflate
  7324. Apply inflate effect to the video.
  7325. This filter replaces the pixel by the local(3x3) average by taking into account
  7326. only values higher than the pixel.
  7327. It accepts the following options:
  7328. @table @option
  7329. @item threshold0
  7330. @item threshold1
  7331. @item threshold2
  7332. @item threshold3
  7333. Limit the maximum change for each plane, default is 65535.
  7334. If 0, plane will remain unchanged.
  7335. @end table
  7336. @section interlace
  7337. Simple interlacing filter from progressive contents. This interleaves upper (or
  7338. lower) lines from odd frames with lower (or upper) lines from even frames,
  7339. halving the frame rate and preserving image height.
  7340. @example
  7341. Original Original New Frame
  7342. Frame 'j' Frame 'j+1' (tff)
  7343. ========== =========== ==================
  7344. Line 0 --------------------> Frame 'j' Line 0
  7345. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7346. Line 2 ---------------------> Frame 'j' Line 2
  7347. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7348. ... ... ...
  7349. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7350. @end example
  7351. It accepts the following optional parameters:
  7352. @table @option
  7353. @item scan
  7354. This determines whether the interlaced frame is taken from the even
  7355. (tff - default) or odd (bff) lines of the progressive frame.
  7356. @item lowpass
  7357. Vertical lowpass filter to avoid twitter interlacing and
  7358. reduce moire patterns.
  7359. @table @samp
  7360. @item 0, off
  7361. Disable vertical lowpass filter
  7362. @item 1, linear
  7363. Enable linear filter (default)
  7364. @item 2, complex
  7365. Enable complex filter. This will slightly less reduce twitter and moire
  7366. but better retain detail and subjective sharpness impression.
  7367. @end table
  7368. @end table
  7369. @section kerndeint
  7370. Deinterlace input video by applying Donald Graft's adaptive kernel
  7371. deinterling. Work on interlaced parts of a video to produce
  7372. progressive frames.
  7373. The description of the accepted parameters follows.
  7374. @table @option
  7375. @item thresh
  7376. Set the threshold which affects the filter's tolerance when
  7377. determining if a pixel line must be processed. It must be an integer
  7378. in the range [0,255] and defaults to 10. A value of 0 will result in
  7379. applying the process on every pixels.
  7380. @item map
  7381. Paint pixels exceeding the threshold value to white if set to 1.
  7382. Default is 0.
  7383. @item order
  7384. Set the fields order. Swap fields if set to 1, leave fields alone if
  7385. 0. Default is 0.
  7386. @item sharp
  7387. Enable additional sharpening if set to 1. Default is 0.
  7388. @item twoway
  7389. Enable twoway sharpening if set to 1. Default is 0.
  7390. @end table
  7391. @subsection Examples
  7392. @itemize
  7393. @item
  7394. Apply default values:
  7395. @example
  7396. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7397. @end example
  7398. @item
  7399. Enable additional sharpening:
  7400. @example
  7401. kerndeint=sharp=1
  7402. @end example
  7403. @item
  7404. Paint processed pixels in white:
  7405. @example
  7406. kerndeint=map=1
  7407. @end example
  7408. @end itemize
  7409. @section lenscorrection
  7410. Correct radial lens distortion
  7411. This filter can be used to correct for radial distortion as can result from the use
  7412. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7413. one can use tools available for example as part of opencv or simply trial-and-error.
  7414. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7415. and extract the k1 and k2 coefficients from the resulting matrix.
  7416. Note that effectively the same filter is available in the open-source tools Krita and
  7417. Digikam from the KDE project.
  7418. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7419. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7420. brightness distribution, so you may want to use both filters together in certain
  7421. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7422. be applied before or after lens correction.
  7423. @subsection Options
  7424. The filter accepts the following options:
  7425. @table @option
  7426. @item cx
  7427. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7428. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7429. width.
  7430. @item cy
  7431. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7432. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7433. height.
  7434. @item k1
  7435. Coefficient of the quadratic correction term. 0.5 means no correction.
  7436. @item k2
  7437. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7438. @end table
  7439. The formula that generates the correction is:
  7440. @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)
  7441. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7442. distances from the focal point in the source and target images, respectively.
  7443. @section libvmaf
  7444. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7445. score between two input videos.
  7446. This filter takes two input videos.
  7447. Both video inputs must have the same resolution and pixel format for
  7448. this filter to work correctly. Also it assumes that both inputs
  7449. have the same number of frames, which are compared one by one.
  7450. The obtained average VMAF score is printed through the logging system.
  7451. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7452. After installing the library it can be enabled using:
  7453. @code{./configure --enable-libvmaf}.
  7454. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7455. On the below examples the input file @file{main.mpg} being processed is
  7456. compared with the reference file @file{ref.mpg}.
  7457. The filter has following options:
  7458. @table @option
  7459. @item model_path
  7460. Set the model path which is to be used for SVM.
  7461. Default value: @code{"vmaf_v0.6.1.pkl"}
  7462. @item log_path
  7463. Set the file path to be used to store logs.
  7464. @item log_fmt
  7465. Set the format of the log file (xml or json).
  7466. @item enable_transform
  7467. Enables transform for computing vmaf.
  7468. @item phone_model
  7469. Invokes the phone model which will generate VMAF scores higher than in the
  7470. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7471. @item psnr
  7472. Enables computing psnr along with vmaf.
  7473. @item ssim
  7474. Enables computing ssim along with vmaf.
  7475. @item ms_ssim
  7476. Enables computing ms_ssim along with vmaf.
  7477. @item pool
  7478. Set the pool method to be used for computing vmaf.
  7479. @end table
  7480. For example:
  7481. @example
  7482. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7483. @end example
  7484. Example with options:
  7485. @example
  7486. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7487. @end example
  7488. @section limiter
  7489. Limits the pixel components values to the specified range [min, max].
  7490. The filter accepts the following options:
  7491. @table @option
  7492. @item min
  7493. Lower bound. Defaults to the lowest allowed value for the input.
  7494. @item max
  7495. Upper bound. Defaults to the highest allowed value for the input.
  7496. @item planes
  7497. Specify which planes will be processed. Defaults to all available.
  7498. @end table
  7499. @section loop
  7500. Loop video frames.
  7501. The filter accepts the following options:
  7502. @table @option
  7503. @item loop
  7504. Set the number of loops.
  7505. @item size
  7506. Set maximal size in number of frames.
  7507. @item start
  7508. Set first frame of loop.
  7509. @end table
  7510. @anchor{lut3d}
  7511. @section lut3d
  7512. Apply a 3D LUT to an input video.
  7513. The filter accepts the following options:
  7514. @table @option
  7515. @item file
  7516. Set the 3D LUT file name.
  7517. Currently supported formats:
  7518. @table @samp
  7519. @item 3dl
  7520. AfterEffects
  7521. @item cube
  7522. Iridas
  7523. @item dat
  7524. DaVinci
  7525. @item m3d
  7526. Pandora
  7527. @end table
  7528. @item interp
  7529. Select interpolation mode.
  7530. Available values are:
  7531. @table @samp
  7532. @item nearest
  7533. Use values from the nearest defined point.
  7534. @item trilinear
  7535. Interpolate values using the 8 points defining a cube.
  7536. @item tetrahedral
  7537. Interpolate values using a tetrahedron.
  7538. @end table
  7539. @end table
  7540. @section lumakey
  7541. Turn certain luma values into transparency.
  7542. The filter accepts the following options:
  7543. @table @option
  7544. @item threshold
  7545. Set the luma which will be used as base for transparency.
  7546. Default value is @code{0}.
  7547. @item tolerance
  7548. Set the range of luma values to be keyed out.
  7549. Default value is @code{0}.
  7550. @item softness
  7551. Set the range of softness. Default value is @code{0}.
  7552. Use this to control gradual transition from zero to full transparency.
  7553. @end table
  7554. @section lut, lutrgb, lutyuv
  7555. Compute a look-up table for binding each pixel component input value
  7556. to an output value, and apply it to the input video.
  7557. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7558. to an RGB input video.
  7559. These filters accept the following parameters:
  7560. @table @option
  7561. @item c0
  7562. set first pixel component expression
  7563. @item c1
  7564. set second pixel component expression
  7565. @item c2
  7566. set third pixel component expression
  7567. @item c3
  7568. set fourth pixel component expression, corresponds to the alpha component
  7569. @item r
  7570. set red component expression
  7571. @item g
  7572. set green component expression
  7573. @item b
  7574. set blue component expression
  7575. @item a
  7576. alpha component expression
  7577. @item y
  7578. set Y/luminance component expression
  7579. @item u
  7580. set U/Cb component expression
  7581. @item v
  7582. set V/Cr component expression
  7583. @end table
  7584. Each of them specifies the expression to use for computing the lookup table for
  7585. the corresponding pixel component values.
  7586. The exact component associated to each of the @var{c*} options depends on the
  7587. format in input.
  7588. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7589. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7590. The expressions can contain the following constants and functions:
  7591. @table @option
  7592. @item w
  7593. @item h
  7594. The input width and height.
  7595. @item val
  7596. The input value for the pixel component.
  7597. @item clipval
  7598. The input value, clipped to the @var{minval}-@var{maxval} range.
  7599. @item maxval
  7600. The maximum value for the pixel component.
  7601. @item minval
  7602. The minimum value for the pixel component.
  7603. @item negval
  7604. The negated value for the pixel component value, clipped to the
  7605. @var{minval}-@var{maxval} range; it corresponds to the expression
  7606. "maxval-clipval+minval".
  7607. @item clip(val)
  7608. The computed value in @var{val}, clipped to the
  7609. @var{minval}-@var{maxval} range.
  7610. @item gammaval(gamma)
  7611. The computed gamma correction value of the pixel component value,
  7612. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7613. expression
  7614. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7615. @end table
  7616. All expressions default to "val".
  7617. @subsection Examples
  7618. @itemize
  7619. @item
  7620. Negate input video:
  7621. @example
  7622. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7623. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7624. @end example
  7625. The above is the same as:
  7626. @example
  7627. lutrgb="r=negval:g=negval:b=negval"
  7628. lutyuv="y=negval:u=negval:v=negval"
  7629. @end example
  7630. @item
  7631. Negate luminance:
  7632. @example
  7633. lutyuv=y=negval
  7634. @end example
  7635. @item
  7636. Remove chroma components, turning the video into a graytone image:
  7637. @example
  7638. lutyuv="u=128:v=128"
  7639. @end example
  7640. @item
  7641. Apply a luma burning effect:
  7642. @example
  7643. lutyuv="y=2*val"
  7644. @end example
  7645. @item
  7646. Remove green and blue components:
  7647. @example
  7648. lutrgb="g=0:b=0"
  7649. @end example
  7650. @item
  7651. Set a constant alpha channel value on input:
  7652. @example
  7653. format=rgba,lutrgb=a="maxval-minval/2"
  7654. @end example
  7655. @item
  7656. Correct luminance gamma by a factor of 0.5:
  7657. @example
  7658. lutyuv=y=gammaval(0.5)
  7659. @end example
  7660. @item
  7661. Discard least significant bits of luma:
  7662. @example
  7663. lutyuv=y='bitand(val, 128+64+32)'
  7664. @end example
  7665. @item
  7666. Technicolor like effect:
  7667. @example
  7668. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7669. @end example
  7670. @end itemize
  7671. @section lut2, tlut2
  7672. The @code{lut2} filter takes two input streams and outputs one
  7673. stream.
  7674. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7675. from one single stream.
  7676. This filter accepts the following parameters:
  7677. @table @option
  7678. @item c0
  7679. set first pixel component expression
  7680. @item c1
  7681. set second pixel component expression
  7682. @item c2
  7683. set third pixel component expression
  7684. @item c3
  7685. set fourth pixel component expression, corresponds to the alpha component
  7686. @end table
  7687. Each of them specifies the expression to use for computing the lookup table for
  7688. the corresponding pixel component values.
  7689. The exact component associated to each of the @var{c*} options depends on the
  7690. format in inputs.
  7691. The expressions can contain the following constants:
  7692. @table @option
  7693. @item w
  7694. @item h
  7695. The input width and height.
  7696. @item x
  7697. The first input value for the pixel component.
  7698. @item y
  7699. The second input value for the pixel component.
  7700. @item bdx
  7701. The first input video bit depth.
  7702. @item bdy
  7703. The second input video bit depth.
  7704. @end table
  7705. All expressions default to "x".
  7706. @subsection Examples
  7707. @itemize
  7708. @item
  7709. Highlight differences between two RGB video streams:
  7710. @example
  7711. 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)'
  7712. @end example
  7713. @item
  7714. Highlight differences between two YUV video streams:
  7715. @example
  7716. 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)'
  7717. @end example
  7718. @item
  7719. Show max difference between two video streams:
  7720. @example
  7721. 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)))'
  7722. @end example
  7723. @end itemize
  7724. @section maskedclamp
  7725. Clamp the first input stream with the second input and third input stream.
  7726. Returns the value of first stream to be between second input
  7727. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7728. This filter accepts the following options:
  7729. @table @option
  7730. @item undershoot
  7731. Default value is @code{0}.
  7732. @item overshoot
  7733. Default value is @code{0}.
  7734. @item planes
  7735. Set which planes will be processed as bitmap, unprocessed planes will be
  7736. copied from first stream.
  7737. By default value 0xf, all planes will be processed.
  7738. @end table
  7739. @section maskedmerge
  7740. Merge the first input stream with the second input stream using per pixel
  7741. weights in the third input stream.
  7742. A value of 0 in the third stream pixel component means that pixel component
  7743. from first stream is returned unchanged, while maximum value (eg. 255 for
  7744. 8-bit videos) means that pixel component from second stream is returned
  7745. unchanged. Intermediate values define the amount of merging between both
  7746. input stream's pixel components.
  7747. This filter accepts the following options:
  7748. @table @option
  7749. @item planes
  7750. Set which planes will be processed as bitmap, unprocessed planes will be
  7751. copied from first stream.
  7752. By default value 0xf, all planes will be processed.
  7753. @end table
  7754. @section mcdeint
  7755. Apply motion-compensation deinterlacing.
  7756. It needs one field per frame as input and must thus be used together
  7757. with yadif=1/3 or equivalent.
  7758. This filter accepts the following options:
  7759. @table @option
  7760. @item mode
  7761. Set the deinterlacing mode.
  7762. It accepts one of the following values:
  7763. @table @samp
  7764. @item fast
  7765. @item medium
  7766. @item slow
  7767. use iterative motion estimation
  7768. @item extra_slow
  7769. like @samp{slow}, but use multiple reference frames.
  7770. @end table
  7771. Default value is @samp{fast}.
  7772. @item parity
  7773. Set the picture field parity assumed for the input video. It must be
  7774. one of the following values:
  7775. @table @samp
  7776. @item 0, tff
  7777. assume top field first
  7778. @item 1, bff
  7779. assume bottom field first
  7780. @end table
  7781. Default value is @samp{bff}.
  7782. @item qp
  7783. Set per-block quantization parameter (QP) used by the internal
  7784. encoder.
  7785. Higher values should result in a smoother motion vector field but less
  7786. optimal individual vectors. Default value is 1.
  7787. @end table
  7788. @section mergeplanes
  7789. Merge color channel components from several video streams.
  7790. The filter accepts up to 4 input streams, and merge selected input
  7791. planes to the output video.
  7792. This filter accepts the following options:
  7793. @table @option
  7794. @item mapping
  7795. Set input to output plane mapping. Default is @code{0}.
  7796. The mappings is specified as a bitmap. It should be specified as a
  7797. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7798. mapping for the first plane of the output stream. 'A' sets the number of
  7799. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7800. corresponding input to use (from 0 to 3). The rest of the mappings is
  7801. similar, 'Bb' describes the mapping for the output stream second
  7802. plane, 'Cc' describes the mapping for the output stream third plane and
  7803. 'Dd' describes the mapping for the output stream fourth plane.
  7804. @item format
  7805. Set output pixel format. Default is @code{yuva444p}.
  7806. @end table
  7807. @subsection Examples
  7808. @itemize
  7809. @item
  7810. Merge three gray video streams of same width and height into single video stream:
  7811. @example
  7812. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7813. @end example
  7814. @item
  7815. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7816. @example
  7817. [a0][a1]mergeplanes=0x00010210:yuva444p
  7818. @end example
  7819. @item
  7820. Swap Y and A plane in yuva444p stream:
  7821. @example
  7822. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7823. @end example
  7824. @item
  7825. Swap U and V plane in yuv420p stream:
  7826. @example
  7827. format=yuv420p,mergeplanes=0x000201:yuv420p
  7828. @end example
  7829. @item
  7830. Cast a rgb24 clip to yuv444p:
  7831. @example
  7832. format=rgb24,mergeplanes=0x000102:yuv444p
  7833. @end example
  7834. @end itemize
  7835. @section mestimate
  7836. Estimate and export motion vectors using block matching algorithms.
  7837. Motion vectors are stored in frame side data to be used by other filters.
  7838. This filter accepts the following options:
  7839. @table @option
  7840. @item method
  7841. Specify the motion estimation method. Accepts one of the following values:
  7842. @table @samp
  7843. @item esa
  7844. Exhaustive search algorithm.
  7845. @item tss
  7846. Three step search algorithm.
  7847. @item tdls
  7848. Two dimensional logarithmic search algorithm.
  7849. @item ntss
  7850. New three step search algorithm.
  7851. @item fss
  7852. Four step search algorithm.
  7853. @item ds
  7854. Diamond search algorithm.
  7855. @item hexbs
  7856. Hexagon-based search algorithm.
  7857. @item epzs
  7858. Enhanced predictive zonal search algorithm.
  7859. @item umh
  7860. Uneven multi-hexagon search algorithm.
  7861. @end table
  7862. Default value is @samp{esa}.
  7863. @item mb_size
  7864. Macroblock size. Default @code{16}.
  7865. @item search_param
  7866. Search parameter. Default @code{7}.
  7867. @end table
  7868. @section midequalizer
  7869. Apply Midway Image Equalization effect using two video streams.
  7870. Midway Image Equalization adjusts a pair of images to have the same
  7871. histogram, while maintaining their dynamics as much as possible. It's
  7872. useful for e.g. matching exposures from a pair of stereo cameras.
  7873. This filter has two inputs and one output, which must be of same pixel format, but
  7874. may be of different sizes. The output of filter is first input adjusted with
  7875. midway histogram of both inputs.
  7876. This filter accepts the following option:
  7877. @table @option
  7878. @item planes
  7879. Set which planes to process. Default is @code{15}, which is all available planes.
  7880. @end table
  7881. @section minterpolate
  7882. Convert the video to specified frame rate using motion interpolation.
  7883. This filter accepts the following options:
  7884. @table @option
  7885. @item fps
  7886. 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}.
  7887. @item mi_mode
  7888. Motion interpolation mode. Following values are accepted:
  7889. @table @samp
  7890. @item dup
  7891. Duplicate previous or next frame for interpolating new ones.
  7892. @item blend
  7893. Blend source frames. Interpolated frame is mean of previous and next frames.
  7894. @item mci
  7895. Motion compensated interpolation. Following options are effective when this mode is selected:
  7896. @table @samp
  7897. @item mc_mode
  7898. Motion compensation mode. Following values are accepted:
  7899. @table @samp
  7900. @item obmc
  7901. Overlapped block motion compensation.
  7902. @item aobmc
  7903. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7904. @end table
  7905. Default mode is @samp{obmc}.
  7906. @item me_mode
  7907. Motion estimation mode. Following values are accepted:
  7908. @table @samp
  7909. @item bidir
  7910. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7911. @item bilat
  7912. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7913. @end table
  7914. Default mode is @samp{bilat}.
  7915. @item me
  7916. The algorithm to be used for motion estimation. Following values are accepted:
  7917. @table @samp
  7918. @item esa
  7919. Exhaustive search algorithm.
  7920. @item tss
  7921. Three step search algorithm.
  7922. @item tdls
  7923. Two dimensional logarithmic search algorithm.
  7924. @item ntss
  7925. New three step search algorithm.
  7926. @item fss
  7927. Four step search algorithm.
  7928. @item ds
  7929. Diamond search algorithm.
  7930. @item hexbs
  7931. Hexagon-based search algorithm.
  7932. @item epzs
  7933. Enhanced predictive zonal search algorithm.
  7934. @item umh
  7935. Uneven multi-hexagon search algorithm.
  7936. @end table
  7937. Default algorithm is @samp{epzs}.
  7938. @item mb_size
  7939. Macroblock size. Default @code{16}.
  7940. @item search_param
  7941. Motion estimation search parameter. Default @code{32}.
  7942. @item vsbmc
  7943. 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).
  7944. @end table
  7945. @end table
  7946. @item scd
  7947. 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:
  7948. @table @samp
  7949. @item none
  7950. Disable scene change detection.
  7951. @item fdiff
  7952. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7953. @end table
  7954. Default method is @samp{fdiff}.
  7955. @item scd_threshold
  7956. Scene change detection threshold. Default is @code{5.0}.
  7957. @end table
  7958. @section mpdecimate
  7959. Drop frames that do not differ greatly from the previous frame in
  7960. order to reduce frame rate.
  7961. The main use of this filter is for very-low-bitrate encoding
  7962. (e.g. streaming over dialup modem), but it could in theory be used for
  7963. fixing movies that were inverse-telecined incorrectly.
  7964. A description of the accepted options follows.
  7965. @table @option
  7966. @item max
  7967. Set the maximum number of consecutive frames which can be dropped (if
  7968. positive), or the minimum interval between dropped frames (if
  7969. negative). If the value is 0, the frame is dropped unregarding the
  7970. number of previous sequentially dropped frames.
  7971. Default value is 0.
  7972. @item hi
  7973. @item lo
  7974. @item frac
  7975. Set the dropping threshold values.
  7976. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7977. represent actual pixel value differences, so a threshold of 64
  7978. corresponds to 1 unit of difference for each pixel, or the same spread
  7979. out differently over the block.
  7980. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7981. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7982. meaning the whole image) differ by more than a threshold of @option{lo}.
  7983. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7984. 64*5, and default value for @option{frac} is 0.33.
  7985. @end table
  7986. @section negate
  7987. Negate input video.
  7988. It accepts an integer in input; if non-zero it negates the
  7989. alpha component (if available). The default value in input is 0.
  7990. @section nlmeans
  7991. Denoise frames using Non-Local Means algorithm.
  7992. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7993. context similarity is defined by comparing their surrounding patches of size
  7994. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7995. around the pixel.
  7996. Note that the research area defines centers for patches, which means some
  7997. patches will be made of pixels outside that research area.
  7998. The filter accepts the following options.
  7999. @table @option
  8000. @item s
  8001. Set denoising strength.
  8002. @item p
  8003. Set patch size.
  8004. @item pc
  8005. Same as @option{p} but for chroma planes.
  8006. The default value is @var{0} and means automatic.
  8007. @item r
  8008. Set research size.
  8009. @item rc
  8010. Same as @option{r} but for chroma planes.
  8011. The default value is @var{0} and means automatic.
  8012. @end table
  8013. @section nnedi
  8014. Deinterlace video using neural network edge directed interpolation.
  8015. This filter accepts the following options:
  8016. @table @option
  8017. @item weights
  8018. Mandatory option, without binary file filter can not work.
  8019. Currently file can be found here:
  8020. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8021. @item deint
  8022. Set which frames to deinterlace, by default it is @code{all}.
  8023. Can be @code{all} or @code{interlaced}.
  8024. @item field
  8025. Set mode of operation.
  8026. Can be one of the following:
  8027. @table @samp
  8028. @item af
  8029. Use frame flags, both fields.
  8030. @item a
  8031. Use frame flags, single field.
  8032. @item t
  8033. Use top field only.
  8034. @item b
  8035. Use bottom field only.
  8036. @item tf
  8037. Use both fields, top first.
  8038. @item bf
  8039. Use both fields, bottom first.
  8040. @end table
  8041. @item planes
  8042. Set which planes to process, by default filter process all frames.
  8043. @item nsize
  8044. Set size of local neighborhood around each pixel, used by the predictor neural
  8045. network.
  8046. Can be one of the following:
  8047. @table @samp
  8048. @item s8x6
  8049. @item s16x6
  8050. @item s32x6
  8051. @item s48x6
  8052. @item s8x4
  8053. @item s16x4
  8054. @item s32x4
  8055. @end table
  8056. @item nns
  8057. Set the number of neurons in predicctor neural network.
  8058. Can be one of the following:
  8059. @table @samp
  8060. @item n16
  8061. @item n32
  8062. @item n64
  8063. @item n128
  8064. @item n256
  8065. @end table
  8066. @item qual
  8067. Controls the number of different neural network predictions that are blended
  8068. together to compute the final output value. Can be @code{fast}, default or
  8069. @code{slow}.
  8070. @item etype
  8071. Set which set of weights to use in the predictor.
  8072. Can be one of the following:
  8073. @table @samp
  8074. @item a
  8075. weights trained to minimize absolute error
  8076. @item s
  8077. weights trained to minimize squared error
  8078. @end table
  8079. @item pscrn
  8080. Controls whether or not the prescreener neural network is used to decide
  8081. which pixels should be processed by the predictor neural network and which
  8082. can be handled by simple cubic interpolation.
  8083. The prescreener is trained to know whether cubic interpolation will be
  8084. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8085. The computational complexity of the prescreener nn is much less than that of
  8086. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8087. using the prescreener generally results in much faster processing.
  8088. The prescreener is pretty accurate, so the difference between using it and not
  8089. using it is almost always unnoticeable.
  8090. Can be one of the following:
  8091. @table @samp
  8092. @item none
  8093. @item original
  8094. @item new
  8095. @end table
  8096. Default is @code{new}.
  8097. @item fapprox
  8098. Set various debugging flags.
  8099. @end table
  8100. @section noformat
  8101. Force libavfilter not to use any of the specified pixel formats for the
  8102. input to the next filter.
  8103. It accepts the following parameters:
  8104. @table @option
  8105. @item pix_fmts
  8106. A '|'-separated list of pixel format names, such as
  8107. apix_fmts=yuv420p|monow|rgb24".
  8108. @end table
  8109. @subsection Examples
  8110. @itemize
  8111. @item
  8112. Force libavfilter to use a format different from @var{yuv420p} for the
  8113. input to the vflip filter:
  8114. @example
  8115. noformat=pix_fmts=yuv420p,vflip
  8116. @end example
  8117. @item
  8118. Convert the input video to any of the formats not contained in the list:
  8119. @example
  8120. noformat=yuv420p|yuv444p|yuv410p
  8121. @end example
  8122. @end itemize
  8123. @section noise
  8124. Add noise on video input frame.
  8125. The filter accepts the following options:
  8126. @table @option
  8127. @item all_seed
  8128. @item c0_seed
  8129. @item c1_seed
  8130. @item c2_seed
  8131. @item c3_seed
  8132. Set noise seed for specific pixel component or all pixel components in case
  8133. of @var{all_seed}. Default value is @code{123457}.
  8134. @item all_strength, alls
  8135. @item c0_strength, c0s
  8136. @item c1_strength, c1s
  8137. @item c2_strength, c2s
  8138. @item c3_strength, c3s
  8139. Set noise strength for specific pixel component or all pixel components in case
  8140. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8141. @item all_flags, allf
  8142. @item c0_flags, c0f
  8143. @item c1_flags, c1f
  8144. @item c2_flags, c2f
  8145. @item c3_flags, c3f
  8146. Set pixel component flags or set flags for all components if @var{all_flags}.
  8147. Available values for component flags are:
  8148. @table @samp
  8149. @item a
  8150. averaged temporal noise (smoother)
  8151. @item p
  8152. mix random noise with a (semi)regular pattern
  8153. @item t
  8154. temporal noise (noise pattern changes between frames)
  8155. @item u
  8156. uniform noise (gaussian otherwise)
  8157. @end table
  8158. @end table
  8159. @subsection Examples
  8160. Add temporal and uniform noise to input video:
  8161. @example
  8162. noise=alls=20:allf=t+u
  8163. @end example
  8164. @section null
  8165. Pass the video source unchanged to the output.
  8166. @section ocr
  8167. Optical Character Recognition
  8168. This filter uses Tesseract for optical character recognition.
  8169. It accepts the following options:
  8170. @table @option
  8171. @item datapath
  8172. Set datapath to tesseract data. Default is to use whatever was
  8173. set at installation.
  8174. @item language
  8175. Set language, default is "eng".
  8176. @item whitelist
  8177. Set character whitelist.
  8178. @item blacklist
  8179. Set character blacklist.
  8180. @end table
  8181. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8182. @section ocv
  8183. Apply a video transform using libopencv.
  8184. To enable this filter, install the libopencv library and headers and
  8185. configure FFmpeg with @code{--enable-libopencv}.
  8186. It accepts the following parameters:
  8187. @table @option
  8188. @item filter_name
  8189. The name of the libopencv filter to apply.
  8190. @item filter_params
  8191. The parameters to pass to the libopencv filter. If not specified, the default
  8192. values are assumed.
  8193. @end table
  8194. Refer to the official libopencv documentation for more precise
  8195. information:
  8196. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8197. Several libopencv filters are supported; see the following subsections.
  8198. @anchor{dilate}
  8199. @subsection dilate
  8200. Dilate an image by using a specific structuring element.
  8201. It corresponds to the libopencv function @code{cvDilate}.
  8202. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8203. @var{struct_el} represents a structuring element, and has the syntax:
  8204. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8205. @var{cols} and @var{rows} represent the number of columns and rows of
  8206. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8207. point, and @var{shape} the shape for the structuring element. @var{shape}
  8208. must be "rect", "cross", "ellipse", or "custom".
  8209. If the value for @var{shape} is "custom", it must be followed by a
  8210. string of the form "=@var{filename}". The file with name
  8211. @var{filename} is assumed to represent a binary image, with each
  8212. printable character corresponding to a bright pixel. When a custom
  8213. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8214. or columns and rows of the read file are assumed instead.
  8215. The default value for @var{struct_el} is "3x3+0x0/rect".
  8216. @var{nb_iterations} specifies the number of times the transform is
  8217. applied to the image, and defaults to 1.
  8218. Some examples:
  8219. @example
  8220. # Use the default values
  8221. ocv=dilate
  8222. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8223. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8224. # Read the shape from the file diamond.shape, iterating two times.
  8225. # The file diamond.shape may contain a pattern of characters like this
  8226. # *
  8227. # ***
  8228. # *****
  8229. # ***
  8230. # *
  8231. # The specified columns and rows are ignored
  8232. # but the anchor point coordinates are not
  8233. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8234. @end example
  8235. @subsection erode
  8236. Erode an image by using a specific structuring element.
  8237. It corresponds to the libopencv function @code{cvErode}.
  8238. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8239. with the same syntax and semantics as the @ref{dilate} filter.
  8240. @subsection smooth
  8241. Smooth the input video.
  8242. The filter takes the following parameters:
  8243. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8244. @var{type} is the type of smooth filter to apply, and must be one of
  8245. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8246. or "bilateral". The default value is "gaussian".
  8247. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8248. depend on the smooth type. @var{param1} and
  8249. @var{param2} accept integer positive values or 0. @var{param3} and
  8250. @var{param4} accept floating point values.
  8251. The default value for @var{param1} is 3. The default value for the
  8252. other parameters is 0.
  8253. These parameters correspond to the parameters assigned to the
  8254. libopencv function @code{cvSmooth}.
  8255. @section oscilloscope
  8256. 2D Video Oscilloscope.
  8257. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8258. It accepts the following parameters:
  8259. @table @option
  8260. @item x
  8261. Set scope center x position.
  8262. @item y
  8263. Set scope center y position.
  8264. @item s
  8265. Set scope size, relative to frame diagonal.
  8266. @item t
  8267. Set scope tilt/rotation.
  8268. @item o
  8269. Set trace opacity.
  8270. @item tx
  8271. Set trace center x position.
  8272. @item ty
  8273. Set trace center y position.
  8274. @item tw
  8275. Set trace width, relative to width of frame.
  8276. @item th
  8277. Set trace height, relative to height of frame.
  8278. @item c
  8279. Set which components to trace. By default it traces first three components.
  8280. @item g
  8281. Draw trace grid. By default is enabled.
  8282. @item st
  8283. Draw some statistics. By default is enabled.
  8284. @item sc
  8285. Draw scope. By default is enabled.
  8286. @end table
  8287. @subsection Examples
  8288. @itemize
  8289. @item
  8290. Inspect full first row of video frame.
  8291. @example
  8292. oscilloscope=x=0.5:y=0:s=1
  8293. @end example
  8294. @item
  8295. Inspect full last row of video frame.
  8296. @example
  8297. oscilloscope=x=0.5:y=1:s=1
  8298. @end example
  8299. @item
  8300. Inspect full 5th line of video frame of height 1080.
  8301. @example
  8302. oscilloscope=x=0.5:y=5/1080:s=1
  8303. @end example
  8304. @item
  8305. Inspect full last column of video frame.
  8306. @example
  8307. oscilloscope=x=1:y=0.5:s=1:t=1
  8308. @end example
  8309. @end itemize
  8310. @anchor{overlay}
  8311. @section overlay
  8312. Overlay one video on top of another.
  8313. It takes two inputs and has one output. The first input is the "main"
  8314. video on which the second input is overlaid.
  8315. It accepts the following parameters:
  8316. A description of the accepted options follows.
  8317. @table @option
  8318. @item x
  8319. @item y
  8320. Set the expression for the x and y coordinates of the overlaid video
  8321. on the main video. Default value is "0" for both expressions. In case
  8322. the expression is invalid, it is set to a huge value (meaning that the
  8323. overlay will not be displayed within the output visible area).
  8324. @item eof_action
  8325. The action to take when EOF is encountered on the secondary input; it accepts
  8326. one of the following values:
  8327. @table @option
  8328. @item repeat
  8329. Repeat the last frame (the default).
  8330. @item endall
  8331. End both streams.
  8332. @item pass
  8333. Pass the main input through.
  8334. @end table
  8335. @item eval
  8336. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8337. It accepts the following values:
  8338. @table @samp
  8339. @item init
  8340. only evaluate expressions once during the filter initialization or
  8341. when a command is processed
  8342. @item frame
  8343. evaluate expressions for each incoming frame
  8344. @end table
  8345. Default value is @samp{frame}.
  8346. @item shortest
  8347. If set to 1, force the output to terminate when the shortest input
  8348. terminates. Default value is 0.
  8349. @item format
  8350. Set the format for the output video.
  8351. It accepts the following values:
  8352. @table @samp
  8353. @item yuv420
  8354. force YUV420 output
  8355. @item yuv422
  8356. force YUV422 output
  8357. @item yuv444
  8358. force YUV444 output
  8359. @item rgb
  8360. force packed RGB output
  8361. @item gbrp
  8362. force planar RGB output
  8363. @item auto
  8364. automatically pick format
  8365. @end table
  8366. Default value is @samp{yuv420}.
  8367. @item repeatlast
  8368. If set to 1, force the filter to draw the last overlay frame over the
  8369. main input until the end of the stream. A value of 0 disables this
  8370. behavior. Default value is 1.
  8371. @end table
  8372. The @option{x}, and @option{y} expressions can contain the following
  8373. parameters.
  8374. @table @option
  8375. @item main_w, W
  8376. @item main_h, H
  8377. The main input width and height.
  8378. @item overlay_w, w
  8379. @item overlay_h, h
  8380. The overlay input width and height.
  8381. @item x
  8382. @item y
  8383. The computed values for @var{x} and @var{y}. They are evaluated for
  8384. each new frame.
  8385. @item hsub
  8386. @item vsub
  8387. horizontal and vertical chroma subsample values of the output
  8388. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8389. @var{vsub} is 1.
  8390. @item n
  8391. the number of input frame, starting from 0
  8392. @item pos
  8393. the position in the file of the input frame, NAN if unknown
  8394. @item t
  8395. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8396. @end table
  8397. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8398. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8399. when @option{eval} is set to @samp{init}.
  8400. Be aware that frames are taken from each input video in timestamp
  8401. order, hence, if their initial timestamps differ, it is a good idea
  8402. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8403. have them begin in the same zero timestamp, as the example for
  8404. the @var{movie} filter does.
  8405. You can chain together more overlays but you should test the
  8406. efficiency of such approach.
  8407. @subsection Commands
  8408. This filter supports the following commands:
  8409. @table @option
  8410. @item x
  8411. @item y
  8412. Modify the x and y of the overlay input.
  8413. The command accepts the same syntax of the corresponding option.
  8414. If the specified expression is not valid, it is kept at its current
  8415. value.
  8416. @end table
  8417. @subsection Examples
  8418. @itemize
  8419. @item
  8420. Draw the overlay at 10 pixels from the bottom right corner of the main
  8421. video:
  8422. @example
  8423. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8424. @end example
  8425. Using named options the example above becomes:
  8426. @example
  8427. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8428. @end example
  8429. @item
  8430. Insert a transparent PNG logo in the bottom left corner of the input,
  8431. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8432. @example
  8433. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8434. @end example
  8435. @item
  8436. Insert 2 different transparent PNG logos (second logo on bottom
  8437. right corner) using the @command{ffmpeg} tool:
  8438. @example
  8439. 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
  8440. @end example
  8441. @item
  8442. Add a transparent color layer on top of the main video; @code{WxH}
  8443. must specify the size of the main input to the overlay filter:
  8444. @example
  8445. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8446. @end example
  8447. @item
  8448. Play an original video and a filtered version (here with the deshake
  8449. filter) side by side using the @command{ffplay} tool:
  8450. @example
  8451. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8452. @end example
  8453. The above command is the same as:
  8454. @example
  8455. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8456. @end example
  8457. @item
  8458. Make a sliding overlay appearing from the left to the right top part of the
  8459. screen starting since time 2:
  8460. @example
  8461. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8462. @end example
  8463. @item
  8464. Compose output by putting two input videos side to side:
  8465. @example
  8466. ffmpeg -i left.avi -i right.avi -filter_complex "
  8467. nullsrc=size=200x100 [background];
  8468. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8469. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8470. [background][left] overlay=shortest=1 [background+left];
  8471. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8472. "
  8473. @end example
  8474. @item
  8475. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8476. @example
  8477. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8478. -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]'
  8479. masked.avi
  8480. @end example
  8481. @item
  8482. Chain several overlays in cascade:
  8483. @example
  8484. nullsrc=s=200x200 [bg];
  8485. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8486. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8487. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8488. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8489. [in3] null, [mid2] overlay=100:100 [out0]
  8490. @end example
  8491. @end itemize
  8492. @section owdenoise
  8493. Apply Overcomplete Wavelet denoiser.
  8494. The filter accepts the following options:
  8495. @table @option
  8496. @item depth
  8497. Set depth.
  8498. Larger depth values will denoise lower frequency components more, but
  8499. slow down filtering.
  8500. Must be an int in the range 8-16, default is @code{8}.
  8501. @item luma_strength, ls
  8502. Set luma strength.
  8503. Must be a double value in the range 0-1000, default is @code{1.0}.
  8504. @item chroma_strength, cs
  8505. Set chroma strength.
  8506. Must be a double value in the range 0-1000, default is @code{1.0}.
  8507. @end table
  8508. @anchor{pad}
  8509. @section pad
  8510. Add paddings to the input image, and place the original input at the
  8511. provided @var{x}, @var{y} coordinates.
  8512. It accepts the following parameters:
  8513. @table @option
  8514. @item width, w
  8515. @item height, h
  8516. Specify an expression for the size of the output image with the
  8517. paddings added. If the value for @var{width} or @var{height} is 0, the
  8518. corresponding input size is used for the output.
  8519. The @var{width} expression can reference the value set by the
  8520. @var{height} expression, and vice versa.
  8521. The default value of @var{width} and @var{height} is 0.
  8522. @item x
  8523. @item y
  8524. Specify the offsets to place the input image at within the padded area,
  8525. with respect to the top/left border of the output image.
  8526. The @var{x} expression can reference the value set by the @var{y}
  8527. expression, and vice versa.
  8528. The default value of @var{x} and @var{y} is 0.
  8529. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8530. so the input image is centered on the padded area.
  8531. @item color
  8532. Specify the color of the padded area. For the syntax of this option,
  8533. check the "Color" section in the ffmpeg-utils manual.
  8534. The default value of @var{color} is "black".
  8535. @item eval
  8536. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8537. It accepts the following values:
  8538. @table @samp
  8539. @item init
  8540. Only evaluate expressions once during the filter initialization or when
  8541. a command is processed.
  8542. @item frame
  8543. Evaluate expressions for each incoming frame.
  8544. @end table
  8545. Default value is @samp{init}.
  8546. @item aspect
  8547. Pad to aspect instead to a resolution.
  8548. @end table
  8549. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8550. options are expressions containing the following constants:
  8551. @table @option
  8552. @item in_w
  8553. @item in_h
  8554. The input video width and height.
  8555. @item iw
  8556. @item ih
  8557. These are the same as @var{in_w} and @var{in_h}.
  8558. @item out_w
  8559. @item out_h
  8560. The output width and height (the size of the padded area), as
  8561. specified by the @var{width} and @var{height} expressions.
  8562. @item ow
  8563. @item oh
  8564. These are the same as @var{out_w} and @var{out_h}.
  8565. @item x
  8566. @item y
  8567. The x and y offsets as specified by the @var{x} and @var{y}
  8568. expressions, or NAN if not yet specified.
  8569. @item a
  8570. same as @var{iw} / @var{ih}
  8571. @item sar
  8572. input sample aspect ratio
  8573. @item dar
  8574. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8575. @item hsub
  8576. @item vsub
  8577. The horizontal and vertical chroma subsample values. For example for the
  8578. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8579. @end table
  8580. @subsection Examples
  8581. @itemize
  8582. @item
  8583. Add paddings with the color "violet" to the input video. The output video
  8584. size is 640x480, and the top-left corner of the input video is placed at
  8585. column 0, row 40
  8586. @example
  8587. pad=640:480:0:40:violet
  8588. @end example
  8589. The example above is equivalent to the following command:
  8590. @example
  8591. pad=width=640:height=480:x=0:y=40:color=violet
  8592. @end example
  8593. @item
  8594. Pad the input to get an output with dimensions increased by 3/2,
  8595. and put the input video at the center of the padded area:
  8596. @example
  8597. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8598. @end example
  8599. @item
  8600. Pad the input to get a squared output with size equal to the maximum
  8601. value between the input width and height, and put the input video at
  8602. the center of the padded area:
  8603. @example
  8604. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8605. @end example
  8606. @item
  8607. Pad the input to get a final w/h ratio of 16:9:
  8608. @example
  8609. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8610. @end example
  8611. @item
  8612. In case of anamorphic video, in order to set the output display aspect
  8613. correctly, it is necessary to use @var{sar} in the expression,
  8614. according to the relation:
  8615. @example
  8616. (ih * X / ih) * sar = output_dar
  8617. X = output_dar / sar
  8618. @end example
  8619. Thus the previous example needs to be modified to:
  8620. @example
  8621. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8622. @end example
  8623. @item
  8624. Double the output size and put the input video in the bottom-right
  8625. corner of the output padded area:
  8626. @example
  8627. pad="2*iw:2*ih:ow-iw:oh-ih"
  8628. @end example
  8629. @end itemize
  8630. @anchor{palettegen}
  8631. @section palettegen
  8632. Generate one palette for a whole video stream.
  8633. It accepts the following options:
  8634. @table @option
  8635. @item max_colors
  8636. Set the maximum number of colors to quantize in the palette.
  8637. Note: the palette will still contain 256 colors; the unused palette entries
  8638. will be black.
  8639. @item reserve_transparent
  8640. Create a palette of 255 colors maximum and reserve the last one for
  8641. transparency. Reserving the transparency color is useful for GIF optimization.
  8642. If not set, the maximum of colors in the palette will be 256. You probably want
  8643. to disable this option for a standalone image.
  8644. Set by default.
  8645. @item stats_mode
  8646. Set statistics mode.
  8647. It accepts the following values:
  8648. @table @samp
  8649. @item full
  8650. Compute full frame histograms.
  8651. @item diff
  8652. Compute histograms only for the part that differs from previous frame. This
  8653. might be relevant to give more importance to the moving part of your input if
  8654. the background is static.
  8655. @item single
  8656. Compute new histogram for each frame.
  8657. @end table
  8658. Default value is @var{full}.
  8659. @end table
  8660. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8661. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8662. color quantization of the palette. This information is also visible at
  8663. @var{info} logging level.
  8664. @subsection Examples
  8665. @itemize
  8666. @item
  8667. Generate a representative palette of a given video using @command{ffmpeg}:
  8668. @example
  8669. ffmpeg -i input.mkv -vf palettegen palette.png
  8670. @end example
  8671. @end itemize
  8672. @section paletteuse
  8673. Use a palette to downsample an input video stream.
  8674. The filter takes two inputs: one video stream and a palette. The palette must
  8675. be a 256 pixels image.
  8676. It accepts the following options:
  8677. @table @option
  8678. @item dither
  8679. Select dithering mode. Available algorithms are:
  8680. @table @samp
  8681. @item bayer
  8682. Ordered 8x8 bayer dithering (deterministic)
  8683. @item heckbert
  8684. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8685. Note: this dithering is sometimes considered "wrong" and is included as a
  8686. reference.
  8687. @item floyd_steinberg
  8688. Floyd and Steingberg dithering (error diffusion)
  8689. @item sierra2
  8690. Frankie Sierra dithering v2 (error diffusion)
  8691. @item sierra2_4a
  8692. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8693. @end table
  8694. Default is @var{sierra2_4a}.
  8695. @item bayer_scale
  8696. When @var{bayer} dithering is selected, this option defines the scale of the
  8697. pattern (how much the crosshatch pattern is visible). A low value means more
  8698. visible pattern for less banding, and higher value means less visible pattern
  8699. at the cost of more banding.
  8700. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8701. @item diff_mode
  8702. If set, define the zone to process
  8703. @table @samp
  8704. @item rectangle
  8705. Only the changing rectangle will be reprocessed. This is similar to GIF
  8706. cropping/offsetting compression mechanism. This option can be useful for speed
  8707. if only a part of the image is changing, and has use cases such as limiting the
  8708. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8709. moving scene (it leads to more deterministic output if the scene doesn't change
  8710. much, and as a result less moving noise and better GIF compression).
  8711. @end table
  8712. Default is @var{none}.
  8713. @item new
  8714. Take new palette for each output frame.
  8715. @end table
  8716. @subsection Examples
  8717. @itemize
  8718. @item
  8719. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8720. using @command{ffmpeg}:
  8721. @example
  8722. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8723. @end example
  8724. @end itemize
  8725. @section perspective
  8726. Correct perspective of video not recorded perpendicular to the screen.
  8727. A description of the accepted parameters follows.
  8728. @table @option
  8729. @item x0
  8730. @item y0
  8731. @item x1
  8732. @item y1
  8733. @item x2
  8734. @item y2
  8735. @item x3
  8736. @item y3
  8737. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8738. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8739. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8740. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8741. then the corners of the source will be sent to the specified coordinates.
  8742. The expressions can use the following variables:
  8743. @table @option
  8744. @item W
  8745. @item H
  8746. the width and height of video frame.
  8747. @item in
  8748. Input frame count.
  8749. @item on
  8750. Output frame count.
  8751. @end table
  8752. @item interpolation
  8753. Set interpolation for perspective correction.
  8754. It accepts the following values:
  8755. @table @samp
  8756. @item linear
  8757. @item cubic
  8758. @end table
  8759. Default value is @samp{linear}.
  8760. @item sense
  8761. Set interpretation of coordinate options.
  8762. It accepts the following values:
  8763. @table @samp
  8764. @item 0, source
  8765. Send point in the source specified by the given coordinates to
  8766. the corners of the destination.
  8767. @item 1, destination
  8768. Send the corners of the source to the point in the destination specified
  8769. by the given coordinates.
  8770. Default value is @samp{source}.
  8771. @end table
  8772. @item eval
  8773. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8774. It accepts the following values:
  8775. @table @samp
  8776. @item init
  8777. only evaluate expressions once during the filter initialization or
  8778. when a command is processed
  8779. @item frame
  8780. evaluate expressions for each incoming frame
  8781. @end table
  8782. Default value is @samp{init}.
  8783. @end table
  8784. @section phase
  8785. Delay interlaced video by one field time so that the field order changes.
  8786. The intended use is to fix PAL movies that have been captured with the
  8787. opposite field order to the film-to-video transfer.
  8788. A description of the accepted parameters follows.
  8789. @table @option
  8790. @item mode
  8791. Set phase mode.
  8792. It accepts the following values:
  8793. @table @samp
  8794. @item t
  8795. Capture field order top-first, transfer bottom-first.
  8796. Filter will delay the bottom field.
  8797. @item b
  8798. Capture field order bottom-first, transfer top-first.
  8799. Filter will delay the top field.
  8800. @item p
  8801. Capture and transfer with the same field order. This mode only exists
  8802. for the documentation of the other options to refer to, but if you
  8803. actually select it, the filter will faithfully do nothing.
  8804. @item a
  8805. Capture field order determined automatically by field flags, transfer
  8806. opposite.
  8807. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8808. basis using field flags. If no field information is available,
  8809. then this works just like @samp{u}.
  8810. @item u
  8811. Capture unknown or varying, transfer opposite.
  8812. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8813. analyzing the images and selecting the alternative that produces best
  8814. match between the fields.
  8815. @item T
  8816. Capture top-first, transfer unknown or varying.
  8817. Filter selects among @samp{t} and @samp{p} using image analysis.
  8818. @item B
  8819. Capture bottom-first, transfer unknown or varying.
  8820. Filter selects among @samp{b} and @samp{p} using image analysis.
  8821. @item A
  8822. Capture determined by field flags, transfer unknown or varying.
  8823. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8824. image analysis. If no field information is available, then this works just
  8825. like @samp{U}. This is the default mode.
  8826. @item U
  8827. Both capture and transfer unknown or varying.
  8828. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8829. @end table
  8830. @end table
  8831. @section pixdesctest
  8832. Pixel format descriptor test filter, mainly useful for internal
  8833. testing. The output video should be equal to the input video.
  8834. For example:
  8835. @example
  8836. format=monow, pixdesctest
  8837. @end example
  8838. can be used to test the monowhite pixel format descriptor definition.
  8839. @section pixscope
  8840. Display sample values of color channels. Mainly useful for checking color and levels.
  8841. The filters accept the following options:
  8842. @table @option
  8843. @item x
  8844. Set scope X position, offset on X axis.
  8845. @item y
  8846. Set scope Y position, offset on Y axis.
  8847. @item w
  8848. Set scope width.
  8849. @item h
  8850. Set scope height.
  8851. @item o
  8852. Set window opacity. This window also holds statistics about pixel area.
  8853. @end table
  8854. @section pp
  8855. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8856. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8857. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8858. Each subfilter and some options have a short and a long name that can be used
  8859. interchangeably, i.e. dr/dering are the same.
  8860. The filters accept the following options:
  8861. @table @option
  8862. @item subfilters
  8863. Set postprocessing subfilters string.
  8864. @end table
  8865. All subfilters share common options to determine their scope:
  8866. @table @option
  8867. @item a/autoq
  8868. Honor the quality commands for this subfilter.
  8869. @item c/chrom
  8870. Do chrominance filtering, too (default).
  8871. @item y/nochrom
  8872. Do luminance filtering only (no chrominance).
  8873. @item n/noluma
  8874. Do chrominance filtering only (no luminance).
  8875. @end table
  8876. These options can be appended after the subfilter name, separated by a '|'.
  8877. Available subfilters are:
  8878. @table @option
  8879. @item hb/hdeblock[|difference[|flatness]]
  8880. Horizontal deblocking filter
  8881. @table @option
  8882. @item difference
  8883. Difference factor where higher values mean more deblocking (default: @code{32}).
  8884. @item flatness
  8885. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8886. @end table
  8887. @item vb/vdeblock[|difference[|flatness]]
  8888. Vertical deblocking filter
  8889. @table @option
  8890. @item difference
  8891. Difference factor where higher values mean more deblocking (default: @code{32}).
  8892. @item flatness
  8893. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8894. @end table
  8895. @item ha/hadeblock[|difference[|flatness]]
  8896. Accurate horizontal deblocking filter
  8897. @table @option
  8898. @item difference
  8899. Difference factor where higher values mean more deblocking (default: @code{32}).
  8900. @item flatness
  8901. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8902. @end table
  8903. @item va/vadeblock[|difference[|flatness]]
  8904. Accurate vertical deblocking filter
  8905. @table @option
  8906. @item difference
  8907. Difference factor where higher values mean more deblocking (default: @code{32}).
  8908. @item flatness
  8909. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8910. @end table
  8911. @end table
  8912. The horizontal and vertical deblocking filters share the difference and
  8913. flatness values so you cannot set different horizontal and vertical
  8914. thresholds.
  8915. @table @option
  8916. @item h1/x1hdeblock
  8917. Experimental horizontal deblocking filter
  8918. @item v1/x1vdeblock
  8919. Experimental vertical deblocking filter
  8920. @item dr/dering
  8921. Deringing filter
  8922. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8923. @table @option
  8924. @item threshold1
  8925. larger -> stronger filtering
  8926. @item threshold2
  8927. larger -> stronger filtering
  8928. @item threshold3
  8929. larger -> stronger filtering
  8930. @end table
  8931. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8932. @table @option
  8933. @item f/fullyrange
  8934. Stretch luminance to @code{0-255}.
  8935. @end table
  8936. @item lb/linblenddeint
  8937. Linear blend deinterlacing filter that deinterlaces the given block by
  8938. filtering all lines with a @code{(1 2 1)} filter.
  8939. @item li/linipoldeint
  8940. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8941. linearly interpolating every second line.
  8942. @item ci/cubicipoldeint
  8943. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8944. cubically interpolating every second line.
  8945. @item md/mediandeint
  8946. Median deinterlacing filter that deinterlaces the given block by applying a
  8947. median filter to every second line.
  8948. @item fd/ffmpegdeint
  8949. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8950. second line with a @code{(-1 4 2 4 -1)} filter.
  8951. @item l5/lowpass5
  8952. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8953. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8954. @item fq/forceQuant[|quantizer]
  8955. Overrides the quantizer table from the input with the constant quantizer you
  8956. specify.
  8957. @table @option
  8958. @item quantizer
  8959. Quantizer to use
  8960. @end table
  8961. @item de/default
  8962. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8963. @item fa/fast
  8964. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8965. @item ac
  8966. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8967. @end table
  8968. @subsection Examples
  8969. @itemize
  8970. @item
  8971. Apply horizontal and vertical deblocking, deringing and automatic
  8972. brightness/contrast:
  8973. @example
  8974. pp=hb/vb/dr/al
  8975. @end example
  8976. @item
  8977. Apply default filters without brightness/contrast correction:
  8978. @example
  8979. pp=de/-al
  8980. @end example
  8981. @item
  8982. Apply default filters and temporal denoiser:
  8983. @example
  8984. pp=default/tmpnoise|1|2|3
  8985. @end example
  8986. @item
  8987. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8988. automatically depending on available CPU time:
  8989. @example
  8990. pp=hb|y/vb|a
  8991. @end example
  8992. @end itemize
  8993. @section pp7
  8994. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8995. similar to spp = 6 with 7 point DCT, where only the center sample is
  8996. used after IDCT.
  8997. The filter accepts the following options:
  8998. @table @option
  8999. @item qp
  9000. Force a constant quantization parameter. It accepts an integer in range
  9001. 0 to 63. If not set, the filter will use the QP from the video stream
  9002. (if available).
  9003. @item mode
  9004. Set thresholding mode. Available modes are:
  9005. @table @samp
  9006. @item hard
  9007. Set hard thresholding.
  9008. @item soft
  9009. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9010. @item medium
  9011. Set medium thresholding (good results, default).
  9012. @end table
  9013. @end table
  9014. @section premultiply
  9015. Apply alpha premultiply effect to input video stream using first plane
  9016. of second stream as alpha.
  9017. Both streams must have same dimensions and same pixel format.
  9018. The filter accepts the following option:
  9019. @table @option
  9020. @item planes
  9021. Set which planes will be processed, unprocessed planes will be copied.
  9022. By default value 0xf, all planes will be processed.
  9023. @item inplace
  9024. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9025. @end table
  9026. @section prewitt
  9027. Apply prewitt operator to input video stream.
  9028. The filter accepts the following option:
  9029. @table @option
  9030. @item planes
  9031. Set which planes will be processed, unprocessed planes will be copied.
  9032. By default value 0xf, all planes will be processed.
  9033. @item scale
  9034. Set value which will be multiplied with filtered result.
  9035. @item delta
  9036. Set value which will be added to filtered result.
  9037. @end table
  9038. @section psnr
  9039. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9040. Ratio) between two input videos.
  9041. This filter takes in input two input videos, the first input is
  9042. considered the "main" source and is passed unchanged to the
  9043. output. The second input is used as a "reference" video for computing
  9044. the PSNR.
  9045. Both video inputs must have the same resolution and pixel format for
  9046. this filter to work correctly. Also it assumes that both inputs
  9047. have the same number of frames, which are compared one by one.
  9048. The obtained average PSNR is printed through the logging system.
  9049. The filter stores the accumulated MSE (mean squared error) of each
  9050. frame, and at the end of the processing it is averaged across all frames
  9051. equally, and the following formula is applied to obtain the PSNR:
  9052. @example
  9053. PSNR = 10*log10(MAX^2/MSE)
  9054. @end example
  9055. Where MAX is the average of the maximum values of each component of the
  9056. image.
  9057. The description of the accepted parameters follows.
  9058. @table @option
  9059. @item stats_file, f
  9060. If specified the filter will use the named file to save the PSNR of
  9061. each individual frame. When filename equals "-" the data is sent to
  9062. standard output.
  9063. @item stats_version
  9064. Specifies which version of the stats file format to use. Details of
  9065. each format are written below.
  9066. Default value is 1.
  9067. @item stats_add_max
  9068. Determines whether the max value is output to the stats log.
  9069. Default value is 0.
  9070. Requires stats_version >= 2. If this is set and stats_version < 2,
  9071. the filter will return an error.
  9072. @end table
  9073. The file printed if @var{stats_file} is selected, contains a sequence of
  9074. key/value pairs of the form @var{key}:@var{value} for each compared
  9075. couple of frames.
  9076. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9077. the list of per-frame-pair stats, with key value pairs following the frame
  9078. format with the following parameters:
  9079. @table @option
  9080. @item psnr_log_version
  9081. The version of the log file format. Will match @var{stats_version}.
  9082. @item fields
  9083. A comma separated list of the per-frame-pair parameters included in
  9084. the log.
  9085. @end table
  9086. A description of each shown per-frame-pair parameter follows:
  9087. @table @option
  9088. @item n
  9089. sequential number of the input frame, starting from 1
  9090. @item mse_avg
  9091. Mean Square Error pixel-by-pixel average difference of the compared
  9092. frames, averaged over all the image components.
  9093. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9094. Mean Square Error pixel-by-pixel average difference of the compared
  9095. frames for the component specified by the suffix.
  9096. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9097. Peak Signal to Noise ratio of the compared frames for the component
  9098. specified by the suffix.
  9099. @item max_avg, max_y, max_u, max_v
  9100. Maximum allowed value for each channel, and average over all
  9101. channels.
  9102. @end table
  9103. For example:
  9104. @example
  9105. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9106. [main][ref] psnr="stats_file=stats.log" [out]
  9107. @end example
  9108. On this example the input file being processed is compared with the
  9109. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9110. is stored in @file{stats.log}.
  9111. @anchor{pullup}
  9112. @section pullup
  9113. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9114. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9115. content.
  9116. The pullup filter is designed to take advantage of future context in making
  9117. its decisions. This filter is stateless in the sense that it does not lock
  9118. onto a pattern to follow, but it instead looks forward to the following
  9119. fields in order to identify matches and rebuild progressive frames.
  9120. To produce content with an even framerate, insert the fps filter after
  9121. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9122. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9123. The filter accepts the following options:
  9124. @table @option
  9125. @item jl
  9126. @item jr
  9127. @item jt
  9128. @item jb
  9129. These options set the amount of "junk" to ignore at the left, right, top, and
  9130. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9131. while top and bottom are in units of 2 lines.
  9132. The default is 8 pixels on each side.
  9133. @item sb
  9134. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9135. filter generating an occasional mismatched frame, but it may also cause an
  9136. excessive number of frames to be dropped during high motion sequences.
  9137. Conversely, setting it to -1 will make filter match fields more easily.
  9138. This may help processing of video where there is slight blurring between
  9139. the fields, but may also cause there to be interlaced frames in the output.
  9140. Default value is @code{0}.
  9141. @item mp
  9142. Set the metric plane to use. It accepts the following values:
  9143. @table @samp
  9144. @item l
  9145. Use luma plane.
  9146. @item u
  9147. Use chroma blue plane.
  9148. @item v
  9149. Use chroma red plane.
  9150. @end table
  9151. This option may be set to use chroma plane instead of the default luma plane
  9152. for doing filter's computations. This may improve accuracy on very clean
  9153. source material, but more likely will decrease accuracy, especially if there
  9154. is chroma noise (rainbow effect) or any grayscale video.
  9155. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9156. load and make pullup usable in realtime on slow machines.
  9157. @end table
  9158. For best results (without duplicated frames in the output file) it is
  9159. necessary to change the output frame rate. For example, to inverse
  9160. telecine NTSC input:
  9161. @example
  9162. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9163. @end example
  9164. @section qp
  9165. Change video quantization parameters (QP).
  9166. The filter accepts the following option:
  9167. @table @option
  9168. @item qp
  9169. Set expression for quantization parameter.
  9170. @end table
  9171. The expression is evaluated through the eval API and can contain, among others,
  9172. the following constants:
  9173. @table @var
  9174. @item known
  9175. 1 if index is not 129, 0 otherwise.
  9176. @item qp
  9177. Sequentional index starting from -129 to 128.
  9178. @end table
  9179. @subsection Examples
  9180. @itemize
  9181. @item
  9182. Some equation like:
  9183. @example
  9184. qp=2+2*sin(PI*qp)
  9185. @end example
  9186. @end itemize
  9187. @section random
  9188. Flush video frames from internal cache of frames into a random order.
  9189. No frame is discarded.
  9190. Inspired by @ref{frei0r} nervous filter.
  9191. @table @option
  9192. @item frames
  9193. Set size in number of frames of internal cache, in range from @code{2} to
  9194. @code{512}. Default is @code{30}.
  9195. @item seed
  9196. Set seed for random number generator, must be an integer included between
  9197. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9198. less than @code{0}, the filter will try to use a good random seed on a
  9199. best effort basis.
  9200. @end table
  9201. @section readeia608
  9202. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9203. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9204. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9205. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9206. @table @option
  9207. @item lavfi.readeia608.X.cc
  9208. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9209. @item lavfi.readeia608.X.line
  9210. The number of the line on which the EIA-608 data was identified and read.
  9211. @end table
  9212. This filter accepts the following options:
  9213. @table @option
  9214. @item scan_min
  9215. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9216. @item scan_max
  9217. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9218. @item mac
  9219. Set minimal acceptable amplitude change for sync codes detection.
  9220. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9221. @item spw
  9222. Set the ratio of width reserved for sync code detection.
  9223. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9224. @item mhd
  9225. Set the max peaks height difference for sync code detection.
  9226. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9227. @item mpd
  9228. Set max peaks period difference for sync code detection.
  9229. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9230. @item msd
  9231. Set the first two max start code bits differences.
  9232. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9233. @item bhd
  9234. Set the minimum ratio of bits height compared to 3rd start code bit.
  9235. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9236. @item th_w
  9237. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9238. @item th_b
  9239. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9240. @item chp
  9241. Enable checking the parity bit. In the event of a parity error, the filter will output
  9242. @code{0x00} for that character. Default is false.
  9243. @end table
  9244. @subsection Examples
  9245. @itemize
  9246. @item
  9247. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9248. @example
  9249. 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
  9250. @end example
  9251. @end itemize
  9252. @section readvitc
  9253. Read vertical interval timecode (VITC) information from the top lines of a
  9254. video frame.
  9255. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9256. timecode value, if a valid timecode has been detected. Further metadata key
  9257. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9258. timecode data has been found or not.
  9259. This filter accepts the following options:
  9260. @table @option
  9261. @item scan_max
  9262. Set the maximum number of lines to scan for VITC data. If the value is set to
  9263. @code{-1} the full video frame is scanned. Default is @code{45}.
  9264. @item thr_b
  9265. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9266. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9267. @item thr_w
  9268. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9269. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9270. @end table
  9271. @subsection Examples
  9272. @itemize
  9273. @item
  9274. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9275. draw @code{--:--:--:--} as a placeholder:
  9276. @example
  9277. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9278. @end example
  9279. @end itemize
  9280. @section remap
  9281. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9282. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9283. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9284. value for pixel will be used for destination pixel.
  9285. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9286. will have Xmap/Ymap video stream dimensions.
  9287. Xmap and Ymap input video streams are 16bit depth, single channel.
  9288. @section removegrain
  9289. The removegrain filter is a spatial denoiser for progressive video.
  9290. @table @option
  9291. @item m0
  9292. Set mode for the first plane.
  9293. @item m1
  9294. Set mode for the second plane.
  9295. @item m2
  9296. Set mode for the third plane.
  9297. @item m3
  9298. Set mode for the fourth plane.
  9299. @end table
  9300. Range of mode is from 0 to 24. Description of each mode follows:
  9301. @table @var
  9302. @item 0
  9303. Leave input plane unchanged. Default.
  9304. @item 1
  9305. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9306. @item 2
  9307. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9308. @item 3
  9309. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9310. @item 4
  9311. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9312. This is equivalent to a median filter.
  9313. @item 5
  9314. Line-sensitive clipping giving the minimal change.
  9315. @item 6
  9316. Line-sensitive clipping, intermediate.
  9317. @item 7
  9318. Line-sensitive clipping, intermediate.
  9319. @item 8
  9320. Line-sensitive clipping, intermediate.
  9321. @item 9
  9322. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9323. @item 10
  9324. Replaces the target pixel with the closest neighbour.
  9325. @item 11
  9326. [1 2 1] horizontal and vertical kernel blur.
  9327. @item 12
  9328. Same as mode 11.
  9329. @item 13
  9330. Bob mode, interpolates top field from the line where the neighbours
  9331. pixels are the closest.
  9332. @item 14
  9333. Bob mode, interpolates bottom field from the line where the neighbours
  9334. pixels are the closest.
  9335. @item 15
  9336. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9337. interpolation formula.
  9338. @item 16
  9339. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9340. interpolation formula.
  9341. @item 17
  9342. Clips the pixel with the minimum and maximum of respectively the maximum and
  9343. minimum of each pair of opposite neighbour pixels.
  9344. @item 18
  9345. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9346. the current pixel is minimal.
  9347. @item 19
  9348. Replaces the pixel with the average of its 8 neighbours.
  9349. @item 20
  9350. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9351. @item 21
  9352. Clips pixels using the averages of opposite neighbour.
  9353. @item 22
  9354. Same as mode 21 but simpler and faster.
  9355. @item 23
  9356. Small edge and halo removal, but reputed useless.
  9357. @item 24
  9358. Similar as 23.
  9359. @end table
  9360. @section removelogo
  9361. Suppress a TV station logo, using an image file to determine which
  9362. pixels comprise the logo. It works by filling in the pixels that
  9363. comprise the logo with neighboring pixels.
  9364. The filter accepts the following options:
  9365. @table @option
  9366. @item filename, f
  9367. Set the filter bitmap file, which can be any image format supported by
  9368. libavformat. The width and height of the image file must match those of the
  9369. video stream being processed.
  9370. @end table
  9371. Pixels in the provided bitmap image with a value of zero are not
  9372. considered part of the logo, non-zero pixels are considered part of
  9373. the logo. If you use white (255) for the logo and black (0) for the
  9374. rest, you will be safe. For making the filter bitmap, it is
  9375. recommended to take a screen capture of a black frame with the logo
  9376. visible, and then using a threshold filter followed by the erode
  9377. filter once or twice.
  9378. If needed, little splotches can be fixed manually. Remember that if
  9379. logo pixels are not covered, the filter quality will be much
  9380. reduced. Marking too many pixels as part of the logo does not hurt as
  9381. much, but it will increase the amount of blurring needed to cover over
  9382. the image and will destroy more information than necessary, and extra
  9383. pixels will slow things down on a large logo.
  9384. @section repeatfields
  9385. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9386. fields based on its value.
  9387. @section reverse
  9388. Reverse a video clip.
  9389. Warning: This filter requires memory to buffer the entire clip, so trimming
  9390. is suggested.
  9391. @subsection Examples
  9392. @itemize
  9393. @item
  9394. Take the first 5 seconds of a clip, and reverse it.
  9395. @example
  9396. trim=end=5,reverse
  9397. @end example
  9398. @end itemize
  9399. @section roberts
  9400. Apply roberts cross operator to input video stream.
  9401. The filter accepts the following option:
  9402. @table @option
  9403. @item planes
  9404. Set which planes will be processed, unprocessed planes will be copied.
  9405. By default value 0xf, all planes will be processed.
  9406. @item scale
  9407. Set value which will be multiplied with filtered result.
  9408. @item delta
  9409. Set value which will be added to filtered result.
  9410. @end table
  9411. @section rotate
  9412. Rotate video by an arbitrary angle expressed in radians.
  9413. The filter accepts the following options:
  9414. A description of the optional parameters follows.
  9415. @table @option
  9416. @item angle, a
  9417. Set an expression for the angle by which to rotate the input video
  9418. clockwise, expressed as a number of radians. A negative value will
  9419. result in a counter-clockwise rotation. By default it is set to "0".
  9420. This expression is evaluated for each frame.
  9421. @item out_w, ow
  9422. Set the output width expression, default value is "iw".
  9423. This expression is evaluated just once during configuration.
  9424. @item out_h, oh
  9425. Set the output height expression, default value is "ih".
  9426. This expression is evaluated just once during configuration.
  9427. @item bilinear
  9428. Enable bilinear interpolation if set to 1, a value of 0 disables
  9429. it. Default value is 1.
  9430. @item fillcolor, c
  9431. Set the color used to fill the output area not covered by the rotated
  9432. image. For the general syntax of this option, check the "Color" section in the
  9433. ffmpeg-utils manual. If the special value "none" is selected then no
  9434. background is printed (useful for example if the background is never shown).
  9435. Default value is "black".
  9436. @end table
  9437. The expressions for the angle and the output size can contain the
  9438. following constants and functions:
  9439. @table @option
  9440. @item n
  9441. sequential number of the input frame, starting from 0. It is always NAN
  9442. before the first frame is filtered.
  9443. @item t
  9444. time in seconds of the input frame, it is set to 0 when the filter is
  9445. configured. It is always NAN before the first frame is filtered.
  9446. @item hsub
  9447. @item vsub
  9448. horizontal and vertical chroma subsample values. For example for the
  9449. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9450. @item in_w, iw
  9451. @item in_h, ih
  9452. the input video width and height
  9453. @item out_w, ow
  9454. @item out_h, oh
  9455. the output width and height, that is the size of the padded area as
  9456. specified by the @var{width} and @var{height} expressions
  9457. @item rotw(a)
  9458. @item roth(a)
  9459. the minimal width/height required for completely containing the input
  9460. video rotated by @var{a} radians.
  9461. These are only available when computing the @option{out_w} and
  9462. @option{out_h} expressions.
  9463. @end table
  9464. @subsection Examples
  9465. @itemize
  9466. @item
  9467. Rotate the input by PI/6 radians clockwise:
  9468. @example
  9469. rotate=PI/6
  9470. @end example
  9471. @item
  9472. Rotate the input by PI/6 radians counter-clockwise:
  9473. @example
  9474. rotate=-PI/6
  9475. @end example
  9476. @item
  9477. Rotate the input by 45 degrees clockwise:
  9478. @example
  9479. rotate=45*PI/180
  9480. @end example
  9481. @item
  9482. Apply a constant rotation with period T, starting from an angle of PI/3:
  9483. @example
  9484. rotate=PI/3+2*PI*t/T
  9485. @end example
  9486. @item
  9487. Make the input video rotation oscillating with a period of T
  9488. seconds and an amplitude of A radians:
  9489. @example
  9490. rotate=A*sin(2*PI/T*t)
  9491. @end example
  9492. @item
  9493. Rotate the video, output size is chosen so that the whole rotating
  9494. input video is always completely contained in the output:
  9495. @example
  9496. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9497. @end example
  9498. @item
  9499. Rotate the video, reduce the output size so that no background is ever
  9500. shown:
  9501. @example
  9502. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9503. @end example
  9504. @end itemize
  9505. @subsection Commands
  9506. The filter supports the following commands:
  9507. @table @option
  9508. @item a, angle
  9509. Set the angle expression.
  9510. The command accepts the same syntax of the corresponding option.
  9511. If the specified expression is not valid, it is kept at its current
  9512. value.
  9513. @end table
  9514. @section sab
  9515. Apply Shape Adaptive Blur.
  9516. The filter accepts the following options:
  9517. @table @option
  9518. @item luma_radius, lr
  9519. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9520. value is 1.0. A greater value will result in a more blurred image, and
  9521. in slower processing.
  9522. @item luma_pre_filter_radius, lpfr
  9523. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9524. value is 1.0.
  9525. @item luma_strength, ls
  9526. Set luma maximum difference between pixels to still be considered, must
  9527. be a value in the 0.1-100.0 range, default value is 1.0.
  9528. @item chroma_radius, cr
  9529. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9530. greater value will result in a more blurred image, and in slower
  9531. processing.
  9532. @item chroma_pre_filter_radius, cpfr
  9533. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9534. @item chroma_strength, cs
  9535. Set chroma maximum difference between pixels to still be considered,
  9536. must be a value in the -0.9-100.0 range.
  9537. @end table
  9538. Each chroma option value, if not explicitly specified, is set to the
  9539. corresponding luma option value.
  9540. @anchor{scale}
  9541. @section scale
  9542. Scale (resize) the input video, using the libswscale library.
  9543. The scale filter forces the output display aspect ratio to be the same
  9544. of the input, by changing the output sample aspect ratio.
  9545. If the input image format is different from the format requested by
  9546. the next filter, the scale filter will convert the input to the
  9547. requested format.
  9548. @subsection Options
  9549. The filter accepts the following options, or any of the options
  9550. supported by the libswscale scaler.
  9551. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9552. the complete list of scaler options.
  9553. @table @option
  9554. @item width, w
  9555. @item height, h
  9556. Set the output video dimension expression. Default value is the input
  9557. dimension.
  9558. If the @var{width} or @var{w} value is 0, the input width is used for
  9559. the output. If the @var{height} or @var{h} value is 0, the input height
  9560. is used for the output.
  9561. If one and only one of the values is -n with n >= 1, the scale filter
  9562. will use a value that maintains the aspect ratio of the input image,
  9563. calculated from the other specified dimension. After that it will,
  9564. however, make sure that the calculated dimension is divisible by n and
  9565. adjust the value if necessary.
  9566. If both values are -n with n >= 1, the behavior will be identical to
  9567. both values being set to 0 as previously detailed.
  9568. See below for the list of accepted constants for use in the dimension
  9569. expression.
  9570. @item eval
  9571. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9572. @table @samp
  9573. @item init
  9574. Only evaluate expressions once during the filter initialization or when a command is processed.
  9575. @item frame
  9576. Evaluate expressions for each incoming frame.
  9577. @end table
  9578. Default value is @samp{init}.
  9579. @item interl
  9580. Set the interlacing mode. It accepts the following values:
  9581. @table @samp
  9582. @item 1
  9583. Force interlaced aware scaling.
  9584. @item 0
  9585. Do not apply interlaced scaling.
  9586. @item -1
  9587. Select interlaced aware scaling depending on whether the source frames
  9588. are flagged as interlaced or not.
  9589. @end table
  9590. Default value is @samp{0}.
  9591. @item flags
  9592. Set libswscale scaling flags. See
  9593. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9594. complete list of values. If not explicitly specified the filter applies
  9595. the default flags.
  9596. @item param0, param1
  9597. Set libswscale input parameters for scaling algorithms that need them. See
  9598. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9599. complete documentation. If not explicitly specified the filter applies
  9600. empty parameters.
  9601. @item size, s
  9602. Set the video size. For the syntax of this option, check the
  9603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9604. @item in_color_matrix
  9605. @item out_color_matrix
  9606. Set in/output YCbCr color space type.
  9607. This allows the autodetected value to be overridden as well as allows forcing
  9608. a specific value used for the output and encoder.
  9609. If not specified, the color space type depends on the pixel format.
  9610. Possible values:
  9611. @table @samp
  9612. @item auto
  9613. Choose automatically.
  9614. @item bt709
  9615. Format conforming to International Telecommunication Union (ITU)
  9616. Recommendation BT.709.
  9617. @item fcc
  9618. Set color space conforming to the United States Federal Communications
  9619. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9620. @item bt601
  9621. Set color space conforming to:
  9622. @itemize
  9623. @item
  9624. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9625. @item
  9626. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9627. @item
  9628. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9629. @end itemize
  9630. @item smpte240m
  9631. Set color space conforming to SMPTE ST 240:1999.
  9632. @end table
  9633. @item in_range
  9634. @item out_range
  9635. Set in/output YCbCr sample range.
  9636. This allows the autodetected value to be overridden as well as allows forcing
  9637. a specific value used for the output and encoder. If not specified, the
  9638. range depends on the pixel format. Possible values:
  9639. @table @samp
  9640. @item auto
  9641. Choose automatically.
  9642. @item jpeg/full/pc
  9643. Set full range (0-255 in case of 8-bit luma).
  9644. @item mpeg/tv
  9645. Set "MPEG" range (16-235 in case of 8-bit luma).
  9646. @end table
  9647. @item force_original_aspect_ratio
  9648. Enable decreasing or increasing output video width or height if necessary to
  9649. keep the original aspect ratio. Possible values:
  9650. @table @samp
  9651. @item disable
  9652. Scale the video as specified and disable this feature.
  9653. @item decrease
  9654. The output video dimensions will automatically be decreased if needed.
  9655. @item increase
  9656. The output video dimensions will automatically be increased if needed.
  9657. @end table
  9658. One useful instance of this option is that when you know a specific device's
  9659. maximum allowed resolution, you can use this to limit the output video to
  9660. that, while retaining the aspect ratio. For example, device A allows
  9661. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9662. decrease) and specifying 1280x720 to the command line makes the output
  9663. 1280x533.
  9664. Please note that this is a different thing than specifying -1 for @option{w}
  9665. or @option{h}, you still need to specify the output resolution for this option
  9666. to work.
  9667. @end table
  9668. The values of the @option{w} and @option{h} options are expressions
  9669. containing the following constants:
  9670. @table @var
  9671. @item in_w
  9672. @item in_h
  9673. The input width and height
  9674. @item iw
  9675. @item ih
  9676. These are the same as @var{in_w} and @var{in_h}.
  9677. @item out_w
  9678. @item out_h
  9679. The output (scaled) width and height
  9680. @item ow
  9681. @item oh
  9682. These are the same as @var{out_w} and @var{out_h}
  9683. @item a
  9684. The same as @var{iw} / @var{ih}
  9685. @item sar
  9686. input sample aspect ratio
  9687. @item dar
  9688. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9689. @item hsub
  9690. @item vsub
  9691. horizontal and vertical input chroma subsample values. For example for the
  9692. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9693. @item ohsub
  9694. @item ovsub
  9695. horizontal and vertical output chroma subsample values. For example for the
  9696. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9697. @end table
  9698. @subsection Examples
  9699. @itemize
  9700. @item
  9701. Scale the input video to a size of 200x100
  9702. @example
  9703. scale=w=200:h=100
  9704. @end example
  9705. This is equivalent to:
  9706. @example
  9707. scale=200:100
  9708. @end example
  9709. or:
  9710. @example
  9711. scale=200x100
  9712. @end example
  9713. @item
  9714. Specify a size abbreviation for the output size:
  9715. @example
  9716. scale=qcif
  9717. @end example
  9718. which can also be written as:
  9719. @example
  9720. scale=size=qcif
  9721. @end example
  9722. @item
  9723. Scale the input to 2x:
  9724. @example
  9725. scale=w=2*iw:h=2*ih
  9726. @end example
  9727. @item
  9728. The above is the same as:
  9729. @example
  9730. scale=2*in_w:2*in_h
  9731. @end example
  9732. @item
  9733. Scale the input to 2x with forced interlaced scaling:
  9734. @example
  9735. scale=2*iw:2*ih:interl=1
  9736. @end example
  9737. @item
  9738. Scale the input to half size:
  9739. @example
  9740. scale=w=iw/2:h=ih/2
  9741. @end example
  9742. @item
  9743. Increase the width, and set the height to the same size:
  9744. @example
  9745. scale=3/2*iw:ow
  9746. @end example
  9747. @item
  9748. Seek Greek harmony:
  9749. @example
  9750. scale=iw:1/PHI*iw
  9751. scale=ih*PHI:ih
  9752. @end example
  9753. @item
  9754. Increase the height, and set the width to 3/2 of the height:
  9755. @example
  9756. scale=w=3/2*oh:h=3/5*ih
  9757. @end example
  9758. @item
  9759. Increase the size, making the size a multiple of the chroma
  9760. subsample values:
  9761. @example
  9762. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9763. @end example
  9764. @item
  9765. Increase the width to a maximum of 500 pixels,
  9766. keeping the same aspect ratio as the input:
  9767. @example
  9768. scale=w='min(500\, iw*3/2):h=-1'
  9769. @end example
  9770. @end itemize
  9771. @subsection Commands
  9772. This filter supports the following commands:
  9773. @table @option
  9774. @item width, w
  9775. @item height, h
  9776. Set the output video dimension expression.
  9777. The command accepts the same syntax of the corresponding option.
  9778. If the specified expression is not valid, it is kept at its current
  9779. value.
  9780. @end table
  9781. @section scale_npp
  9782. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9783. format conversion on CUDA video frames. Setting the output width and height
  9784. works in the same way as for the @var{scale} filter.
  9785. The following additional options are accepted:
  9786. @table @option
  9787. @item format
  9788. The pixel format of the output CUDA frames. If set to the string "same" (the
  9789. default), the input format will be kept. Note that automatic format negotiation
  9790. and conversion is not yet supported for hardware frames
  9791. @item interp_algo
  9792. The interpolation algorithm used for resizing. One of the following:
  9793. @table @option
  9794. @item nn
  9795. Nearest neighbour.
  9796. @item linear
  9797. @item cubic
  9798. @item cubic2p_bspline
  9799. 2-parameter cubic (B=1, C=0)
  9800. @item cubic2p_catmullrom
  9801. 2-parameter cubic (B=0, C=1/2)
  9802. @item cubic2p_b05c03
  9803. 2-parameter cubic (B=1/2, C=3/10)
  9804. @item super
  9805. Supersampling
  9806. @item lanczos
  9807. @end table
  9808. @end table
  9809. @section scale2ref
  9810. Scale (resize) the input video, based on a reference video.
  9811. See the scale filter for available options, scale2ref supports the same but
  9812. uses the reference video instead of the main input as basis. scale2ref also
  9813. supports the following additional constants for the @option{w} and
  9814. @option{h} options:
  9815. @table @var
  9816. @item main_w
  9817. @item main_h
  9818. The main input video's width and height
  9819. @item main_a
  9820. The same as @var{main_w} / @var{main_h}
  9821. @item main_sar
  9822. The main input video's sample aspect ratio
  9823. @item main_dar, mdar
  9824. The main input video's display aspect ratio. Calculated from
  9825. @code{(main_w / main_h) * main_sar}.
  9826. @item main_hsub
  9827. @item main_vsub
  9828. The main input video's horizontal and vertical chroma subsample values.
  9829. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9830. is 1.
  9831. @end table
  9832. @subsection Examples
  9833. @itemize
  9834. @item
  9835. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9836. @example
  9837. 'scale2ref[b][a];[a][b]overlay'
  9838. @end example
  9839. @end itemize
  9840. @anchor{selectivecolor}
  9841. @section selectivecolor
  9842. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9843. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9844. by the "purity" of the color (that is, how saturated it already is).
  9845. This filter is similar to the Adobe Photoshop Selective Color tool.
  9846. The filter accepts the following options:
  9847. @table @option
  9848. @item correction_method
  9849. Select color correction method.
  9850. Available values are:
  9851. @table @samp
  9852. @item absolute
  9853. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9854. component value).
  9855. @item relative
  9856. Specified adjustments are relative to the original component value.
  9857. @end table
  9858. Default is @code{absolute}.
  9859. @item reds
  9860. Adjustments for red pixels (pixels where the red component is the maximum)
  9861. @item yellows
  9862. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9863. @item greens
  9864. Adjustments for green pixels (pixels where the green component is the maximum)
  9865. @item cyans
  9866. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9867. @item blues
  9868. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9869. @item magentas
  9870. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9871. @item whites
  9872. Adjustments for white pixels (pixels where all components are greater than 128)
  9873. @item neutrals
  9874. Adjustments for all pixels except pure black and pure white
  9875. @item blacks
  9876. Adjustments for black pixels (pixels where all components are lesser than 128)
  9877. @item psfile
  9878. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9879. @end table
  9880. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9881. 4 space separated floating point adjustment values in the [-1,1] range,
  9882. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9883. pixels of its range.
  9884. @subsection Examples
  9885. @itemize
  9886. @item
  9887. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9888. increase magenta by 27% in blue areas:
  9889. @example
  9890. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9891. @end example
  9892. @item
  9893. Use a Photoshop selective color preset:
  9894. @example
  9895. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9896. @end example
  9897. @end itemize
  9898. @anchor{separatefields}
  9899. @section separatefields
  9900. The @code{separatefields} takes a frame-based video input and splits
  9901. each frame into its components fields, producing a new half height clip
  9902. with twice the frame rate and twice the frame count.
  9903. This filter use field-dominance information in frame to decide which
  9904. of each pair of fields to place first in the output.
  9905. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9906. @section setdar, setsar
  9907. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9908. output video.
  9909. This is done by changing the specified Sample (aka Pixel) Aspect
  9910. Ratio, according to the following equation:
  9911. @example
  9912. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9913. @end example
  9914. Keep in mind that the @code{setdar} filter does not modify the pixel
  9915. dimensions of the video frame. Also, the display aspect ratio set by
  9916. this filter may be changed by later filters in the filterchain,
  9917. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9918. applied.
  9919. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9920. the filter output video.
  9921. Note that as a consequence of the application of this filter, the
  9922. output display aspect ratio will change according to the equation
  9923. above.
  9924. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9925. filter may be changed by later filters in the filterchain, e.g. if
  9926. another "setsar" or a "setdar" filter is applied.
  9927. It accepts the following parameters:
  9928. @table @option
  9929. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9930. Set the aspect ratio used by the filter.
  9931. The parameter can be a floating point number string, an expression, or
  9932. a string of the form @var{num}:@var{den}, where @var{num} and
  9933. @var{den} are the numerator and denominator of the aspect ratio. If
  9934. the parameter is not specified, it is assumed the value "0".
  9935. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9936. should be escaped.
  9937. @item max
  9938. Set the maximum integer value to use for expressing numerator and
  9939. denominator when reducing the expressed aspect ratio to a rational.
  9940. Default value is @code{100}.
  9941. @end table
  9942. The parameter @var{sar} is an expression containing
  9943. the following constants:
  9944. @table @option
  9945. @item E, PI, PHI
  9946. These are approximated values for the mathematical constants e
  9947. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9948. @item w, h
  9949. The input width and height.
  9950. @item a
  9951. These are the same as @var{w} / @var{h}.
  9952. @item sar
  9953. The input sample aspect ratio.
  9954. @item dar
  9955. The input display aspect ratio. It is the same as
  9956. (@var{w} / @var{h}) * @var{sar}.
  9957. @item hsub, vsub
  9958. Horizontal and vertical chroma subsample values. For example, for the
  9959. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9960. @end table
  9961. @subsection Examples
  9962. @itemize
  9963. @item
  9964. To change the display aspect ratio to 16:9, specify one of the following:
  9965. @example
  9966. setdar=dar=1.77777
  9967. setdar=dar=16/9
  9968. @end example
  9969. @item
  9970. To change the sample aspect ratio to 10:11, specify:
  9971. @example
  9972. setsar=sar=10/11
  9973. @end example
  9974. @item
  9975. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9976. 1000 in the aspect ratio reduction, use the command:
  9977. @example
  9978. setdar=ratio=16/9:max=1000
  9979. @end example
  9980. @end itemize
  9981. @anchor{setfield}
  9982. @section setfield
  9983. Force field for the output video frame.
  9984. The @code{setfield} filter marks the interlace type field for the
  9985. output frames. It does not change the input frame, but only sets the
  9986. corresponding property, which affects how the frame is treated by
  9987. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9988. The filter accepts the following options:
  9989. @table @option
  9990. @item mode
  9991. Available values are:
  9992. @table @samp
  9993. @item auto
  9994. Keep the same field property.
  9995. @item bff
  9996. Mark the frame as bottom-field-first.
  9997. @item tff
  9998. Mark the frame as top-field-first.
  9999. @item prog
  10000. Mark the frame as progressive.
  10001. @end table
  10002. @end table
  10003. @section showinfo
  10004. Show a line containing various information for each input video frame.
  10005. The input video is not modified.
  10006. The shown line contains a sequence of key/value pairs of the form
  10007. @var{key}:@var{value}.
  10008. The following values are shown in the output:
  10009. @table @option
  10010. @item n
  10011. The (sequential) number of the input frame, starting from 0.
  10012. @item pts
  10013. The Presentation TimeStamp of the input frame, expressed as a number of
  10014. time base units. The time base unit depends on the filter input pad.
  10015. @item pts_time
  10016. The Presentation TimeStamp of the input frame, expressed as a number of
  10017. seconds.
  10018. @item pos
  10019. The position of the frame in the input stream, or -1 if this information is
  10020. unavailable and/or meaningless (for example in case of synthetic video).
  10021. @item fmt
  10022. The pixel format name.
  10023. @item sar
  10024. The sample aspect ratio of the input frame, expressed in the form
  10025. @var{num}/@var{den}.
  10026. @item s
  10027. The size of the input frame. For the syntax of this option, check the
  10028. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10029. @item i
  10030. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10031. for bottom field first).
  10032. @item iskey
  10033. This is 1 if the frame is a key frame, 0 otherwise.
  10034. @item type
  10035. The picture type of the input frame ("I" for an I-frame, "P" for a
  10036. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10037. Also refer to the documentation of the @code{AVPictureType} enum and of
  10038. the @code{av_get_picture_type_char} function defined in
  10039. @file{libavutil/avutil.h}.
  10040. @item checksum
  10041. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10042. @item plane_checksum
  10043. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10044. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10045. @end table
  10046. @section showpalette
  10047. Displays the 256 colors palette of each frame. This filter is only relevant for
  10048. @var{pal8} pixel format frames.
  10049. It accepts the following option:
  10050. @table @option
  10051. @item s
  10052. Set the size of the box used to represent one palette color entry. Default is
  10053. @code{30} (for a @code{30x30} pixel box).
  10054. @end table
  10055. @section shuffleframes
  10056. Reorder and/or duplicate and/or drop video frames.
  10057. It accepts the following parameters:
  10058. @table @option
  10059. @item mapping
  10060. Set the destination indexes of input frames.
  10061. This is space or '|' separated list of indexes that maps input frames to output
  10062. frames. Number of indexes also sets maximal value that each index may have.
  10063. '-1' index have special meaning and that is to drop frame.
  10064. @end table
  10065. The first frame has the index 0. The default is to keep the input unchanged.
  10066. @subsection Examples
  10067. @itemize
  10068. @item
  10069. Swap second and third frame of every three frames of the input:
  10070. @example
  10071. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10072. @end example
  10073. @item
  10074. Swap 10th and 1st frame of every ten frames of the input:
  10075. @example
  10076. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10077. @end example
  10078. @end itemize
  10079. @section shuffleplanes
  10080. Reorder and/or duplicate video planes.
  10081. It accepts the following parameters:
  10082. @table @option
  10083. @item map0
  10084. The index of the input plane to be used as the first output plane.
  10085. @item map1
  10086. The index of the input plane to be used as the second output plane.
  10087. @item map2
  10088. The index of the input plane to be used as the third output plane.
  10089. @item map3
  10090. The index of the input plane to be used as the fourth output plane.
  10091. @end table
  10092. The first plane has the index 0. The default is to keep the input unchanged.
  10093. @subsection Examples
  10094. @itemize
  10095. @item
  10096. Swap the second and third planes of the input:
  10097. @example
  10098. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10099. @end example
  10100. @end itemize
  10101. @anchor{signalstats}
  10102. @section signalstats
  10103. Evaluate various visual metrics that assist in determining issues associated
  10104. with the digitization of analog video media.
  10105. By default the filter will log these metadata values:
  10106. @table @option
  10107. @item YMIN
  10108. Display the minimal Y value contained within the input frame. Expressed in
  10109. range of [0-255].
  10110. @item YLOW
  10111. Display the Y value at the 10% percentile within the input frame. Expressed in
  10112. range of [0-255].
  10113. @item YAVG
  10114. Display the average Y value within the input frame. Expressed in range of
  10115. [0-255].
  10116. @item YHIGH
  10117. Display the Y value at the 90% percentile within the input frame. Expressed in
  10118. range of [0-255].
  10119. @item YMAX
  10120. Display the maximum Y value contained within the input frame. Expressed in
  10121. range of [0-255].
  10122. @item UMIN
  10123. Display the minimal U value contained within the input frame. Expressed in
  10124. range of [0-255].
  10125. @item ULOW
  10126. Display the U value at the 10% percentile within the input frame. Expressed in
  10127. range of [0-255].
  10128. @item UAVG
  10129. Display the average U value within the input frame. Expressed in range of
  10130. [0-255].
  10131. @item UHIGH
  10132. Display the U value at the 90% percentile within the input frame. Expressed in
  10133. range of [0-255].
  10134. @item UMAX
  10135. Display the maximum U value contained within the input frame. Expressed in
  10136. range of [0-255].
  10137. @item VMIN
  10138. Display the minimal V value contained within the input frame. Expressed in
  10139. range of [0-255].
  10140. @item VLOW
  10141. Display the V value at the 10% percentile within the input frame. Expressed in
  10142. range of [0-255].
  10143. @item VAVG
  10144. Display the average V value within the input frame. Expressed in range of
  10145. [0-255].
  10146. @item VHIGH
  10147. Display the V value at the 90% percentile within the input frame. Expressed in
  10148. range of [0-255].
  10149. @item VMAX
  10150. Display the maximum V value contained within the input frame. Expressed in
  10151. range of [0-255].
  10152. @item SATMIN
  10153. Display the minimal saturation value contained within the input frame.
  10154. Expressed in range of [0-~181.02].
  10155. @item SATLOW
  10156. Display the saturation value at the 10% percentile within the input frame.
  10157. Expressed in range of [0-~181.02].
  10158. @item SATAVG
  10159. Display the average saturation value within the input frame. Expressed in range
  10160. of [0-~181.02].
  10161. @item SATHIGH
  10162. Display the saturation value at the 90% percentile within the input frame.
  10163. Expressed in range of [0-~181.02].
  10164. @item SATMAX
  10165. Display the maximum saturation value contained within the input frame.
  10166. Expressed in range of [0-~181.02].
  10167. @item HUEMED
  10168. Display the median value for hue within the input frame. Expressed in range of
  10169. [0-360].
  10170. @item HUEAVG
  10171. Display the average value for hue within the input frame. Expressed in range of
  10172. [0-360].
  10173. @item YDIF
  10174. Display the average of sample value difference between all values of the Y
  10175. plane in the current frame and corresponding values of the previous input frame.
  10176. Expressed in range of [0-255].
  10177. @item UDIF
  10178. Display the average of sample value difference between all values of the U
  10179. plane in the current frame and corresponding values of the previous input frame.
  10180. Expressed in range of [0-255].
  10181. @item VDIF
  10182. Display the average of sample value difference between all values of the V
  10183. plane in the current frame and corresponding values of the previous input frame.
  10184. Expressed in range of [0-255].
  10185. @item YBITDEPTH
  10186. Display bit depth of Y plane in current frame.
  10187. Expressed in range of [0-16].
  10188. @item UBITDEPTH
  10189. Display bit depth of U plane in current frame.
  10190. Expressed in range of [0-16].
  10191. @item VBITDEPTH
  10192. Display bit depth of V plane in current frame.
  10193. Expressed in range of [0-16].
  10194. @end table
  10195. The filter accepts the following options:
  10196. @table @option
  10197. @item stat
  10198. @item out
  10199. @option{stat} specify an additional form of image analysis.
  10200. @option{out} output video with the specified type of pixel highlighted.
  10201. Both options accept the following values:
  10202. @table @samp
  10203. @item tout
  10204. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10205. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10206. include the results of video dropouts, head clogs, or tape tracking issues.
  10207. @item vrep
  10208. Identify @var{vertical line repetition}. Vertical line repetition includes
  10209. similar rows of pixels within a frame. In born-digital video vertical line
  10210. repetition is common, but this pattern is uncommon in video digitized from an
  10211. analog source. When it occurs in video that results from the digitization of an
  10212. analog source it can indicate concealment from a dropout compensator.
  10213. @item brng
  10214. Identify pixels that fall outside of legal broadcast range.
  10215. @end table
  10216. @item color, c
  10217. Set the highlight color for the @option{out} option. The default color is
  10218. yellow.
  10219. @end table
  10220. @subsection Examples
  10221. @itemize
  10222. @item
  10223. Output data of various video metrics:
  10224. @example
  10225. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10226. @end example
  10227. @item
  10228. Output specific data about the minimum and maximum values of the Y plane per frame:
  10229. @example
  10230. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10231. @end example
  10232. @item
  10233. Playback video while highlighting pixels that are outside of broadcast range in red.
  10234. @example
  10235. ffplay example.mov -vf signalstats="out=brng:color=red"
  10236. @end example
  10237. @item
  10238. Playback video with signalstats metadata drawn over the frame.
  10239. @example
  10240. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10241. @end example
  10242. The contents of signalstat_drawtext.txt used in the command are:
  10243. @example
  10244. time %@{pts:hms@}
  10245. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10246. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10247. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10248. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10249. @end example
  10250. @end itemize
  10251. @anchor{signature}
  10252. @section signature
  10253. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10254. input. In this case the matching between the inputs can be calculated additionally.
  10255. The filter always passes through the first input. The signature of each stream can
  10256. be written into a file.
  10257. It accepts the following options:
  10258. @table @option
  10259. @item detectmode
  10260. Enable or disable the matching process.
  10261. Available values are:
  10262. @table @samp
  10263. @item off
  10264. Disable the calculation of a matching (default).
  10265. @item full
  10266. Calculate the matching for the whole video and output whether the whole video
  10267. matches or only parts.
  10268. @item fast
  10269. Calculate only until a matching is found or the video ends. Should be faster in
  10270. some cases.
  10271. @end table
  10272. @item nb_inputs
  10273. Set the number of inputs. The option value must be a non negative integer.
  10274. Default value is 1.
  10275. @item filename
  10276. Set the path to which the output is written. If there is more than one input,
  10277. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10278. integer), that will be replaced with the input number. If no filename is
  10279. specified, no output will be written. This is the default.
  10280. @item format
  10281. Choose the output format.
  10282. Available values are:
  10283. @table @samp
  10284. @item binary
  10285. Use the specified binary representation (default).
  10286. @item xml
  10287. Use the specified xml representation.
  10288. @end table
  10289. @item th_d
  10290. Set threshold to detect one word as similar. The option value must be an integer
  10291. greater than zero. The default value is 9000.
  10292. @item th_dc
  10293. Set threshold to detect all words as similar. The option value must be an integer
  10294. greater than zero. The default value is 60000.
  10295. @item th_xh
  10296. Set threshold to detect frames as similar. The option value must be an integer
  10297. greater than zero. The default value is 116.
  10298. @item th_di
  10299. Set the minimum length of a sequence in frames to recognize it as matching
  10300. sequence. The option value must be a non negative integer value.
  10301. The default value is 0.
  10302. @item th_it
  10303. Set the minimum relation, that matching frames to all frames must have.
  10304. The option value must be a double value between 0 and 1. The default value is 0.5.
  10305. @end table
  10306. @subsection Examples
  10307. @itemize
  10308. @item
  10309. To calculate the signature of an input video and store it in signature.bin:
  10310. @example
  10311. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10312. @end example
  10313. @item
  10314. To detect whether two videos match and store the signatures in XML format in
  10315. signature0.xml and signature1.xml:
  10316. @example
  10317. 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 -
  10318. @end example
  10319. @end itemize
  10320. @anchor{smartblur}
  10321. @section smartblur
  10322. Blur the input video without impacting the outlines.
  10323. It accepts the following options:
  10324. @table @option
  10325. @item luma_radius, lr
  10326. Set the luma radius. The option value must be a float number in
  10327. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10328. used to blur the image (slower if larger). Default value is 1.0.
  10329. @item luma_strength, ls
  10330. Set the luma strength. The option value must be a float number
  10331. in the range [-1.0,1.0] that configures the blurring. A value included
  10332. in [0.0,1.0] will blur the image whereas a value included in
  10333. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10334. @item luma_threshold, lt
  10335. Set the luma threshold used as a coefficient to determine
  10336. whether a pixel should be blurred or not. The option value must be an
  10337. integer in the range [-30,30]. A value of 0 will filter all the image,
  10338. a value included in [0,30] will filter flat areas and a value included
  10339. in [-30,0] will filter edges. Default value is 0.
  10340. @item chroma_radius, cr
  10341. Set the chroma radius. The option value must be a float number in
  10342. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10343. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10344. @item chroma_strength, cs
  10345. Set the chroma strength. The option value must be a float number
  10346. in the range [-1.0,1.0] that configures the blurring. A value included
  10347. in [0.0,1.0] will blur the image whereas a value included in
  10348. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10349. @item chroma_threshold, ct
  10350. Set the chroma threshold used as a coefficient to determine
  10351. whether a pixel should be blurred or not. The option value must be an
  10352. integer in the range [-30,30]. A value of 0 will filter all the image,
  10353. a value included in [0,30] will filter flat areas and a value included
  10354. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10355. @end table
  10356. If a chroma option is not explicitly set, the corresponding luma value
  10357. is set.
  10358. @section ssim
  10359. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10360. This filter takes in input two input videos, the first input is
  10361. considered the "main" source and is passed unchanged to the
  10362. output. The second input is used as a "reference" video for computing
  10363. the SSIM.
  10364. Both video inputs must have the same resolution and pixel format for
  10365. this filter to work correctly. Also it assumes that both inputs
  10366. have the same number of frames, which are compared one by one.
  10367. The filter stores the calculated SSIM of each frame.
  10368. The description of the accepted parameters follows.
  10369. @table @option
  10370. @item stats_file, f
  10371. If specified the filter will use the named file to save the SSIM of
  10372. each individual frame. When filename equals "-" the data is sent to
  10373. standard output.
  10374. @end table
  10375. The file printed if @var{stats_file} is selected, contains a sequence of
  10376. key/value pairs of the form @var{key}:@var{value} for each compared
  10377. couple of frames.
  10378. A description of each shown parameter follows:
  10379. @table @option
  10380. @item n
  10381. sequential number of the input frame, starting from 1
  10382. @item Y, U, V, R, G, B
  10383. SSIM of the compared frames for the component specified by the suffix.
  10384. @item All
  10385. SSIM of the compared frames for the whole frame.
  10386. @item dB
  10387. Same as above but in dB representation.
  10388. @end table
  10389. For example:
  10390. @example
  10391. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10392. [main][ref] ssim="stats_file=stats.log" [out]
  10393. @end example
  10394. On this example the input file being processed is compared with the
  10395. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10396. is stored in @file{stats.log}.
  10397. Another example with both psnr and ssim at same time:
  10398. @example
  10399. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10400. @end example
  10401. @section stereo3d
  10402. Convert between different stereoscopic image formats.
  10403. The filters accept the following options:
  10404. @table @option
  10405. @item in
  10406. Set stereoscopic image format of input.
  10407. Available values for input image formats are:
  10408. @table @samp
  10409. @item sbsl
  10410. side by side parallel (left eye left, right eye right)
  10411. @item sbsr
  10412. side by side crosseye (right eye left, left eye right)
  10413. @item sbs2l
  10414. side by side parallel with half width resolution
  10415. (left eye left, right eye right)
  10416. @item sbs2r
  10417. side by side crosseye with half width resolution
  10418. (right eye left, left eye right)
  10419. @item abl
  10420. above-below (left eye above, right eye below)
  10421. @item abr
  10422. above-below (right eye above, left eye below)
  10423. @item ab2l
  10424. above-below with half height resolution
  10425. (left eye above, right eye below)
  10426. @item ab2r
  10427. above-below with half height resolution
  10428. (right eye above, left eye below)
  10429. @item al
  10430. alternating frames (left eye first, right eye second)
  10431. @item ar
  10432. alternating frames (right eye first, left eye second)
  10433. @item irl
  10434. interleaved rows (left eye has top row, right eye starts on next row)
  10435. @item irr
  10436. interleaved rows (right eye has top row, left eye starts on next row)
  10437. @item icl
  10438. interleaved columns, left eye first
  10439. @item icr
  10440. interleaved columns, right eye first
  10441. Default value is @samp{sbsl}.
  10442. @end table
  10443. @item out
  10444. Set stereoscopic image format of output.
  10445. @table @samp
  10446. @item sbsl
  10447. side by side parallel (left eye left, right eye right)
  10448. @item sbsr
  10449. side by side crosseye (right eye left, left eye right)
  10450. @item sbs2l
  10451. side by side parallel with half width resolution
  10452. (left eye left, right eye right)
  10453. @item sbs2r
  10454. side by side crosseye with half width resolution
  10455. (right eye left, left eye right)
  10456. @item abl
  10457. above-below (left eye above, right eye below)
  10458. @item abr
  10459. above-below (right eye above, left eye below)
  10460. @item ab2l
  10461. above-below with half height resolution
  10462. (left eye above, right eye below)
  10463. @item ab2r
  10464. above-below with half height resolution
  10465. (right eye above, left eye below)
  10466. @item al
  10467. alternating frames (left eye first, right eye second)
  10468. @item ar
  10469. alternating frames (right eye first, left eye second)
  10470. @item irl
  10471. interleaved rows (left eye has top row, right eye starts on next row)
  10472. @item irr
  10473. interleaved rows (right eye has top row, left eye starts on next row)
  10474. @item arbg
  10475. anaglyph red/blue gray
  10476. (red filter on left eye, blue filter on right eye)
  10477. @item argg
  10478. anaglyph red/green gray
  10479. (red filter on left eye, green filter on right eye)
  10480. @item arcg
  10481. anaglyph red/cyan gray
  10482. (red filter on left eye, cyan filter on right eye)
  10483. @item arch
  10484. anaglyph red/cyan half colored
  10485. (red filter on left eye, cyan filter on right eye)
  10486. @item arcc
  10487. anaglyph red/cyan color
  10488. (red filter on left eye, cyan filter on right eye)
  10489. @item arcd
  10490. anaglyph red/cyan color optimized with the least squares projection of dubois
  10491. (red filter on left eye, cyan filter on right eye)
  10492. @item agmg
  10493. anaglyph green/magenta gray
  10494. (green filter on left eye, magenta filter on right eye)
  10495. @item agmh
  10496. anaglyph green/magenta half colored
  10497. (green filter on left eye, magenta filter on right eye)
  10498. @item agmc
  10499. anaglyph green/magenta colored
  10500. (green filter on left eye, magenta filter on right eye)
  10501. @item agmd
  10502. anaglyph green/magenta color optimized with the least squares projection of dubois
  10503. (green filter on left eye, magenta filter on right eye)
  10504. @item aybg
  10505. anaglyph yellow/blue gray
  10506. (yellow filter on left eye, blue filter on right eye)
  10507. @item aybh
  10508. anaglyph yellow/blue half colored
  10509. (yellow filter on left eye, blue filter on right eye)
  10510. @item aybc
  10511. anaglyph yellow/blue colored
  10512. (yellow filter on left eye, blue filter on right eye)
  10513. @item aybd
  10514. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10515. (yellow filter on left eye, blue filter on right eye)
  10516. @item ml
  10517. mono output (left eye only)
  10518. @item mr
  10519. mono output (right eye only)
  10520. @item chl
  10521. checkerboard, left eye first
  10522. @item chr
  10523. checkerboard, right eye first
  10524. @item icl
  10525. interleaved columns, left eye first
  10526. @item icr
  10527. interleaved columns, right eye first
  10528. @item hdmi
  10529. HDMI frame pack
  10530. @end table
  10531. Default value is @samp{arcd}.
  10532. @end table
  10533. @subsection Examples
  10534. @itemize
  10535. @item
  10536. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10537. @example
  10538. stereo3d=sbsl:aybd
  10539. @end example
  10540. @item
  10541. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10542. @example
  10543. stereo3d=abl:sbsr
  10544. @end example
  10545. @end itemize
  10546. @section streamselect, astreamselect
  10547. Select video or audio streams.
  10548. The filter accepts the following options:
  10549. @table @option
  10550. @item inputs
  10551. Set number of inputs. Default is 2.
  10552. @item map
  10553. Set input indexes to remap to outputs.
  10554. @end table
  10555. @subsection Commands
  10556. The @code{streamselect} and @code{astreamselect} filter supports the following
  10557. commands:
  10558. @table @option
  10559. @item map
  10560. Set input indexes to remap to outputs.
  10561. @end table
  10562. @subsection Examples
  10563. @itemize
  10564. @item
  10565. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10566. @example
  10567. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10568. @end example
  10569. @item
  10570. Same as above, but for audio:
  10571. @example
  10572. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10573. @end example
  10574. @end itemize
  10575. @section sobel
  10576. Apply sobel operator to input video stream.
  10577. The filter accepts the following option:
  10578. @table @option
  10579. @item planes
  10580. Set which planes will be processed, unprocessed planes will be copied.
  10581. By default value 0xf, all planes will be processed.
  10582. @item scale
  10583. Set value which will be multiplied with filtered result.
  10584. @item delta
  10585. Set value which will be added to filtered result.
  10586. @end table
  10587. @anchor{spp}
  10588. @section spp
  10589. Apply a simple postprocessing filter that compresses and decompresses the image
  10590. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10591. and average the results.
  10592. The filter accepts the following options:
  10593. @table @option
  10594. @item quality
  10595. Set quality. This option defines the number of levels for averaging. It accepts
  10596. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10597. effect. A value of @code{6} means the higher quality. For each increment of
  10598. that value the speed drops by a factor of approximately 2. Default value is
  10599. @code{3}.
  10600. @item qp
  10601. Force a constant quantization parameter. If not set, the filter will use the QP
  10602. from the video stream (if available).
  10603. @item mode
  10604. Set thresholding mode. Available modes are:
  10605. @table @samp
  10606. @item hard
  10607. Set hard thresholding (default).
  10608. @item soft
  10609. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10610. @end table
  10611. @item use_bframe_qp
  10612. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10613. option may cause flicker since the B-Frames have often larger QP. Default is
  10614. @code{0} (not enabled).
  10615. @end table
  10616. @anchor{subtitles}
  10617. @section subtitles
  10618. Draw subtitles on top of input video using the libass library.
  10619. To enable compilation of this filter you need to configure FFmpeg with
  10620. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10621. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10622. Alpha) subtitles format.
  10623. The filter accepts the following options:
  10624. @table @option
  10625. @item filename, f
  10626. Set the filename of the subtitle file to read. It must be specified.
  10627. @item original_size
  10628. Specify the size of the original video, the video for which the ASS file
  10629. was composed. For the syntax of this option, check the
  10630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10631. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10632. correctly scale the fonts if the aspect ratio has been changed.
  10633. @item fontsdir
  10634. Set a directory path containing fonts that can be used by the filter.
  10635. These fonts will be used in addition to whatever the font provider uses.
  10636. @item charenc
  10637. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10638. useful if not UTF-8.
  10639. @item stream_index, si
  10640. Set subtitles stream index. @code{subtitles} filter only.
  10641. @item force_style
  10642. Override default style or script info parameters of the subtitles. It accepts a
  10643. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10644. @end table
  10645. If the first key is not specified, it is assumed that the first value
  10646. specifies the @option{filename}.
  10647. For example, to render the file @file{sub.srt} on top of the input
  10648. video, use the command:
  10649. @example
  10650. subtitles=sub.srt
  10651. @end example
  10652. which is equivalent to:
  10653. @example
  10654. subtitles=filename=sub.srt
  10655. @end example
  10656. To render the default subtitles stream from file @file{video.mkv}, use:
  10657. @example
  10658. subtitles=video.mkv
  10659. @end example
  10660. To render the second subtitles stream from that file, use:
  10661. @example
  10662. subtitles=video.mkv:si=1
  10663. @end example
  10664. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10665. @code{DejaVu Serif}, use:
  10666. @example
  10667. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10668. @end example
  10669. @section super2xsai
  10670. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10671. Interpolate) pixel art scaling algorithm.
  10672. Useful for enlarging pixel art images without reducing sharpness.
  10673. @section swaprect
  10674. Swap two rectangular objects in video.
  10675. This filter accepts the following options:
  10676. @table @option
  10677. @item w
  10678. Set object width.
  10679. @item h
  10680. Set object height.
  10681. @item x1
  10682. Set 1st rect x coordinate.
  10683. @item y1
  10684. Set 1st rect y coordinate.
  10685. @item x2
  10686. Set 2nd rect x coordinate.
  10687. @item y2
  10688. Set 2nd rect y coordinate.
  10689. All expressions are evaluated once for each frame.
  10690. @end table
  10691. The all options are expressions containing the following constants:
  10692. @table @option
  10693. @item w
  10694. @item h
  10695. The input width and height.
  10696. @item a
  10697. same as @var{w} / @var{h}
  10698. @item sar
  10699. input sample aspect ratio
  10700. @item dar
  10701. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10702. @item n
  10703. The number of the input frame, starting from 0.
  10704. @item t
  10705. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10706. @item pos
  10707. the position in the file of the input frame, NAN if unknown
  10708. @end table
  10709. @section swapuv
  10710. Swap U & V plane.
  10711. @section telecine
  10712. Apply telecine process to the video.
  10713. This filter accepts the following options:
  10714. @table @option
  10715. @item first_field
  10716. @table @samp
  10717. @item top, t
  10718. top field first
  10719. @item bottom, b
  10720. bottom field first
  10721. The default value is @code{top}.
  10722. @end table
  10723. @item pattern
  10724. A string of numbers representing the pulldown pattern you wish to apply.
  10725. The default value is @code{23}.
  10726. @end table
  10727. @example
  10728. Some typical patterns:
  10729. NTSC output (30i):
  10730. 27.5p: 32222
  10731. 24p: 23 (classic)
  10732. 24p: 2332 (preferred)
  10733. 20p: 33
  10734. 18p: 334
  10735. 16p: 3444
  10736. PAL output (25i):
  10737. 27.5p: 12222
  10738. 24p: 222222222223 ("Euro pulldown")
  10739. 16.67p: 33
  10740. 16p: 33333334
  10741. @end example
  10742. @section threshold
  10743. Apply threshold effect to video stream.
  10744. This filter needs four video streams to perform thresholding.
  10745. First stream is stream we are filtering.
  10746. Second stream is holding threshold values, third stream is holding min values,
  10747. and last, fourth stream is holding max values.
  10748. The filter accepts the following option:
  10749. @table @option
  10750. @item planes
  10751. Set which planes will be processed, unprocessed planes will be copied.
  10752. By default value 0xf, all planes will be processed.
  10753. @end table
  10754. For example if first stream pixel's component value is less then threshold value
  10755. of pixel component from 2nd threshold stream, third stream value will picked,
  10756. otherwise fourth stream pixel component value will be picked.
  10757. Using color source filter one can perform various types of thresholding:
  10758. @subsection Examples
  10759. @itemize
  10760. @item
  10761. Binary threshold, using gray color as threshold:
  10762. @example
  10763. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10764. @end example
  10765. @item
  10766. Inverted binary threshold, using gray color as threshold:
  10767. @example
  10768. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10769. @end example
  10770. @item
  10771. Truncate binary threshold, using gray color as threshold:
  10772. @example
  10773. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10774. @end example
  10775. @item
  10776. Threshold to zero, using gray color as threshold:
  10777. @example
  10778. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10779. @end example
  10780. @item
  10781. Inverted threshold to zero, using gray color as threshold:
  10782. @example
  10783. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10784. @end example
  10785. @end itemize
  10786. @section thumbnail
  10787. Select the most representative frame in a given sequence of consecutive frames.
  10788. The filter accepts the following options:
  10789. @table @option
  10790. @item n
  10791. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10792. will pick one of them, and then handle the next batch of @var{n} frames until
  10793. the end. Default is @code{100}.
  10794. @end table
  10795. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10796. value will result in a higher memory usage, so a high value is not recommended.
  10797. @subsection Examples
  10798. @itemize
  10799. @item
  10800. Extract one picture each 50 frames:
  10801. @example
  10802. thumbnail=50
  10803. @end example
  10804. @item
  10805. Complete example of a thumbnail creation with @command{ffmpeg}:
  10806. @example
  10807. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10808. @end example
  10809. @end itemize
  10810. @section tile
  10811. Tile several successive frames together.
  10812. The filter accepts the following options:
  10813. @table @option
  10814. @item layout
  10815. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10816. this option, check the
  10817. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10818. @item nb_frames
  10819. Set the maximum number of frames to render in the given area. It must be less
  10820. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10821. the area will be used.
  10822. @item margin
  10823. Set the outer border margin in pixels.
  10824. @item padding
  10825. Set the inner border thickness (i.e. the number of pixels between frames). For
  10826. more advanced padding options (such as having different values for the edges),
  10827. refer to the pad video filter.
  10828. @item color
  10829. Specify the color of the unused area. For the syntax of this option, check the
  10830. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10831. is "black".
  10832. @end table
  10833. @subsection Examples
  10834. @itemize
  10835. @item
  10836. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10837. @example
  10838. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10839. @end example
  10840. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10841. duplicating each output frame to accommodate the originally detected frame
  10842. rate.
  10843. @item
  10844. Display @code{5} pictures in an area of @code{3x2} frames,
  10845. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10846. mixed flat and named options:
  10847. @example
  10848. tile=3x2:nb_frames=5:padding=7:margin=2
  10849. @end example
  10850. @end itemize
  10851. @section tinterlace
  10852. Perform various types of temporal field interlacing.
  10853. Frames are counted starting from 1, so the first input frame is
  10854. considered odd.
  10855. The filter accepts the following options:
  10856. @table @option
  10857. @item mode
  10858. Specify the mode of the interlacing. This option can also be specified
  10859. as a value alone. See below for a list of values for this option.
  10860. Available values are:
  10861. @table @samp
  10862. @item merge, 0
  10863. Move odd frames into the upper field, even into the lower field,
  10864. generating a double height frame at half frame rate.
  10865. @example
  10866. ------> time
  10867. Input:
  10868. Frame 1 Frame 2 Frame 3 Frame 4
  10869. 11111 22222 33333 44444
  10870. 11111 22222 33333 44444
  10871. 11111 22222 33333 44444
  10872. 11111 22222 33333 44444
  10873. Output:
  10874. 11111 33333
  10875. 22222 44444
  10876. 11111 33333
  10877. 22222 44444
  10878. 11111 33333
  10879. 22222 44444
  10880. 11111 33333
  10881. 22222 44444
  10882. @end example
  10883. @item drop_even, 1
  10884. Only output odd frames, even frames are dropped, generating a frame with
  10885. unchanged height at half frame rate.
  10886. @example
  10887. ------> time
  10888. Input:
  10889. Frame 1 Frame 2 Frame 3 Frame 4
  10890. 11111 22222 33333 44444
  10891. 11111 22222 33333 44444
  10892. 11111 22222 33333 44444
  10893. 11111 22222 33333 44444
  10894. Output:
  10895. 11111 33333
  10896. 11111 33333
  10897. 11111 33333
  10898. 11111 33333
  10899. @end example
  10900. @item drop_odd, 2
  10901. Only output even frames, odd frames are dropped, generating a frame with
  10902. unchanged height at half frame rate.
  10903. @example
  10904. ------> time
  10905. Input:
  10906. Frame 1 Frame 2 Frame 3 Frame 4
  10907. 11111 22222 33333 44444
  10908. 11111 22222 33333 44444
  10909. 11111 22222 33333 44444
  10910. 11111 22222 33333 44444
  10911. Output:
  10912. 22222 44444
  10913. 22222 44444
  10914. 22222 44444
  10915. 22222 44444
  10916. @end example
  10917. @item pad, 3
  10918. Expand each frame to full height, but pad alternate lines with black,
  10919. generating a frame with double height at the same input frame rate.
  10920. @example
  10921. ------> time
  10922. Input:
  10923. Frame 1 Frame 2 Frame 3 Frame 4
  10924. 11111 22222 33333 44444
  10925. 11111 22222 33333 44444
  10926. 11111 22222 33333 44444
  10927. 11111 22222 33333 44444
  10928. Output:
  10929. 11111 ..... 33333 .....
  10930. ..... 22222 ..... 44444
  10931. 11111 ..... 33333 .....
  10932. ..... 22222 ..... 44444
  10933. 11111 ..... 33333 .....
  10934. ..... 22222 ..... 44444
  10935. 11111 ..... 33333 .....
  10936. ..... 22222 ..... 44444
  10937. @end example
  10938. @item interleave_top, 4
  10939. Interleave the upper field from odd frames with the lower field from
  10940. even frames, generating a frame with unchanged height at half frame rate.
  10941. @example
  10942. ------> time
  10943. Input:
  10944. Frame 1 Frame 2 Frame 3 Frame 4
  10945. 11111<- 22222 33333<- 44444
  10946. 11111 22222<- 33333 44444<-
  10947. 11111<- 22222 33333<- 44444
  10948. 11111 22222<- 33333 44444<-
  10949. Output:
  10950. 11111 33333
  10951. 22222 44444
  10952. 11111 33333
  10953. 22222 44444
  10954. @end example
  10955. @item interleave_bottom, 5
  10956. Interleave the lower field from odd frames with the upper field from
  10957. even frames, generating a frame with unchanged height at half frame rate.
  10958. @example
  10959. ------> time
  10960. Input:
  10961. Frame 1 Frame 2 Frame 3 Frame 4
  10962. 11111 22222<- 33333 44444<-
  10963. 11111<- 22222 33333<- 44444
  10964. 11111 22222<- 33333 44444<-
  10965. 11111<- 22222 33333<- 44444
  10966. Output:
  10967. 22222 44444
  10968. 11111 33333
  10969. 22222 44444
  10970. 11111 33333
  10971. @end example
  10972. @item interlacex2, 6
  10973. Double frame rate with unchanged height. Frames are inserted each
  10974. containing the second temporal field from the previous input frame and
  10975. the first temporal field from the next input frame. This mode relies on
  10976. the top_field_first flag. Useful for interlaced video displays with no
  10977. field synchronisation.
  10978. @example
  10979. ------> time
  10980. Input:
  10981. Frame 1 Frame 2 Frame 3 Frame 4
  10982. 11111 22222 33333 44444
  10983. 11111 22222 33333 44444
  10984. 11111 22222 33333 44444
  10985. 11111 22222 33333 44444
  10986. Output:
  10987. 11111 22222 22222 33333 33333 44444 44444
  10988. 11111 11111 22222 22222 33333 33333 44444
  10989. 11111 22222 22222 33333 33333 44444 44444
  10990. 11111 11111 22222 22222 33333 33333 44444
  10991. @end example
  10992. @item mergex2, 7
  10993. Move odd frames into the upper field, even into the lower field,
  10994. generating a double height frame at same frame rate.
  10995. @example
  10996. ------> time
  10997. Input:
  10998. Frame 1 Frame 2 Frame 3 Frame 4
  10999. 11111 22222 33333 44444
  11000. 11111 22222 33333 44444
  11001. 11111 22222 33333 44444
  11002. 11111 22222 33333 44444
  11003. Output:
  11004. 11111 33333 33333 55555
  11005. 22222 22222 44444 44444
  11006. 11111 33333 33333 55555
  11007. 22222 22222 44444 44444
  11008. 11111 33333 33333 55555
  11009. 22222 22222 44444 44444
  11010. 11111 33333 33333 55555
  11011. 22222 22222 44444 44444
  11012. @end example
  11013. @end table
  11014. Numeric values are deprecated but are accepted for backward
  11015. compatibility reasons.
  11016. Default mode is @code{merge}.
  11017. @item flags
  11018. Specify flags influencing the filter process.
  11019. Available value for @var{flags} is:
  11020. @table @option
  11021. @item low_pass_filter, vlfp
  11022. Enable linear vertical low-pass filtering in the filter.
  11023. Vertical low-pass filtering is required when creating an interlaced
  11024. destination from a progressive source which contains high-frequency
  11025. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11026. patterning.
  11027. @item complex_filter, cvlfp
  11028. Enable complex vertical low-pass filtering.
  11029. This will slightly less reduce interlace 'twitter' and Moire
  11030. patterning but better retain detail and subjective sharpness impression.
  11031. @end table
  11032. Vertical low-pass filtering can only be enabled for @option{mode}
  11033. @var{interleave_top} and @var{interleave_bottom}.
  11034. @end table
  11035. @section transpose
  11036. Transpose rows with columns in the input video and optionally flip it.
  11037. It accepts the following parameters:
  11038. @table @option
  11039. @item dir
  11040. Specify the transposition direction.
  11041. Can assume the following values:
  11042. @table @samp
  11043. @item 0, 4, cclock_flip
  11044. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11045. @example
  11046. L.R L.l
  11047. . . -> . .
  11048. l.r R.r
  11049. @end example
  11050. @item 1, 5, clock
  11051. Rotate by 90 degrees clockwise, that is:
  11052. @example
  11053. L.R l.L
  11054. . . -> . .
  11055. l.r r.R
  11056. @end example
  11057. @item 2, 6, cclock
  11058. Rotate by 90 degrees counterclockwise, that is:
  11059. @example
  11060. L.R R.r
  11061. . . -> . .
  11062. l.r L.l
  11063. @end example
  11064. @item 3, 7, clock_flip
  11065. Rotate by 90 degrees clockwise and vertically flip, that is:
  11066. @example
  11067. L.R r.R
  11068. . . -> . .
  11069. l.r l.L
  11070. @end example
  11071. @end table
  11072. For values between 4-7, the transposition is only done if the input
  11073. video geometry is portrait and not landscape. These values are
  11074. deprecated, the @code{passthrough} option should be used instead.
  11075. Numerical values are deprecated, and should be dropped in favor of
  11076. symbolic constants.
  11077. @item passthrough
  11078. Do not apply the transposition if the input geometry matches the one
  11079. specified by the specified value. It accepts the following values:
  11080. @table @samp
  11081. @item none
  11082. Always apply transposition.
  11083. @item portrait
  11084. Preserve portrait geometry (when @var{height} >= @var{width}).
  11085. @item landscape
  11086. Preserve landscape geometry (when @var{width} >= @var{height}).
  11087. @end table
  11088. Default value is @code{none}.
  11089. @end table
  11090. For example to rotate by 90 degrees clockwise and preserve portrait
  11091. layout:
  11092. @example
  11093. transpose=dir=1:passthrough=portrait
  11094. @end example
  11095. The command above can also be specified as:
  11096. @example
  11097. transpose=1:portrait
  11098. @end example
  11099. @section trim
  11100. Trim the input so that the output contains one continuous subpart of the input.
  11101. It accepts the following parameters:
  11102. @table @option
  11103. @item start
  11104. Specify the time of the start of the kept section, i.e. the frame with the
  11105. timestamp @var{start} will be the first frame in the output.
  11106. @item end
  11107. Specify the time of the first frame that will be dropped, i.e. the frame
  11108. immediately preceding the one with the timestamp @var{end} will be the last
  11109. frame in the output.
  11110. @item start_pts
  11111. This is the same as @var{start}, except this option sets the start timestamp
  11112. in timebase units instead of seconds.
  11113. @item end_pts
  11114. This is the same as @var{end}, except this option sets the end timestamp
  11115. in timebase units instead of seconds.
  11116. @item duration
  11117. The maximum duration of the output in seconds.
  11118. @item start_frame
  11119. The number of the first frame that should be passed to the output.
  11120. @item end_frame
  11121. The number of the first frame that should be dropped.
  11122. @end table
  11123. @option{start}, @option{end}, and @option{duration} are expressed as time
  11124. duration specifications; see
  11125. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11126. for the accepted syntax.
  11127. Note that the first two sets of the start/end options and the @option{duration}
  11128. option look at the frame timestamp, while the _frame variants simply count the
  11129. frames that pass through the filter. Also note that this filter does not modify
  11130. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11131. setpts filter after the trim filter.
  11132. If multiple start or end options are set, this filter tries to be greedy and
  11133. keep all the frames that match at least one of the specified constraints. To keep
  11134. only the part that matches all the constraints at once, chain multiple trim
  11135. filters.
  11136. The defaults are such that all the input is kept. So it is possible to set e.g.
  11137. just the end values to keep everything before the specified time.
  11138. Examples:
  11139. @itemize
  11140. @item
  11141. Drop everything except the second minute of input:
  11142. @example
  11143. ffmpeg -i INPUT -vf trim=60:120
  11144. @end example
  11145. @item
  11146. Keep only the first second:
  11147. @example
  11148. ffmpeg -i INPUT -vf trim=duration=1
  11149. @end example
  11150. @end itemize
  11151. @section unpremultiply
  11152. Apply alpha unpremultiply effect to input video stream using first plane
  11153. of second stream as alpha.
  11154. Both streams must have same dimensions and same pixel format.
  11155. The filter accepts the following option:
  11156. @table @option
  11157. @item planes
  11158. Set which planes will be processed, unprocessed planes will be copied.
  11159. By default value 0xf, all planes will be processed.
  11160. If the format has 1 or 2 components, then luma is bit 0.
  11161. If the format has 3 or 4 components:
  11162. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11163. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11164. If present, the alpha channel is always the last bit.
  11165. @item inplace
  11166. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11167. @end table
  11168. @anchor{unsharp}
  11169. @section unsharp
  11170. Sharpen or blur the input video.
  11171. It accepts the following parameters:
  11172. @table @option
  11173. @item luma_msize_x, lx
  11174. Set the luma matrix horizontal size. It must be an odd integer between
  11175. 3 and 23. The default value is 5.
  11176. @item luma_msize_y, ly
  11177. Set the luma matrix vertical size. It must be an odd integer between 3
  11178. and 23. The default value is 5.
  11179. @item luma_amount, la
  11180. Set the luma effect strength. It must be a floating point number, reasonable
  11181. values lay between -1.5 and 1.5.
  11182. Negative values will blur the input video, while positive values will
  11183. sharpen it, a value of zero will disable the effect.
  11184. Default value is 1.0.
  11185. @item chroma_msize_x, cx
  11186. Set the chroma matrix horizontal size. It must be an odd integer
  11187. between 3 and 23. The default value is 5.
  11188. @item chroma_msize_y, cy
  11189. Set the chroma matrix vertical size. It must be an odd integer
  11190. between 3 and 23. The default value is 5.
  11191. @item chroma_amount, ca
  11192. Set the chroma effect strength. It must be a floating point number, reasonable
  11193. values lay between -1.5 and 1.5.
  11194. Negative values will blur the input video, while positive values will
  11195. sharpen it, a value of zero will disable the effect.
  11196. Default value is 0.0.
  11197. @item opencl
  11198. If set to 1, specify using OpenCL capabilities, only available if
  11199. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11200. @end table
  11201. All parameters are optional and default to the equivalent of the
  11202. string '5:5:1.0:5:5:0.0'.
  11203. @subsection Examples
  11204. @itemize
  11205. @item
  11206. Apply strong luma sharpen effect:
  11207. @example
  11208. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11209. @end example
  11210. @item
  11211. Apply a strong blur of both luma and chroma parameters:
  11212. @example
  11213. unsharp=7:7:-2:7:7:-2
  11214. @end example
  11215. @end itemize
  11216. @section uspp
  11217. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11218. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11219. shifts and average the results.
  11220. The way this differs from the behavior of spp is that uspp actually encodes &
  11221. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11222. DCT similar to MJPEG.
  11223. The filter accepts the following options:
  11224. @table @option
  11225. @item quality
  11226. Set quality. This option defines the number of levels for averaging. It accepts
  11227. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11228. effect. A value of @code{8} means the higher quality. For each increment of
  11229. that value the speed drops by a factor of approximately 2. Default value is
  11230. @code{3}.
  11231. @item qp
  11232. Force a constant quantization parameter. If not set, the filter will use the QP
  11233. from the video stream (if available).
  11234. @end table
  11235. @section vaguedenoiser
  11236. Apply a wavelet based denoiser.
  11237. It transforms each frame from the video input into the wavelet domain,
  11238. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11239. the obtained coefficients. It does an inverse wavelet transform after.
  11240. Due to wavelet properties, it should give a nice smoothed result, and
  11241. reduced noise, without blurring picture features.
  11242. This filter accepts the following options:
  11243. @table @option
  11244. @item threshold
  11245. The filtering strength. The higher, the more filtered the video will be.
  11246. Hard thresholding can use a higher threshold than soft thresholding
  11247. before the video looks overfiltered.
  11248. @item method
  11249. The filtering method the filter will use.
  11250. It accepts the following values:
  11251. @table @samp
  11252. @item hard
  11253. All values under the threshold will be zeroed.
  11254. @item soft
  11255. All values under the threshold will be zeroed. All values above will be
  11256. reduced by the threshold.
  11257. @item garrote
  11258. Scales or nullifies coefficients - intermediary between (more) soft and
  11259. (less) hard thresholding.
  11260. @end table
  11261. @item nsteps
  11262. Number of times, the wavelet will decompose the picture. Picture can't
  11263. be decomposed beyond a particular point (typically, 8 for a 640x480
  11264. frame - as 2^9 = 512 > 480)
  11265. @item percent
  11266. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11267. @item planes
  11268. A list of the planes to process. By default all planes are processed.
  11269. @end table
  11270. @section vectorscope
  11271. Display 2 color component values in the two dimensional graph (which is called
  11272. a vectorscope).
  11273. This filter accepts the following options:
  11274. @table @option
  11275. @item mode, m
  11276. Set vectorscope mode.
  11277. It accepts the following values:
  11278. @table @samp
  11279. @item gray
  11280. Gray values are displayed on graph, higher brightness means more pixels have
  11281. same component color value on location in graph. This is the default mode.
  11282. @item color
  11283. Gray values are displayed on graph. Surrounding pixels values which are not
  11284. present in video frame are drawn in gradient of 2 color components which are
  11285. set by option @code{x} and @code{y}. The 3rd color component is static.
  11286. @item color2
  11287. Actual color components values present in video frame are displayed on graph.
  11288. @item color3
  11289. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11290. on graph increases value of another color component, which is luminance by
  11291. default values of @code{x} and @code{y}.
  11292. @item color4
  11293. Actual colors present in video frame are displayed on graph. If two different
  11294. colors map to same position on graph then color with higher value of component
  11295. not present in graph is picked.
  11296. @item color5
  11297. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11298. component picked from radial gradient.
  11299. @end table
  11300. @item x
  11301. Set which color component will be represented on X-axis. Default is @code{1}.
  11302. @item y
  11303. Set which color component will be represented on Y-axis. Default is @code{2}.
  11304. @item intensity, i
  11305. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11306. of color component which represents frequency of (X, Y) location in graph.
  11307. @item envelope, e
  11308. @table @samp
  11309. @item none
  11310. No envelope, this is default.
  11311. @item instant
  11312. Instant envelope, even darkest single pixel will be clearly highlighted.
  11313. @item peak
  11314. Hold maximum and minimum values presented in graph over time. This way you
  11315. can still spot out of range values without constantly looking at vectorscope.
  11316. @item peak+instant
  11317. Peak and instant envelope combined together.
  11318. @end table
  11319. @item graticule, g
  11320. Set what kind of graticule to draw.
  11321. @table @samp
  11322. @item none
  11323. @item green
  11324. @item color
  11325. @end table
  11326. @item opacity, o
  11327. Set graticule opacity.
  11328. @item flags, f
  11329. Set graticule flags.
  11330. @table @samp
  11331. @item white
  11332. Draw graticule for white point.
  11333. @item black
  11334. Draw graticule for black point.
  11335. @item name
  11336. Draw color points short names.
  11337. @end table
  11338. @item bgopacity, b
  11339. Set background opacity.
  11340. @item lthreshold, l
  11341. Set low threshold for color component not represented on X or Y axis.
  11342. Values lower than this value will be ignored. Default is 0.
  11343. Note this value is multiplied with actual max possible value one pixel component
  11344. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11345. is 0.1 * 255 = 25.
  11346. @item hthreshold, h
  11347. Set high threshold for color component not represented on X or Y axis.
  11348. Values higher than this value will be ignored. Default is 1.
  11349. Note this value is multiplied with actual max possible value one pixel component
  11350. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11351. is 0.9 * 255 = 230.
  11352. @item colorspace, c
  11353. Set what kind of colorspace to use when drawing graticule.
  11354. @table @samp
  11355. @item auto
  11356. @item 601
  11357. @item 709
  11358. @end table
  11359. Default is auto.
  11360. @end table
  11361. @anchor{vidstabdetect}
  11362. @section vidstabdetect
  11363. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11364. @ref{vidstabtransform} for pass 2.
  11365. This filter generates a file with relative translation and rotation
  11366. transform information about subsequent frames, which is then used by
  11367. the @ref{vidstabtransform} filter.
  11368. To enable compilation of this filter you need to configure FFmpeg with
  11369. @code{--enable-libvidstab}.
  11370. This filter accepts the following options:
  11371. @table @option
  11372. @item result
  11373. Set the path to the file used to write the transforms information.
  11374. Default value is @file{transforms.trf}.
  11375. @item shakiness
  11376. Set how shaky the video is and how quick the camera is. It accepts an
  11377. integer in the range 1-10, a value of 1 means little shakiness, a
  11378. value of 10 means strong shakiness. Default value is 5.
  11379. @item accuracy
  11380. Set the accuracy of the detection process. It must be a value in the
  11381. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11382. accuracy. Default value is 15.
  11383. @item stepsize
  11384. Set stepsize of the search process. The region around minimum is
  11385. scanned with 1 pixel resolution. Default value is 6.
  11386. @item mincontrast
  11387. Set minimum contrast. Below this value a local measurement field is
  11388. discarded. Must be a floating point value in the range 0-1. Default
  11389. value is 0.3.
  11390. @item tripod
  11391. Set reference frame number for tripod mode.
  11392. If enabled, the motion of the frames is compared to a reference frame
  11393. in the filtered stream, identified by the specified number. The idea
  11394. is to compensate all movements in a more-or-less static scene and keep
  11395. the camera view absolutely still.
  11396. If set to 0, it is disabled. The frames are counted starting from 1.
  11397. @item show
  11398. Show fields and transforms in the resulting frames. It accepts an
  11399. integer in the range 0-2. Default value is 0, which disables any
  11400. visualization.
  11401. @end table
  11402. @subsection Examples
  11403. @itemize
  11404. @item
  11405. Use default values:
  11406. @example
  11407. vidstabdetect
  11408. @end example
  11409. @item
  11410. Analyze strongly shaky movie and put the results in file
  11411. @file{mytransforms.trf}:
  11412. @example
  11413. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11414. @end example
  11415. @item
  11416. Visualize the result of internal transformations in the resulting
  11417. video:
  11418. @example
  11419. vidstabdetect=show=1
  11420. @end example
  11421. @item
  11422. Analyze a video with medium shakiness using @command{ffmpeg}:
  11423. @example
  11424. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11425. @end example
  11426. @end itemize
  11427. @anchor{vidstabtransform}
  11428. @section vidstabtransform
  11429. Video stabilization/deshaking: pass 2 of 2,
  11430. see @ref{vidstabdetect} for pass 1.
  11431. Read a file with transform information for each frame and
  11432. apply/compensate them. Together with the @ref{vidstabdetect}
  11433. filter this can be used to deshake videos. See also
  11434. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11435. the @ref{unsharp} filter, see below.
  11436. To enable compilation of this filter you need to configure FFmpeg with
  11437. @code{--enable-libvidstab}.
  11438. @subsection Options
  11439. @table @option
  11440. @item input
  11441. Set path to the file used to read the transforms. Default value is
  11442. @file{transforms.trf}.
  11443. @item smoothing
  11444. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11445. camera movements. Default value is 10.
  11446. For example a number of 10 means that 21 frames are used (10 in the
  11447. past and 10 in the future) to smoothen the motion in the video. A
  11448. larger value leads to a smoother video, but limits the acceleration of
  11449. the camera (pan/tilt movements). 0 is a special case where a static
  11450. camera is simulated.
  11451. @item optalgo
  11452. Set the camera path optimization algorithm.
  11453. Accepted values are:
  11454. @table @samp
  11455. @item gauss
  11456. gaussian kernel low-pass filter on camera motion (default)
  11457. @item avg
  11458. averaging on transformations
  11459. @end table
  11460. @item maxshift
  11461. Set maximal number of pixels to translate frames. Default value is -1,
  11462. meaning no limit.
  11463. @item maxangle
  11464. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11465. value is -1, meaning no limit.
  11466. @item crop
  11467. Specify how to deal with borders that may be visible due to movement
  11468. compensation.
  11469. Available values are:
  11470. @table @samp
  11471. @item keep
  11472. keep image information from previous frame (default)
  11473. @item black
  11474. fill the border black
  11475. @end table
  11476. @item invert
  11477. Invert transforms if set to 1. Default value is 0.
  11478. @item relative
  11479. Consider transforms as relative to previous frame if set to 1,
  11480. absolute if set to 0. Default value is 0.
  11481. @item zoom
  11482. Set percentage to zoom. A positive value will result in a zoom-in
  11483. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11484. zoom).
  11485. @item optzoom
  11486. Set optimal zooming to avoid borders.
  11487. Accepted values are:
  11488. @table @samp
  11489. @item 0
  11490. disabled
  11491. @item 1
  11492. optimal static zoom value is determined (only very strong movements
  11493. will lead to visible borders) (default)
  11494. @item 2
  11495. optimal adaptive zoom value is determined (no borders will be
  11496. visible), see @option{zoomspeed}
  11497. @end table
  11498. Note that the value given at zoom is added to the one calculated here.
  11499. @item zoomspeed
  11500. Set percent to zoom maximally each frame (enabled when
  11501. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11502. 0.25.
  11503. @item interpol
  11504. Specify type of interpolation.
  11505. Available values are:
  11506. @table @samp
  11507. @item no
  11508. no interpolation
  11509. @item linear
  11510. linear only horizontal
  11511. @item bilinear
  11512. linear in both directions (default)
  11513. @item bicubic
  11514. cubic in both directions (slow)
  11515. @end table
  11516. @item tripod
  11517. Enable virtual tripod mode if set to 1, which is equivalent to
  11518. @code{relative=0:smoothing=0}. Default value is 0.
  11519. Use also @code{tripod} option of @ref{vidstabdetect}.
  11520. @item debug
  11521. Increase log verbosity if set to 1. Also the detected global motions
  11522. are written to the temporary file @file{global_motions.trf}. Default
  11523. value is 0.
  11524. @end table
  11525. @subsection Examples
  11526. @itemize
  11527. @item
  11528. Use @command{ffmpeg} for a typical stabilization with default values:
  11529. @example
  11530. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11531. @end example
  11532. Note the use of the @ref{unsharp} filter which is always recommended.
  11533. @item
  11534. Zoom in a bit more and load transform data from a given file:
  11535. @example
  11536. vidstabtransform=zoom=5:input="mytransforms.trf"
  11537. @end example
  11538. @item
  11539. Smoothen the video even more:
  11540. @example
  11541. vidstabtransform=smoothing=30
  11542. @end example
  11543. @end itemize
  11544. @section vflip
  11545. Flip the input video vertically.
  11546. For example, to vertically flip a video with @command{ffmpeg}:
  11547. @example
  11548. ffmpeg -i in.avi -vf "vflip" out.avi
  11549. @end example
  11550. @anchor{vignette}
  11551. @section vignette
  11552. Make or reverse a natural vignetting effect.
  11553. The filter accepts the following options:
  11554. @table @option
  11555. @item angle, a
  11556. Set lens angle expression as a number of radians.
  11557. The value is clipped in the @code{[0,PI/2]} range.
  11558. Default value: @code{"PI/5"}
  11559. @item x0
  11560. @item y0
  11561. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11562. by default.
  11563. @item mode
  11564. Set forward/backward mode.
  11565. Available modes are:
  11566. @table @samp
  11567. @item forward
  11568. The larger the distance from the central point, the darker the image becomes.
  11569. @item backward
  11570. The larger the distance from the central point, the brighter the image becomes.
  11571. This can be used to reverse a vignette effect, though there is no automatic
  11572. detection to extract the lens @option{angle} and other settings (yet). It can
  11573. also be used to create a burning effect.
  11574. @end table
  11575. Default value is @samp{forward}.
  11576. @item eval
  11577. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11578. It accepts the following values:
  11579. @table @samp
  11580. @item init
  11581. Evaluate expressions only once during the filter initialization.
  11582. @item frame
  11583. Evaluate expressions for each incoming frame. This is way slower than the
  11584. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11585. allows advanced dynamic expressions.
  11586. @end table
  11587. Default value is @samp{init}.
  11588. @item dither
  11589. Set dithering to reduce the circular banding effects. Default is @code{1}
  11590. (enabled).
  11591. @item aspect
  11592. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11593. Setting this value to the SAR of the input will make a rectangular vignetting
  11594. following the dimensions of the video.
  11595. Default is @code{1/1}.
  11596. @end table
  11597. @subsection Expressions
  11598. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11599. following parameters.
  11600. @table @option
  11601. @item w
  11602. @item h
  11603. input width and height
  11604. @item n
  11605. the number of input frame, starting from 0
  11606. @item pts
  11607. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11608. @var{TB} units, NAN if undefined
  11609. @item r
  11610. frame rate of the input video, NAN if the input frame rate is unknown
  11611. @item t
  11612. the PTS (Presentation TimeStamp) of the filtered video frame,
  11613. expressed in seconds, NAN if undefined
  11614. @item tb
  11615. time base of the input video
  11616. @end table
  11617. @subsection Examples
  11618. @itemize
  11619. @item
  11620. Apply simple strong vignetting effect:
  11621. @example
  11622. vignette=PI/4
  11623. @end example
  11624. @item
  11625. Make a flickering vignetting:
  11626. @example
  11627. vignette='PI/4+random(1)*PI/50':eval=frame
  11628. @end example
  11629. @end itemize
  11630. @section vstack
  11631. Stack input videos vertically.
  11632. All streams must be of same pixel format and of same width.
  11633. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11634. to create same output.
  11635. The filter accept the following option:
  11636. @table @option
  11637. @item inputs
  11638. Set number of input streams. Default is 2.
  11639. @item shortest
  11640. If set to 1, force the output to terminate when the shortest input
  11641. terminates. Default value is 0.
  11642. @end table
  11643. @section w3fdif
  11644. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11645. Deinterlacing Filter").
  11646. Based on the process described by Martin Weston for BBC R&D, and
  11647. implemented based on the de-interlace algorithm written by Jim
  11648. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11649. uses filter coefficients calculated by BBC R&D.
  11650. There are two sets of filter coefficients, so called "simple":
  11651. and "complex". Which set of filter coefficients is used can
  11652. be set by passing an optional parameter:
  11653. @table @option
  11654. @item filter
  11655. Set the interlacing filter coefficients. Accepts one of the following values:
  11656. @table @samp
  11657. @item simple
  11658. Simple filter coefficient set.
  11659. @item complex
  11660. More-complex filter coefficient set.
  11661. @end table
  11662. Default value is @samp{complex}.
  11663. @item deint
  11664. Specify which frames to deinterlace. Accept one of the following values:
  11665. @table @samp
  11666. @item all
  11667. Deinterlace all frames,
  11668. @item interlaced
  11669. Only deinterlace frames marked as interlaced.
  11670. @end table
  11671. Default value is @samp{all}.
  11672. @end table
  11673. @section waveform
  11674. Video waveform monitor.
  11675. The waveform monitor plots color component intensity. By default luminance
  11676. only. Each column of the waveform corresponds to a column of pixels in the
  11677. source video.
  11678. It accepts the following options:
  11679. @table @option
  11680. @item mode, m
  11681. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11682. In row mode, the graph on the left side represents color component value 0 and
  11683. the right side represents value = 255. In column mode, the top side represents
  11684. color component value = 0 and bottom side represents value = 255.
  11685. @item intensity, i
  11686. Set intensity. Smaller values are useful to find out how many values of the same
  11687. luminance are distributed across input rows/columns.
  11688. Default value is @code{0.04}. Allowed range is [0, 1].
  11689. @item mirror, r
  11690. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11691. In mirrored mode, higher values will be represented on the left
  11692. side for @code{row} mode and at the top for @code{column} mode. Default is
  11693. @code{1} (mirrored).
  11694. @item display, d
  11695. Set display mode.
  11696. It accepts the following values:
  11697. @table @samp
  11698. @item overlay
  11699. Presents information identical to that in the @code{parade}, except
  11700. that the graphs representing color components are superimposed directly
  11701. over one another.
  11702. This display mode makes it easier to spot relative differences or similarities
  11703. in overlapping areas of the color components that are supposed to be identical,
  11704. such as neutral whites, grays, or blacks.
  11705. @item stack
  11706. Display separate graph for the color components side by side in
  11707. @code{row} mode or one below the other in @code{column} mode.
  11708. @item parade
  11709. Display separate graph for the color components side by side in
  11710. @code{column} mode or one below the other in @code{row} mode.
  11711. Using this display mode makes it easy to spot color casts in the highlights
  11712. and shadows of an image, by comparing the contours of the top and the bottom
  11713. graphs of each waveform. Since whites, grays, and blacks are characterized
  11714. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11715. should display three waveforms of roughly equal width/height. If not, the
  11716. correction is easy to perform by making level adjustments the three waveforms.
  11717. @end table
  11718. Default is @code{stack}.
  11719. @item components, c
  11720. Set which color components to display. Default is 1, which means only luminance
  11721. or red color component if input is in RGB colorspace. If is set for example to
  11722. 7 it will display all 3 (if) available color components.
  11723. @item envelope, e
  11724. @table @samp
  11725. @item none
  11726. No envelope, this is default.
  11727. @item instant
  11728. Instant envelope, minimum and maximum values presented in graph will be easily
  11729. visible even with small @code{step} value.
  11730. @item peak
  11731. Hold minimum and maximum values presented in graph across time. This way you
  11732. can still spot out of range values without constantly looking at waveforms.
  11733. @item peak+instant
  11734. Peak and instant envelope combined together.
  11735. @end table
  11736. @item filter, f
  11737. @table @samp
  11738. @item lowpass
  11739. No filtering, this is default.
  11740. @item flat
  11741. Luma and chroma combined together.
  11742. @item aflat
  11743. Similar as above, but shows difference between blue and red chroma.
  11744. @item chroma
  11745. Displays only chroma.
  11746. @item color
  11747. Displays actual color value on waveform.
  11748. @item acolor
  11749. Similar as above, but with luma showing frequency of chroma values.
  11750. @end table
  11751. @item graticule, g
  11752. Set which graticule to display.
  11753. @table @samp
  11754. @item none
  11755. Do not display graticule.
  11756. @item green
  11757. Display green graticule showing legal broadcast ranges.
  11758. @end table
  11759. @item opacity, o
  11760. Set graticule opacity.
  11761. @item flags, fl
  11762. Set graticule flags.
  11763. @table @samp
  11764. @item numbers
  11765. Draw numbers above lines. By default enabled.
  11766. @item dots
  11767. Draw dots instead of lines.
  11768. @end table
  11769. @item scale, s
  11770. Set scale used for displaying graticule.
  11771. @table @samp
  11772. @item digital
  11773. @item millivolts
  11774. @item ire
  11775. @end table
  11776. Default is digital.
  11777. @item bgopacity, b
  11778. Set background opacity.
  11779. @end table
  11780. @section weave, doubleweave
  11781. The @code{weave} takes a field-based video input and join
  11782. each two sequential fields into single frame, producing a new double
  11783. height clip with half the frame rate and half the frame count.
  11784. The @code{doubleweave} works same as @code{weave} but without
  11785. halving frame rate and frame count.
  11786. It accepts the following option:
  11787. @table @option
  11788. @item first_field
  11789. Set first field. Available values are:
  11790. @table @samp
  11791. @item top, t
  11792. Set the frame as top-field-first.
  11793. @item bottom, b
  11794. Set the frame as bottom-field-first.
  11795. @end table
  11796. @end table
  11797. @subsection Examples
  11798. @itemize
  11799. @item
  11800. Interlace video using @ref{select} and @ref{separatefields} filter:
  11801. @example
  11802. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11803. @end example
  11804. @end itemize
  11805. @section xbr
  11806. Apply the xBR high-quality magnification filter which is designed for pixel
  11807. art. It follows a set of edge-detection rules, see
  11808. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11809. It accepts the following option:
  11810. @table @option
  11811. @item n
  11812. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11813. @code{3xBR} and @code{4} for @code{4xBR}.
  11814. Default is @code{3}.
  11815. @end table
  11816. @anchor{yadif}
  11817. @section yadif
  11818. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11819. filter").
  11820. It accepts the following parameters:
  11821. @table @option
  11822. @item mode
  11823. The interlacing mode to adopt. It accepts one of the following values:
  11824. @table @option
  11825. @item 0, send_frame
  11826. Output one frame for each frame.
  11827. @item 1, send_field
  11828. Output one frame for each field.
  11829. @item 2, send_frame_nospatial
  11830. Like @code{send_frame}, but it skips the spatial interlacing check.
  11831. @item 3, send_field_nospatial
  11832. Like @code{send_field}, but it skips the spatial interlacing check.
  11833. @end table
  11834. The default value is @code{send_frame}.
  11835. @item parity
  11836. The picture field parity assumed for the input interlaced video. It accepts one
  11837. of the following values:
  11838. @table @option
  11839. @item 0, tff
  11840. Assume the top field is first.
  11841. @item 1, bff
  11842. Assume the bottom field is first.
  11843. @item -1, auto
  11844. Enable automatic detection of field parity.
  11845. @end table
  11846. The default value is @code{auto}.
  11847. If the interlacing is unknown or the decoder does not export this information,
  11848. top field first will be assumed.
  11849. @item deint
  11850. Specify which frames to deinterlace. Accept one of the following
  11851. values:
  11852. @table @option
  11853. @item 0, all
  11854. Deinterlace all frames.
  11855. @item 1, interlaced
  11856. Only deinterlace frames marked as interlaced.
  11857. @end table
  11858. The default value is @code{all}.
  11859. @end table
  11860. @section zoompan
  11861. Apply Zoom & Pan effect.
  11862. This filter accepts the following options:
  11863. @table @option
  11864. @item zoom, z
  11865. Set the zoom expression. Default is 1.
  11866. @item x
  11867. @item y
  11868. Set the x and y expression. Default is 0.
  11869. @item d
  11870. Set the duration expression in number of frames.
  11871. This sets for how many number of frames effect will last for
  11872. single input image.
  11873. @item s
  11874. Set the output image size, default is 'hd720'.
  11875. @item fps
  11876. Set the output frame rate, default is '25'.
  11877. @end table
  11878. Each expression can contain the following constants:
  11879. @table @option
  11880. @item in_w, iw
  11881. Input width.
  11882. @item in_h, ih
  11883. Input height.
  11884. @item out_w, ow
  11885. Output width.
  11886. @item out_h, oh
  11887. Output height.
  11888. @item in
  11889. Input frame count.
  11890. @item on
  11891. Output frame count.
  11892. @item x
  11893. @item y
  11894. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11895. for current input frame.
  11896. @item px
  11897. @item py
  11898. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11899. not yet such frame (first input frame).
  11900. @item zoom
  11901. Last calculated zoom from 'z' expression for current input frame.
  11902. @item pzoom
  11903. Last calculated zoom of last output frame of previous input frame.
  11904. @item duration
  11905. Number of output frames for current input frame. Calculated from 'd' expression
  11906. for each input frame.
  11907. @item pduration
  11908. number of output frames created for previous input frame
  11909. @item a
  11910. Rational number: input width / input height
  11911. @item sar
  11912. sample aspect ratio
  11913. @item dar
  11914. display aspect ratio
  11915. @end table
  11916. @subsection Examples
  11917. @itemize
  11918. @item
  11919. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11920. @example
  11921. 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
  11922. @end example
  11923. @item
  11924. Zoom-in up to 1.5 and pan always at center of picture:
  11925. @example
  11926. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11927. @end example
  11928. @item
  11929. Same as above but without pausing:
  11930. @example
  11931. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11932. @end example
  11933. @end itemize
  11934. @section zscale
  11935. Scale (resize) the input video, using the z.lib library:
  11936. https://github.com/sekrit-twc/zimg.
  11937. The zscale filter forces the output display aspect ratio to be the same
  11938. as the input, by changing the output sample aspect ratio.
  11939. If the input image format is different from the format requested by
  11940. the next filter, the zscale filter will convert the input to the
  11941. requested format.
  11942. @subsection Options
  11943. The filter accepts the following options.
  11944. @table @option
  11945. @item width, w
  11946. @item height, h
  11947. Set the output video dimension expression. Default value is the input
  11948. dimension.
  11949. If the @var{width} or @var{w} value is 0, the input width is used for
  11950. the output. If the @var{height} or @var{h} value is 0, the input height
  11951. is used for the output.
  11952. If one and only one of the values is -n with n >= 1, the zscale filter
  11953. will use a value that maintains the aspect ratio of the input image,
  11954. calculated from the other specified dimension. After that it will,
  11955. however, make sure that the calculated dimension is divisible by n and
  11956. adjust the value if necessary.
  11957. If both values are -n with n >= 1, the behavior will be identical to
  11958. both values being set to 0 as previously detailed.
  11959. See below for the list of accepted constants for use in the dimension
  11960. expression.
  11961. @item size, s
  11962. Set the video size. For the syntax of this option, check the
  11963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11964. @item dither, d
  11965. Set the dither type.
  11966. Possible values are:
  11967. @table @var
  11968. @item none
  11969. @item ordered
  11970. @item random
  11971. @item error_diffusion
  11972. @end table
  11973. Default is none.
  11974. @item filter, f
  11975. Set the resize filter type.
  11976. Possible values are:
  11977. @table @var
  11978. @item point
  11979. @item bilinear
  11980. @item bicubic
  11981. @item spline16
  11982. @item spline36
  11983. @item lanczos
  11984. @end table
  11985. Default is bilinear.
  11986. @item range, r
  11987. Set the color range.
  11988. Possible values are:
  11989. @table @var
  11990. @item input
  11991. @item limited
  11992. @item full
  11993. @end table
  11994. Default is same as input.
  11995. @item primaries, p
  11996. Set the color primaries.
  11997. Possible values are:
  11998. @table @var
  11999. @item input
  12000. @item 709
  12001. @item unspecified
  12002. @item 170m
  12003. @item 240m
  12004. @item 2020
  12005. @end table
  12006. Default is same as input.
  12007. @item transfer, t
  12008. Set the transfer characteristics.
  12009. Possible values are:
  12010. @table @var
  12011. @item input
  12012. @item 709
  12013. @item unspecified
  12014. @item 601
  12015. @item linear
  12016. @item 2020_10
  12017. @item 2020_12
  12018. @item smpte2084
  12019. @item iec61966-2-1
  12020. @item arib-std-b67
  12021. @end table
  12022. Default is same as input.
  12023. @item matrix, m
  12024. Set the colorspace matrix.
  12025. Possible value are:
  12026. @table @var
  12027. @item input
  12028. @item 709
  12029. @item unspecified
  12030. @item 470bg
  12031. @item 170m
  12032. @item 2020_ncl
  12033. @item 2020_cl
  12034. @end table
  12035. Default is same as input.
  12036. @item rangein, rin
  12037. Set the input color range.
  12038. Possible values are:
  12039. @table @var
  12040. @item input
  12041. @item limited
  12042. @item full
  12043. @end table
  12044. Default is same as input.
  12045. @item primariesin, pin
  12046. Set the input color primaries.
  12047. Possible values are:
  12048. @table @var
  12049. @item input
  12050. @item 709
  12051. @item unspecified
  12052. @item 170m
  12053. @item 240m
  12054. @item 2020
  12055. @end table
  12056. Default is same as input.
  12057. @item transferin, tin
  12058. Set the input transfer characteristics.
  12059. Possible values are:
  12060. @table @var
  12061. @item input
  12062. @item 709
  12063. @item unspecified
  12064. @item 601
  12065. @item linear
  12066. @item 2020_10
  12067. @item 2020_12
  12068. @end table
  12069. Default is same as input.
  12070. @item matrixin, min
  12071. Set the input colorspace matrix.
  12072. Possible value are:
  12073. @table @var
  12074. @item input
  12075. @item 709
  12076. @item unspecified
  12077. @item 470bg
  12078. @item 170m
  12079. @item 2020_ncl
  12080. @item 2020_cl
  12081. @end table
  12082. @item chromal, c
  12083. Set the output chroma location.
  12084. Possible values are:
  12085. @table @var
  12086. @item input
  12087. @item left
  12088. @item center
  12089. @item topleft
  12090. @item top
  12091. @item bottomleft
  12092. @item bottom
  12093. @end table
  12094. @item chromalin, cin
  12095. Set the input chroma location.
  12096. Possible values are:
  12097. @table @var
  12098. @item input
  12099. @item left
  12100. @item center
  12101. @item topleft
  12102. @item top
  12103. @item bottomleft
  12104. @item bottom
  12105. @end table
  12106. @item npl
  12107. Set the nominal peak luminance.
  12108. @end table
  12109. The values of the @option{w} and @option{h} options are expressions
  12110. containing the following constants:
  12111. @table @var
  12112. @item in_w
  12113. @item in_h
  12114. The input width and height
  12115. @item iw
  12116. @item ih
  12117. These are the same as @var{in_w} and @var{in_h}.
  12118. @item out_w
  12119. @item out_h
  12120. The output (scaled) width and height
  12121. @item ow
  12122. @item oh
  12123. These are the same as @var{out_w} and @var{out_h}
  12124. @item a
  12125. The same as @var{iw} / @var{ih}
  12126. @item sar
  12127. input sample aspect ratio
  12128. @item dar
  12129. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12130. @item hsub
  12131. @item vsub
  12132. horizontal and vertical input chroma subsample values. For example for the
  12133. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12134. @item ohsub
  12135. @item ovsub
  12136. horizontal and vertical output chroma subsample values. For example for the
  12137. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12138. @end table
  12139. @table @option
  12140. @end table
  12141. @c man end VIDEO FILTERS
  12142. @chapter Video Sources
  12143. @c man begin VIDEO SOURCES
  12144. Below is a description of the currently available video sources.
  12145. @section buffer
  12146. Buffer video frames, and make them available to the filter chain.
  12147. This source is mainly intended for a programmatic use, in particular
  12148. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12149. It accepts the following parameters:
  12150. @table @option
  12151. @item video_size
  12152. Specify the size (width and height) of the buffered video frames. For the
  12153. syntax of this option, check the
  12154. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12155. @item width
  12156. The input video width.
  12157. @item height
  12158. The input video height.
  12159. @item pix_fmt
  12160. A string representing the pixel format of the buffered video frames.
  12161. It may be a number corresponding to a pixel format, or a pixel format
  12162. name.
  12163. @item time_base
  12164. Specify the timebase assumed by the timestamps of the buffered frames.
  12165. @item frame_rate
  12166. Specify the frame rate expected for the video stream.
  12167. @item pixel_aspect, sar
  12168. The sample (pixel) aspect ratio of the input video.
  12169. @item sws_param
  12170. Specify the optional parameters to be used for the scale filter which
  12171. is automatically inserted when an input change is detected in the
  12172. input size or format.
  12173. @item hw_frames_ctx
  12174. When using a hardware pixel format, this should be a reference to an
  12175. AVHWFramesContext describing input frames.
  12176. @end table
  12177. For example:
  12178. @example
  12179. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12180. @end example
  12181. will instruct the source to accept video frames with size 320x240 and
  12182. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12183. square pixels (1:1 sample aspect ratio).
  12184. Since the pixel format with name "yuv410p" corresponds to the number 6
  12185. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12186. this example corresponds to:
  12187. @example
  12188. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12189. @end example
  12190. Alternatively, the options can be specified as a flat string, but this
  12191. syntax is deprecated:
  12192. @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}]
  12193. @section cellauto
  12194. Create a pattern generated by an elementary cellular automaton.
  12195. The initial state of the cellular automaton can be defined through the
  12196. @option{filename} and @option{pattern} options. If such options are
  12197. not specified an initial state is created randomly.
  12198. At each new frame a new row in the video is filled with the result of
  12199. the cellular automaton next generation. The behavior when the whole
  12200. frame is filled is defined by the @option{scroll} option.
  12201. This source accepts the following options:
  12202. @table @option
  12203. @item filename, f
  12204. Read the initial cellular automaton state, i.e. the starting row, from
  12205. the specified file.
  12206. In the file, each non-whitespace character is considered an alive
  12207. cell, a newline will terminate the row, and further characters in the
  12208. file will be ignored.
  12209. @item pattern, p
  12210. Read the initial cellular automaton state, i.e. the starting row, from
  12211. the specified string.
  12212. Each non-whitespace character in the string is considered an alive
  12213. cell, a newline will terminate the row, and further characters in the
  12214. string will be ignored.
  12215. @item rate, r
  12216. Set the video rate, that is the number of frames generated per second.
  12217. Default is 25.
  12218. @item random_fill_ratio, ratio
  12219. Set the random fill ratio for the initial cellular automaton row. It
  12220. is a floating point number value ranging from 0 to 1, defaults to
  12221. 1/PHI.
  12222. This option is ignored when a file or a pattern is specified.
  12223. @item random_seed, seed
  12224. Set the seed for filling randomly the initial row, must be an integer
  12225. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12226. set to -1, the filter will try to use a good random seed on a best
  12227. effort basis.
  12228. @item rule
  12229. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12230. Default value is 110.
  12231. @item size, s
  12232. Set the size of the output video. For the syntax of this option, check the
  12233. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12234. If @option{filename} or @option{pattern} is specified, the size is set
  12235. by default to the width of the specified initial state row, and the
  12236. height is set to @var{width} * PHI.
  12237. If @option{size} is set, it must contain the width of the specified
  12238. pattern string, and the specified pattern will be centered in the
  12239. larger row.
  12240. If a filename or a pattern string is not specified, the size value
  12241. defaults to "320x518" (used for a randomly generated initial state).
  12242. @item scroll
  12243. If set to 1, scroll the output upward when all the rows in the output
  12244. have been already filled. If set to 0, the new generated row will be
  12245. written over the top row just after the bottom row is filled.
  12246. Defaults to 1.
  12247. @item start_full, full
  12248. If set to 1, completely fill the output with generated rows before
  12249. outputting the first frame.
  12250. This is the default behavior, for disabling set the value to 0.
  12251. @item stitch
  12252. If set to 1, stitch the left and right row edges together.
  12253. This is the default behavior, for disabling set the value to 0.
  12254. @end table
  12255. @subsection Examples
  12256. @itemize
  12257. @item
  12258. Read the initial state from @file{pattern}, and specify an output of
  12259. size 200x400.
  12260. @example
  12261. cellauto=f=pattern:s=200x400
  12262. @end example
  12263. @item
  12264. Generate a random initial row with a width of 200 cells, with a fill
  12265. ratio of 2/3:
  12266. @example
  12267. cellauto=ratio=2/3:s=200x200
  12268. @end example
  12269. @item
  12270. Create a pattern generated by rule 18 starting by a single alive cell
  12271. centered on an initial row with width 100:
  12272. @example
  12273. cellauto=p=@@:s=100x400:full=0:rule=18
  12274. @end example
  12275. @item
  12276. Specify a more elaborated initial pattern:
  12277. @example
  12278. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12279. @end example
  12280. @end itemize
  12281. @anchor{coreimagesrc}
  12282. @section coreimagesrc
  12283. Video source generated on GPU using Apple's CoreImage API on OSX.
  12284. This video source is a specialized version of the @ref{coreimage} video filter.
  12285. Use a core image generator at the beginning of the applied filterchain to
  12286. generate the content.
  12287. The coreimagesrc video source accepts the following options:
  12288. @table @option
  12289. @item list_generators
  12290. List all available generators along with all their respective options as well as
  12291. possible minimum and maximum values along with the default values.
  12292. @example
  12293. list_generators=true
  12294. @end example
  12295. @item size, s
  12296. Specify the size of the sourced video. For the syntax of this option, check the
  12297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12298. The default value is @code{320x240}.
  12299. @item rate, r
  12300. Specify the frame rate of the sourced video, as the number of frames
  12301. generated per second. It has to be a string in the format
  12302. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12303. number or a valid video frame rate abbreviation. The default value is
  12304. "25".
  12305. @item sar
  12306. Set the sample aspect ratio of the sourced video.
  12307. @item duration, d
  12308. Set the duration of the sourced video. See
  12309. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12310. for the accepted syntax.
  12311. If not specified, or the expressed duration is negative, the video is
  12312. supposed to be generated forever.
  12313. @end table
  12314. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12315. A complete filterchain can be used for further processing of the
  12316. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12317. and examples for details.
  12318. @subsection Examples
  12319. @itemize
  12320. @item
  12321. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12322. given as complete and escaped command-line for Apple's standard bash shell:
  12323. @example
  12324. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12325. @end example
  12326. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12327. need for a nullsrc video source.
  12328. @end itemize
  12329. @section mandelbrot
  12330. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12331. point specified with @var{start_x} and @var{start_y}.
  12332. This source accepts the following options:
  12333. @table @option
  12334. @item end_pts
  12335. Set the terminal pts value. Default value is 400.
  12336. @item end_scale
  12337. Set the terminal scale value.
  12338. Must be a floating point value. Default value is 0.3.
  12339. @item inner
  12340. Set the inner coloring mode, that is the algorithm used to draw the
  12341. Mandelbrot fractal internal region.
  12342. It shall assume one of the following values:
  12343. @table @option
  12344. @item black
  12345. Set black mode.
  12346. @item convergence
  12347. Show time until convergence.
  12348. @item mincol
  12349. Set color based on point closest to the origin of the iterations.
  12350. @item period
  12351. Set period mode.
  12352. @end table
  12353. Default value is @var{mincol}.
  12354. @item bailout
  12355. Set the bailout value. Default value is 10.0.
  12356. @item maxiter
  12357. Set the maximum of iterations performed by the rendering
  12358. algorithm. Default value is 7189.
  12359. @item outer
  12360. Set outer coloring mode.
  12361. It shall assume one of following values:
  12362. @table @option
  12363. @item iteration_count
  12364. Set iteration cound mode.
  12365. @item normalized_iteration_count
  12366. set normalized iteration count mode.
  12367. @end table
  12368. Default value is @var{normalized_iteration_count}.
  12369. @item rate, r
  12370. Set frame rate, expressed as number of frames per second. Default
  12371. value is "25".
  12372. @item size, s
  12373. Set frame size. For the syntax of this option, check the "Video
  12374. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12375. @item start_scale
  12376. Set the initial scale value. Default value is 3.0.
  12377. @item start_x
  12378. Set the initial x position. Must be a floating point value between
  12379. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12380. @item start_y
  12381. Set the initial y position. Must be a floating point value between
  12382. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12383. @end table
  12384. @section mptestsrc
  12385. Generate various test patterns, as generated by the MPlayer test filter.
  12386. The size of the generated video is fixed, and is 256x256.
  12387. This source is useful in particular for testing encoding features.
  12388. This source accepts the following options:
  12389. @table @option
  12390. @item rate, r
  12391. Specify the frame rate of the sourced video, as the number of frames
  12392. generated per second. It has to be a string in the format
  12393. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12394. number or a valid video frame rate abbreviation. The default value is
  12395. "25".
  12396. @item duration, d
  12397. Set the duration of the sourced video. See
  12398. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12399. for the accepted syntax.
  12400. If not specified, or the expressed duration is negative, the video is
  12401. supposed to be generated forever.
  12402. @item test, t
  12403. Set the number or the name of the test to perform. Supported tests are:
  12404. @table @option
  12405. @item dc_luma
  12406. @item dc_chroma
  12407. @item freq_luma
  12408. @item freq_chroma
  12409. @item amp_luma
  12410. @item amp_chroma
  12411. @item cbp
  12412. @item mv
  12413. @item ring1
  12414. @item ring2
  12415. @item all
  12416. @end table
  12417. Default value is "all", which will cycle through the list of all tests.
  12418. @end table
  12419. Some examples:
  12420. @example
  12421. mptestsrc=t=dc_luma
  12422. @end example
  12423. will generate a "dc_luma" test pattern.
  12424. @section frei0r_src
  12425. Provide a frei0r source.
  12426. To enable compilation of this filter you need to install the frei0r
  12427. header and configure FFmpeg with @code{--enable-frei0r}.
  12428. This source accepts the following parameters:
  12429. @table @option
  12430. @item size
  12431. The size of the video to generate. For the syntax of this option, check the
  12432. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12433. @item framerate
  12434. The framerate of the generated video. It may be a string of the form
  12435. @var{num}/@var{den} or a frame rate abbreviation.
  12436. @item filter_name
  12437. The name to the frei0r source to load. For more information regarding frei0r and
  12438. how to set the parameters, read the @ref{frei0r} section in the video filters
  12439. documentation.
  12440. @item filter_params
  12441. A '|'-separated list of parameters to pass to the frei0r source.
  12442. @end table
  12443. For example, to generate a frei0r partik0l source with size 200x200
  12444. and frame rate 10 which is overlaid on the overlay filter main input:
  12445. @example
  12446. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12447. @end example
  12448. @section life
  12449. Generate a life pattern.
  12450. This source is based on a generalization of John Conway's life game.
  12451. The sourced input represents a life grid, each pixel represents a cell
  12452. which can be in one of two possible states, alive or dead. Every cell
  12453. interacts with its eight neighbours, which are the cells that are
  12454. horizontally, vertically, or diagonally adjacent.
  12455. At each interaction the grid evolves according to the adopted rule,
  12456. which specifies the number of neighbor alive cells which will make a
  12457. cell stay alive or born. The @option{rule} option allows one to specify
  12458. the rule to adopt.
  12459. This source accepts the following options:
  12460. @table @option
  12461. @item filename, f
  12462. Set the file from which to read the initial grid state. In the file,
  12463. each non-whitespace character is considered an alive cell, and newline
  12464. is used to delimit the end of each row.
  12465. If this option is not specified, the initial grid is generated
  12466. randomly.
  12467. @item rate, r
  12468. Set the video rate, that is the number of frames generated per second.
  12469. Default is 25.
  12470. @item random_fill_ratio, ratio
  12471. Set the random fill ratio for the initial random grid. It is a
  12472. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12473. It is ignored when a file is specified.
  12474. @item random_seed, seed
  12475. Set the seed for filling the initial random grid, must be an integer
  12476. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12477. set to -1, the filter will try to use a good random seed on a best
  12478. effort basis.
  12479. @item rule
  12480. Set the life rule.
  12481. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12482. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12483. @var{NS} specifies the number of alive neighbor cells which make a
  12484. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12485. which make a dead cell to become alive (i.e. to "born").
  12486. "s" and "b" can be used in place of "S" and "B", respectively.
  12487. Alternatively a rule can be specified by an 18-bits integer. The 9
  12488. high order bits are used to encode the next cell state if it is alive
  12489. for each number of neighbor alive cells, the low order bits specify
  12490. the rule for "borning" new cells. Higher order bits encode for an
  12491. higher number of neighbor cells.
  12492. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12493. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12494. Default value is "S23/B3", which is the original Conway's game of life
  12495. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12496. cells, and will born a new cell if there are three alive cells around
  12497. a dead cell.
  12498. @item size, s
  12499. Set the size of the output video. For the syntax of this option, check the
  12500. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12501. If @option{filename} is specified, the size is set by default to the
  12502. same size of the input file. If @option{size} is set, it must contain
  12503. the size specified in the input file, and the initial grid defined in
  12504. that file is centered in the larger resulting area.
  12505. If a filename is not specified, the size value defaults to "320x240"
  12506. (used for a randomly generated initial grid).
  12507. @item stitch
  12508. If set to 1, stitch the left and right grid edges together, and the
  12509. top and bottom edges also. Defaults to 1.
  12510. @item mold
  12511. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12512. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12513. value from 0 to 255.
  12514. @item life_color
  12515. Set the color of living (or new born) cells.
  12516. @item death_color
  12517. Set the color of dead cells. If @option{mold} is set, this is the first color
  12518. used to represent a dead cell.
  12519. @item mold_color
  12520. Set mold color, for definitely dead and moldy cells.
  12521. For the syntax of these 3 color options, check the "Color" section in the
  12522. ffmpeg-utils manual.
  12523. @end table
  12524. @subsection Examples
  12525. @itemize
  12526. @item
  12527. Read a grid from @file{pattern}, and center it on a grid of size
  12528. 300x300 pixels:
  12529. @example
  12530. life=f=pattern:s=300x300
  12531. @end example
  12532. @item
  12533. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12534. @example
  12535. life=ratio=2/3:s=200x200
  12536. @end example
  12537. @item
  12538. Specify a custom rule for evolving a randomly generated grid:
  12539. @example
  12540. life=rule=S14/B34
  12541. @end example
  12542. @item
  12543. Full example with slow death effect (mold) using @command{ffplay}:
  12544. @example
  12545. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12546. @end example
  12547. @end itemize
  12548. @anchor{allrgb}
  12549. @anchor{allyuv}
  12550. @anchor{color}
  12551. @anchor{haldclutsrc}
  12552. @anchor{nullsrc}
  12553. @anchor{rgbtestsrc}
  12554. @anchor{smptebars}
  12555. @anchor{smptehdbars}
  12556. @anchor{testsrc}
  12557. @anchor{testsrc2}
  12558. @anchor{yuvtestsrc}
  12559. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12560. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12561. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12562. The @code{color} source provides an uniformly colored input.
  12563. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12564. @ref{haldclut} filter.
  12565. The @code{nullsrc} source returns unprocessed video frames. It is
  12566. mainly useful to be employed in analysis / debugging tools, or as the
  12567. source for filters which ignore the input data.
  12568. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12569. detecting RGB vs BGR issues. You should see a red, green and blue
  12570. stripe from top to bottom.
  12571. The @code{smptebars} source generates a color bars pattern, based on
  12572. the SMPTE Engineering Guideline EG 1-1990.
  12573. The @code{smptehdbars} source generates a color bars pattern, based on
  12574. the SMPTE RP 219-2002.
  12575. The @code{testsrc} source generates a test video pattern, showing a
  12576. color pattern, a scrolling gradient and a timestamp. This is mainly
  12577. intended for testing purposes.
  12578. The @code{testsrc2} source is similar to testsrc, but supports more
  12579. pixel formats instead of just @code{rgb24}. This allows using it as an
  12580. input for other tests without requiring a format conversion.
  12581. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12582. see a y, cb and cr stripe from top to bottom.
  12583. The sources accept the following parameters:
  12584. @table @option
  12585. @item alpha
  12586. Specify the alpha (opacity) of the background, only available in the
  12587. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12588. 255 (fully opaque, the default).
  12589. @item color, c
  12590. Specify the color of the source, only available in the @code{color}
  12591. source. For the syntax of this option, check the "Color" section in the
  12592. ffmpeg-utils manual.
  12593. @item level
  12594. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12595. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12596. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12597. coded on a @code{1/(N*N)} scale.
  12598. @item size, s
  12599. Specify the size of the sourced video. For the syntax of this option, check the
  12600. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12601. The default value is @code{320x240}.
  12602. This option is not available with the @code{haldclutsrc} filter.
  12603. @item rate, r
  12604. Specify the frame rate of the sourced video, as the number of frames
  12605. generated per second. It has to be a string in the format
  12606. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12607. number or a valid video frame rate abbreviation. The default value is
  12608. "25".
  12609. @item sar
  12610. Set the sample aspect ratio of the sourced video.
  12611. @item duration, d
  12612. Set the duration of the sourced video. See
  12613. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12614. for the accepted syntax.
  12615. If not specified, or the expressed duration is negative, the video is
  12616. supposed to be generated forever.
  12617. @item decimals, n
  12618. Set the number of decimals to show in the timestamp, only available in the
  12619. @code{testsrc} source.
  12620. The displayed timestamp value will correspond to the original
  12621. timestamp value multiplied by the power of 10 of the specified
  12622. value. Default value is 0.
  12623. @end table
  12624. For example the following:
  12625. @example
  12626. testsrc=duration=5.3:size=qcif:rate=10
  12627. @end example
  12628. will generate a video with a duration of 5.3 seconds, with size
  12629. 176x144 and a frame rate of 10 frames per second.
  12630. The following graph description will generate a red source
  12631. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12632. frames per second.
  12633. @example
  12634. color=c=red@@0.2:s=qcif:r=10
  12635. @end example
  12636. If the input content is to be ignored, @code{nullsrc} can be used. The
  12637. following command generates noise in the luminance plane by employing
  12638. the @code{geq} filter:
  12639. @example
  12640. nullsrc=s=256x256, geq=random(1)*255:128:128
  12641. @end example
  12642. @subsection Commands
  12643. The @code{color} source supports the following commands:
  12644. @table @option
  12645. @item c, color
  12646. Set the color of the created image. Accepts the same syntax of the
  12647. corresponding @option{color} option.
  12648. @end table
  12649. @c man end VIDEO SOURCES
  12650. @chapter Video Sinks
  12651. @c man begin VIDEO SINKS
  12652. Below is a description of the currently available video sinks.
  12653. @section buffersink
  12654. Buffer video frames, and make them available to the end of the filter
  12655. graph.
  12656. This sink is mainly intended for programmatic use, in particular
  12657. through the interface defined in @file{libavfilter/buffersink.h}
  12658. or the options system.
  12659. It accepts a pointer to an AVBufferSinkContext structure, which
  12660. defines the incoming buffers' formats, to be passed as the opaque
  12661. parameter to @code{avfilter_init_filter} for initialization.
  12662. @section nullsink
  12663. Null video sink: do absolutely nothing with the input video. It is
  12664. mainly useful as a template and for use in analysis / debugging
  12665. tools.
  12666. @c man end VIDEO SINKS
  12667. @chapter Multimedia Filters
  12668. @c man begin MULTIMEDIA FILTERS
  12669. Below is a description of the currently available multimedia filters.
  12670. @section abitscope
  12671. Convert input audio to a video output, displaying the audio bit scope.
  12672. The filter accepts the following options:
  12673. @table @option
  12674. @item rate, r
  12675. Set frame rate, expressed as number of frames per second. Default
  12676. value is "25".
  12677. @item size, s
  12678. Specify the video size for the output. For the syntax of this option, check the
  12679. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12680. Default value is @code{1024x256}.
  12681. @item colors
  12682. Specify list of colors separated by space or by '|' which will be used to
  12683. draw channels. Unrecognized or missing colors will be replaced
  12684. by white color.
  12685. @end table
  12686. @section ahistogram
  12687. Convert input audio to a video output, displaying the volume histogram.
  12688. The filter accepts the following options:
  12689. @table @option
  12690. @item dmode
  12691. Specify how histogram is calculated.
  12692. It accepts the following values:
  12693. @table @samp
  12694. @item single
  12695. Use single histogram for all channels.
  12696. @item separate
  12697. Use separate histogram for each channel.
  12698. @end table
  12699. Default is @code{single}.
  12700. @item rate, r
  12701. Set frame rate, expressed as number of frames per second. Default
  12702. value is "25".
  12703. @item size, s
  12704. Specify 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{hd720}.
  12707. @item scale
  12708. Set display scale.
  12709. It accepts the following values:
  12710. @table @samp
  12711. @item log
  12712. logarithmic
  12713. @item sqrt
  12714. square root
  12715. @item cbrt
  12716. cubic root
  12717. @item lin
  12718. linear
  12719. @item rlog
  12720. reverse logarithmic
  12721. @end table
  12722. Default is @code{log}.
  12723. @item ascale
  12724. Set amplitude scale.
  12725. It accepts the following values:
  12726. @table @samp
  12727. @item log
  12728. logarithmic
  12729. @item lin
  12730. linear
  12731. @end table
  12732. Default is @code{log}.
  12733. @item acount
  12734. Set how much frames to accumulate in histogram.
  12735. Defauls is 1. Setting this to -1 accumulates all frames.
  12736. @item rheight
  12737. Set histogram ratio of window height.
  12738. @item slide
  12739. Set sonogram sliding.
  12740. It accepts the following values:
  12741. @table @samp
  12742. @item replace
  12743. replace old rows with new ones.
  12744. @item scroll
  12745. scroll from top to bottom.
  12746. @end table
  12747. Default is @code{replace}.
  12748. @end table
  12749. @section aphasemeter
  12750. Convert input audio to a video output, displaying the audio phase.
  12751. The filter accepts the following options:
  12752. @table @option
  12753. @item rate, r
  12754. Set the output frame rate. Default value is @code{25}.
  12755. @item size, s
  12756. Set the video size for the output. For the syntax of this option, check the
  12757. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12758. Default value is @code{800x400}.
  12759. @item rc
  12760. @item gc
  12761. @item bc
  12762. Specify the red, green, blue contrast. Default values are @code{2},
  12763. @code{7} and @code{1}.
  12764. Allowed range is @code{[0, 255]}.
  12765. @item mpc
  12766. Set color which will be used for drawing median phase. If color is
  12767. @code{none} which is default, no median phase value will be drawn.
  12768. @item video
  12769. Enable video output. Default is enabled.
  12770. @end table
  12771. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12772. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12773. The @code{-1} means left and right channels are completely out of phase and
  12774. @code{1} means channels are in phase.
  12775. @section avectorscope
  12776. Convert input audio to a video output, representing the audio vector
  12777. scope.
  12778. The filter is used to measure the difference between channels of stereo
  12779. audio stream. A monoaural signal, consisting of identical left and right
  12780. signal, results in straight vertical line. Any stereo separation is visible
  12781. as a deviation from this line, creating a Lissajous figure.
  12782. If the straight (or deviation from it) but horizontal line appears this
  12783. indicates that the left and right channels are out of phase.
  12784. The filter accepts the following options:
  12785. @table @option
  12786. @item mode, m
  12787. Set the vectorscope mode.
  12788. Available values are:
  12789. @table @samp
  12790. @item lissajous
  12791. Lissajous rotated by 45 degrees.
  12792. @item lissajous_xy
  12793. Same as above but not rotated.
  12794. @item polar
  12795. Shape resembling half of circle.
  12796. @end table
  12797. Default value is @samp{lissajous}.
  12798. @item size, s
  12799. Set the video size for the output. For the syntax of this option, check the
  12800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12801. Default value is @code{400x400}.
  12802. @item rate, r
  12803. Set the output frame rate. Default value is @code{25}.
  12804. @item rc
  12805. @item gc
  12806. @item bc
  12807. @item ac
  12808. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12809. @code{160}, @code{80} and @code{255}.
  12810. Allowed range is @code{[0, 255]}.
  12811. @item rf
  12812. @item gf
  12813. @item bf
  12814. @item af
  12815. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12816. @code{10}, @code{5} and @code{5}.
  12817. Allowed range is @code{[0, 255]}.
  12818. @item zoom
  12819. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12820. @item draw
  12821. Set the vectorscope drawing mode.
  12822. Available values are:
  12823. @table @samp
  12824. @item dot
  12825. Draw dot for each sample.
  12826. @item line
  12827. Draw line between previous and current sample.
  12828. @end table
  12829. Default value is @samp{dot}.
  12830. @item scale
  12831. Specify amplitude scale of audio samples.
  12832. Available values are:
  12833. @table @samp
  12834. @item lin
  12835. Linear.
  12836. @item sqrt
  12837. Square root.
  12838. @item cbrt
  12839. Cubic root.
  12840. @item log
  12841. Logarithmic.
  12842. @end table
  12843. @end table
  12844. @subsection Examples
  12845. @itemize
  12846. @item
  12847. Complete example using @command{ffplay}:
  12848. @example
  12849. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12850. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12851. @end example
  12852. @end itemize
  12853. @section bench, abench
  12854. Benchmark part of a filtergraph.
  12855. The filter accepts the following options:
  12856. @table @option
  12857. @item action
  12858. Start or stop a timer.
  12859. Available values are:
  12860. @table @samp
  12861. @item start
  12862. Get the current time, set it as frame metadata (using the key
  12863. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12864. @item stop
  12865. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12866. the input frame metadata to get the time difference. Time difference, average,
  12867. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12868. @code{min}) are then printed. The timestamps are expressed in seconds.
  12869. @end table
  12870. @end table
  12871. @subsection Examples
  12872. @itemize
  12873. @item
  12874. Benchmark @ref{selectivecolor} filter:
  12875. @example
  12876. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12877. @end example
  12878. @end itemize
  12879. @section concat
  12880. Concatenate audio and video streams, joining them together one after the
  12881. other.
  12882. The filter works on segments of synchronized video and audio streams. All
  12883. segments must have the same number of streams of each type, and that will
  12884. also be the number of streams at output.
  12885. The filter accepts the following options:
  12886. @table @option
  12887. @item n
  12888. Set the number of segments. Default is 2.
  12889. @item v
  12890. Set the number of output video streams, that is also the number of video
  12891. streams in each segment. Default is 1.
  12892. @item a
  12893. Set the number of output audio streams, that is also the number of audio
  12894. streams in each segment. Default is 0.
  12895. @item unsafe
  12896. Activate unsafe mode: do not fail if segments have a different format.
  12897. @end table
  12898. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12899. @var{a} audio outputs.
  12900. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12901. segment, in the same order as the outputs, then the inputs for the second
  12902. segment, etc.
  12903. Related streams do not always have exactly the same duration, for various
  12904. reasons including codec frame size or sloppy authoring. For that reason,
  12905. related synchronized streams (e.g. a video and its audio track) should be
  12906. concatenated at once. The concat filter will use the duration of the longest
  12907. stream in each segment (except the last one), and if necessary pad shorter
  12908. audio streams with silence.
  12909. For this filter to work correctly, all segments must start at timestamp 0.
  12910. All corresponding streams must have the same parameters in all segments; the
  12911. filtering system will automatically select a common pixel format for video
  12912. streams, and a common sample format, sample rate and channel layout for
  12913. audio streams, but other settings, such as resolution, must be converted
  12914. explicitly by the user.
  12915. Different frame rates are acceptable but will result in variable frame rate
  12916. at output; be sure to configure the output file to handle it.
  12917. @subsection Examples
  12918. @itemize
  12919. @item
  12920. Concatenate an opening, an episode and an ending, all in bilingual version
  12921. (video in stream 0, audio in streams 1 and 2):
  12922. @example
  12923. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12924. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12925. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12926. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12927. @end example
  12928. @item
  12929. Concatenate two parts, handling audio and video separately, using the
  12930. (a)movie sources, and adjusting the resolution:
  12931. @example
  12932. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12933. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12934. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12935. @end example
  12936. Note that a desync will happen at the stitch if the audio and video streams
  12937. do not have exactly the same duration in the first file.
  12938. @end itemize
  12939. @section drawgraph, adrawgraph
  12940. Draw a graph using input video or audio metadata.
  12941. It accepts the following parameters:
  12942. @table @option
  12943. @item m1
  12944. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12945. @item fg1
  12946. Set 1st foreground color expression.
  12947. @item m2
  12948. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12949. @item fg2
  12950. Set 2nd foreground color expression.
  12951. @item m3
  12952. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12953. @item fg3
  12954. Set 3rd foreground color expression.
  12955. @item m4
  12956. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12957. @item fg4
  12958. Set 4th foreground color expression.
  12959. @item min
  12960. Set minimal value of metadata value.
  12961. @item max
  12962. Set maximal value of metadata value.
  12963. @item bg
  12964. Set graph background color. Default is white.
  12965. @item mode
  12966. Set graph mode.
  12967. Available values for mode is:
  12968. @table @samp
  12969. @item bar
  12970. @item dot
  12971. @item line
  12972. @end table
  12973. Default is @code{line}.
  12974. @item slide
  12975. Set slide mode.
  12976. Available values for slide is:
  12977. @table @samp
  12978. @item frame
  12979. Draw new frame when right border is reached.
  12980. @item replace
  12981. Replace old columns with new ones.
  12982. @item scroll
  12983. Scroll from right to left.
  12984. @item rscroll
  12985. Scroll from left to right.
  12986. @item picture
  12987. Draw single picture.
  12988. @end table
  12989. Default is @code{frame}.
  12990. @item size
  12991. Set size of graph video. For the syntax of this option, check the
  12992. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12993. The default value is @code{900x256}.
  12994. The foreground color expressions can use the following variables:
  12995. @table @option
  12996. @item MIN
  12997. Minimal value of metadata value.
  12998. @item MAX
  12999. Maximal value of metadata value.
  13000. @item VAL
  13001. Current metadata key value.
  13002. @end table
  13003. The color is defined as 0xAABBGGRR.
  13004. @end table
  13005. Example using metadata from @ref{signalstats} filter:
  13006. @example
  13007. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13008. @end example
  13009. Example using metadata from @ref{ebur128} filter:
  13010. @example
  13011. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13012. @end example
  13013. @anchor{ebur128}
  13014. @section ebur128
  13015. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13016. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13017. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13018. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13019. The filter also has a video output (see the @var{video} option) with a real
  13020. time graph to observe the loudness evolution. The graphic contains the logged
  13021. message mentioned above, so it is not printed anymore when this option is set,
  13022. unless the verbose logging is set. The main graphing area contains the
  13023. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13024. the momentary loudness (400 milliseconds).
  13025. More information about the Loudness Recommendation EBU R128 on
  13026. @url{http://tech.ebu.ch/loudness}.
  13027. The filter accepts the following options:
  13028. @table @option
  13029. @item video
  13030. Activate the video output. The audio stream is passed unchanged whether this
  13031. option is set or no. The video stream will be the first output stream if
  13032. activated. Default is @code{0}.
  13033. @item size
  13034. Set the video size. This option is for video only. For the syntax of this
  13035. option, check the
  13036. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13037. Default and minimum resolution is @code{640x480}.
  13038. @item meter
  13039. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13040. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13041. other integer value between this range is allowed.
  13042. @item metadata
  13043. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13044. into 100ms output frames, each of them containing various loudness information
  13045. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13046. Default is @code{0}.
  13047. @item framelog
  13048. Force the frame logging level.
  13049. Available values are:
  13050. @table @samp
  13051. @item info
  13052. information logging level
  13053. @item verbose
  13054. verbose logging level
  13055. @end table
  13056. By default, the logging level is set to @var{info}. If the @option{video} or
  13057. the @option{metadata} options are set, it switches to @var{verbose}.
  13058. @item peak
  13059. Set peak mode(s).
  13060. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13061. values are:
  13062. @table @samp
  13063. @item none
  13064. Disable any peak mode (default).
  13065. @item sample
  13066. Enable sample-peak mode.
  13067. Simple peak mode looking for the higher sample value. It logs a message
  13068. for sample-peak (identified by @code{SPK}).
  13069. @item true
  13070. Enable true-peak mode.
  13071. If enabled, the peak lookup is done on an over-sampled version of the input
  13072. stream for better peak accuracy. It logs a message for true-peak.
  13073. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13074. This mode requires a build with @code{libswresample}.
  13075. @end table
  13076. @item dualmono
  13077. Treat mono input files as "dual mono". If a mono file is intended for playback
  13078. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13079. If set to @code{true}, this option will compensate for this effect.
  13080. Multi-channel input files are not affected by this option.
  13081. @item panlaw
  13082. Set a specific pan law to be used for the measurement of dual mono files.
  13083. This parameter is optional, and has a default value of -3.01dB.
  13084. @end table
  13085. @subsection Examples
  13086. @itemize
  13087. @item
  13088. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13089. @example
  13090. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13091. @end example
  13092. @item
  13093. Run an analysis with @command{ffmpeg}:
  13094. @example
  13095. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13096. @end example
  13097. @end itemize
  13098. @section interleave, ainterleave
  13099. Temporally interleave frames from several inputs.
  13100. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13101. These filters read frames from several inputs and send the oldest
  13102. queued frame to the output.
  13103. Input streams must have well defined, monotonically increasing frame
  13104. timestamp values.
  13105. In order to submit one frame to output, these filters need to enqueue
  13106. at least one frame for each input, so they cannot work in case one
  13107. input is not yet terminated and will not receive incoming frames.
  13108. For example consider the case when one input is a @code{select} filter
  13109. which always drops input frames. The @code{interleave} filter will keep
  13110. reading from that input, but it will never be able to send new frames
  13111. to output until the input sends an end-of-stream signal.
  13112. Also, depending on inputs synchronization, the filters will drop
  13113. frames in case one input receives more frames than the other ones, and
  13114. the queue is already filled.
  13115. These filters accept the following options:
  13116. @table @option
  13117. @item nb_inputs, n
  13118. Set the number of different inputs, it is 2 by default.
  13119. @end table
  13120. @subsection Examples
  13121. @itemize
  13122. @item
  13123. Interleave frames belonging to different streams using @command{ffmpeg}:
  13124. @example
  13125. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13126. @end example
  13127. @item
  13128. Add flickering blur effect:
  13129. @example
  13130. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13131. @end example
  13132. @end itemize
  13133. @section metadata, ametadata
  13134. Manipulate frame metadata.
  13135. This filter accepts the following options:
  13136. @table @option
  13137. @item mode
  13138. Set mode of operation of the filter.
  13139. Can be one of the following:
  13140. @table @samp
  13141. @item select
  13142. If both @code{value} and @code{key} is set, select frames
  13143. which have such metadata. If only @code{key} is set, select
  13144. every frame that has such key in metadata.
  13145. @item add
  13146. Add new metadata @code{key} and @code{value}. If key is already available
  13147. do nothing.
  13148. @item modify
  13149. Modify value of already present key.
  13150. @item delete
  13151. If @code{value} is set, delete only keys that have such value.
  13152. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13153. the frame.
  13154. @item print
  13155. Print key and its value if metadata was found. If @code{key} is not set print all
  13156. metadata values available in frame.
  13157. @end table
  13158. @item key
  13159. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13160. @item value
  13161. Set metadata value which will be used. This option is mandatory for
  13162. @code{modify} and @code{add} mode.
  13163. @item function
  13164. Which function to use when comparing metadata value and @code{value}.
  13165. Can be one of following:
  13166. @table @samp
  13167. @item same_str
  13168. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13169. @item starts_with
  13170. Values are interpreted as strings, returns true if metadata value starts with
  13171. the @code{value} option string.
  13172. @item less
  13173. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13174. @item equal
  13175. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13176. @item greater
  13177. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13178. @item expr
  13179. Values are interpreted as floats, returns true if expression from option @code{expr}
  13180. evaluates to true.
  13181. @end table
  13182. @item expr
  13183. Set expression which is used when @code{function} is set to @code{expr}.
  13184. The expression is evaluated through the eval API and can contain the following
  13185. constants:
  13186. @table @option
  13187. @item VALUE1
  13188. Float representation of @code{value} from metadata key.
  13189. @item VALUE2
  13190. Float representation of @code{value} as supplied by user in @code{value} option.
  13191. @end table
  13192. @item file
  13193. If specified in @code{print} mode, output is written to the named file. Instead of
  13194. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13195. for standard output. If @code{file} option is not set, output is written to the log
  13196. with AV_LOG_INFO loglevel.
  13197. @end table
  13198. @subsection Examples
  13199. @itemize
  13200. @item
  13201. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13202. between 0 and 1.
  13203. @example
  13204. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13205. @end example
  13206. @item
  13207. Print silencedetect output to file @file{metadata.txt}.
  13208. @example
  13209. silencedetect,ametadata=mode=print:file=metadata.txt
  13210. @end example
  13211. @item
  13212. Direct all metadata to a pipe with file descriptor 4.
  13213. @example
  13214. metadata=mode=print:file='pipe\:4'
  13215. @end example
  13216. @end itemize
  13217. @section perms, aperms
  13218. Set read/write permissions for the output frames.
  13219. These filters are mainly aimed at developers to test direct path in the
  13220. following filter in the filtergraph.
  13221. The filters accept the following options:
  13222. @table @option
  13223. @item mode
  13224. Select the permissions mode.
  13225. It accepts the following values:
  13226. @table @samp
  13227. @item none
  13228. Do nothing. This is the default.
  13229. @item ro
  13230. Set all the output frames read-only.
  13231. @item rw
  13232. Set all the output frames directly writable.
  13233. @item toggle
  13234. Make the frame read-only if writable, and writable if read-only.
  13235. @item random
  13236. Set each output frame read-only or writable randomly.
  13237. @end table
  13238. @item seed
  13239. Set the seed for the @var{random} mode, must be an integer included between
  13240. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13241. @code{-1}, the filter will try to use a good random seed on a best effort
  13242. basis.
  13243. @end table
  13244. Note: in case of auto-inserted filter between the permission filter and the
  13245. following one, the permission might not be received as expected in that
  13246. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13247. perms/aperms filter can avoid this problem.
  13248. @section realtime, arealtime
  13249. Slow down filtering to match real time approximatively.
  13250. These filters will pause the filtering for a variable amount of time to
  13251. match the output rate with the input timestamps.
  13252. They are similar to the @option{re} option to @code{ffmpeg}.
  13253. They accept the following options:
  13254. @table @option
  13255. @item limit
  13256. Time limit for the pauses. Any pause longer than that will be considered
  13257. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13258. @end table
  13259. @anchor{select}
  13260. @section select, aselect
  13261. Select frames to pass in output.
  13262. This filter accepts the following options:
  13263. @table @option
  13264. @item expr, e
  13265. Set expression, which is evaluated for each input frame.
  13266. If the expression is evaluated to zero, the frame is discarded.
  13267. If the evaluation result is negative or NaN, the frame is sent to the
  13268. first output; otherwise it is sent to the output with index
  13269. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13270. For example a value of @code{1.2} corresponds to the output with index
  13271. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13272. @item outputs, n
  13273. Set the number of outputs. The output to which to send the selected
  13274. frame is based on the result of the evaluation. Default value is 1.
  13275. @end table
  13276. The expression can contain the following constants:
  13277. @table @option
  13278. @item n
  13279. The (sequential) number of the filtered frame, starting from 0.
  13280. @item selected_n
  13281. The (sequential) number of the selected frame, starting from 0.
  13282. @item prev_selected_n
  13283. The sequential number of the last selected frame. It's NAN if undefined.
  13284. @item TB
  13285. The timebase of the input timestamps.
  13286. @item pts
  13287. The PTS (Presentation TimeStamp) of the filtered video frame,
  13288. expressed in @var{TB} units. It's NAN if undefined.
  13289. @item t
  13290. The PTS of the filtered video frame,
  13291. expressed in seconds. It's NAN if undefined.
  13292. @item prev_pts
  13293. The PTS of the previously filtered video frame. It's NAN if undefined.
  13294. @item prev_selected_pts
  13295. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13296. @item prev_selected_t
  13297. The PTS of the last previously selected video frame. It's NAN if undefined.
  13298. @item start_pts
  13299. The PTS of the first video frame in the video. It's NAN if undefined.
  13300. @item start_t
  13301. The time of the first video frame in the video. It's NAN if undefined.
  13302. @item pict_type @emph{(video only)}
  13303. The type of the filtered frame. It can assume one of the following
  13304. values:
  13305. @table @option
  13306. @item I
  13307. @item P
  13308. @item B
  13309. @item S
  13310. @item SI
  13311. @item SP
  13312. @item BI
  13313. @end table
  13314. @item interlace_type @emph{(video only)}
  13315. The frame interlace type. It can assume one of the following values:
  13316. @table @option
  13317. @item PROGRESSIVE
  13318. The frame is progressive (not interlaced).
  13319. @item TOPFIRST
  13320. The frame is top-field-first.
  13321. @item BOTTOMFIRST
  13322. The frame is bottom-field-first.
  13323. @end table
  13324. @item consumed_sample_n @emph{(audio only)}
  13325. the number of selected samples before the current frame
  13326. @item samples_n @emph{(audio only)}
  13327. the number of samples in the current frame
  13328. @item sample_rate @emph{(audio only)}
  13329. the input sample rate
  13330. @item key
  13331. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13332. @item pos
  13333. the position in the file of the filtered frame, -1 if the information
  13334. is not available (e.g. for synthetic video)
  13335. @item scene @emph{(video only)}
  13336. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13337. probability for the current frame to introduce a new scene, while a higher
  13338. value means the current frame is more likely to be one (see the example below)
  13339. @item concatdec_select
  13340. The concat demuxer can select only part of a concat input file by setting an
  13341. inpoint and an outpoint, but the output packets may not be entirely contained
  13342. in the selected interval. By using this variable, it is possible to skip frames
  13343. generated by the concat demuxer which are not exactly contained in the selected
  13344. interval.
  13345. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13346. and the @var{lavf.concat.duration} packet metadata values which are also
  13347. present in the decoded frames.
  13348. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13349. start_time and either the duration metadata is missing or the frame pts is less
  13350. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13351. missing.
  13352. That basically means that an input frame is selected if its pts is within the
  13353. interval set by the concat demuxer.
  13354. @end table
  13355. The default value of the select expression is "1".
  13356. @subsection Examples
  13357. @itemize
  13358. @item
  13359. Select all frames in input:
  13360. @example
  13361. select
  13362. @end example
  13363. The example above is the same as:
  13364. @example
  13365. select=1
  13366. @end example
  13367. @item
  13368. Skip all frames:
  13369. @example
  13370. select=0
  13371. @end example
  13372. @item
  13373. Select only I-frames:
  13374. @example
  13375. select='eq(pict_type\,I)'
  13376. @end example
  13377. @item
  13378. Select one frame every 100:
  13379. @example
  13380. select='not(mod(n\,100))'
  13381. @end example
  13382. @item
  13383. Select only frames contained in the 10-20 time interval:
  13384. @example
  13385. select=between(t\,10\,20)
  13386. @end example
  13387. @item
  13388. Select only I-frames contained in the 10-20 time interval:
  13389. @example
  13390. select=between(t\,10\,20)*eq(pict_type\,I)
  13391. @end example
  13392. @item
  13393. Select frames with a minimum distance of 10 seconds:
  13394. @example
  13395. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13396. @end example
  13397. @item
  13398. Use aselect to select only audio frames with samples number > 100:
  13399. @example
  13400. aselect='gt(samples_n\,100)'
  13401. @end example
  13402. @item
  13403. Create a mosaic of the first scenes:
  13404. @example
  13405. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13406. @end example
  13407. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13408. choice.
  13409. @item
  13410. Send even and odd frames to separate outputs, and compose them:
  13411. @example
  13412. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13413. @end example
  13414. @item
  13415. Select useful frames from an ffconcat file which is using inpoints and
  13416. outpoints but where the source files are not intra frame only.
  13417. @example
  13418. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13419. @end example
  13420. @end itemize
  13421. @section sendcmd, asendcmd
  13422. Send commands to filters in the filtergraph.
  13423. These filters read commands to be sent to other filters in the
  13424. filtergraph.
  13425. @code{sendcmd} must be inserted between two video filters,
  13426. @code{asendcmd} must be inserted between two audio filters, but apart
  13427. from that they act the same way.
  13428. The specification of commands can be provided in the filter arguments
  13429. with the @var{commands} option, or in a file specified by the
  13430. @var{filename} option.
  13431. These filters accept the following options:
  13432. @table @option
  13433. @item commands, c
  13434. Set the commands to be read and sent to the other filters.
  13435. @item filename, f
  13436. Set the filename of the commands to be read and sent to the other
  13437. filters.
  13438. @end table
  13439. @subsection Commands syntax
  13440. A commands description consists of a sequence of interval
  13441. specifications, comprising a list of commands to be executed when a
  13442. particular event related to that interval occurs. The occurring event
  13443. is typically the current frame time entering or leaving a given time
  13444. interval.
  13445. An interval is specified by the following syntax:
  13446. @example
  13447. @var{START}[-@var{END}] @var{COMMANDS};
  13448. @end example
  13449. The time interval is specified by the @var{START} and @var{END} times.
  13450. @var{END} is optional and defaults to the maximum time.
  13451. The current frame time is considered within the specified interval if
  13452. it is included in the interval [@var{START}, @var{END}), that is when
  13453. the time is greater or equal to @var{START} and is lesser than
  13454. @var{END}.
  13455. @var{COMMANDS} consists of a sequence of one or more command
  13456. specifications, separated by ",", relating to that interval. The
  13457. syntax of a command specification is given by:
  13458. @example
  13459. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13460. @end example
  13461. @var{FLAGS} is optional and specifies the type of events relating to
  13462. the time interval which enable sending the specified command, and must
  13463. be a non-null sequence of identifier flags separated by "+" or "|" and
  13464. enclosed between "[" and "]".
  13465. The following flags are recognized:
  13466. @table @option
  13467. @item enter
  13468. The command is sent when the current frame timestamp enters the
  13469. specified interval. In other words, the command is sent when the
  13470. previous frame timestamp was not in the given interval, and the
  13471. current is.
  13472. @item leave
  13473. The command is sent when the current frame timestamp leaves the
  13474. specified interval. In other words, the command is sent when the
  13475. previous frame timestamp was in the given interval, and the
  13476. current is not.
  13477. @end table
  13478. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13479. assumed.
  13480. @var{TARGET} specifies the target of the command, usually the name of
  13481. the filter class or a specific filter instance name.
  13482. @var{COMMAND} specifies the name of the command for the target filter.
  13483. @var{ARG} is optional and specifies the optional list of argument for
  13484. the given @var{COMMAND}.
  13485. Between one interval specification and another, whitespaces, or
  13486. sequences of characters starting with @code{#} until the end of line,
  13487. are ignored and can be used to annotate comments.
  13488. A simplified BNF description of the commands specification syntax
  13489. follows:
  13490. @example
  13491. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13492. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13493. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13494. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13495. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13496. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13497. @end example
  13498. @subsection Examples
  13499. @itemize
  13500. @item
  13501. Specify audio tempo change at second 4:
  13502. @example
  13503. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13504. @end example
  13505. @item
  13506. Target a specific filter instance:
  13507. @example
  13508. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13509. @end example
  13510. @item
  13511. Specify a list of drawtext and hue commands in a file.
  13512. @example
  13513. # show text in the interval 5-10
  13514. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13515. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13516. # desaturate the image in the interval 15-20
  13517. 15.0-20.0 [enter] hue s 0,
  13518. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13519. [leave] hue s 1,
  13520. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13521. # apply an exponential saturation fade-out effect, starting from time 25
  13522. 25 [enter] hue s exp(25-t)
  13523. @end example
  13524. A filtergraph allowing to read and process the above command list
  13525. stored in a file @file{test.cmd}, can be specified with:
  13526. @example
  13527. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13528. @end example
  13529. @end itemize
  13530. @anchor{setpts}
  13531. @section setpts, asetpts
  13532. Change the PTS (presentation timestamp) of the input frames.
  13533. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13534. This filter accepts the following options:
  13535. @table @option
  13536. @item expr
  13537. The expression which is evaluated for each frame to construct its timestamp.
  13538. @end table
  13539. The expression is evaluated through the eval API and can contain the following
  13540. constants:
  13541. @table @option
  13542. @item FRAME_RATE
  13543. frame rate, only defined for constant frame-rate video
  13544. @item PTS
  13545. The presentation timestamp in input
  13546. @item N
  13547. The count of the input frame for video or the number of consumed samples,
  13548. not including the current frame for audio, starting from 0.
  13549. @item NB_CONSUMED_SAMPLES
  13550. The number of consumed samples, not including the current frame (only
  13551. audio)
  13552. @item NB_SAMPLES, S
  13553. The number of samples in the current frame (only audio)
  13554. @item SAMPLE_RATE, SR
  13555. The audio sample rate.
  13556. @item STARTPTS
  13557. The PTS of the first frame.
  13558. @item STARTT
  13559. the time in seconds of the first frame
  13560. @item INTERLACED
  13561. State whether the current frame is interlaced.
  13562. @item T
  13563. the time in seconds of the current frame
  13564. @item POS
  13565. original position in the file of the frame, or undefined if undefined
  13566. for the current frame
  13567. @item PREV_INPTS
  13568. The previous input PTS.
  13569. @item PREV_INT
  13570. previous input time in seconds
  13571. @item PREV_OUTPTS
  13572. The previous output PTS.
  13573. @item PREV_OUTT
  13574. previous output time in seconds
  13575. @item RTCTIME
  13576. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13577. instead.
  13578. @item RTCSTART
  13579. The wallclock (RTC) time at the start of the movie in microseconds.
  13580. @item TB
  13581. The timebase of the input timestamps.
  13582. @end table
  13583. @subsection Examples
  13584. @itemize
  13585. @item
  13586. Start counting PTS from zero
  13587. @example
  13588. setpts=PTS-STARTPTS
  13589. @end example
  13590. @item
  13591. Apply fast motion effect:
  13592. @example
  13593. setpts=0.5*PTS
  13594. @end example
  13595. @item
  13596. Apply slow motion effect:
  13597. @example
  13598. setpts=2.0*PTS
  13599. @end example
  13600. @item
  13601. Set fixed rate of 25 frames per second:
  13602. @example
  13603. setpts=N/(25*TB)
  13604. @end example
  13605. @item
  13606. Set fixed rate 25 fps with some jitter:
  13607. @example
  13608. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13609. @end example
  13610. @item
  13611. Apply an offset of 10 seconds to the input PTS:
  13612. @example
  13613. setpts=PTS+10/TB
  13614. @end example
  13615. @item
  13616. Generate timestamps from a "live source" and rebase onto the current timebase:
  13617. @example
  13618. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13619. @end example
  13620. @item
  13621. Generate timestamps by counting samples:
  13622. @example
  13623. asetpts=N/SR/TB
  13624. @end example
  13625. @end itemize
  13626. @section settb, asettb
  13627. Set the timebase to use for the output frames timestamps.
  13628. It is mainly useful for testing timebase configuration.
  13629. It accepts the following parameters:
  13630. @table @option
  13631. @item expr, tb
  13632. The expression which is evaluated into the output timebase.
  13633. @end table
  13634. The value for @option{tb} is an arithmetic expression representing a
  13635. rational. The expression can contain the constants "AVTB" (the default
  13636. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13637. audio only). Default value is "intb".
  13638. @subsection Examples
  13639. @itemize
  13640. @item
  13641. Set the timebase to 1/25:
  13642. @example
  13643. settb=expr=1/25
  13644. @end example
  13645. @item
  13646. Set the timebase to 1/10:
  13647. @example
  13648. settb=expr=0.1
  13649. @end example
  13650. @item
  13651. Set the timebase to 1001/1000:
  13652. @example
  13653. settb=1+0.001
  13654. @end example
  13655. @item
  13656. Set the timebase to 2*intb:
  13657. @example
  13658. settb=2*intb
  13659. @end example
  13660. @item
  13661. Set the default timebase value:
  13662. @example
  13663. settb=AVTB
  13664. @end example
  13665. @end itemize
  13666. @section showcqt
  13667. Convert input audio to a video output representing frequency spectrum
  13668. logarithmically using Brown-Puckette constant Q transform algorithm with
  13669. direct frequency domain coefficient calculation (but the transform itself
  13670. is not really constant Q, instead the Q factor is actually variable/clamped),
  13671. with musical tone scale, from E0 to D#10.
  13672. The filter accepts the following options:
  13673. @table @option
  13674. @item size, s
  13675. Specify the video size for the output. It must be even. For the syntax of this option,
  13676. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13677. Default value is @code{1920x1080}.
  13678. @item fps, rate, r
  13679. Set the output frame rate. Default value is @code{25}.
  13680. @item bar_h
  13681. Set the bargraph height. It must be even. Default value is @code{-1} which
  13682. computes the bargraph height automatically.
  13683. @item axis_h
  13684. Set the axis height. It must be even. Default value is @code{-1} which computes
  13685. the axis height automatically.
  13686. @item sono_h
  13687. Set the sonogram height. It must be even. Default value is @code{-1} which
  13688. computes the sonogram height automatically.
  13689. @item fullhd
  13690. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13691. instead. Default value is @code{1}.
  13692. @item sono_v, volume
  13693. Specify the sonogram volume expression. It can contain variables:
  13694. @table @option
  13695. @item bar_v
  13696. the @var{bar_v} evaluated expression
  13697. @item frequency, freq, f
  13698. the frequency where it is evaluated
  13699. @item timeclamp, tc
  13700. the value of @var{timeclamp} option
  13701. @end table
  13702. and functions:
  13703. @table @option
  13704. @item a_weighting(f)
  13705. A-weighting of equal loudness
  13706. @item b_weighting(f)
  13707. B-weighting of equal loudness
  13708. @item c_weighting(f)
  13709. C-weighting of equal loudness.
  13710. @end table
  13711. Default value is @code{16}.
  13712. @item bar_v, volume2
  13713. Specify the bargraph volume expression. It can contain variables:
  13714. @table @option
  13715. @item sono_v
  13716. the @var{sono_v} evaluated expression
  13717. @item frequency, freq, f
  13718. the frequency where it is evaluated
  13719. @item timeclamp, tc
  13720. the value of @var{timeclamp} option
  13721. @end table
  13722. and functions:
  13723. @table @option
  13724. @item a_weighting(f)
  13725. A-weighting of equal loudness
  13726. @item b_weighting(f)
  13727. B-weighting of equal loudness
  13728. @item c_weighting(f)
  13729. C-weighting of equal loudness.
  13730. @end table
  13731. Default value is @code{sono_v}.
  13732. @item sono_g, gamma
  13733. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13734. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13735. Acceptable range is @code{[1, 7]}.
  13736. @item bar_g, gamma2
  13737. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13738. @code{[1, 7]}.
  13739. @item bar_t
  13740. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13741. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13742. @item timeclamp, tc
  13743. Specify the transform timeclamp. At low frequency, there is trade-off between
  13744. accuracy in time domain and frequency domain. If timeclamp is lower,
  13745. event in time domain is represented more accurately (such as fast bass drum),
  13746. otherwise event in frequency domain is represented more accurately
  13747. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13748. @item attack
  13749. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13750. limits future samples by applying asymmetric windowing in time domain, useful
  13751. when low latency is required. Accepted range is @code{[0, 1]}.
  13752. @item basefreq
  13753. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13754. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13755. @item endfreq
  13756. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13757. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13758. @item coeffclamp
  13759. This option is deprecated and ignored.
  13760. @item tlength
  13761. Specify the transform length in time domain. Use this option to control accuracy
  13762. trade-off between time domain and frequency domain at every frequency sample.
  13763. It can contain variables:
  13764. @table @option
  13765. @item frequency, freq, f
  13766. the frequency where it is evaluated
  13767. @item timeclamp, tc
  13768. the value of @var{timeclamp} option.
  13769. @end table
  13770. Default value is @code{384*tc/(384+tc*f)}.
  13771. @item count
  13772. Specify the transform count for every video frame. Default value is @code{6}.
  13773. Acceptable range is @code{[1, 30]}.
  13774. @item fcount
  13775. Specify the transform count for every single pixel. Default value is @code{0},
  13776. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13777. @item fontfile
  13778. Specify font file for use with freetype to draw the axis. If not specified,
  13779. use embedded font. Note that drawing with font file or embedded font is not
  13780. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13781. option instead.
  13782. @item font
  13783. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13784. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13785. @item fontcolor
  13786. Specify font color expression. This is arithmetic expression that should return
  13787. integer value 0xRRGGBB. It can contain variables:
  13788. @table @option
  13789. @item frequency, freq, f
  13790. the frequency where it is evaluated
  13791. @item timeclamp, tc
  13792. the value of @var{timeclamp} option
  13793. @end table
  13794. and functions:
  13795. @table @option
  13796. @item midi(f)
  13797. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13798. @item r(x), g(x), b(x)
  13799. red, green, and blue value of intensity x.
  13800. @end table
  13801. Default value is @code{st(0, (midi(f)-59.5)/12);
  13802. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13803. r(1-ld(1)) + b(ld(1))}.
  13804. @item axisfile
  13805. Specify image file to draw the axis. This option override @var{fontfile} and
  13806. @var{fontcolor} option.
  13807. @item axis, text
  13808. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13809. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13810. Default value is @code{1}.
  13811. @item csp
  13812. Set colorspace. The accepted values are:
  13813. @table @samp
  13814. @item unspecified
  13815. Unspecified (default)
  13816. @item bt709
  13817. BT.709
  13818. @item fcc
  13819. FCC
  13820. @item bt470bg
  13821. BT.470BG or BT.601-6 625
  13822. @item smpte170m
  13823. SMPTE-170M or BT.601-6 525
  13824. @item smpte240m
  13825. SMPTE-240M
  13826. @item bt2020ncl
  13827. BT.2020 with non-constant luminance
  13828. @end table
  13829. @item cscheme
  13830. Set spectrogram color scheme. This is list of floating point values with format
  13831. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13832. The default is @code{1|0.5|0|0|0.5|1}.
  13833. @end table
  13834. @subsection Examples
  13835. @itemize
  13836. @item
  13837. Playing audio while showing the spectrum:
  13838. @example
  13839. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13840. @end example
  13841. @item
  13842. Same as above, but with frame rate 30 fps:
  13843. @example
  13844. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13845. @end example
  13846. @item
  13847. Playing at 1280x720:
  13848. @example
  13849. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13850. @end example
  13851. @item
  13852. Disable sonogram display:
  13853. @example
  13854. sono_h=0
  13855. @end example
  13856. @item
  13857. A1 and its harmonics: A1, A2, (near)E3, A3:
  13858. @example
  13859. 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),
  13860. asplit[a][out1]; [a] showcqt [out0]'
  13861. @end example
  13862. @item
  13863. Same as above, but with more accuracy in frequency domain:
  13864. @example
  13865. 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),
  13866. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13867. @end example
  13868. @item
  13869. Custom volume:
  13870. @example
  13871. bar_v=10:sono_v=bar_v*a_weighting(f)
  13872. @end example
  13873. @item
  13874. Custom gamma, now spectrum is linear to the amplitude.
  13875. @example
  13876. bar_g=2:sono_g=2
  13877. @end example
  13878. @item
  13879. Custom tlength equation:
  13880. @example
  13881. 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)))'
  13882. @end example
  13883. @item
  13884. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13885. @example
  13886. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13887. @end example
  13888. @item
  13889. Custom font using fontconfig:
  13890. @example
  13891. font='Courier New,Monospace,mono|bold'
  13892. @end example
  13893. @item
  13894. Custom frequency range with custom axis using image file:
  13895. @example
  13896. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13897. @end example
  13898. @end itemize
  13899. @section showfreqs
  13900. Convert input audio to video output representing the audio power spectrum.
  13901. Audio amplitude is on Y-axis while frequency is on X-axis.
  13902. The filter accepts the following options:
  13903. @table @option
  13904. @item size, s
  13905. Specify size of video. For the syntax of this option, check the
  13906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13907. Default is @code{1024x512}.
  13908. @item mode
  13909. Set display mode.
  13910. This set how each frequency bin will be represented.
  13911. It accepts the following values:
  13912. @table @samp
  13913. @item line
  13914. @item bar
  13915. @item dot
  13916. @end table
  13917. Default is @code{bar}.
  13918. @item ascale
  13919. Set amplitude scale.
  13920. It accepts the following values:
  13921. @table @samp
  13922. @item lin
  13923. Linear scale.
  13924. @item sqrt
  13925. Square root scale.
  13926. @item cbrt
  13927. Cubic root scale.
  13928. @item log
  13929. Logarithmic scale.
  13930. @end table
  13931. Default is @code{log}.
  13932. @item fscale
  13933. Set frequency scale.
  13934. It accepts the following values:
  13935. @table @samp
  13936. @item lin
  13937. Linear scale.
  13938. @item log
  13939. Logarithmic scale.
  13940. @item rlog
  13941. Reverse logarithmic scale.
  13942. @end table
  13943. Default is @code{lin}.
  13944. @item win_size
  13945. Set window size.
  13946. It accepts the following values:
  13947. @table @samp
  13948. @item w16
  13949. @item w32
  13950. @item w64
  13951. @item w128
  13952. @item w256
  13953. @item w512
  13954. @item w1024
  13955. @item w2048
  13956. @item w4096
  13957. @item w8192
  13958. @item w16384
  13959. @item w32768
  13960. @item w65536
  13961. @end table
  13962. Default is @code{w2048}
  13963. @item win_func
  13964. Set windowing function.
  13965. It accepts the following values:
  13966. @table @samp
  13967. @item rect
  13968. @item bartlett
  13969. @item hanning
  13970. @item hamming
  13971. @item blackman
  13972. @item welch
  13973. @item flattop
  13974. @item bharris
  13975. @item bnuttall
  13976. @item bhann
  13977. @item sine
  13978. @item nuttall
  13979. @item lanczos
  13980. @item gauss
  13981. @item tukey
  13982. @item dolph
  13983. @item cauchy
  13984. @item parzen
  13985. @item poisson
  13986. @end table
  13987. Default is @code{hanning}.
  13988. @item overlap
  13989. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13990. which means optimal overlap for selected window function will be picked.
  13991. @item averaging
  13992. Set time averaging. Setting this to 0 will display current maximal peaks.
  13993. Default is @code{1}, which means time averaging is disabled.
  13994. @item colors
  13995. Specify list of colors separated by space or by '|' which will be used to
  13996. draw channel frequencies. Unrecognized or missing colors will be replaced
  13997. by white color.
  13998. @item cmode
  13999. Set channel display mode.
  14000. It accepts the following values:
  14001. @table @samp
  14002. @item combined
  14003. @item separate
  14004. @end table
  14005. Default is @code{combined}.
  14006. @item minamp
  14007. Set minimum amplitude used in @code{log} amplitude scaler.
  14008. @end table
  14009. @anchor{showspectrum}
  14010. @section showspectrum
  14011. Convert input audio to a video output, representing the audio frequency
  14012. spectrum.
  14013. The filter accepts the following options:
  14014. @table @option
  14015. @item size, s
  14016. Specify the video size for the output. For the syntax of this option, check the
  14017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14018. Default value is @code{640x512}.
  14019. @item slide
  14020. Specify how the spectrum should slide along the window.
  14021. It accepts the following values:
  14022. @table @samp
  14023. @item replace
  14024. the samples start again on the left when they reach the right
  14025. @item scroll
  14026. the samples scroll from right to left
  14027. @item fullframe
  14028. frames are only produced when the samples reach the right
  14029. @item rscroll
  14030. the samples scroll from left to right
  14031. @end table
  14032. Default value is @code{replace}.
  14033. @item mode
  14034. Specify display mode.
  14035. It accepts the following values:
  14036. @table @samp
  14037. @item combined
  14038. all channels are displayed in the same row
  14039. @item separate
  14040. all channels are displayed in separate rows
  14041. @end table
  14042. Default value is @samp{combined}.
  14043. @item color
  14044. Specify display color mode.
  14045. It accepts the following values:
  14046. @table @samp
  14047. @item channel
  14048. each channel is displayed in a separate color
  14049. @item intensity
  14050. each channel is displayed using the same color scheme
  14051. @item rainbow
  14052. each channel is displayed using the rainbow color scheme
  14053. @item moreland
  14054. each channel is displayed using the moreland color scheme
  14055. @item nebulae
  14056. each channel is displayed using the nebulae color scheme
  14057. @item fire
  14058. each channel is displayed using the fire color scheme
  14059. @item fiery
  14060. each channel is displayed using the fiery color scheme
  14061. @item fruit
  14062. each channel is displayed using the fruit color scheme
  14063. @item cool
  14064. each channel is displayed using the cool color scheme
  14065. @end table
  14066. Default value is @samp{channel}.
  14067. @item scale
  14068. Specify scale used for calculating intensity color values.
  14069. It accepts the following values:
  14070. @table @samp
  14071. @item lin
  14072. linear
  14073. @item sqrt
  14074. square root, default
  14075. @item cbrt
  14076. cubic root
  14077. @item log
  14078. logarithmic
  14079. @item 4thrt
  14080. 4th root
  14081. @item 5thrt
  14082. 5th root
  14083. @end table
  14084. Default value is @samp{sqrt}.
  14085. @item saturation
  14086. Set saturation modifier for displayed colors. Negative values provide
  14087. alternative color scheme. @code{0} is no saturation at all.
  14088. Saturation must be in [-10.0, 10.0] range.
  14089. Default value is @code{1}.
  14090. @item win_func
  14091. Set window function.
  14092. It accepts the following values:
  14093. @table @samp
  14094. @item rect
  14095. @item bartlett
  14096. @item hann
  14097. @item hanning
  14098. @item hamming
  14099. @item blackman
  14100. @item welch
  14101. @item flattop
  14102. @item bharris
  14103. @item bnuttall
  14104. @item bhann
  14105. @item sine
  14106. @item nuttall
  14107. @item lanczos
  14108. @item gauss
  14109. @item tukey
  14110. @item dolph
  14111. @item cauchy
  14112. @item parzen
  14113. @item poisson
  14114. @end table
  14115. Default value is @code{hann}.
  14116. @item orientation
  14117. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14118. @code{horizontal}. Default is @code{vertical}.
  14119. @item overlap
  14120. Set ratio of overlap window. Default value is @code{0}.
  14121. When value is @code{1} overlap is set to recommended size for specific
  14122. window function currently used.
  14123. @item gain
  14124. Set scale gain for calculating intensity color values.
  14125. Default value is @code{1}.
  14126. @item data
  14127. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14128. @item rotation
  14129. Set color rotation, must be in [-1.0, 1.0] range.
  14130. Default value is @code{0}.
  14131. @end table
  14132. The usage is very similar to the showwaves filter; see the examples in that
  14133. section.
  14134. @subsection Examples
  14135. @itemize
  14136. @item
  14137. Large window with logarithmic color scaling:
  14138. @example
  14139. showspectrum=s=1280x480:scale=log
  14140. @end example
  14141. @item
  14142. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14143. @example
  14144. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14145. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14146. @end example
  14147. @end itemize
  14148. @section showspectrumpic
  14149. Convert input audio to a single video frame, representing the audio frequency
  14150. spectrum.
  14151. The filter accepts the following options:
  14152. @table @option
  14153. @item size, s
  14154. Specify the video size for the output. For the syntax of this option, check the
  14155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14156. Default value is @code{4096x2048}.
  14157. @item mode
  14158. Specify display mode.
  14159. It accepts the following values:
  14160. @table @samp
  14161. @item combined
  14162. all channels are displayed in the same row
  14163. @item separate
  14164. all channels are displayed in separate rows
  14165. @end table
  14166. Default value is @samp{combined}.
  14167. @item color
  14168. Specify display color mode.
  14169. It accepts the following values:
  14170. @table @samp
  14171. @item channel
  14172. each channel is displayed in a separate color
  14173. @item intensity
  14174. each channel is displayed using the same color scheme
  14175. @item rainbow
  14176. each channel is displayed using the rainbow color scheme
  14177. @item moreland
  14178. each channel is displayed using the moreland color scheme
  14179. @item nebulae
  14180. each channel is displayed using the nebulae color scheme
  14181. @item fire
  14182. each channel is displayed using the fire color scheme
  14183. @item fiery
  14184. each channel is displayed using the fiery color scheme
  14185. @item fruit
  14186. each channel is displayed using the fruit color scheme
  14187. @item cool
  14188. each channel is displayed using the cool color scheme
  14189. @end table
  14190. Default value is @samp{intensity}.
  14191. @item scale
  14192. Specify scale used for calculating intensity color values.
  14193. It accepts the following values:
  14194. @table @samp
  14195. @item lin
  14196. linear
  14197. @item sqrt
  14198. square root, default
  14199. @item cbrt
  14200. cubic root
  14201. @item log
  14202. logarithmic
  14203. @item 4thrt
  14204. 4th root
  14205. @item 5thrt
  14206. 5th root
  14207. @end table
  14208. Default value is @samp{log}.
  14209. @item saturation
  14210. Set saturation modifier for displayed colors. Negative values provide
  14211. alternative color scheme. @code{0} is no saturation at all.
  14212. Saturation must be in [-10.0, 10.0] range.
  14213. Default value is @code{1}.
  14214. @item win_func
  14215. Set window function.
  14216. It accepts the following values:
  14217. @table @samp
  14218. @item rect
  14219. @item bartlett
  14220. @item hann
  14221. @item hanning
  14222. @item hamming
  14223. @item blackman
  14224. @item welch
  14225. @item flattop
  14226. @item bharris
  14227. @item bnuttall
  14228. @item bhann
  14229. @item sine
  14230. @item nuttall
  14231. @item lanczos
  14232. @item gauss
  14233. @item tukey
  14234. @item dolph
  14235. @item cauchy
  14236. @item parzen
  14237. @item poisson
  14238. @end table
  14239. Default value is @code{hann}.
  14240. @item orientation
  14241. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14242. @code{horizontal}. Default is @code{vertical}.
  14243. @item gain
  14244. Set scale gain for calculating intensity color values.
  14245. Default value is @code{1}.
  14246. @item legend
  14247. Draw time and frequency axes and legends. Default is enabled.
  14248. @item rotation
  14249. Set color rotation, must be in [-1.0, 1.0] range.
  14250. Default value is @code{0}.
  14251. @end table
  14252. @subsection Examples
  14253. @itemize
  14254. @item
  14255. Extract an audio spectrogram of a whole audio track
  14256. in a 1024x1024 picture using @command{ffmpeg}:
  14257. @example
  14258. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14259. @end example
  14260. @end itemize
  14261. @section showvolume
  14262. Convert input audio volume to a video output.
  14263. The filter accepts the following options:
  14264. @table @option
  14265. @item rate, r
  14266. Set video rate.
  14267. @item b
  14268. Set border width, allowed range is [0, 5]. Default is 1.
  14269. @item w
  14270. Set channel width, allowed range is [80, 8192]. Default is 400.
  14271. @item h
  14272. Set channel height, allowed range is [1, 900]. Default is 20.
  14273. @item f
  14274. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14275. @item c
  14276. Set volume color expression.
  14277. The expression can use the following variables:
  14278. @table @option
  14279. @item VOLUME
  14280. Current max volume of channel in dB.
  14281. @item PEAK
  14282. Current peak.
  14283. @item CHANNEL
  14284. Current channel number, starting from 0.
  14285. @end table
  14286. @item t
  14287. If set, displays channel names. Default is enabled.
  14288. @item v
  14289. If set, displays volume values. Default is enabled.
  14290. @item o
  14291. Set orientation, can be @code{horizontal} or @code{vertical},
  14292. default is @code{horizontal}.
  14293. @item s
  14294. Set step size, allowed range s [0, 5]. Default is 0, which means
  14295. step is disabled.
  14296. @end table
  14297. @section showwaves
  14298. Convert input audio to a video output, representing the samples waves.
  14299. The filter accepts the following options:
  14300. @table @option
  14301. @item size, s
  14302. Specify the video size for the output. For the syntax of this option, check the
  14303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14304. Default value is @code{600x240}.
  14305. @item mode
  14306. Set display mode.
  14307. Available values are:
  14308. @table @samp
  14309. @item point
  14310. Draw a point for each sample.
  14311. @item line
  14312. Draw a vertical line for each sample.
  14313. @item p2p
  14314. Draw a point for each sample and a line between them.
  14315. @item cline
  14316. Draw a centered vertical line for each sample.
  14317. @end table
  14318. Default value is @code{point}.
  14319. @item n
  14320. Set the number of samples which are printed on the same column. A
  14321. larger value will decrease the frame rate. Must be a positive
  14322. integer. This option can be set only if the value for @var{rate}
  14323. is not explicitly specified.
  14324. @item rate, r
  14325. Set the (approximate) output frame rate. This is done by setting the
  14326. option @var{n}. Default value is "25".
  14327. @item split_channels
  14328. Set if channels should be drawn separately or overlap. Default value is 0.
  14329. @item colors
  14330. Set colors separated by '|' which are going to be used for drawing of each channel.
  14331. @item scale
  14332. Set amplitude scale.
  14333. Available values are:
  14334. @table @samp
  14335. @item lin
  14336. Linear.
  14337. @item log
  14338. Logarithmic.
  14339. @item sqrt
  14340. Square root.
  14341. @item cbrt
  14342. Cubic root.
  14343. @end table
  14344. Default is linear.
  14345. @end table
  14346. @subsection Examples
  14347. @itemize
  14348. @item
  14349. Output the input file audio and the corresponding video representation
  14350. at the same time:
  14351. @example
  14352. amovie=a.mp3,asplit[out0],showwaves[out1]
  14353. @end example
  14354. @item
  14355. Create a synthetic signal and show it with showwaves, forcing a
  14356. frame rate of 30 frames per second:
  14357. @example
  14358. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14359. @end example
  14360. @end itemize
  14361. @section showwavespic
  14362. Convert input audio to a single video frame, representing the samples waves.
  14363. The filter accepts the following options:
  14364. @table @option
  14365. @item size, s
  14366. Specify the video size for the output. For the syntax of this option, check the
  14367. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14368. Default value is @code{600x240}.
  14369. @item split_channels
  14370. Set if channels should be drawn separately or overlap. Default value is 0.
  14371. @item colors
  14372. Set colors separated by '|' which are going to be used for drawing of each channel.
  14373. @item scale
  14374. Set amplitude scale.
  14375. Available values are:
  14376. @table @samp
  14377. @item lin
  14378. Linear.
  14379. @item log
  14380. Logarithmic.
  14381. @item sqrt
  14382. Square root.
  14383. @item cbrt
  14384. Cubic root.
  14385. @end table
  14386. Default is linear.
  14387. @end table
  14388. @subsection Examples
  14389. @itemize
  14390. @item
  14391. Extract a channel split representation of the wave form of a whole audio track
  14392. in a 1024x800 picture using @command{ffmpeg}:
  14393. @example
  14394. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14395. @end example
  14396. @end itemize
  14397. @section sidedata, asidedata
  14398. Delete frame side data, or select frames based on it.
  14399. This filter accepts the following options:
  14400. @table @option
  14401. @item mode
  14402. Set mode of operation of the filter.
  14403. Can be one of the following:
  14404. @table @samp
  14405. @item select
  14406. Select every frame with side data of @code{type}.
  14407. @item delete
  14408. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14409. data in the frame.
  14410. @end table
  14411. @item type
  14412. Set side data type used with all modes. Must be set for @code{select} mode. For
  14413. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14414. in @file{libavutil/frame.h}. For example, to choose
  14415. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14416. @end table
  14417. @section spectrumsynth
  14418. Sythesize audio from 2 input video spectrums, first input stream represents
  14419. magnitude across time and second represents phase across time.
  14420. The filter will transform from frequency domain as displayed in videos back
  14421. to time domain as presented in audio output.
  14422. This filter is primarily created for reversing processed @ref{showspectrum}
  14423. filter outputs, but can synthesize sound from other spectrograms too.
  14424. But in such case results are going to be poor if the phase data is not
  14425. available, because in such cases phase data need to be recreated, usually
  14426. its just recreated from random noise.
  14427. For best results use gray only output (@code{channel} color mode in
  14428. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14429. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14430. @code{data} option. Inputs videos should generally use @code{fullframe}
  14431. slide mode as that saves resources needed for decoding video.
  14432. The filter accepts the following options:
  14433. @table @option
  14434. @item sample_rate
  14435. Specify sample rate of output audio, the sample rate of audio from which
  14436. spectrum was generated may differ.
  14437. @item channels
  14438. Set number of channels represented in input video spectrums.
  14439. @item scale
  14440. Set scale which was used when generating magnitude input spectrum.
  14441. Can be @code{lin} or @code{log}. Default is @code{log}.
  14442. @item slide
  14443. Set slide which was used when generating inputs spectrums.
  14444. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14445. Default is @code{fullframe}.
  14446. @item win_func
  14447. Set window function used for resynthesis.
  14448. @item overlap
  14449. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14450. which means optimal overlap for selected window function will be picked.
  14451. @item orientation
  14452. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14453. Default is @code{vertical}.
  14454. @end table
  14455. @subsection Examples
  14456. @itemize
  14457. @item
  14458. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14459. then resynthesize videos back to audio with spectrumsynth:
  14460. @example
  14461. 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
  14462. 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
  14463. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14464. @end example
  14465. @end itemize
  14466. @section split, asplit
  14467. Split input into several identical outputs.
  14468. @code{asplit} works with audio input, @code{split} with video.
  14469. The filter accepts a single parameter which specifies the number of outputs. If
  14470. unspecified, it defaults to 2.
  14471. @subsection Examples
  14472. @itemize
  14473. @item
  14474. Create two separate outputs from the same input:
  14475. @example
  14476. [in] split [out0][out1]
  14477. @end example
  14478. @item
  14479. To create 3 or more outputs, you need to specify the number of
  14480. outputs, like in:
  14481. @example
  14482. [in] asplit=3 [out0][out1][out2]
  14483. @end example
  14484. @item
  14485. Create two separate outputs from the same input, one cropped and
  14486. one padded:
  14487. @example
  14488. [in] split [splitout1][splitout2];
  14489. [splitout1] crop=100:100:0:0 [cropout];
  14490. [splitout2] pad=200:200:100:100 [padout];
  14491. @end example
  14492. @item
  14493. Create 5 copies of the input audio with @command{ffmpeg}:
  14494. @example
  14495. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14496. @end example
  14497. @end itemize
  14498. @section zmq, azmq
  14499. Receive commands sent through a libzmq client, and forward them to
  14500. filters in the filtergraph.
  14501. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14502. must be inserted between two video filters, @code{azmq} between two
  14503. audio filters.
  14504. To enable these filters you need to install the libzmq library and
  14505. headers and configure FFmpeg with @code{--enable-libzmq}.
  14506. For more information about libzmq see:
  14507. @url{http://www.zeromq.org/}
  14508. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14509. receives messages sent through a network interface defined by the
  14510. @option{bind_address} option.
  14511. The received message must be in the form:
  14512. @example
  14513. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14514. @end example
  14515. @var{TARGET} specifies the target of the command, usually the name of
  14516. the filter class or a specific filter instance name.
  14517. @var{COMMAND} specifies the name of the command for the target filter.
  14518. @var{ARG} is optional and specifies the optional argument list for the
  14519. given @var{COMMAND}.
  14520. Upon reception, the message is processed and the corresponding command
  14521. is injected into the filtergraph. Depending on the result, the filter
  14522. will send a reply to the client, adopting the format:
  14523. @example
  14524. @var{ERROR_CODE} @var{ERROR_REASON}
  14525. @var{MESSAGE}
  14526. @end example
  14527. @var{MESSAGE} is optional.
  14528. @subsection Examples
  14529. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14530. be used to send commands processed by these filters.
  14531. Consider the following filtergraph generated by @command{ffplay}
  14532. @example
  14533. ffplay -dumpgraph 1 -f lavfi "
  14534. color=s=100x100:c=red [l];
  14535. color=s=100x100:c=blue [r];
  14536. nullsrc=s=200x100, zmq [bg];
  14537. [bg][l] overlay [bg+l];
  14538. [bg+l][r] overlay=x=100 "
  14539. @end example
  14540. To change the color of the left side of the video, the following
  14541. command can be used:
  14542. @example
  14543. echo Parsed_color_0 c yellow | tools/zmqsend
  14544. @end example
  14545. To change the right side:
  14546. @example
  14547. echo Parsed_color_1 c pink | tools/zmqsend
  14548. @end example
  14549. @c man end MULTIMEDIA FILTERS
  14550. @chapter Multimedia Sources
  14551. @c man begin MULTIMEDIA SOURCES
  14552. Below is a description of the currently available multimedia sources.
  14553. @section amovie
  14554. This is the same as @ref{movie} source, except it selects an audio
  14555. stream by default.
  14556. @anchor{movie}
  14557. @section movie
  14558. Read audio and/or video stream(s) from a movie container.
  14559. It accepts the following parameters:
  14560. @table @option
  14561. @item filename
  14562. The name of the resource to read (not necessarily a file; it can also be a
  14563. device or a stream accessed through some protocol).
  14564. @item format_name, f
  14565. Specifies the format assumed for the movie to read, and can be either
  14566. the name of a container or an input device. If not specified, the
  14567. format is guessed from @var{movie_name} or by probing.
  14568. @item seek_point, sp
  14569. Specifies the seek point in seconds. The frames will be output
  14570. starting from this seek point. The parameter is evaluated with
  14571. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14572. postfix. The default value is "0".
  14573. @item streams, s
  14574. Specifies the streams to read. Several streams can be specified,
  14575. separated by "+". The source will then have as many outputs, in the
  14576. same order. The syntax is explained in the ``Stream specifiers''
  14577. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14578. respectively the default (best suited) video and audio stream. Default
  14579. is "dv", or "da" if the filter is called as "amovie".
  14580. @item stream_index, si
  14581. Specifies the index of the video stream to read. If the value is -1,
  14582. the most suitable video stream will be automatically selected. The default
  14583. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14584. audio instead of video.
  14585. @item loop
  14586. Specifies how many times to read the stream in sequence.
  14587. If the value is 0, the stream will be looped infinitely.
  14588. Default value is "1".
  14589. Note that when the movie is looped the source timestamps are not
  14590. changed, so it will generate non monotonically increasing timestamps.
  14591. @item discontinuity
  14592. Specifies the time difference between frames above which the point is
  14593. considered a timestamp discontinuity which is removed by adjusting the later
  14594. timestamps.
  14595. @end table
  14596. It allows overlaying a second video on top of the main input of
  14597. a filtergraph, as shown in this graph:
  14598. @example
  14599. input -----------> deltapts0 --> overlay --> output
  14600. ^
  14601. |
  14602. movie --> scale--> deltapts1 -------+
  14603. @end example
  14604. @subsection Examples
  14605. @itemize
  14606. @item
  14607. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14608. on top of the input labelled "in":
  14609. @example
  14610. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14611. [in] setpts=PTS-STARTPTS [main];
  14612. [main][over] overlay=16:16 [out]
  14613. @end example
  14614. @item
  14615. Read from a video4linux2 device, and overlay it on top of the input
  14616. labelled "in":
  14617. @example
  14618. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14619. [in] setpts=PTS-STARTPTS [main];
  14620. [main][over] overlay=16:16 [out]
  14621. @end example
  14622. @item
  14623. Read the first video stream and the audio stream with id 0x81 from
  14624. dvd.vob; the video is connected to the pad named "video" and the audio is
  14625. connected to the pad named "audio":
  14626. @example
  14627. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14628. @end example
  14629. @end itemize
  14630. @subsection Commands
  14631. Both movie and amovie support the following commands:
  14632. @table @option
  14633. @item seek
  14634. Perform seek using "av_seek_frame".
  14635. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14636. @itemize
  14637. @item
  14638. @var{stream_index}: If stream_index is -1, a default
  14639. stream is selected, and @var{timestamp} is automatically converted
  14640. from AV_TIME_BASE units to the stream specific time_base.
  14641. @item
  14642. @var{timestamp}: Timestamp in AVStream.time_base units
  14643. or, if no stream is specified, in AV_TIME_BASE units.
  14644. @item
  14645. @var{flags}: Flags which select direction and seeking mode.
  14646. @end itemize
  14647. @item get_duration
  14648. Get movie duration in AV_TIME_BASE units.
  14649. @end table
  14650. @c man end MULTIMEDIA SOURCES