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.

18701 lines
496KB

  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
  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. and for Overall:
  1251. DC_offset
  1252. Min_level
  1253. Max_level
  1254. Min_difference
  1255. Max_difference
  1256. Mean_difference
  1257. RMS_difference
  1258. Peak_level
  1259. RMS_level
  1260. RMS_peak
  1261. RMS_trough
  1262. Flat_factor
  1263. Peak_count
  1264. Bit_depth
  1265. Number_of_samples
  1266. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1267. this @code{lavfi.astats.Overall.Peak_count}.
  1268. For description what each key means read below.
  1269. @item reset
  1270. Set number of frame after which stats are going to be recalculated.
  1271. Default is disabled.
  1272. @end table
  1273. A description of each shown parameter follows:
  1274. @table @option
  1275. @item DC offset
  1276. Mean amplitude displacement from zero.
  1277. @item Min level
  1278. Minimal sample level.
  1279. @item Max level
  1280. Maximal sample level.
  1281. @item Min difference
  1282. Minimal difference between two consecutive samples.
  1283. @item Max difference
  1284. Maximal difference between two consecutive samples.
  1285. @item Mean difference
  1286. Mean difference between two consecutive samples.
  1287. The average of each difference between two consecutive samples.
  1288. @item RMS difference
  1289. Root Mean Square difference between two consecutive samples.
  1290. @item Peak level dB
  1291. @item RMS level dB
  1292. Standard peak and RMS level measured in dBFS.
  1293. @item RMS peak dB
  1294. @item RMS trough dB
  1295. Peak and trough values for RMS level measured over a short window.
  1296. @item Crest factor
  1297. Standard ratio of peak to RMS level (note: not in dB).
  1298. @item Flat factor
  1299. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1300. (i.e. either @var{Min level} or @var{Max level}).
  1301. @item Peak count
  1302. Number of occasions (not the number of samples) that the signal attained either
  1303. @var{Min level} or @var{Max level}.
  1304. @item Bit depth
  1305. Overall bit depth of audio. Number of bits used for each sample.
  1306. @end table
  1307. @section atempo
  1308. Adjust audio tempo.
  1309. The filter accepts exactly one parameter, the audio tempo. If not
  1310. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1311. be in the [0.5, 2.0] range.
  1312. @subsection Examples
  1313. @itemize
  1314. @item
  1315. Slow down audio to 80% tempo:
  1316. @example
  1317. atempo=0.8
  1318. @end example
  1319. @item
  1320. To speed up audio to 125% tempo:
  1321. @example
  1322. atempo=1.25
  1323. @end example
  1324. @end itemize
  1325. @section atrim
  1326. Trim the input so that the output contains one continuous subpart of the input.
  1327. It accepts the following parameters:
  1328. @table @option
  1329. @item start
  1330. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1331. sample with the timestamp @var{start} will be the first sample in the output.
  1332. @item end
  1333. Specify time of the first audio sample that will be dropped, i.e. the
  1334. audio sample immediately preceding the one with the timestamp @var{end} will be
  1335. the last sample in the output.
  1336. @item start_pts
  1337. Same as @var{start}, except this option sets the start timestamp in samples
  1338. instead of seconds.
  1339. @item end_pts
  1340. Same as @var{end}, except this option sets the end timestamp in samples instead
  1341. of seconds.
  1342. @item duration
  1343. The maximum duration of the output in seconds.
  1344. @item start_sample
  1345. The number of the first sample that should be output.
  1346. @item end_sample
  1347. The number of the first sample that should be dropped.
  1348. @end table
  1349. @option{start}, @option{end}, and @option{duration} are expressed as time
  1350. duration specifications; see
  1351. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1352. Note that the first two sets of the start/end options and the @option{duration}
  1353. option look at the frame timestamp, while the _sample options simply count the
  1354. samples that pass through the filter. So start/end_pts and start/end_sample will
  1355. give different results when the timestamps are wrong, inexact or do not start at
  1356. zero. Also note that this filter does not modify the timestamps. If you wish
  1357. to have the output timestamps start at zero, insert the asetpts filter after the
  1358. atrim filter.
  1359. If multiple start or end options are set, this filter tries to be greedy and
  1360. keep all samples that match at least one of the specified constraints. To keep
  1361. only the part that matches all the constraints at once, chain multiple atrim
  1362. filters.
  1363. The defaults are such that all the input is kept. So it is possible to set e.g.
  1364. just the end values to keep everything before the specified time.
  1365. Examples:
  1366. @itemize
  1367. @item
  1368. Drop everything except the second minute of input:
  1369. @example
  1370. ffmpeg -i INPUT -af atrim=60:120
  1371. @end example
  1372. @item
  1373. Keep only the first 1000 samples:
  1374. @example
  1375. ffmpeg -i INPUT -af atrim=end_sample=1000
  1376. @end example
  1377. @end itemize
  1378. @section bandpass
  1379. Apply a two-pole Butterworth band-pass filter with central
  1380. frequency @var{frequency}, and (3dB-point) band-width width.
  1381. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1382. instead of the default: constant 0dB peak gain.
  1383. The filter roll off at 6dB per octave (20dB per decade).
  1384. The filter accepts the following options:
  1385. @table @option
  1386. @item frequency, f
  1387. Set the filter's central frequency. Default is @code{3000}.
  1388. @item csg
  1389. Constant skirt gain if set to 1. Defaults to 0.
  1390. @item width_type
  1391. Set method to specify band-width of filter.
  1392. @table @option
  1393. @item h
  1394. Hz
  1395. @item q
  1396. Q-Factor
  1397. @item o
  1398. octave
  1399. @item s
  1400. slope
  1401. @end table
  1402. @item width, w
  1403. Specify the band-width of a filter in width_type units.
  1404. @item channels, c
  1405. Specify which channels to filter, by default all available are filtered.
  1406. @end table
  1407. @section bandreject
  1408. Apply a two-pole Butterworth band-reject filter with central
  1409. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1410. The filter roll off at 6dB per octave (20dB per decade).
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item frequency, f
  1414. Set the filter's central frequency. Default is @code{3000}.
  1415. @item width_type
  1416. Set method to specify band-width of filter.
  1417. @table @option
  1418. @item h
  1419. Hz
  1420. @item q
  1421. Q-Factor
  1422. @item o
  1423. octave
  1424. @item s
  1425. slope
  1426. @end table
  1427. @item width, w
  1428. Specify the band-width of a filter in width_type units.
  1429. @item channels, c
  1430. Specify which channels to filter, by default all available are filtered.
  1431. @end table
  1432. @section bass
  1433. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1434. shelving filter with a response similar to that of a standard
  1435. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1436. The filter accepts the following options:
  1437. @table @option
  1438. @item gain, g
  1439. Give the gain at 0 Hz. Its useful range is about -20
  1440. (for a large cut) to +20 (for a large boost).
  1441. Beware of clipping when using a positive gain.
  1442. @item frequency, f
  1443. Set the filter's central frequency and so can be used
  1444. to extend or reduce the frequency range to be boosted or cut.
  1445. The default value is @code{100} Hz.
  1446. @item width_type
  1447. Set method to specify band-width of filter.
  1448. @table @option
  1449. @item h
  1450. Hz
  1451. @item q
  1452. Q-Factor
  1453. @item o
  1454. octave
  1455. @item s
  1456. slope
  1457. @end table
  1458. @item width, w
  1459. Determine how steep is the filter's shelf transition.
  1460. @item channels, c
  1461. Specify which channels to filter, by default all available are filtered.
  1462. @end table
  1463. @section biquad
  1464. Apply a biquad IIR filter with the given coefficients.
  1465. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1466. are the numerator and denominator coefficients respectively.
  1467. and @var{channels}, @var{c} specify which channels to filter, by default all
  1468. available are filtered.
  1469. @section bs2b
  1470. Bauer stereo to binaural transformation, which improves headphone listening of
  1471. stereo audio records.
  1472. To enable compilation of this filter you need to configure FFmpeg with
  1473. @code{--enable-libbs2b}.
  1474. It accepts the following parameters:
  1475. @table @option
  1476. @item profile
  1477. Pre-defined crossfeed level.
  1478. @table @option
  1479. @item default
  1480. Default level (fcut=700, feed=50).
  1481. @item cmoy
  1482. Chu Moy circuit (fcut=700, feed=60).
  1483. @item jmeier
  1484. Jan Meier circuit (fcut=650, feed=95).
  1485. @end table
  1486. @item fcut
  1487. Cut frequency (in Hz).
  1488. @item feed
  1489. Feed level (in Hz).
  1490. @end table
  1491. @section channelmap
  1492. Remap input channels to new locations.
  1493. It accepts the following parameters:
  1494. @table @option
  1495. @item map
  1496. Map channels from input to output. The argument is a '|'-separated list of
  1497. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1498. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1499. channel (e.g. FL for front left) or its index in the input channel layout.
  1500. @var{out_channel} is the name of the output channel or its index in the output
  1501. channel layout. If @var{out_channel} is not given then it is implicitly an
  1502. index, starting with zero and increasing by one for each mapping.
  1503. @item channel_layout
  1504. The channel layout of the output stream.
  1505. @end table
  1506. If no mapping is present, the filter will implicitly map input channels to
  1507. output channels, preserving indices.
  1508. For example, assuming a 5.1+downmix input MOV file,
  1509. @example
  1510. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1511. @end example
  1512. will create an output WAV file tagged as stereo from the downmix channels of
  1513. the input.
  1514. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1515. @example
  1516. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1517. @end example
  1518. @section channelsplit
  1519. Split each channel from an input audio stream into a separate output stream.
  1520. It accepts the following parameters:
  1521. @table @option
  1522. @item channel_layout
  1523. The channel layout of the input stream. The default is "stereo".
  1524. @end table
  1525. For example, assuming a stereo input MP3 file,
  1526. @example
  1527. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1528. @end example
  1529. will create an output Matroska file with two audio streams, one containing only
  1530. the left channel and the other the right channel.
  1531. Split a 5.1 WAV file into per-channel files:
  1532. @example
  1533. ffmpeg -i in.wav -filter_complex
  1534. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1535. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1536. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1537. side_right.wav
  1538. @end example
  1539. @section chorus
  1540. Add a chorus effect to the audio.
  1541. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1542. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1543. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1544. The modulation depth defines the range the modulated delay is played before or after
  1545. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1546. sound tuned around the original one, like in a chorus where some vocals are slightly
  1547. off key.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item in_gain
  1551. Set input gain. Default is 0.4.
  1552. @item out_gain
  1553. Set output gain. Default is 0.4.
  1554. @item delays
  1555. Set delays. A typical delay is around 40ms to 60ms.
  1556. @item decays
  1557. Set decays.
  1558. @item speeds
  1559. Set speeds.
  1560. @item depths
  1561. Set depths.
  1562. @end table
  1563. @subsection Examples
  1564. @itemize
  1565. @item
  1566. A single delay:
  1567. @example
  1568. chorus=0.7:0.9:55:0.4:0.25:2
  1569. @end example
  1570. @item
  1571. Two delays:
  1572. @example
  1573. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1574. @end example
  1575. @item
  1576. Fuller sounding chorus with three delays:
  1577. @example
  1578. 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
  1579. @end example
  1580. @end itemize
  1581. @section compand
  1582. Compress or expand the audio's dynamic range.
  1583. It accepts the following parameters:
  1584. @table @option
  1585. @item attacks
  1586. @item decays
  1587. A list of times in seconds for each channel over which the instantaneous level
  1588. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1589. increase of volume and @var{decays} refers to decrease of volume. For most
  1590. situations, the attack time (response to the audio getting louder) should be
  1591. shorter than the decay time, because the human ear is more sensitive to sudden
  1592. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1593. a typical value for decay is 0.8 seconds.
  1594. If specified number of attacks & decays is lower than number of channels, the last
  1595. set attack/decay will be used for all remaining channels.
  1596. @item points
  1597. A list of points for the transfer function, specified in dB relative to the
  1598. maximum possible signal amplitude. Each key points list must be defined using
  1599. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1600. @code{x0/y0 x1/y1 x2/y2 ....}
  1601. The input values must be in strictly increasing order but the transfer function
  1602. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1603. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1604. function are @code{-70/-70|-60/-20|1/0}.
  1605. @item soft-knee
  1606. Set the curve radius in dB for all joints. It defaults to 0.01.
  1607. @item gain
  1608. Set the additional gain in dB to be applied at all points on the transfer
  1609. function. This allows for easy adjustment of the overall gain.
  1610. It defaults to 0.
  1611. @item volume
  1612. Set an initial volume, in dB, to be assumed for each channel when filtering
  1613. starts. This permits the user to supply a nominal level initially, so that, for
  1614. example, a very large gain is not applied to initial signal levels before the
  1615. companding has begun to operate. A typical value for audio which is initially
  1616. quiet is -90 dB. It defaults to 0.
  1617. @item delay
  1618. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1619. delayed before being fed to the volume adjuster. Specifying a delay
  1620. approximately equal to the attack/decay times allows the filter to effectively
  1621. operate in predictive rather than reactive mode. It defaults to 0.
  1622. @end table
  1623. @subsection Examples
  1624. @itemize
  1625. @item
  1626. Make music with both quiet and loud passages suitable for listening to in a
  1627. noisy environment:
  1628. @example
  1629. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1630. @end example
  1631. Another example for audio with whisper and explosion parts:
  1632. @example
  1633. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1634. @end example
  1635. @item
  1636. A noise gate for when the noise is at a lower level than the signal:
  1637. @example
  1638. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1639. @end example
  1640. @item
  1641. Here is another noise gate, this time for when the noise is at a higher level
  1642. than the signal (making it, in some ways, similar to squelch):
  1643. @example
  1644. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1645. @end example
  1646. @item
  1647. 2:1 compression starting at -6dB:
  1648. @example
  1649. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1650. @end example
  1651. @item
  1652. 2:1 compression starting at -9dB:
  1653. @example
  1654. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1655. @end example
  1656. @item
  1657. 2:1 compression starting at -12dB:
  1658. @example
  1659. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1660. @end example
  1661. @item
  1662. 2:1 compression starting at -18dB:
  1663. @example
  1664. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1665. @end example
  1666. @item
  1667. 3:1 compression starting at -15dB:
  1668. @example
  1669. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1670. @end example
  1671. @item
  1672. Compressor/Gate:
  1673. @example
  1674. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1675. @end example
  1676. @item
  1677. Expander:
  1678. @example
  1679. 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
  1680. @end example
  1681. @item
  1682. Hard limiter at -6dB:
  1683. @example
  1684. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1685. @end example
  1686. @item
  1687. Hard limiter at -12dB:
  1688. @example
  1689. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1690. @end example
  1691. @item
  1692. Hard noise gate at -35 dB:
  1693. @example
  1694. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1695. @end example
  1696. @item
  1697. Soft limiter:
  1698. @example
  1699. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1700. @end example
  1701. @end itemize
  1702. @section compensationdelay
  1703. Compensation Delay Line is a metric based delay to compensate differing
  1704. positions of microphones or speakers.
  1705. For example, you have recorded guitar with two microphones placed in
  1706. different location. Because the front of sound wave has fixed speed in
  1707. normal conditions, the phasing of microphones can vary and depends on
  1708. their location and interposition. The best sound mix can be achieved when
  1709. these microphones are in phase (synchronized). Note that distance of
  1710. ~30 cm between microphones makes one microphone to capture signal in
  1711. antiphase to another microphone. That makes the final mix sounding moody.
  1712. This filter helps to solve phasing problems by adding different delays
  1713. to each microphone track and make them synchronized.
  1714. The best result can be reached when you take one track as base and
  1715. synchronize other tracks one by one with it.
  1716. Remember that synchronization/delay tolerance depends on sample rate, too.
  1717. Higher sample rates will give more tolerance.
  1718. It accepts the following parameters:
  1719. @table @option
  1720. @item mm
  1721. Set millimeters distance. This is compensation distance for fine tuning.
  1722. Default is 0.
  1723. @item cm
  1724. Set cm distance. This is compensation distance for tightening distance setup.
  1725. Default is 0.
  1726. @item m
  1727. Set meters distance. This is compensation distance for hard distance setup.
  1728. Default is 0.
  1729. @item dry
  1730. Set dry amount. Amount of unprocessed (dry) signal.
  1731. Default is 0.
  1732. @item wet
  1733. Set wet amount. Amount of processed (wet) signal.
  1734. Default is 1.
  1735. @item temp
  1736. Set temperature degree in Celsius. This is the temperature of the environment.
  1737. Default is 20.
  1738. @end table
  1739. @section crossfeed
  1740. Apply headphone crossfeed filter.
  1741. Crossfeed is the process of blending the left and right channels of stereo
  1742. audio recording.
  1743. It is mainly used to reduce extreme stereo separation of low frequencies.
  1744. The intent is to produce more speaker like sound to the listener.
  1745. The filter accepts the following options:
  1746. @table @option
  1747. @item strength
  1748. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1749. This sets gain of low shelf filter for side part of stereo image.
  1750. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1751. @item range
  1752. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1753. This sets cut off frequency of low shelf filter. Default is cut off near
  1754. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1755. @item level_in
  1756. Set input gain. Default is 0.9.
  1757. @item level_out
  1758. Set output gain. Default is 1.
  1759. @end table
  1760. @section crystalizer
  1761. Simple algorithm to expand audio dynamic range.
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item i
  1765. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1766. (unchanged sound) to 10.0 (maximum effect).
  1767. @item c
  1768. Enable clipping. By default is enabled.
  1769. @end table
  1770. @section dcshift
  1771. Apply a DC shift to the audio.
  1772. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1773. in the recording chain) from the audio. The effect of a DC offset is reduced
  1774. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1775. a signal has a DC offset.
  1776. @table @option
  1777. @item shift
  1778. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1779. the audio.
  1780. @item limitergain
  1781. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1782. used to prevent clipping.
  1783. @end table
  1784. @section dynaudnorm
  1785. Dynamic Audio Normalizer.
  1786. This filter applies a certain amount of gain to the input audio in order
  1787. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1788. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1789. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1790. This allows for applying extra gain to the "quiet" sections of the audio
  1791. while avoiding distortions or clipping the "loud" sections. In other words:
  1792. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1793. sections, in the sense that the volume of each section is brought to the
  1794. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1795. this goal *without* applying "dynamic range compressing". It will retain 100%
  1796. of the dynamic range *within* each section of the audio file.
  1797. @table @option
  1798. @item f
  1799. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1800. Default is 500 milliseconds.
  1801. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1802. referred to as frames. This is required, because a peak magnitude has no
  1803. meaning for just a single sample value. Instead, we need to determine the
  1804. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1805. normalizer would simply use the peak magnitude of the complete file, the
  1806. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1807. frame. The length of a frame is specified in milliseconds. By default, the
  1808. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1809. been found to give good results with most files.
  1810. Note that the exact frame length, in number of samples, will be determined
  1811. automatically, based on the sampling rate of the individual input audio file.
  1812. @item g
  1813. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1814. number. Default is 31.
  1815. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1816. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1817. is specified in frames, centered around the current frame. For the sake of
  1818. simplicity, this must be an odd number. Consequently, the default value of 31
  1819. takes into account the current frame, as well as the 15 preceding frames and
  1820. the 15 subsequent frames. Using a larger window results in a stronger
  1821. smoothing effect and thus in less gain variation, i.e. slower gain
  1822. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1823. effect and thus in more gain variation, i.e. faster gain adaptation.
  1824. In other words, the more you increase this value, the more the Dynamic Audio
  1825. Normalizer will behave like a "traditional" normalization filter. On the
  1826. contrary, the more you decrease this value, the more the Dynamic Audio
  1827. Normalizer will behave like a dynamic range compressor.
  1828. @item p
  1829. Set the target peak value. This specifies the highest permissible magnitude
  1830. level for the normalized audio input. This filter will try to approach the
  1831. target peak magnitude as closely as possible, but at the same time it also
  1832. makes sure that the normalized signal will never exceed the peak magnitude.
  1833. A frame's maximum local gain factor is imposed directly by the target peak
  1834. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1835. It is not recommended to go above this value.
  1836. @item m
  1837. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1838. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1839. factor for each input frame, i.e. the maximum gain factor that does not
  1840. result in clipping or distortion. The maximum gain factor is determined by
  1841. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1842. additionally bounds the frame's maximum gain factor by a predetermined
  1843. (global) maximum gain factor. This is done in order to avoid excessive gain
  1844. factors in "silent" or almost silent frames. By default, the maximum gain
  1845. factor is 10.0, For most inputs the default value should be sufficient and
  1846. it usually is not recommended to increase this value. Though, for input
  1847. with an extremely low overall volume level, it may be necessary to allow even
  1848. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1849. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1850. Instead, a "sigmoid" threshold function will be applied. This way, the
  1851. gain factors will smoothly approach the threshold value, but never exceed that
  1852. value.
  1853. @item r
  1854. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1855. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1856. This means that the maximum local gain factor for each frame is defined
  1857. (only) by the frame's highest magnitude sample. This way, the samples can
  1858. be amplified as much as possible without exceeding the maximum signal
  1859. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1860. Normalizer can also take into account the frame's root mean square,
  1861. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1862. determine the power of a time-varying signal. It is therefore considered
  1863. that the RMS is a better approximation of the "perceived loudness" than
  1864. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1865. frames to a constant RMS value, a uniform "perceived loudness" can be
  1866. established. If a target RMS value has been specified, a frame's local gain
  1867. factor is defined as the factor that would result in exactly that RMS value.
  1868. Note, however, that the maximum local gain factor is still restricted by the
  1869. frame's highest magnitude sample, in order to prevent clipping.
  1870. @item n
  1871. Enable channels coupling. By default is enabled.
  1872. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1873. amount. This means the same gain factor will be applied to all channels, i.e.
  1874. the maximum possible gain factor is determined by the "loudest" channel.
  1875. However, in some recordings, it may happen that the volume of the different
  1876. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1877. In this case, this option can be used to disable the channel coupling. This way,
  1878. the gain factor will be determined independently for each channel, depending
  1879. only on the individual channel's highest magnitude sample. This allows for
  1880. harmonizing the volume of the different channels.
  1881. @item c
  1882. Enable DC bias correction. By default is disabled.
  1883. An audio signal (in the time domain) is a sequence of sample values.
  1884. In the Dynamic Audio Normalizer these sample values are represented in the
  1885. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1886. audio signal, or "waveform", should be centered around the zero point.
  1887. That means if we calculate the mean value of all samples in a file, or in a
  1888. single frame, then the result should be 0.0 or at least very close to that
  1889. value. If, however, there is a significant deviation of the mean value from
  1890. 0.0, in either positive or negative direction, this is referred to as a
  1891. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1892. Audio Normalizer provides optional DC bias correction.
  1893. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1894. the mean value, or "DC correction" offset, of each input frame and subtract
  1895. that value from all of the frame's sample values which ensures those samples
  1896. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1897. boundaries, the DC correction offset values will be interpolated smoothly
  1898. between neighbouring frames.
  1899. @item b
  1900. Enable alternative boundary mode. By default is disabled.
  1901. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1902. around each frame. This includes the preceding frames as well as the
  1903. subsequent frames. However, for the "boundary" frames, located at the very
  1904. beginning and at the very end of the audio file, not all neighbouring
  1905. frames are available. In particular, for the first few frames in the audio
  1906. file, the preceding frames are not known. And, similarly, for the last few
  1907. frames in the audio file, the subsequent frames are not known. Thus, the
  1908. question arises which gain factors should be assumed for the missing frames
  1909. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1910. to deal with this situation. The default boundary mode assumes a gain factor
  1911. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1912. "fade out" at the beginning and at the end of the input, respectively.
  1913. @item s
  1914. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1915. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1916. compression. This means that signal peaks will not be pruned and thus the
  1917. full dynamic range will be retained within each local neighbourhood. However,
  1918. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1919. normalization algorithm with a more "traditional" compression.
  1920. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1921. (thresholding) function. If (and only if) the compression feature is enabled,
  1922. all input frames will be processed by a soft knee thresholding function prior
  1923. to the actual normalization process. Put simply, the thresholding function is
  1924. going to prune all samples whose magnitude exceeds a certain threshold value.
  1925. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1926. value. Instead, the threshold value will be adjusted for each individual
  1927. frame.
  1928. In general, smaller parameters result in stronger compression, and vice versa.
  1929. Values below 3.0 are not recommended, because audible distortion may appear.
  1930. @end table
  1931. @section earwax
  1932. Make audio easier to listen to on headphones.
  1933. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1934. so that when listened to on headphones the stereo image is moved from
  1935. inside your head (standard for headphones) to outside and in front of
  1936. the listener (standard for speakers).
  1937. Ported from SoX.
  1938. @section equalizer
  1939. Apply a two-pole peaking equalisation (EQ) filter. With this
  1940. filter, the signal-level at and around a selected frequency can
  1941. be increased or decreased, whilst (unlike bandpass and bandreject
  1942. filters) that at all other frequencies is unchanged.
  1943. In order to produce complex equalisation curves, this filter can
  1944. be given several times, each with a different central frequency.
  1945. The filter accepts the following options:
  1946. @table @option
  1947. @item frequency, f
  1948. Set the filter's central frequency in Hz.
  1949. @item width_type
  1950. Set method to specify band-width of filter.
  1951. @table @option
  1952. @item h
  1953. Hz
  1954. @item q
  1955. Q-Factor
  1956. @item o
  1957. octave
  1958. @item s
  1959. slope
  1960. @end table
  1961. @item width, w
  1962. Specify the band-width of a filter in width_type units.
  1963. @item gain, g
  1964. Set the required gain or attenuation in dB.
  1965. Beware of clipping when using a positive gain.
  1966. @item channels, c
  1967. Specify which channels to filter, by default all available are filtered.
  1968. @end table
  1969. @subsection Examples
  1970. @itemize
  1971. @item
  1972. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1973. @example
  1974. equalizer=f=1000:width_type=h:width=200:g=-10
  1975. @end example
  1976. @item
  1977. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1978. @example
  1979. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1980. @end example
  1981. @end itemize
  1982. @section extrastereo
  1983. Linearly increases the difference between left and right channels which
  1984. adds some sort of "live" effect to playback.
  1985. The filter accepts the following options:
  1986. @table @option
  1987. @item m
  1988. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1989. (average of both channels), with 1.0 sound will be unchanged, with
  1990. -1.0 left and right channels will be swapped.
  1991. @item c
  1992. Enable clipping. By default is enabled.
  1993. @end table
  1994. @section firequalizer
  1995. Apply FIR Equalization using arbitrary frequency response.
  1996. The filter accepts the following option:
  1997. @table @option
  1998. @item gain
  1999. Set gain curve equation (in dB). The expression can contain variables:
  2000. @table @option
  2001. @item f
  2002. the evaluated frequency
  2003. @item sr
  2004. sample rate
  2005. @item ch
  2006. channel number, set to 0 when multichannels evaluation is disabled
  2007. @item chid
  2008. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2009. multichannels evaluation is disabled
  2010. @item chs
  2011. number of channels
  2012. @item chlayout
  2013. channel_layout, see libavutil/channel_layout.h
  2014. @end table
  2015. and functions:
  2016. @table @option
  2017. @item gain_interpolate(f)
  2018. interpolate gain on frequency f based on gain_entry
  2019. @item cubic_interpolate(f)
  2020. same as gain_interpolate, but smoother
  2021. @end table
  2022. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2023. @item gain_entry
  2024. Set gain entry for gain_interpolate function. The expression can
  2025. contain functions:
  2026. @table @option
  2027. @item entry(f, g)
  2028. store gain entry at frequency f with value g
  2029. @end table
  2030. This option is also available as command.
  2031. @item delay
  2032. Set filter delay in seconds. Higher value means more accurate.
  2033. Default is @code{0.01}.
  2034. @item accuracy
  2035. Set filter accuracy in Hz. Lower value means more accurate.
  2036. Default is @code{5}.
  2037. @item wfunc
  2038. Set window function. Acceptable values are:
  2039. @table @option
  2040. @item rectangular
  2041. rectangular window, useful when gain curve is already smooth
  2042. @item hann
  2043. hann window (default)
  2044. @item hamming
  2045. hamming window
  2046. @item blackman
  2047. blackman window
  2048. @item nuttall3
  2049. 3-terms continuous 1st derivative nuttall window
  2050. @item mnuttall3
  2051. minimum 3-terms discontinuous nuttall window
  2052. @item nuttall
  2053. 4-terms continuous 1st derivative nuttall window
  2054. @item bnuttall
  2055. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2056. @item bharris
  2057. blackman-harris window
  2058. @item tukey
  2059. tukey window
  2060. @end table
  2061. @item fixed
  2062. If enabled, use fixed number of audio samples. This improves speed when
  2063. filtering with large delay. Default is disabled.
  2064. @item multi
  2065. Enable multichannels evaluation on gain. Default is disabled.
  2066. @item zero_phase
  2067. Enable zero phase mode by subtracting timestamp to compensate delay.
  2068. Default is disabled.
  2069. @item scale
  2070. Set scale used by gain. Acceptable values are:
  2071. @table @option
  2072. @item linlin
  2073. linear frequency, linear gain
  2074. @item linlog
  2075. linear frequency, logarithmic (in dB) gain (default)
  2076. @item loglin
  2077. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2078. @item loglog
  2079. logarithmic frequency, logarithmic gain
  2080. @end table
  2081. @item dumpfile
  2082. Set file for dumping, suitable for gnuplot.
  2083. @item dumpscale
  2084. Set scale for dumpfile. Acceptable values are same with scale option.
  2085. Default is linlog.
  2086. @item fft2
  2087. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2088. Default is disabled.
  2089. @end table
  2090. @subsection Examples
  2091. @itemize
  2092. @item
  2093. lowpass at 1000 Hz:
  2094. @example
  2095. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2096. @end example
  2097. @item
  2098. lowpass at 1000 Hz with gain_entry:
  2099. @example
  2100. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2101. @end example
  2102. @item
  2103. custom equalization:
  2104. @example
  2105. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2106. @end example
  2107. @item
  2108. higher delay with zero phase to compensate delay:
  2109. @example
  2110. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2111. @end example
  2112. @item
  2113. lowpass on left channel, highpass on right channel:
  2114. @example
  2115. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2116. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2117. @end example
  2118. @end itemize
  2119. @section flanger
  2120. Apply a flanging effect to the audio.
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item delay
  2124. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2125. @item depth
  2126. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2127. @item regen
  2128. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2129. Default value is 0.
  2130. @item width
  2131. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2132. Default value is 71.
  2133. @item speed
  2134. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2135. @item shape
  2136. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2137. Default value is @var{sinusoidal}.
  2138. @item phase
  2139. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2140. Default value is 25.
  2141. @item interp
  2142. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2143. Default is @var{linear}.
  2144. @end table
  2145. @section hdcd
  2146. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2147. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2148. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2149. of HDCD, and detects the Transient Filter flag.
  2150. @example
  2151. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2152. @end example
  2153. When using the filter with wav, note the default encoding for wav is 16-bit,
  2154. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2155. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2156. @example
  2157. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2158. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2159. @end example
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item disable_autoconvert
  2163. Disable any automatic format conversion or resampling in the filter graph.
  2164. @item process_stereo
  2165. Process the stereo channels together. If target_gain does not match between
  2166. channels, consider it invalid and use the last valid target_gain.
  2167. @item cdt_ms
  2168. Set the code detect timer period in ms.
  2169. @item force_pe
  2170. Always extend peaks above -3dBFS even if PE isn't signaled.
  2171. @item analyze_mode
  2172. Replace audio with a solid tone and adjust the amplitude to signal some
  2173. specific aspect of the decoding process. The output file can be loaded in
  2174. an audio editor alongside the original to aid analysis.
  2175. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2176. Modes are:
  2177. @table @samp
  2178. @item 0, off
  2179. Disabled
  2180. @item 1, lle
  2181. Gain adjustment level at each sample
  2182. @item 2, pe
  2183. Samples where peak extend occurs
  2184. @item 3, cdt
  2185. Samples where the code detect timer is active
  2186. @item 4, tgm
  2187. Samples where the target gain does not match between channels
  2188. @end table
  2189. @end table
  2190. @section highpass
  2191. Apply a high-pass filter with 3dB point frequency.
  2192. The filter can be either single-pole, or double-pole (the default).
  2193. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2194. The filter accepts the following options:
  2195. @table @option
  2196. @item frequency, f
  2197. Set frequency in Hz. Default is 3000.
  2198. @item poles, p
  2199. Set number of poles. Default is 2.
  2200. @item width_type
  2201. Set method to specify band-width of filter.
  2202. @table @option
  2203. @item h
  2204. Hz
  2205. @item q
  2206. Q-Factor
  2207. @item o
  2208. octave
  2209. @item s
  2210. slope
  2211. @end table
  2212. @item width, w
  2213. Specify the band-width of a filter in width_type units.
  2214. Applies only to double-pole filter.
  2215. The default is 0.707q and gives a Butterworth response.
  2216. @item channels, c
  2217. Specify which channels to filter, by default all available are filtered.
  2218. @end table
  2219. @section join
  2220. Join multiple input streams into one multi-channel stream.
  2221. It accepts the following parameters:
  2222. @table @option
  2223. @item inputs
  2224. The number of input streams. It defaults to 2.
  2225. @item channel_layout
  2226. The desired output channel layout. It defaults to stereo.
  2227. @item map
  2228. Map channels from inputs to output. The argument is a '|'-separated list of
  2229. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2230. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2231. can be either the name of the input channel (e.g. FL for front left) or its
  2232. index in the specified input stream. @var{out_channel} is the name of the output
  2233. channel.
  2234. @end table
  2235. The filter will attempt to guess the mappings when they are not specified
  2236. explicitly. It does so by first trying to find an unused matching input channel
  2237. and if that fails it picks the first unused input channel.
  2238. Join 3 inputs (with properly set channel layouts):
  2239. @example
  2240. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2241. @end example
  2242. Build a 5.1 output from 6 single-channel streams:
  2243. @example
  2244. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2245. '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'
  2246. out
  2247. @end example
  2248. @section ladspa
  2249. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2250. To enable compilation of this filter you need to configure FFmpeg with
  2251. @code{--enable-ladspa}.
  2252. @table @option
  2253. @item file, f
  2254. Specifies the name of LADSPA plugin library to load. If the environment
  2255. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2256. each one of the directories specified by the colon separated list in
  2257. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2258. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2259. @file{/usr/lib/ladspa/}.
  2260. @item plugin, p
  2261. Specifies the plugin within the library. Some libraries contain only
  2262. one plugin, but others contain many of them. If this is not set filter
  2263. will list all available plugins within the specified library.
  2264. @item controls, c
  2265. Set the '|' separated list of controls which are zero or more floating point
  2266. values that determine the behavior of the loaded plugin (for example delay,
  2267. threshold or gain).
  2268. Controls need to be defined using the following syntax:
  2269. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2270. @var{valuei} is the value set on the @var{i}-th control.
  2271. Alternatively they can be also defined using the following syntax:
  2272. @var{value0}|@var{value1}|@var{value2}|..., where
  2273. @var{valuei} is the value set on the @var{i}-th control.
  2274. If @option{controls} is set to @code{help}, all available controls and
  2275. their valid ranges are printed.
  2276. @item sample_rate, s
  2277. Specify the sample rate, default to 44100. Only used if plugin have
  2278. zero inputs.
  2279. @item nb_samples, n
  2280. Set the number of samples per channel per each output frame, default
  2281. is 1024. Only used if plugin have zero inputs.
  2282. @item duration, d
  2283. Set the minimum duration of the sourced audio. See
  2284. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2285. for the accepted syntax.
  2286. Note that the resulting duration may be greater than the specified duration,
  2287. as the generated audio is always cut at the end of a complete frame.
  2288. If not specified, or the expressed duration is negative, the audio is
  2289. supposed to be generated forever.
  2290. Only used if plugin have zero inputs.
  2291. @end table
  2292. @subsection Examples
  2293. @itemize
  2294. @item
  2295. List all available plugins within amp (LADSPA example plugin) library:
  2296. @example
  2297. ladspa=file=amp
  2298. @end example
  2299. @item
  2300. List all available controls and their valid ranges for @code{vcf_notch}
  2301. plugin from @code{VCF} library:
  2302. @example
  2303. ladspa=f=vcf:p=vcf_notch:c=help
  2304. @end example
  2305. @item
  2306. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2307. plugin library:
  2308. @example
  2309. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2310. @end example
  2311. @item
  2312. Add reverberation to the audio using TAP-plugins
  2313. (Tom's Audio Processing plugins):
  2314. @example
  2315. ladspa=file=tap_reverb:tap_reverb
  2316. @end example
  2317. @item
  2318. Generate white noise, with 0.2 amplitude:
  2319. @example
  2320. ladspa=file=cmt:noise_source_white:c=c0=.2
  2321. @end example
  2322. @item
  2323. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2324. @code{C* Audio Plugin Suite} (CAPS) library:
  2325. @example
  2326. ladspa=file=caps:Click:c=c1=20'
  2327. @end example
  2328. @item
  2329. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2330. @example
  2331. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2332. @end example
  2333. @item
  2334. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2335. @code{SWH Plugins} collection:
  2336. @example
  2337. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2338. @end example
  2339. @item
  2340. Attenuate low frequencies using Multiband EQ from Steve Harris
  2341. @code{SWH Plugins} collection:
  2342. @example
  2343. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2344. @end example
  2345. @item
  2346. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2347. (CAPS) library:
  2348. @example
  2349. ladspa=caps:Narrower
  2350. @end example
  2351. @item
  2352. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2353. @example
  2354. ladspa=caps:White:.2
  2355. @end example
  2356. @item
  2357. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2358. @example
  2359. ladspa=caps:Fractal:c=c1=1
  2360. @end example
  2361. @item
  2362. Dynamic volume normalization using @code{VLevel} plugin:
  2363. @example
  2364. ladspa=vlevel-ladspa:vlevel_mono
  2365. @end example
  2366. @end itemize
  2367. @subsection Commands
  2368. This filter supports the following commands:
  2369. @table @option
  2370. @item cN
  2371. Modify the @var{N}-th control value.
  2372. If the specified value is not valid, it is ignored and prior one is kept.
  2373. @end table
  2374. @section loudnorm
  2375. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2376. Support for both single pass (livestreams, files) and double pass (files) modes.
  2377. This algorithm can target IL, LRA, and maximum true peak.
  2378. The filter accepts the following options:
  2379. @table @option
  2380. @item I, i
  2381. Set integrated loudness target.
  2382. Range is -70.0 - -5.0. Default value is -24.0.
  2383. @item LRA, lra
  2384. Set loudness range target.
  2385. Range is 1.0 - 20.0. Default value is 7.0.
  2386. @item TP, tp
  2387. Set maximum true peak.
  2388. Range is -9.0 - +0.0. Default value is -2.0.
  2389. @item measured_I, measured_i
  2390. Measured IL of input file.
  2391. Range is -99.0 - +0.0.
  2392. @item measured_LRA, measured_lra
  2393. Measured LRA of input file.
  2394. Range is 0.0 - 99.0.
  2395. @item measured_TP, measured_tp
  2396. Measured true peak of input file.
  2397. Range is -99.0 - +99.0.
  2398. @item measured_thresh
  2399. Measured threshold of input file.
  2400. Range is -99.0 - +0.0.
  2401. @item offset
  2402. Set offset gain. Gain is applied before the true-peak limiter.
  2403. Range is -99.0 - +99.0. Default is +0.0.
  2404. @item linear
  2405. Normalize linearly if possible.
  2406. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2407. to be specified in order to use this mode.
  2408. Options are true or false. Default is true.
  2409. @item dual_mono
  2410. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2411. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2412. If set to @code{true}, this option will compensate for this effect.
  2413. Multi-channel input files are not affected by this option.
  2414. Options are true or false. Default is false.
  2415. @item print_format
  2416. Set print format for stats. Options are summary, json, or none.
  2417. Default value is none.
  2418. @end table
  2419. @section lowpass
  2420. Apply a low-pass filter with 3dB point frequency.
  2421. The filter can be either single-pole or double-pole (the default).
  2422. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2423. The filter accepts the following options:
  2424. @table @option
  2425. @item frequency, f
  2426. Set frequency in Hz. Default is 500.
  2427. @item poles, p
  2428. Set number of poles. Default is 2.
  2429. @item width_type
  2430. Set method to specify band-width of filter.
  2431. @table @option
  2432. @item h
  2433. Hz
  2434. @item q
  2435. Q-Factor
  2436. @item o
  2437. octave
  2438. @item s
  2439. slope
  2440. @end table
  2441. @item width, w
  2442. Specify the band-width of a filter in width_type units.
  2443. Applies only to double-pole filter.
  2444. The default is 0.707q and gives a Butterworth response.
  2445. @item channels, c
  2446. Specify which channels to filter, by default all available are filtered.
  2447. @end table
  2448. @subsection Examples
  2449. @itemize
  2450. @item
  2451. Lowpass only LFE channel, it LFE is not present it does nothing:
  2452. @example
  2453. lowpass=c=LFE
  2454. @end example
  2455. @end itemize
  2456. @anchor{pan}
  2457. @section pan
  2458. Mix channels with specific gain levels. The filter accepts the output
  2459. channel layout followed by a set of channels definitions.
  2460. This filter is also designed to efficiently remap the channels of an audio
  2461. stream.
  2462. The filter accepts parameters of the form:
  2463. "@var{l}|@var{outdef}|@var{outdef}|..."
  2464. @table @option
  2465. @item l
  2466. output channel layout or number of channels
  2467. @item outdef
  2468. output channel specification, of the form:
  2469. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2470. @item out_name
  2471. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2472. number (c0, c1, etc.)
  2473. @item gain
  2474. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2475. @item in_name
  2476. input channel to use, see out_name for details; it is not possible to mix
  2477. named and numbered input channels
  2478. @end table
  2479. If the `=' in a channel specification is replaced by `<', then the gains for
  2480. that specification will be renormalized so that the total is 1, thus
  2481. avoiding clipping noise.
  2482. @subsection Mixing examples
  2483. For example, if you want to down-mix from stereo to mono, but with a bigger
  2484. factor for the left channel:
  2485. @example
  2486. pan=1c|c0=0.9*c0+0.1*c1
  2487. @end example
  2488. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2489. 7-channels surround:
  2490. @example
  2491. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2492. @end example
  2493. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2494. that should be preferred (see "-ac" option) unless you have very specific
  2495. needs.
  2496. @subsection Remapping examples
  2497. The channel remapping will be effective if, and only if:
  2498. @itemize
  2499. @item gain coefficients are zeroes or ones,
  2500. @item only one input per channel output,
  2501. @end itemize
  2502. If all these conditions are satisfied, the filter will notify the user ("Pure
  2503. channel mapping detected"), and use an optimized and lossless method to do the
  2504. remapping.
  2505. For example, if you have a 5.1 source and want a stereo audio stream by
  2506. dropping the extra channels:
  2507. @example
  2508. pan="stereo| c0=FL | c1=FR"
  2509. @end example
  2510. Given the same source, you can also switch front left and front right channels
  2511. and keep the input channel layout:
  2512. @example
  2513. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2514. @end example
  2515. If the input is a stereo audio stream, you can mute the front left channel (and
  2516. still keep the stereo channel layout) with:
  2517. @example
  2518. pan="stereo|c1=c1"
  2519. @end example
  2520. Still with a stereo audio stream input, you can copy the right channel in both
  2521. front left and right:
  2522. @example
  2523. pan="stereo| c0=FR | c1=FR"
  2524. @end example
  2525. @section replaygain
  2526. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2527. outputs it unchanged.
  2528. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2529. @section resample
  2530. Convert the audio sample format, sample rate and channel layout. It is
  2531. not meant to be used directly.
  2532. @section rubberband
  2533. Apply time-stretching and pitch-shifting with librubberband.
  2534. The filter accepts the following options:
  2535. @table @option
  2536. @item tempo
  2537. Set tempo scale factor.
  2538. @item pitch
  2539. Set pitch scale factor.
  2540. @item transients
  2541. Set transients detector.
  2542. Possible values are:
  2543. @table @var
  2544. @item crisp
  2545. @item mixed
  2546. @item smooth
  2547. @end table
  2548. @item detector
  2549. Set detector.
  2550. Possible values are:
  2551. @table @var
  2552. @item compound
  2553. @item percussive
  2554. @item soft
  2555. @end table
  2556. @item phase
  2557. Set phase.
  2558. Possible values are:
  2559. @table @var
  2560. @item laminar
  2561. @item independent
  2562. @end table
  2563. @item window
  2564. Set processing window size.
  2565. Possible values are:
  2566. @table @var
  2567. @item standard
  2568. @item short
  2569. @item long
  2570. @end table
  2571. @item smoothing
  2572. Set smoothing.
  2573. Possible values are:
  2574. @table @var
  2575. @item off
  2576. @item on
  2577. @end table
  2578. @item formant
  2579. Enable formant preservation when shift pitching.
  2580. Possible values are:
  2581. @table @var
  2582. @item shifted
  2583. @item preserved
  2584. @end table
  2585. @item pitchq
  2586. Set pitch quality.
  2587. Possible values are:
  2588. @table @var
  2589. @item quality
  2590. @item speed
  2591. @item consistency
  2592. @end table
  2593. @item channels
  2594. Set channels.
  2595. Possible values are:
  2596. @table @var
  2597. @item apart
  2598. @item together
  2599. @end table
  2600. @end table
  2601. @section sidechaincompress
  2602. This filter acts like normal compressor but has the ability to compress
  2603. detected signal using second input signal.
  2604. It needs two input streams and returns one output stream.
  2605. First input stream will be processed depending on second stream signal.
  2606. The filtered signal then can be filtered with other filters in later stages of
  2607. processing. See @ref{pan} and @ref{amerge} filter.
  2608. The filter accepts the following options:
  2609. @table @option
  2610. @item level_in
  2611. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2612. @item threshold
  2613. If a signal of second stream raises above this level it will affect the gain
  2614. reduction of first stream.
  2615. By default is 0.125. Range is between 0.00097563 and 1.
  2616. @item ratio
  2617. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2618. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2619. Default is 2. Range is between 1 and 20.
  2620. @item attack
  2621. Amount of milliseconds the signal has to rise above the threshold before gain
  2622. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2623. @item release
  2624. Amount of milliseconds the signal has to fall below the threshold before
  2625. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2626. @item makeup
  2627. Set the amount by how much signal will be amplified after processing.
  2628. Default is 1. Range is from 1 to 64.
  2629. @item knee
  2630. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2631. Default is 2.82843. Range is between 1 and 8.
  2632. @item link
  2633. Choose if the @code{average} level between all channels of side-chain stream
  2634. or the louder(@code{maximum}) channel of side-chain stream affects the
  2635. reduction. Default is @code{average}.
  2636. @item detection
  2637. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2638. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2639. @item level_sc
  2640. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2641. @item mix
  2642. How much to use compressed signal in output. Default is 1.
  2643. Range is between 0 and 1.
  2644. @end table
  2645. @subsection Examples
  2646. @itemize
  2647. @item
  2648. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2649. depending on the signal of 2nd input and later compressed signal to be
  2650. merged with 2nd input:
  2651. @example
  2652. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2653. @end example
  2654. @end itemize
  2655. @section sidechaingate
  2656. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2657. filter the detected signal before sending it to the gain reduction stage.
  2658. Normally a gate uses the full range signal to detect a level above the
  2659. threshold.
  2660. For example: If you cut all lower frequencies from your sidechain signal
  2661. the gate will decrease the volume of your track only if not enough highs
  2662. appear. With this technique you are able to reduce the resonation of a
  2663. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2664. guitar.
  2665. It needs two input streams and returns one output stream.
  2666. First input stream will be processed depending on second stream signal.
  2667. The filter accepts the following options:
  2668. @table @option
  2669. @item level_in
  2670. Set input level before filtering.
  2671. Default is 1. Allowed range is from 0.015625 to 64.
  2672. @item range
  2673. Set the level of gain reduction when the signal is below the threshold.
  2674. Default is 0.06125. Allowed range is from 0 to 1.
  2675. @item threshold
  2676. If a signal rises above this level the gain reduction is released.
  2677. Default is 0.125. Allowed range is from 0 to 1.
  2678. @item ratio
  2679. Set a ratio about which the signal is reduced.
  2680. Default is 2. Allowed range is from 1 to 9000.
  2681. @item attack
  2682. Amount of milliseconds the signal has to rise above the threshold before gain
  2683. reduction stops.
  2684. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2685. @item release
  2686. Amount of milliseconds the signal has to fall below the threshold before the
  2687. reduction is increased again. Default is 250 milliseconds.
  2688. Allowed range is from 0.01 to 9000.
  2689. @item makeup
  2690. Set amount of amplification of signal after processing.
  2691. Default is 1. Allowed range is from 1 to 64.
  2692. @item knee
  2693. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2694. Default is 2.828427125. Allowed range is from 1 to 8.
  2695. @item detection
  2696. Choose if exact signal should be taken for detection or an RMS like one.
  2697. Default is rms. Can be peak or rms.
  2698. @item link
  2699. Choose if the average level between all channels or the louder channel affects
  2700. the reduction.
  2701. Default is average. Can be average or maximum.
  2702. @item level_sc
  2703. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2704. @end table
  2705. @section silencedetect
  2706. Detect silence in an audio stream.
  2707. This filter logs a message when it detects that the input audio volume is less
  2708. or equal to a noise tolerance value for a duration greater or equal to the
  2709. minimum detected noise duration.
  2710. The printed times and duration are expressed in seconds.
  2711. The filter accepts the following options:
  2712. @table @option
  2713. @item duration, d
  2714. Set silence duration until notification (default is 2 seconds).
  2715. @item noise, n
  2716. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2717. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2718. @end table
  2719. @subsection Examples
  2720. @itemize
  2721. @item
  2722. Detect 5 seconds of silence with -50dB noise tolerance:
  2723. @example
  2724. silencedetect=n=-50dB:d=5
  2725. @end example
  2726. @item
  2727. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2728. tolerance in @file{silence.mp3}:
  2729. @example
  2730. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2731. @end example
  2732. @end itemize
  2733. @section silenceremove
  2734. Remove silence from the beginning, middle or end of the audio.
  2735. The filter accepts the following options:
  2736. @table @option
  2737. @item start_periods
  2738. This value is used to indicate if audio should be trimmed at beginning of
  2739. the audio. A value of zero indicates no silence should be trimmed from the
  2740. beginning. When specifying a non-zero value, it trims audio up until it
  2741. finds non-silence. Normally, when trimming silence from beginning of audio
  2742. the @var{start_periods} will be @code{1} but it can be increased to higher
  2743. values to trim all audio up to specific count of non-silence periods.
  2744. Default value is @code{0}.
  2745. @item start_duration
  2746. Specify the amount of time that non-silence must be detected before it stops
  2747. trimming audio. By increasing the duration, bursts of noises can be treated
  2748. as silence and trimmed off. Default value is @code{0}.
  2749. @item start_threshold
  2750. This indicates what sample value should be treated as silence. For digital
  2751. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2752. you may wish to increase the value to account for background noise.
  2753. Can be specified in dB (in case "dB" is appended to the specified value)
  2754. or amplitude ratio. Default value is @code{0}.
  2755. @item stop_periods
  2756. Set the count for trimming silence from the end of audio.
  2757. To remove silence from the middle of a file, specify a @var{stop_periods}
  2758. that is negative. This value is then treated as a positive value and is
  2759. used to indicate the effect should restart processing as specified by
  2760. @var{start_periods}, making it suitable for removing periods of silence
  2761. in the middle of the audio.
  2762. Default value is @code{0}.
  2763. @item stop_duration
  2764. Specify a duration of silence that must exist before audio is not copied any
  2765. more. By specifying a higher duration, silence that is wanted can be left in
  2766. the audio.
  2767. Default value is @code{0}.
  2768. @item stop_threshold
  2769. This is the same as @option{start_threshold} but for trimming silence from
  2770. the end of audio.
  2771. Can be specified in dB (in case "dB" is appended to the specified value)
  2772. or amplitude ratio. Default value is @code{0}.
  2773. @item leave_silence
  2774. This indicates that @var{stop_duration} length of audio should be left intact
  2775. at the beginning of each period of silence.
  2776. For example, if you want to remove long pauses between words but do not want
  2777. to remove the pauses completely. Default value is @code{0}.
  2778. @item detection
  2779. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2780. and works better with digital silence which is exactly 0.
  2781. Default value is @code{rms}.
  2782. @item window
  2783. Set ratio used to calculate size of window for detecting silence.
  2784. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2785. @end table
  2786. @subsection Examples
  2787. @itemize
  2788. @item
  2789. The following example shows how this filter can be used to start a recording
  2790. that does not contain the delay at the start which usually occurs between
  2791. pressing the record button and the start of the performance:
  2792. @example
  2793. silenceremove=1:5:0.02
  2794. @end example
  2795. @item
  2796. Trim all silence encountered from beginning to end where there is more than 1
  2797. second of silence in audio:
  2798. @example
  2799. silenceremove=0:0:0:-1:1:-90dB
  2800. @end example
  2801. @end itemize
  2802. @section sofalizer
  2803. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2804. loudspeakers around the user for binaural listening via headphones (audio
  2805. formats up to 9 channels supported).
  2806. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2807. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2808. Austrian Academy of Sciences.
  2809. To enable compilation of this filter you need to configure FFmpeg with
  2810. @code{--enable-netcdf}.
  2811. The filter accepts the following options:
  2812. @table @option
  2813. @item sofa
  2814. Set the SOFA file used for rendering.
  2815. @item gain
  2816. Set gain applied to audio. Value is in dB. Default is 0.
  2817. @item rotation
  2818. Set rotation of virtual loudspeakers in deg. Default is 0.
  2819. @item elevation
  2820. Set elevation of virtual speakers in deg. Default is 0.
  2821. @item radius
  2822. Set distance in meters between loudspeakers and the listener with near-field
  2823. HRTFs. Default is 1.
  2824. @item type
  2825. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2826. processing audio in time domain which is slow.
  2827. @var{freq} is processing audio in frequency domain which is fast.
  2828. Default is @var{freq}.
  2829. @item speakers
  2830. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2831. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2832. Each virtual loudspeaker is described with short channel name following with
  2833. azimuth and elevation in degreees.
  2834. Each virtual loudspeaker description is separated by '|'.
  2835. For example to override front left and front right channel positions use:
  2836. 'speakers=FL 45 15|FR 345 15'.
  2837. Descriptions with unrecognised channel names are ignored.
  2838. @item lfegain
  2839. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2840. @end table
  2841. @subsection Examples
  2842. @itemize
  2843. @item
  2844. Using ClubFritz6 sofa file:
  2845. @example
  2846. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2847. @end example
  2848. @item
  2849. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2850. @example
  2851. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2852. @end example
  2853. @item
  2854. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2855. and also with custom gain:
  2856. @example
  2857. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2858. @end example
  2859. @end itemize
  2860. @section stereotools
  2861. This filter has some handy utilities to manage stereo signals, for converting
  2862. M/S stereo recordings to L/R signal while having control over the parameters
  2863. or spreading the stereo image of master track.
  2864. The filter accepts the following options:
  2865. @table @option
  2866. @item level_in
  2867. Set input level before filtering for both channels. Defaults is 1.
  2868. Allowed range is from 0.015625 to 64.
  2869. @item level_out
  2870. Set output level after filtering for both channels. Defaults is 1.
  2871. Allowed range is from 0.015625 to 64.
  2872. @item balance_in
  2873. Set input balance between both channels. Default is 0.
  2874. Allowed range is from -1 to 1.
  2875. @item balance_out
  2876. Set output balance between both channels. Default is 0.
  2877. Allowed range is from -1 to 1.
  2878. @item softclip
  2879. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2880. clipping. Disabled by default.
  2881. @item mutel
  2882. Mute the left channel. Disabled by default.
  2883. @item muter
  2884. Mute the right channel. Disabled by default.
  2885. @item phasel
  2886. Change the phase of the left channel. Disabled by default.
  2887. @item phaser
  2888. Change the phase of the right channel. Disabled by default.
  2889. @item mode
  2890. Set stereo mode. Available values are:
  2891. @table @samp
  2892. @item lr>lr
  2893. Left/Right to Left/Right, this is default.
  2894. @item lr>ms
  2895. Left/Right to Mid/Side.
  2896. @item ms>lr
  2897. Mid/Side to Left/Right.
  2898. @item lr>ll
  2899. Left/Right to Left/Left.
  2900. @item lr>rr
  2901. Left/Right to Right/Right.
  2902. @item lr>l+r
  2903. Left/Right to Left + Right.
  2904. @item lr>rl
  2905. Left/Right to Right/Left.
  2906. @end table
  2907. @item slev
  2908. Set level of side signal. Default is 1.
  2909. Allowed range is from 0.015625 to 64.
  2910. @item sbal
  2911. Set balance of side signal. Default is 0.
  2912. Allowed range is from -1 to 1.
  2913. @item mlev
  2914. Set level of the middle signal. Default is 1.
  2915. Allowed range is from 0.015625 to 64.
  2916. @item mpan
  2917. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2918. @item base
  2919. Set stereo base between mono and inversed channels. Default is 0.
  2920. Allowed range is from -1 to 1.
  2921. @item delay
  2922. Set delay in milliseconds how much to delay left from right channel and
  2923. vice versa. Default is 0. Allowed range is from -20 to 20.
  2924. @item sclevel
  2925. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2926. @item phase
  2927. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2928. @item bmode_in, bmode_out
  2929. Set balance mode for balance_in/balance_out option.
  2930. Can be one of the following:
  2931. @table @samp
  2932. @item balance
  2933. Classic balance mode. Attenuate one channel at time.
  2934. Gain is raised up to 1.
  2935. @item amplitude
  2936. Similar as classic mode above but gain is raised up to 2.
  2937. @item power
  2938. Equal power distribution, from -6dB to +6dB range.
  2939. @end table
  2940. @end table
  2941. @subsection Examples
  2942. @itemize
  2943. @item
  2944. Apply karaoke like effect:
  2945. @example
  2946. stereotools=mlev=0.015625
  2947. @end example
  2948. @item
  2949. Convert M/S signal to L/R:
  2950. @example
  2951. "stereotools=mode=ms>lr"
  2952. @end example
  2953. @end itemize
  2954. @section stereowiden
  2955. This filter enhance the stereo effect by suppressing signal common to both
  2956. channels and by delaying the signal of left into right and vice versa,
  2957. thereby widening the stereo effect.
  2958. The filter accepts the following options:
  2959. @table @option
  2960. @item delay
  2961. Time in milliseconds of the delay of left signal into right and vice versa.
  2962. Default is 20 milliseconds.
  2963. @item feedback
  2964. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2965. effect of left signal in right output and vice versa which gives widening
  2966. effect. Default is 0.3.
  2967. @item crossfeed
  2968. Cross feed of left into right with inverted phase. This helps in suppressing
  2969. the mono. If the value is 1 it will cancel all the signal common to both
  2970. channels. Default is 0.3.
  2971. @item drymix
  2972. Set level of input signal of original channel. Default is 0.8.
  2973. @end table
  2974. @section treble
  2975. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2976. shelving filter with a response similar to that of a standard
  2977. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2978. The filter accepts the following options:
  2979. @table @option
  2980. @item gain, g
  2981. Give the gain at whichever is the lower of ~22 kHz and the
  2982. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2983. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2984. @item frequency, f
  2985. Set the filter's central frequency and so can be used
  2986. to extend or reduce the frequency range to be boosted or cut.
  2987. The default value is @code{3000} Hz.
  2988. @item width_type
  2989. Set method to specify band-width of filter.
  2990. @table @option
  2991. @item h
  2992. Hz
  2993. @item q
  2994. Q-Factor
  2995. @item o
  2996. octave
  2997. @item s
  2998. slope
  2999. @end table
  3000. @item width, w
  3001. Determine how steep is the filter's shelf transition.
  3002. @item channels, c
  3003. Specify which channels to filter, by default all available are filtered.
  3004. @end table
  3005. @section tremolo
  3006. Sinusoidal amplitude modulation.
  3007. The filter accepts the following options:
  3008. @table @option
  3009. @item f
  3010. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3011. (20 Hz or lower) will result in a tremolo effect.
  3012. This filter may also be used as a ring modulator by specifying
  3013. a modulation frequency higher than 20 Hz.
  3014. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3015. @item d
  3016. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3017. Default value is 0.5.
  3018. @end table
  3019. @section vibrato
  3020. Sinusoidal phase modulation.
  3021. The filter accepts the following options:
  3022. @table @option
  3023. @item f
  3024. Modulation frequency in Hertz.
  3025. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3026. @item d
  3027. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3028. Default value is 0.5.
  3029. @end table
  3030. @section volume
  3031. Adjust the input audio volume.
  3032. It accepts the following parameters:
  3033. @table @option
  3034. @item volume
  3035. Set audio volume expression.
  3036. Output values are clipped to the maximum value.
  3037. The output audio volume is given by the relation:
  3038. @example
  3039. @var{output_volume} = @var{volume} * @var{input_volume}
  3040. @end example
  3041. The default value for @var{volume} is "1.0".
  3042. @item precision
  3043. This parameter represents the mathematical precision.
  3044. It determines which input sample formats will be allowed, which affects the
  3045. precision of the volume scaling.
  3046. @table @option
  3047. @item fixed
  3048. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3049. @item float
  3050. 32-bit floating-point; this limits input sample format to FLT. (default)
  3051. @item double
  3052. 64-bit floating-point; this limits input sample format to DBL.
  3053. @end table
  3054. @item replaygain
  3055. Choose the behaviour on encountering ReplayGain side data in input frames.
  3056. @table @option
  3057. @item drop
  3058. Remove ReplayGain side data, ignoring its contents (the default).
  3059. @item ignore
  3060. Ignore ReplayGain side data, but leave it in the frame.
  3061. @item track
  3062. Prefer the track gain, if present.
  3063. @item album
  3064. Prefer the album gain, if present.
  3065. @end table
  3066. @item replaygain_preamp
  3067. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3068. Default value for @var{replaygain_preamp} is 0.0.
  3069. @item eval
  3070. Set when the volume expression is evaluated.
  3071. It accepts the following values:
  3072. @table @samp
  3073. @item once
  3074. only evaluate expression once during the filter initialization, or
  3075. when the @samp{volume} command is sent
  3076. @item frame
  3077. evaluate expression for each incoming frame
  3078. @end table
  3079. Default value is @samp{once}.
  3080. @end table
  3081. The volume expression can contain the following parameters.
  3082. @table @option
  3083. @item n
  3084. frame number (starting at zero)
  3085. @item nb_channels
  3086. number of channels
  3087. @item nb_consumed_samples
  3088. number of samples consumed by the filter
  3089. @item nb_samples
  3090. number of samples in the current frame
  3091. @item pos
  3092. original frame position in the file
  3093. @item pts
  3094. frame PTS
  3095. @item sample_rate
  3096. sample rate
  3097. @item startpts
  3098. PTS at start of stream
  3099. @item startt
  3100. time at start of stream
  3101. @item t
  3102. frame time
  3103. @item tb
  3104. timestamp timebase
  3105. @item volume
  3106. last set volume value
  3107. @end table
  3108. Note that when @option{eval} is set to @samp{once} only the
  3109. @var{sample_rate} and @var{tb} variables are available, all other
  3110. variables will evaluate to NAN.
  3111. @subsection Commands
  3112. This filter supports the following commands:
  3113. @table @option
  3114. @item volume
  3115. Modify the volume expression.
  3116. The command accepts the same syntax of the corresponding option.
  3117. If the specified expression is not valid, it is kept at its current
  3118. value.
  3119. @item replaygain_noclip
  3120. Prevent clipping by limiting the gain applied.
  3121. Default value for @var{replaygain_noclip} is 1.
  3122. @end table
  3123. @subsection Examples
  3124. @itemize
  3125. @item
  3126. Halve the input audio volume:
  3127. @example
  3128. volume=volume=0.5
  3129. volume=volume=1/2
  3130. volume=volume=-6.0206dB
  3131. @end example
  3132. In all the above example the named key for @option{volume} can be
  3133. omitted, for example like in:
  3134. @example
  3135. volume=0.5
  3136. @end example
  3137. @item
  3138. Increase input audio power by 6 decibels using fixed-point precision:
  3139. @example
  3140. volume=volume=6dB:precision=fixed
  3141. @end example
  3142. @item
  3143. Fade volume after time 10 with an annihilation period of 5 seconds:
  3144. @example
  3145. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3146. @end example
  3147. @end itemize
  3148. @section volumedetect
  3149. Detect the volume of the input video.
  3150. The filter has no parameters. The input is not modified. Statistics about
  3151. the volume will be printed in the log when the input stream end is reached.
  3152. In particular it will show the mean volume (root mean square), maximum
  3153. volume (on a per-sample basis), and the beginning of a histogram of the
  3154. registered volume values (from the maximum value to a cumulated 1/1000 of
  3155. the samples).
  3156. All volumes are in decibels relative to the maximum PCM value.
  3157. @subsection Examples
  3158. Here is an excerpt of the output:
  3159. @example
  3160. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3161. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3162. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3163. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3164. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3165. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3166. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3167. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3168. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3169. @end example
  3170. It means that:
  3171. @itemize
  3172. @item
  3173. The mean square energy is approximately -27 dB, or 10^-2.7.
  3174. @item
  3175. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3176. @item
  3177. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3178. @end itemize
  3179. In other words, raising the volume by +4 dB does not cause any clipping,
  3180. raising it by +5 dB causes clipping for 6 samples, etc.
  3181. @c man end AUDIO FILTERS
  3182. @chapter Audio Sources
  3183. @c man begin AUDIO SOURCES
  3184. Below is a description of the currently available audio sources.
  3185. @section abuffer
  3186. Buffer audio frames, and make them available to the filter chain.
  3187. This source is mainly intended for a programmatic use, in particular
  3188. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3189. It accepts the following parameters:
  3190. @table @option
  3191. @item time_base
  3192. The timebase which will be used for timestamps of submitted frames. It must be
  3193. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3194. @item sample_rate
  3195. The sample rate of the incoming audio buffers.
  3196. @item sample_fmt
  3197. The sample format of the incoming audio buffers.
  3198. Either a sample format name or its corresponding integer representation from
  3199. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3200. @item channel_layout
  3201. The channel layout of the incoming audio buffers.
  3202. Either a channel layout name from channel_layout_map in
  3203. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3204. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3205. @item channels
  3206. The number of channels of the incoming audio buffers.
  3207. If both @var{channels} and @var{channel_layout} are specified, then they
  3208. must be consistent.
  3209. @end table
  3210. @subsection Examples
  3211. @example
  3212. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3213. @end example
  3214. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3215. Since the sample format with name "s16p" corresponds to the number
  3216. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3217. equivalent to:
  3218. @example
  3219. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3220. @end example
  3221. @section aevalsrc
  3222. Generate an audio signal specified by an expression.
  3223. This source accepts in input one or more expressions (one for each
  3224. channel), which are evaluated and used to generate a corresponding
  3225. audio signal.
  3226. This source accepts the following options:
  3227. @table @option
  3228. @item exprs
  3229. Set the '|'-separated expressions list for each separate channel. In case the
  3230. @option{channel_layout} option is not specified, the selected channel layout
  3231. depends on the number of provided expressions. Otherwise the last
  3232. specified expression is applied to the remaining output channels.
  3233. @item channel_layout, c
  3234. Set the channel layout. The number of channels in the specified layout
  3235. must be equal to the number of specified expressions.
  3236. @item duration, d
  3237. Set the minimum duration of the sourced audio. See
  3238. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3239. for the accepted syntax.
  3240. Note that the resulting duration may be greater than the specified
  3241. duration, as the generated audio is always cut at the end of a
  3242. complete frame.
  3243. If not specified, or the expressed duration is negative, the audio is
  3244. supposed to be generated forever.
  3245. @item nb_samples, n
  3246. Set the number of samples per channel per each output frame,
  3247. default to 1024.
  3248. @item sample_rate, s
  3249. Specify the sample rate, default to 44100.
  3250. @end table
  3251. Each expression in @var{exprs} can contain the following constants:
  3252. @table @option
  3253. @item n
  3254. number of the evaluated sample, starting from 0
  3255. @item t
  3256. time of the evaluated sample expressed in seconds, starting from 0
  3257. @item s
  3258. sample rate
  3259. @end table
  3260. @subsection Examples
  3261. @itemize
  3262. @item
  3263. Generate silence:
  3264. @example
  3265. aevalsrc=0
  3266. @end example
  3267. @item
  3268. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3269. 8000 Hz:
  3270. @example
  3271. aevalsrc="sin(440*2*PI*t):s=8000"
  3272. @end example
  3273. @item
  3274. Generate a two channels signal, specify the channel layout (Front
  3275. Center + Back Center) explicitly:
  3276. @example
  3277. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3278. @end example
  3279. @item
  3280. Generate white noise:
  3281. @example
  3282. aevalsrc="-2+random(0)"
  3283. @end example
  3284. @item
  3285. Generate an amplitude modulated signal:
  3286. @example
  3287. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3288. @end example
  3289. @item
  3290. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3291. @example
  3292. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3293. @end example
  3294. @end itemize
  3295. @section anullsrc
  3296. The null audio source, return unprocessed audio frames. It is mainly useful
  3297. as a template and to be employed in analysis / debugging tools, or as
  3298. the source for filters which ignore the input data (for example the sox
  3299. synth filter).
  3300. This source accepts the following options:
  3301. @table @option
  3302. @item channel_layout, cl
  3303. Specifies the channel layout, and can be either an integer or a string
  3304. representing a channel layout. The default value of @var{channel_layout}
  3305. is "stereo".
  3306. Check the channel_layout_map definition in
  3307. @file{libavutil/channel_layout.c} for the mapping between strings and
  3308. channel layout values.
  3309. @item sample_rate, r
  3310. Specifies the sample rate, and defaults to 44100.
  3311. @item nb_samples, n
  3312. Set the number of samples per requested frames.
  3313. @end table
  3314. @subsection Examples
  3315. @itemize
  3316. @item
  3317. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3318. @example
  3319. anullsrc=r=48000:cl=4
  3320. @end example
  3321. @item
  3322. Do the same operation with a more obvious syntax:
  3323. @example
  3324. anullsrc=r=48000:cl=mono
  3325. @end example
  3326. @end itemize
  3327. All the parameters need to be explicitly defined.
  3328. @section flite
  3329. Synthesize a voice utterance using the libflite library.
  3330. To enable compilation of this filter you need to configure FFmpeg with
  3331. @code{--enable-libflite}.
  3332. Note that the flite library is not thread-safe.
  3333. The filter accepts the following options:
  3334. @table @option
  3335. @item list_voices
  3336. If set to 1, list the names of the available voices and exit
  3337. immediately. Default value is 0.
  3338. @item nb_samples, n
  3339. Set the maximum number of samples per frame. Default value is 512.
  3340. @item textfile
  3341. Set the filename containing the text to speak.
  3342. @item text
  3343. Set the text to speak.
  3344. @item voice, v
  3345. Set the voice to use for the speech synthesis. Default value is
  3346. @code{kal}. See also the @var{list_voices} option.
  3347. @end table
  3348. @subsection Examples
  3349. @itemize
  3350. @item
  3351. Read from file @file{speech.txt}, and synthesize the text using the
  3352. standard flite voice:
  3353. @example
  3354. flite=textfile=speech.txt
  3355. @end example
  3356. @item
  3357. Read the specified text selecting the @code{slt} voice:
  3358. @example
  3359. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3360. @end example
  3361. @item
  3362. Input text to ffmpeg:
  3363. @example
  3364. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3365. @end example
  3366. @item
  3367. Make @file{ffplay} speak the specified text, using @code{flite} and
  3368. the @code{lavfi} device:
  3369. @example
  3370. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3371. @end example
  3372. @end itemize
  3373. For more information about libflite, check:
  3374. @url{http://www.speech.cs.cmu.edu/flite/}
  3375. @section anoisesrc
  3376. Generate a noise audio signal.
  3377. The filter accepts the following options:
  3378. @table @option
  3379. @item sample_rate, r
  3380. Specify the sample rate. Default value is 48000 Hz.
  3381. @item amplitude, a
  3382. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3383. is 1.0.
  3384. @item duration, d
  3385. Specify the duration of the generated audio stream. Not specifying this option
  3386. results in noise with an infinite length.
  3387. @item color, colour, c
  3388. Specify the color of noise. Available noise colors are white, pink, and brown.
  3389. Default color is white.
  3390. @item seed, s
  3391. Specify a value used to seed the PRNG.
  3392. @item nb_samples, n
  3393. Set the number of samples per each output frame, default is 1024.
  3394. @end table
  3395. @subsection Examples
  3396. @itemize
  3397. @item
  3398. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3399. @example
  3400. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3401. @end example
  3402. @end itemize
  3403. @section sine
  3404. Generate an audio signal made of a sine wave with amplitude 1/8.
  3405. The audio signal is bit-exact.
  3406. The filter accepts the following options:
  3407. @table @option
  3408. @item frequency, f
  3409. Set the carrier frequency. Default is 440 Hz.
  3410. @item beep_factor, b
  3411. Enable a periodic beep every second with frequency @var{beep_factor} times
  3412. the carrier frequency. Default is 0, meaning the beep is disabled.
  3413. @item sample_rate, r
  3414. Specify the sample rate, default is 44100.
  3415. @item duration, d
  3416. Specify the duration of the generated audio stream.
  3417. @item samples_per_frame
  3418. Set the number of samples per output frame.
  3419. The expression can contain the following constants:
  3420. @table @option
  3421. @item n
  3422. The (sequential) number of the output audio frame, starting from 0.
  3423. @item pts
  3424. The PTS (Presentation TimeStamp) of the output audio frame,
  3425. expressed in @var{TB} units.
  3426. @item t
  3427. The PTS of the output audio frame, expressed in seconds.
  3428. @item TB
  3429. The timebase of the output audio frames.
  3430. @end table
  3431. Default is @code{1024}.
  3432. @end table
  3433. @subsection Examples
  3434. @itemize
  3435. @item
  3436. Generate a simple 440 Hz sine wave:
  3437. @example
  3438. sine
  3439. @end example
  3440. @item
  3441. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3442. @example
  3443. sine=220:4:d=5
  3444. sine=f=220:b=4:d=5
  3445. sine=frequency=220:beep_factor=4:duration=5
  3446. @end example
  3447. @item
  3448. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3449. pattern:
  3450. @example
  3451. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3452. @end example
  3453. @end itemize
  3454. @c man end AUDIO SOURCES
  3455. @chapter Audio Sinks
  3456. @c man begin AUDIO SINKS
  3457. Below is a description of the currently available audio sinks.
  3458. @section abuffersink
  3459. Buffer audio frames, and make them available to the end of filter chain.
  3460. This sink is mainly intended for programmatic use, in particular
  3461. through the interface defined in @file{libavfilter/buffersink.h}
  3462. or the options system.
  3463. It accepts a pointer to an AVABufferSinkContext structure, which
  3464. defines the incoming buffers' formats, to be passed as the opaque
  3465. parameter to @code{avfilter_init_filter} for initialization.
  3466. @section anullsink
  3467. Null audio sink; do absolutely nothing with the input audio. It is
  3468. mainly useful as a template and for use in analysis / debugging
  3469. tools.
  3470. @c man end AUDIO SINKS
  3471. @chapter Video Filters
  3472. @c man begin VIDEO FILTERS
  3473. When you configure your FFmpeg build, you can disable any of the
  3474. existing filters using @code{--disable-filters}.
  3475. The configure output will show the video filters included in your
  3476. build.
  3477. Below is a description of the currently available video filters.
  3478. @section alphaextract
  3479. Extract the alpha component from the input as a grayscale video. This
  3480. is especially useful with the @var{alphamerge} filter.
  3481. @section alphamerge
  3482. Add or replace the alpha component of the primary input with the
  3483. grayscale value of a second input. This is intended for use with
  3484. @var{alphaextract} to allow the transmission or storage of frame
  3485. sequences that have alpha in a format that doesn't support an alpha
  3486. channel.
  3487. For example, to reconstruct full frames from a normal YUV-encoded video
  3488. and a separate video created with @var{alphaextract}, you might use:
  3489. @example
  3490. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3491. @end example
  3492. Since this filter is designed for reconstruction, it operates on frame
  3493. sequences without considering timestamps, and terminates when either
  3494. input reaches end of stream. This will cause problems if your encoding
  3495. pipeline drops frames. If you're trying to apply an image as an
  3496. overlay to a video stream, consider the @var{overlay} filter instead.
  3497. @section ass
  3498. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3499. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3500. Substation Alpha) subtitles files.
  3501. This filter accepts the following option in addition to the common options from
  3502. the @ref{subtitles} filter:
  3503. @table @option
  3504. @item shaping
  3505. Set the shaping engine
  3506. Available values are:
  3507. @table @samp
  3508. @item auto
  3509. The default libass shaping engine, which is the best available.
  3510. @item simple
  3511. Fast, font-agnostic shaper that can do only substitutions
  3512. @item complex
  3513. Slower shaper using OpenType for substitutions and positioning
  3514. @end table
  3515. The default is @code{auto}.
  3516. @end table
  3517. @section atadenoise
  3518. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3519. The filter accepts the following options:
  3520. @table @option
  3521. @item 0a
  3522. Set threshold A for 1st plane. Default is 0.02.
  3523. Valid range is 0 to 0.3.
  3524. @item 0b
  3525. Set threshold B for 1st plane. Default is 0.04.
  3526. Valid range is 0 to 5.
  3527. @item 1a
  3528. Set threshold A for 2nd plane. Default is 0.02.
  3529. Valid range is 0 to 0.3.
  3530. @item 1b
  3531. Set threshold B for 2nd plane. Default is 0.04.
  3532. Valid range is 0 to 5.
  3533. @item 2a
  3534. Set threshold A for 3rd plane. Default is 0.02.
  3535. Valid range is 0 to 0.3.
  3536. @item 2b
  3537. Set threshold B for 3rd plane. Default is 0.04.
  3538. Valid range is 0 to 5.
  3539. Threshold A is designed to react on abrupt changes in the input signal and
  3540. threshold B is designed to react on continuous changes in the input signal.
  3541. @item s
  3542. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3543. number in range [5, 129].
  3544. @item p
  3545. Set what planes of frame filter will use for averaging. Default is all.
  3546. @end table
  3547. @section avgblur
  3548. Apply average blur filter.
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item sizeX
  3552. Set horizontal kernel size.
  3553. @item planes
  3554. Set which planes to filter. By default all planes are filtered.
  3555. @item sizeY
  3556. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3557. Default is @code{0}.
  3558. @end table
  3559. @section bbox
  3560. Compute the bounding box for the non-black pixels in the input frame
  3561. luminance plane.
  3562. This filter computes the bounding box containing all the pixels with a
  3563. luminance value greater than the minimum allowed value.
  3564. The parameters describing the bounding box are printed on the filter
  3565. log.
  3566. The filter accepts the following option:
  3567. @table @option
  3568. @item min_val
  3569. Set the minimal luminance value. Default is @code{16}.
  3570. @end table
  3571. @section bitplanenoise
  3572. Show and measure bit plane noise.
  3573. The filter accepts the following options:
  3574. @table @option
  3575. @item bitplane
  3576. Set which plane to analyze. Default is @code{1}.
  3577. @item filter
  3578. Filter out noisy pixels from @code{bitplane} set above.
  3579. Default is disabled.
  3580. @end table
  3581. @section blackdetect
  3582. Detect video intervals that are (almost) completely black. Can be
  3583. useful to detect chapter transitions, commercials, or invalid
  3584. recordings. Output lines contains the time for the start, end and
  3585. duration of the detected black interval expressed in seconds.
  3586. In order to display the output lines, you need to set the loglevel at
  3587. least to the AV_LOG_INFO value.
  3588. The filter accepts the following options:
  3589. @table @option
  3590. @item black_min_duration, d
  3591. Set the minimum detected black duration expressed in seconds. It must
  3592. be a non-negative floating point number.
  3593. Default value is 2.0.
  3594. @item picture_black_ratio_th, pic_th
  3595. Set the threshold for considering a picture "black".
  3596. Express the minimum value for the ratio:
  3597. @example
  3598. @var{nb_black_pixels} / @var{nb_pixels}
  3599. @end example
  3600. for which a picture is considered black.
  3601. Default value is 0.98.
  3602. @item pixel_black_th, pix_th
  3603. Set the threshold for considering a pixel "black".
  3604. The threshold expresses the maximum pixel luminance value for which a
  3605. pixel is considered "black". The provided value is scaled according to
  3606. the following equation:
  3607. @example
  3608. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3609. @end example
  3610. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3611. the input video format, the range is [0-255] for YUV full-range
  3612. formats and [16-235] for YUV non full-range formats.
  3613. Default value is 0.10.
  3614. @end table
  3615. The following example sets the maximum pixel threshold to the minimum
  3616. value, and detects only black intervals of 2 or more seconds:
  3617. @example
  3618. blackdetect=d=2:pix_th=0.00
  3619. @end example
  3620. @section blackframe
  3621. Detect frames that are (almost) completely black. Can be useful to
  3622. detect chapter transitions or commercials. Output lines consist of
  3623. the frame number of the detected frame, the percentage of blackness,
  3624. the position in the file if known or -1 and the timestamp in seconds.
  3625. In order to display the output lines, you need to set the loglevel at
  3626. least to the AV_LOG_INFO value.
  3627. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3628. The value represents the percentage of pixels in the picture that
  3629. are below the threshold value.
  3630. It accepts the following parameters:
  3631. @table @option
  3632. @item amount
  3633. The percentage of the pixels that have to be below the threshold; it defaults to
  3634. @code{98}.
  3635. @item threshold, thresh
  3636. The threshold below which a pixel value is considered black; it defaults to
  3637. @code{32}.
  3638. @end table
  3639. @section blend, tblend
  3640. Blend two video frames into each other.
  3641. The @code{blend} filter takes two input streams and outputs one
  3642. stream, the first input is the "top" layer and second input is
  3643. "bottom" layer. By default, the output terminates when the longest input terminates.
  3644. The @code{tblend} (time blend) filter takes two consecutive frames
  3645. from one single stream, and outputs the result obtained by blending
  3646. the new frame on top of the old frame.
  3647. A description of the accepted options follows.
  3648. @table @option
  3649. @item c0_mode
  3650. @item c1_mode
  3651. @item c2_mode
  3652. @item c3_mode
  3653. @item all_mode
  3654. Set blend mode for specific pixel component or all pixel components in case
  3655. of @var{all_mode}. Default value is @code{normal}.
  3656. Available values for component modes are:
  3657. @table @samp
  3658. @item addition
  3659. @item addition128
  3660. @item and
  3661. @item average
  3662. @item burn
  3663. @item darken
  3664. @item difference
  3665. @item difference128
  3666. @item divide
  3667. @item dodge
  3668. @item freeze
  3669. @item exclusion
  3670. @item glow
  3671. @item hardlight
  3672. @item hardmix
  3673. @item heat
  3674. @item lighten
  3675. @item linearlight
  3676. @item multiply
  3677. @item multiply128
  3678. @item negation
  3679. @item normal
  3680. @item or
  3681. @item overlay
  3682. @item phoenix
  3683. @item pinlight
  3684. @item reflect
  3685. @item screen
  3686. @item softlight
  3687. @item subtract
  3688. @item vividlight
  3689. @item xor
  3690. @end table
  3691. @item c0_opacity
  3692. @item c1_opacity
  3693. @item c2_opacity
  3694. @item c3_opacity
  3695. @item all_opacity
  3696. Set blend opacity for specific pixel component or all pixel components in case
  3697. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3698. @item c0_expr
  3699. @item c1_expr
  3700. @item c2_expr
  3701. @item c3_expr
  3702. @item all_expr
  3703. Set blend expression for specific pixel component or all pixel components in case
  3704. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3705. The expressions can use the following variables:
  3706. @table @option
  3707. @item N
  3708. The sequential number of the filtered frame, starting from @code{0}.
  3709. @item X
  3710. @item Y
  3711. the coordinates of the current sample
  3712. @item W
  3713. @item H
  3714. the width and height of currently filtered plane
  3715. @item SW
  3716. @item SH
  3717. Width and height scale depending on the currently filtered plane. It is the
  3718. ratio between the corresponding luma plane number of pixels and the current
  3719. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3720. @code{0.5,0.5} for chroma planes.
  3721. @item T
  3722. Time of the current frame, expressed in seconds.
  3723. @item TOP, A
  3724. Value of pixel component at current location for first video frame (top layer).
  3725. @item BOTTOM, B
  3726. Value of pixel component at current location for second video frame (bottom layer).
  3727. @end table
  3728. @item shortest
  3729. Force termination when the shortest input terminates. Default is
  3730. @code{0}. This option is only defined for the @code{blend} filter.
  3731. @item repeatlast
  3732. Continue applying the last bottom frame after the end of the stream. A value of
  3733. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3734. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3735. @end table
  3736. @subsection Examples
  3737. @itemize
  3738. @item
  3739. Apply transition from bottom layer to top layer in first 10 seconds:
  3740. @example
  3741. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3742. @end example
  3743. @item
  3744. Apply 1x1 checkerboard effect:
  3745. @example
  3746. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3747. @end example
  3748. @item
  3749. Apply uncover left effect:
  3750. @example
  3751. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3752. @end example
  3753. @item
  3754. Apply uncover down effect:
  3755. @example
  3756. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3757. @end example
  3758. @item
  3759. Apply uncover up-left effect:
  3760. @example
  3761. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3762. @end example
  3763. @item
  3764. Split diagonally video and shows top and bottom layer on each side:
  3765. @example
  3766. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3767. @end example
  3768. @item
  3769. Display differences between the current and the previous frame:
  3770. @example
  3771. tblend=all_mode=difference128
  3772. @end example
  3773. @end itemize
  3774. @section boxblur
  3775. Apply a boxblur algorithm to the input video.
  3776. It accepts the following parameters:
  3777. @table @option
  3778. @item luma_radius, lr
  3779. @item luma_power, lp
  3780. @item chroma_radius, cr
  3781. @item chroma_power, cp
  3782. @item alpha_radius, ar
  3783. @item alpha_power, ap
  3784. @end table
  3785. A description of the accepted options follows.
  3786. @table @option
  3787. @item luma_radius, lr
  3788. @item chroma_radius, cr
  3789. @item alpha_radius, ar
  3790. Set an expression for the box radius in pixels used for blurring the
  3791. corresponding input plane.
  3792. The radius value must be a non-negative number, and must not be
  3793. greater than the value of the expression @code{min(w,h)/2} for the
  3794. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3795. planes.
  3796. Default value for @option{luma_radius} is "2". If not specified,
  3797. @option{chroma_radius} and @option{alpha_radius} default to the
  3798. corresponding value set for @option{luma_radius}.
  3799. The expressions can contain the following constants:
  3800. @table @option
  3801. @item w
  3802. @item h
  3803. The input width and height in pixels.
  3804. @item cw
  3805. @item ch
  3806. The input chroma image width and height in pixels.
  3807. @item hsub
  3808. @item vsub
  3809. The horizontal and vertical chroma subsample values. For example, for the
  3810. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3811. @end table
  3812. @item luma_power, lp
  3813. @item chroma_power, cp
  3814. @item alpha_power, ap
  3815. Specify how many times the boxblur filter is applied to the
  3816. corresponding plane.
  3817. Default value for @option{luma_power} is 2. If not specified,
  3818. @option{chroma_power} and @option{alpha_power} default to the
  3819. corresponding value set for @option{luma_power}.
  3820. A value of 0 will disable the effect.
  3821. @end table
  3822. @subsection Examples
  3823. @itemize
  3824. @item
  3825. Apply a boxblur filter with the luma, chroma, and alpha radii
  3826. set to 2:
  3827. @example
  3828. boxblur=luma_radius=2:luma_power=1
  3829. boxblur=2:1
  3830. @end example
  3831. @item
  3832. Set the luma radius to 2, and alpha and chroma radius to 0:
  3833. @example
  3834. boxblur=2:1:cr=0:ar=0
  3835. @end example
  3836. @item
  3837. Set the luma and chroma radii to a fraction of the video dimension:
  3838. @example
  3839. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3840. @end example
  3841. @end itemize
  3842. @section bwdif
  3843. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3844. Deinterlacing Filter").
  3845. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3846. interpolation algorithms.
  3847. It accepts the following parameters:
  3848. @table @option
  3849. @item mode
  3850. The interlacing mode to adopt. It accepts one of the following values:
  3851. @table @option
  3852. @item 0, send_frame
  3853. Output one frame for each frame.
  3854. @item 1, send_field
  3855. Output one frame for each field.
  3856. @end table
  3857. The default value is @code{send_field}.
  3858. @item parity
  3859. The picture field parity assumed for the input interlaced video. It accepts one
  3860. of the following values:
  3861. @table @option
  3862. @item 0, tff
  3863. Assume the top field is first.
  3864. @item 1, bff
  3865. Assume the bottom field is first.
  3866. @item -1, auto
  3867. Enable automatic detection of field parity.
  3868. @end table
  3869. The default value is @code{auto}.
  3870. If the interlacing is unknown or the decoder does not export this information,
  3871. top field first will be assumed.
  3872. @item deint
  3873. Specify which frames to deinterlace. Accept one of the following
  3874. values:
  3875. @table @option
  3876. @item 0, all
  3877. Deinterlace all frames.
  3878. @item 1, interlaced
  3879. Only deinterlace frames marked as interlaced.
  3880. @end table
  3881. The default value is @code{all}.
  3882. @end table
  3883. @section chromakey
  3884. YUV colorspace color/chroma keying.
  3885. The filter accepts the following options:
  3886. @table @option
  3887. @item color
  3888. The color which will be replaced with transparency.
  3889. @item similarity
  3890. Similarity percentage with the key color.
  3891. 0.01 matches only the exact key color, while 1.0 matches everything.
  3892. @item blend
  3893. Blend percentage.
  3894. 0.0 makes pixels either fully transparent, or not transparent at all.
  3895. Higher values result in semi-transparent pixels, with a higher transparency
  3896. the more similar the pixels color is to the key color.
  3897. @item yuv
  3898. Signals that the color passed is already in YUV instead of RGB.
  3899. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3900. This can be used to pass exact YUV values as hexadecimal numbers.
  3901. @end table
  3902. @subsection Examples
  3903. @itemize
  3904. @item
  3905. Make every green pixel in the input image transparent:
  3906. @example
  3907. ffmpeg -i input.png -vf chromakey=green out.png
  3908. @end example
  3909. @item
  3910. Overlay a greenscreen-video on top of a static black background.
  3911. @example
  3912. 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
  3913. @end example
  3914. @end itemize
  3915. @section ciescope
  3916. Display CIE color diagram with pixels overlaid onto it.
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item system
  3920. Set color system.
  3921. @table @samp
  3922. @item ntsc, 470m
  3923. @item ebu, 470bg
  3924. @item smpte
  3925. @item 240m
  3926. @item apple
  3927. @item widergb
  3928. @item cie1931
  3929. @item rec709, hdtv
  3930. @item uhdtv, rec2020
  3931. @end table
  3932. @item cie
  3933. Set CIE system.
  3934. @table @samp
  3935. @item xyy
  3936. @item ucs
  3937. @item luv
  3938. @end table
  3939. @item gamuts
  3940. Set what gamuts to draw.
  3941. See @code{system} option for available values.
  3942. @item size, s
  3943. Set ciescope size, by default set to 512.
  3944. @item intensity, i
  3945. Set intensity used to map input pixel values to CIE diagram.
  3946. @item contrast
  3947. Set contrast used to draw tongue colors that are out of active color system gamut.
  3948. @item corrgamma
  3949. Correct gamma displayed on scope, by default enabled.
  3950. @item showwhite
  3951. Show white point on CIE diagram, by default disabled.
  3952. @item gamma
  3953. Set input gamma. Used only with XYZ input color space.
  3954. @end table
  3955. @section codecview
  3956. Visualize information exported by some codecs.
  3957. Some codecs can export information through frames using side-data or other
  3958. means. For example, some MPEG based codecs export motion vectors through the
  3959. @var{export_mvs} flag in the codec @option{flags2} option.
  3960. The filter accepts the following option:
  3961. @table @option
  3962. @item mv
  3963. Set motion vectors to visualize.
  3964. Available flags for @var{mv} are:
  3965. @table @samp
  3966. @item pf
  3967. forward predicted MVs of P-frames
  3968. @item bf
  3969. forward predicted MVs of B-frames
  3970. @item bb
  3971. backward predicted MVs of B-frames
  3972. @end table
  3973. @item qp
  3974. Display quantization parameters using the chroma planes.
  3975. @item mv_type, mvt
  3976. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3977. Available flags for @var{mv_type} are:
  3978. @table @samp
  3979. @item fp
  3980. forward predicted MVs
  3981. @item bp
  3982. backward predicted MVs
  3983. @end table
  3984. @item frame_type, ft
  3985. Set frame type to visualize motion vectors of.
  3986. Available flags for @var{frame_type} are:
  3987. @table @samp
  3988. @item if
  3989. intra-coded frames (I-frames)
  3990. @item pf
  3991. predicted frames (P-frames)
  3992. @item bf
  3993. bi-directionally predicted frames (B-frames)
  3994. @end table
  3995. @end table
  3996. @subsection Examples
  3997. @itemize
  3998. @item
  3999. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4000. @example
  4001. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4002. @end example
  4003. @item
  4004. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4005. @example
  4006. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4007. @end example
  4008. @end itemize
  4009. @section colorbalance
  4010. Modify intensity of primary colors (red, green and blue) of input frames.
  4011. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4012. regions for the red-cyan, green-magenta or blue-yellow balance.
  4013. A positive adjustment value shifts the balance towards the primary color, a negative
  4014. value towards the complementary color.
  4015. The filter accepts the following options:
  4016. @table @option
  4017. @item rs
  4018. @item gs
  4019. @item bs
  4020. Adjust red, green and blue shadows (darkest pixels).
  4021. @item rm
  4022. @item gm
  4023. @item bm
  4024. Adjust red, green and blue midtones (medium pixels).
  4025. @item rh
  4026. @item gh
  4027. @item bh
  4028. Adjust red, green and blue highlights (brightest pixels).
  4029. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4030. @end table
  4031. @subsection Examples
  4032. @itemize
  4033. @item
  4034. Add red color cast to shadows:
  4035. @example
  4036. colorbalance=rs=.3
  4037. @end example
  4038. @end itemize
  4039. @section colorkey
  4040. RGB colorspace color keying.
  4041. The filter accepts the following options:
  4042. @table @option
  4043. @item color
  4044. The color which will be replaced with transparency.
  4045. @item similarity
  4046. Similarity percentage with the key color.
  4047. 0.01 matches only the exact key color, while 1.0 matches everything.
  4048. @item blend
  4049. Blend percentage.
  4050. 0.0 makes pixels either fully transparent, or not transparent at all.
  4051. Higher values result in semi-transparent pixels, with a higher transparency
  4052. the more similar the pixels color is to the key color.
  4053. @end table
  4054. @subsection Examples
  4055. @itemize
  4056. @item
  4057. Make every green pixel in the input image transparent:
  4058. @example
  4059. ffmpeg -i input.png -vf colorkey=green out.png
  4060. @end example
  4061. @item
  4062. Overlay a greenscreen-video on top of a static background image.
  4063. @example
  4064. 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
  4065. @end example
  4066. @end itemize
  4067. @section colorlevels
  4068. Adjust video input frames using levels.
  4069. The filter accepts the following options:
  4070. @table @option
  4071. @item rimin
  4072. @item gimin
  4073. @item bimin
  4074. @item aimin
  4075. Adjust red, green, blue and alpha input black point.
  4076. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4077. @item rimax
  4078. @item gimax
  4079. @item bimax
  4080. @item aimax
  4081. Adjust red, green, blue and alpha input white point.
  4082. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4083. Input levels are used to lighten highlights (bright tones), darken shadows
  4084. (dark tones), change the balance of bright and dark tones.
  4085. @item romin
  4086. @item gomin
  4087. @item bomin
  4088. @item aomin
  4089. Adjust red, green, blue and alpha output black point.
  4090. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4091. @item romax
  4092. @item gomax
  4093. @item bomax
  4094. @item aomax
  4095. Adjust red, green, blue and alpha output white point.
  4096. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4097. Output levels allows manual selection of a constrained output level range.
  4098. @end table
  4099. @subsection Examples
  4100. @itemize
  4101. @item
  4102. Make video output darker:
  4103. @example
  4104. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4105. @end example
  4106. @item
  4107. Increase contrast:
  4108. @example
  4109. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4110. @end example
  4111. @item
  4112. Make video output lighter:
  4113. @example
  4114. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4115. @end example
  4116. @item
  4117. Increase brightness:
  4118. @example
  4119. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4120. @end example
  4121. @end itemize
  4122. @section colorchannelmixer
  4123. Adjust video input frames by re-mixing color channels.
  4124. This filter modifies a color channel by adding the values associated to
  4125. the other channels of the same pixels. For example if the value to
  4126. modify is red, the output value will be:
  4127. @example
  4128. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4129. @end example
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item rr
  4133. @item rg
  4134. @item rb
  4135. @item ra
  4136. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4137. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4138. @item gr
  4139. @item gg
  4140. @item gb
  4141. @item ga
  4142. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4143. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4144. @item br
  4145. @item bg
  4146. @item bb
  4147. @item ba
  4148. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4149. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4150. @item ar
  4151. @item ag
  4152. @item ab
  4153. @item aa
  4154. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4155. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4156. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4157. @end table
  4158. @subsection Examples
  4159. @itemize
  4160. @item
  4161. Convert source to grayscale:
  4162. @example
  4163. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4164. @end example
  4165. @item
  4166. Simulate sepia tones:
  4167. @example
  4168. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4169. @end example
  4170. @end itemize
  4171. @section colormatrix
  4172. Convert color matrix.
  4173. The filter accepts the following options:
  4174. @table @option
  4175. @item src
  4176. @item dst
  4177. Specify the source and destination color matrix. Both values must be
  4178. specified.
  4179. The accepted values are:
  4180. @table @samp
  4181. @item bt709
  4182. BT.709
  4183. @item fcc
  4184. FCC
  4185. @item bt601
  4186. BT.601
  4187. @item bt470
  4188. BT.470
  4189. @item bt470bg
  4190. BT.470BG
  4191. @item smpte170m
  4192. SMPTE-170M
  4193. @item smpte240m
  4194. SMPTE-240M
  4195. @item bt2020
  4196. BT.2020
  4197. @end table
  4198. @end table
  4199. For example to convert from BT.601 to SMPTE-240M, use the command:
  4200. @example
  4201. colormatrix=bt601:smpte240m
  4202. @end example
  4203. @section colorspace
  4204. Convert colorspace, transfer characteristics or color primaries.
  4205. Input video needs to have an even size.
  4206. The filter accepts the following options:
  4207. @table @option
  4208. @anchor{all}
  4209. @item all
  4210. Specify all color properties at once.
  4211. The accepted values are:
  4212. @table @samp
  4213. @item bt470m
  4214. BT.470M
  4215. @item bt470bg
  4216. BT.470BG
  4217. @item bt601-6-525
  4218. BT.601-6 525
  4219. @item bt601-6-625
  4220. BT.601-6 625
  4221. @item bt709
  4222. BT.709
  4223. @item smpte170m
  4224. SMPTE-170M
  4225. @item smpte240m
  4226. SMPTE-240M
  4227. @item bt2020
  4228. BT.2020
  4229. @end table
  4230. @anchor{space}
  4231. @item space
  4232. Specify output colorspace.
  4233. The accepted values are:
  4234. @table @samp
  4235. @item bt709
  4236. BT.709
  4237. @item fcc
  4238. FCC
  4239. @item bt470bg
  4240. BT.470BG or BT.601-6 625
  4241. @item smpte170m
  4242. SMPTE-170M or BT.601-6 525
  4243. @item smpte240m
  4244. SMPTE-240M
  4245. @item ycgco
  4246. YCgCo
  4247. @item bt2020ncl
  4248. BT.2020 with non-constant luminance
  4249. @end table
  4250. @anchor{trc}
  4251. @item trc
  4252. Specify output transfer characteristics.
  4253. The accepted values are:
  4254. @table @samp
  4255. @item bt709
  4256. BT.709
  4257. @item bt470m
  4258. BT.470M
  4259. @item bt470bg
  4260. BT.470BG
  4261. @item gamma22
  4262. Constant gamma of 2.2
  4263. @item gamma28
  4264. Constant gamma of 2.8
  4265. @item smpte170m
  4266. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4267. @item smpte240m
  4268. SMPTE-240M
  4269. @item srgb
  4270. SRGB
  4271. @item iec61966-2-1
  4272. iec61966-2-1
  4273. @item iec61966-2-4
  4274. iec61966-2-4
  4275. @item xvycc
  4276. xvycc
  4277. @item bt2020-10
  4278. BT.2020 for 10-bits content
  4279. @item bt2020-12
  4280. BT.2020 for 12-bits content
  4281. @end table
  4282. @anchor{primaries}
  4283. @item primaries
  4284. Specify output color primaries.
  4285. The accepted values are:
  4286. @table @samp
  4287. @item bt709
  4288. BT.709
  4289. @item bt470m
  4290. BT.470M
  4291. @item bt470bg
  4292. BT.470BG or BT.601-6 625
  4293. @item smpte170m
  4294. SMPTE-170M or BT.601-6 525
  4295. @item smpte240m
  4296. SMPTE-240M
  4297. @item film
  4298. film
  4299. @item smpte431
  4300. SMPTE-431
  4301. @item smpte432
  4302. SMPTE-432
  4303. @item bt2020
  4304. BT.2020
  4305. @end table
  4306. @anchor{range}
  4307. @item range
  4308. Specify output color range.
  4309. The accepted values are:
  4310. @table @samp
  4311. @item tv
  4312. TV (restricted) range
  4313. @item mpeg
  4314. MPEG (restricted) range
  4315. @item pc
  4316. PC (full) range
  4317. @item jpeg
  4318. JPEG (full) range
  4319. @end table
  4320. @item format
  4321. Specify output color format.
  4322. The accepted values are:
  4323. @table @samp
  4324. @item yuv420p
  4325. YUV 4:2:0 planar 8-bits
  4326. @item yuv420p10
  4327. YUV 4:2:0 planar 10-bits
  4328. @item yuv420p12
  4329. YUV 4:2:0 planar 12-bits
  4330. @item yuv422p
  4331. YUV 4:2:2 planar 8-bits
  4332. @item yuv422p10
  4333. YUV 4:2:2 planar 10-bits
  4334. @item yuv422p12
  4335. YUV 4:2:2 planar 12-bits
  4336. @item yuv444p
  4337. YUV 4:4:4 planar 8-bits
  4338. @item yuv444p10
  4339. YUV 4:4:4 planar 10-bits
  4340. @item yuv444p12
  4341. YUV 4:4:4 planar 12-bits
  4342. @end table
  4343. @item fast
  4344. Do a fast conversion, which skips gamma/primary correction. This will take
  4345. significantly less CPU, but will be mathematically incorrect. To get output
  4346. compatible with that produced by the colormatrix filter, use fast=1.
  4347. @item dither
  4348. Specify dithering mode.
  4349. The accepted values are:
  4350. @table @samp
  4351. @item none
  4352. No dithering
  4353. @item fsb
  4354. Floyd-Steinberg dithering
  4355. @end table
  4356. @item wpadapt
  4357. Whitepoint adaptation mode.
  4358. The accepted values are:
  4359. @table @samp
  4360. @item bradford
  4361. Bradford whitepoint adaptation
  4362. @item vonkries
  4363. von Kries whitepoint adaptation
  4364. @item identity
  4365. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4366. @end table
  4367. @item iall
  4368. Override all input properties at once. Same accepted values as @ref{all}.
  4369. @item ispace
  4370. Override input colorspace. Same accepted values as @ref{space}.
  4371. @item iprimaries
  4372. Override input color primaries. Same accepted values as @ref{primaries}.
  4373. @item itrc
  4374. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4375. @item irange
  4376. Override input color range. Same accepted values as @ref{range}.
  4377. @end table
  4378. The filter converts the transfer characteristics, color space and color
  4379. primaries to the specified user values. The output value, if not specified,
  4380. is set to a default value based on the "all" property. If that property is
  4381. also not specified, the filter will log an error. The output color range and
  4382. format default to the same value as the input color range and format. The
  4383. input transfer characteristics, color space, color primaries and color range
  4384. should be set on the input data. If any of these are missing, the filter will
  4385. log an error and no conversion will take place.
  4386. For example to convert the input to SMPTE-240M, use the command:
  4387. @example
  4388. colorspace=smpte240m
  4389. @end example
  4390. @section convolution
  4391. Apply convolution 3x3 or 5x5 filter.
  4392. The filter accepts the following options:
  4393. @table @option
  4394. @item 0m
  4395. @item 1m
  4396. @item 2m
  4397. @item 3m
  4398. Set matrix for each plane.
  4399. Matrix is sequence of 9 or 25 signed integers.
  4400. @item 0rdiv
  4401. @item 1rdiv
  4402. @item 2rdiv
  4403. @item 3rdiv
  4404. Set multiplier for calculated value for each plane.
  4405. @item 0bias
  4406. @item 1bias
  4407. @item 2bias
  4408. @item 3bias
  4409. Set bias for each plane. This value is added to the result of the multiplication.
  4410. Useful for making the overall image brighter or darker. Default is 0.0.
  4411. @end table
  4412. @subsection Examples
  4413. @itemize
  4414. @item
  4415. Apply sharpen:
  4416. @example
  4417. 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"
  4418. @end example
  4419. @item
  4420. Apply blur:
  4421. @example
  4422. 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"
  4423. @end example
  4424. @item
  4425. Apply edge enhance:
  4426. @example
  4427. 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"
  4428. @end example
  4429. @item
  4430. Apply edge detect:
  4431. @example
  4432. 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"
  4433. @end example
  4434. @item
  4435. Apply emboss:
  4436. @example
  4437. 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"
  4438. @end example
  4439. @end itemize
  4440. @section copy
  4441. Copy the input video source unchanged to the output. This is mainly useful for
  4442. testing purposes.
  4443. @anchor{coreimage}
  4444. @section coreimage
  4445. Video filtering on GPU using Apple's CoreImage API on OSX.
  4446. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4447. processed by video hardware. However, software-based OpenGL implementations
  4448. exist which means there is no guarantee for hardware processing. It depends on
  4449. the respective OSX.
  4450. There are many filters and image generators provided by Apple that come with a
  4451. large variety of options. The filter has to be referenced by its name along
  4452. with its options.
  4453. The coreimage filter accepts the following options:
  4454. @table @option
  4455. @item list_filters
  4456. List all available filters and generators along with all their respective
  4457. options as well as possible minimum and maximum values along with the default
  4458. values.
  4459. @example
  4460. list_filters=true
  4461. @end example
  4462. @item filter
  4463. Specify all filters by their respective name and options.
  4464. Use @var{list_filters} to determine all valid filter names and options.
  4465. Numerical options are specified by a float value and are automatically clamped
  4466. to their respective value range. Vector and color options have to be specified
  4467. by a list of space separated float values. Character escaping has to be done.
  4468. A special option name @code{default} is available to use default options for a
  4469. filter.
  4470. It is required to specify either @code{default} or at least one of the filter options.
  4471. All omitted options are used with their default values.
  4472. The syntax of the filter string is as follows:
  4473. @example
  4474. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4475. @end example
  4476. @item output_rect
  4477. Specify a rectangle where the output of the filter chain is copied into the
  4478. input image. It is given by a list of space separated float values:
  4479. @example
  4480. output_rect=x\ y\ width\ height
  4481. @end example
  4482. If not given, the output rectangle equals the dimensions of the input image.
  4483. The output rectangle is automatically cropped at the borders of the input
  4484. image. Negative values are valid for each component.
  4485. @example
  4486. output_rect=25\ 25\ 100\ 100
  4487. @end example
  4488. @end table
  4489. Several filters can be chained for successive processing without GPU-HOST
  4490. transfers allowing for fast processing of complex filter chains.
  4491. Currently, only filters with zero (generators) or exactly one (filters) input
  4492. image and one output image are supported. Also, transition filters are not yet
  4493. usable as intended.
  4494. Some filters generate output images with additional padding depending on the
  4495. respective filter kernel. The padding is automatically removed to ensure the
  4496. filter output has the same size as the input image.
  4497. For image generators, the size of the output image is determined by the
  4498. previous output image of the filter chain or the input image of the whole
  4499. filterchain, respectively. The generators do not use the pixel information of
  4500. this image to generate their output. However, the generated output is
  4501. blended onto this image, resulting in partial or complete coverage of the
  4502. output image.
  4503. The @ref{coreimagesrc} video source can be used for generating input images
  4504. which are directly fed into the filter chain. By using it, providing input
  4505. images by another video source or an input video is not required.
  4506. @subsection Examples
  4507. @itemize
  4508. @item
  4509. List all filters available:
  4510. @example
  4511. coreimage=list_filters=true
  4512. @end example
  4513. @item
  4514. Use the CIBoxBlur filter with default options to blur an image:
  4515. @example
  4516. coreimage=filter=CIBoxBlur@@default
  4517. @end example
  4518. @item
  4519. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4520. its center at 100x100 and a radius of 50 pixels:
  4521. @example
  4522. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4523. @end example
  4524. @item
  4525. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4526. given as complete and escaped command-line for Apple's standard bash shell:
  4527. @example
  4528. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4529. @end example
  4530. @end itemize
  4531. @section crop
  4532. Crop the input video to given dimensions.
  4533. It accepts the following parameters:
  4534. @table @option
  4535. @item w, out_w
  4536. The width of the output video. It defaults to @code{iw}.
  4537. This expression is evaluated only once during the filter
  4538. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4539. @item h, out_h
  4540. The height of the output video. It defaults to @code{ih}.
  4541. This expression is evaluated only once during the filter
  4542. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4543. @item x
  4544. The horizontal position, in the input video, of the left edge of the output
  4545. video. It defaults to @code{(in_w-out_w)/2}.
  4546. This expression is evaluated per-frame.
  4547. @item y
  4548. The vertical position, in the input video, of the top edge of the output video.
  4549. It defaults to @code{(in_h-out_h)/2}.
  4550. This expression is evaluated per-frame.
  4551. @item keep_aspect
  4552. If set to 1 will force the output display aspect ratio
  4553. to be the same of the input, by changing the output sample aspect
  4554. ratio. It defaults to 0.
  4555. @item exact
  4556. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4557. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4558. It defaults to 0.
  4559. @end table
  4560. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4561. expressions containing the following constants:
  4562. @table @option
  4563. @item x
  4564. @item y
  4565. The computed values for @var{x} and @var{y}. They are evaluated for
  4566. each new frame.
  4567. @item in_w
  4568. @item in_h
  4569. The input width and height.
  4570. @item iw
  4571. @item ih
  4572. These are the same as @var{in_w} and @var{in_h}.
  4573. @item out_w
  4574. @item out_h
  4575. The output (cropped) width and height.
  4576. @item ow
  4577. @item oh
  4578. These are the same as @var{out_w} and @var{out_h}.
  4579. @item a
  4580. same as @var{iw} / @var{ih}
  4581. @item sar
  4582. input sample aspect ratio
  4583. @item dar
  4584. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4585. @item hsub
  4586. @item vsub
  4587. horizontal and vertical chroma subsample values. For example for the
  4588. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4589. @item n
  4590. The number of the input frame, starting from 0.
  4591. @item pos
  4592. the position in the file of the input frame, NAN if unknown
  4593. @item t
  4594. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4595. @end table
  4596. The expression for @var{out_w} may depend on the value of @var{out_h},
  4597. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4598. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4599. evaluated after @var{out_w} and @var{out_h}.
  4600. The @var{x} and @var{y} parameters specify the expressions for the
  4601. position of the top-left corner of the output (non-cropped) area. They
  4602. are evaluated for each frame. If the evaluated value is not valid, it
  4603. is approximated to the nearest valid value.
  4604. The expression for @var{x} may depend on @var{y}, and the expression
  4605. for @var{y} may depend on @var{x}.
  4606. @subsection Examples
  4607. @itemize
  4608. @item
  4609. Crop area with size 100x100 at position (12,34).
  4610. @example
  4611. crop=100:100:12:34
  4612. @end example
  4613. Using named options, the example above becomes:
  4614. @example
  4615. crop=w=100:h=100:x=12:y=34
  4616. @end example
  4617. @item
  4618. Crop the central input area with size 100x100:
  4619. @example
  4620. crop=100:100
  4621. @end example
  4622. @item
  4623. Crop the central input area with size 2/3 of the input video:
  4624. @example
  4625. crop=2/3*in_w:2/3*in_h
  4626. @end example
  4627. @item
  4628. Crop the input video central square:
  4629. @example
  4630. crop=out_w=in_h
  4631. crop=in_h
  4632. @end example
  4633. @item
  4634. Delimit the rectangle with the top-left corner placed at position
  4635. 100:100 and the right-bottom corner corresponding to the right-bottom
  4636. corner of the input image.
  4637. @example
  4638. crop=in_w-100:in_h-100:100:100
  4639. @end example
  4640. @item
  4641. Crop 10 pixels from the left and right borders, and 20 pixels from
  4642. the top and bottom borders
  4643. @example
  4644. crop=in_w-2*10:in_h-2*20
  4645. @end example
  4646. @item
  4647. Keep only the bottom right quarter of the input image:
  4648. @example
  4649. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4650. @end example
  4651. @item
  4652. Crop height for getting Greek harmony:
  4653. @example
  4654. crop=in_w:1/PHI*in_w
  4655. @end example
  4656. @item
  4657. Apply trembling effect:
  4658. @example
  4659. 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)
  4660. @end example
  4661. @item
  4662. Apply erratic camera effect depending on timestamp:
  4663. @example
  4664. 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)"
  4665. @end example
  4666. @item
  4667. Set x depending on the value of y:
  4668. @example
  4669. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4670. @end example
  4671. @end itemize
  4672. @subsection Commands
  4673. This filter supports the following commands:
  4674. @table @option
  4675. @item w, out_w
  4676. @item h, out_h
  4677. @item x
  4678. @item y
  4679. Set width/height of the output video and the horizontal/vertical position
  4680. in the input video.
  4681. The command accepts the same syntax of the corresponding option.
  4682. If the specified expression is not valid, it is kept at its current
  4683. value.
  4684. @end table
  4685. @section cropdetect
  4686. Auto-detect the crop size.
  4687. It calculates the necessary cropping parameters and prints the
  4688. recommended parameters via the logging system. The detected dimensions
  4689. correspond to the non-black area of the input video.
  4690. It accepts the following parameters:
  4691. @table @option
  4692. @item limit
  4693. Set higher black value threshold, which can be optionally specified
  4694. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4695. value greater to the set value is considered non-black. It defaults to 24.
  4696. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4697. on the bitdepth of the pixel format.
  4698. @item round
  4699. The value which the width/height should be divisible by. It defaults to
  4700. 16. The offset is automatically adjusted to center the video. Use 2 to
  4701. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4702. encoding to most video codecs.
  4703. @item reset_count, reset
  4704. Set the counter that determines after how many frames cropdetect will
  4705. reset the previously detected largest video area and start over to
  4706. detect the current optimal crop area. Default value is 0.
  4707. This can be useful when channel logos distort the video area. 0
  4708. indicates 'never reset', and returns the largest area encountered during
  4709. playback.
  4710. @end table
  4711. @anchor{curves}
  4712. @section curves
  4713. Apply color adjustments using curves.
  4714. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4715. component (red, green and blue) has its values defined by @var{N} key points
  4716. tied from each other using a smooth curve. The x-axis represents the pixel
  4717. values from the input frame, and the y-axis the new pixel values to be set for
  4718. the output frame.
  4719. By default, a component curve is defined by the two points @var{(0;0)} and
  4720. @var{(1;1)}. This creates a straight line where each original pixel value is
  4721. "adjusted" to its own value, which means no change to the image.
  4722. The filter allows you to redefine these two points and add some more. A new
  4723. curve (using a natural cubic spline interpolation) will be define to pass
  4724. smoothly through all these new coordinates. The new defined points needs to be
  4725. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4726. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4727. the vector spaces, the values will be clipped accordingly.
  4728. The filter accepts the following options:
  4729. @table @option
  4730. @item preset
  4731. Select one of the available color presets. This option can be used in addition
  4732. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4733. options takes priority on the preset values.
  4734. Available presets are:
  4735. @table @samp
  4736. @item none
  4737. @item color_negative
  4738. @item cross_process
  4739. @item darker
  4740. @item increase_contrast
  4741. @item lighter
  4742. @item linear_contrast
  4743. @item medium_contrast
  4744. @item negative
  4745. @item strong_contrast
  4746. @item vintage
  4747. @end table
  4748. Default is @code{none}.
  4749. @item master, m
  4750. Set the master key points. These points will define a second pass mapping. It
  4751. is sometimes called a "luminance" or "value" mapping. It can be used with
  4752. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4753. post-processing LUT.
  4754. @item red, r
  4755. Set the key points for the red component.
  4756. @item green, g
  4757. Set the key points for the green component.
  4758. @item blue, b
  4759. Set the key points for the blue component.
  4760. @item all
  4761. Set the key points for all components (not including master).
  4762. Can be used in addition to the other key points component
  4763. options. In this case, the unset component(s) will fallback on this
  4764. @option{all} setting.
  4765. @item psfile
  4766. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4767. @item plot
  4768. Save Gnuplot script of the curves in specified file.
  4769. @end table
  4770. To avoid some filtergraph syntax conflicts, each key points list need to be
  4771. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4772. @subsection Examples
  4773. @itemize
  4774. @item
  4775. Increase slightly the middle level of blue:
  4776. @example
  4777. curves=blue='0/0 0.5/0.58 1/1'
  4778. @end example
  4779. @item
  4780. Vintage effect:
  4781. @example
  4782. 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'
  4783. @end example
  4784. Here we obtain the following coordinates for each components:
  4785. @table @var
  4786. @item red
  4787. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4788. @item green
  4789. @code{(0;0) (0.50;0.48) (1;1)}
  4790. @item blue
  4791. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4792. @end table
  4793. @item
  4794. The previous example can also be achieved with the associated built-in preset:
  4795. @example
  4796. curves=preset=vintage
  4797. @end example
  4798. @item
  4799. Or simply:
  4800. @example
  4801. curves=vintage
  4802. @end example
  4803. @item
  4804. Use a Photoshop preset and redefine the points of the green component:
  4805. @example
  4806. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4807. @end example
  4808. @item
  4809. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4810. and @command{gnuplot}:
  4811. @example
  4812. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4813. gnuplot -p /tmp/curves.plt
  4814. @end example
  4815. @end itemize
  4816. @section datascope
  4817. Video data analysis filter.
  4818. This filter shows hexadecimal pixel values of part of video.
  4819. The filter accepts the following options:
  4820. @table @option
  4821. @item size, s
  4822. Set output video size.
  4823. @item x
  4824. Set x offset from where to pick pixels.
  4825. @item y
  4826. Set y offset from where to pick pixels.
  4827. @item mode
  4828. Set scope mode, can be one of the following:
  4829. @table @samp
  4830. @item mono
  4831. Draw hexadecimal pixel values with white color on black background.
  4832. @item color
  4833. Draw hexadecimal pixel values with input video pixel color on black
  4834. background.
  4835. @item color2
  4836. Draw hexadecimal pixel values on color background picked from input video,
  4837. the text color is picked in such way so its always visible.
  4838. @end table
  4839. @item axis
  4840. Draw rows and columns numbers on left and top of video.
  4841. @item opacity
  4842. Set background opacity.
  4843. @end table
  4844. @section dctdnoiz
  4845. Denoise frames using 2D DCT (frequency domain filtering).
  4846. This filter is not designed for real time.
  4847. The filter accepts the following options:
  4848. @table @option
  4849. @item sigma, s
  4850. Set the noise sigma constant.
  4851. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4852. coefficient (absolute value) below this threshold with be dropped.
  4853. If you need a more advanced filtering, see @option{expr}.
  4854. Default is @code{0}.
  4855. @item overlap
  4856. Set number overlapping pixels for each block. Since the filter can be slow, you
  4857. may want to reduce this value, at the cost of a less effective filter and the
  4858. risk of various artefacts.
  4859. If the overlapping value doesn't permit processing the whole input width or
  4860. height, a warning will be displayed and according borders won't be denoised.
  4861. Default value is @var{blocksize}-1, which is the best possible setting.
  4862. @item expr, e
  4863. Set the coefficient factor expression.
  4864. For each coefficient of a DCT block, this expression will be evaluated as a
  4865. multiplier value for the coefficient.
  4866. If this is option is set, the @option{sigma} option will be ignored.
  4867. The absolute value of the coefficient can be accessed through the @var{c}
  4868. variable.
  4869. @item n
  4870. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4871. @var{blocksize}, which is the width and height of the processed blocks.
  4872. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4873. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4874. on the speed processing. Also, a larger block size does not necessarily means a
  4875. better de-noising.
  4876. @end table
  4877. @subsection Examples
  4878. Apply a denoise with a @option{sigma} of @code{4.5}:
  4879. @example
  4880. dctdnoiz=4.5
  4881. @end example
  4882. The same operation can be achieved using the expression system:
  4883. @example
  4884. dctdnoiz=e='gte(c, 4.5*3)'
  4885. @end example
  4886. Violent denoise using a block size of @code{16x16}:
  4887. @example
  4888. dctdnoiz=15:n=4
  4889. @end example
  4890. @section deband
  4891. Remove banding artifacts from input video.
  4892. It works by replacing banded pixels with average value of referenced pixels.
  4893. The filter accepts the following options:
  4894. @table @option
  4895. @item 1thr
  4896. @item 2thr
  4897. @item 3thr
  4898. @item 4thr
  4899. Set banding detection threshold for each plane. Default is 0.02.
  4900. Valid range is 0.00003 to 0.5.
  4901. If difference between current pixel and reference pixel is less than threshold,
  4902. it will be considered as banded.
  4903. @item range, r
  4904. Banding detection range in pixels. Default is 16. If positive, random number
  4905. in range 0 to set value will be used. If negative, exact absolute value
  4906. will be used.
  4907. The range defines square of four pixels around current pixel.
  4908. @item direction, d
  4909. Set direction in radians from which four pixel will be compared. If positive,
  4910. random direction from 0 to set direction will be picked. If negative, exact of
  4911. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4912. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4913. column.
  4914. @item blur, b
  4915. If enabled, current pixel is compared with average value of all four
  4916. surrounding pixels. The default is enabled. If disabled current pixel is
  4917. compared with all four surrounding pixels. The pixel is considered banded
  4918. if only all four differences with surrounding pixels are less than threshold.
  4919. @item coupling, c
  4920. If enabled, current pixel is changed if and only if all pixel components are banded,
  4921. e.g. banding detection threshold is triggered for all color components.
  4922. The default is disabled.
  4923. @end table
  4924. @anchor{decimate}
  4925. @section decimate
  4926. Drop duplicated frames at regular intervals.
  4927. The filter accepts the following options:
  4928. @table @option
  4929. @item cycle
  4930. Set the number of frames from which one will be dropped. Setting this to
  4931. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4932. Default is @code{5}.
  4933. @item dupthresh
  4934. Set the threshold for duplicate detection. If the difference metric for a frame
  4935. is less than or equal to this value, then it is declared as duplicate. Default
  4936. is @code{1.1}
  4937. @item scthresh
  4938. Set scene change threshold. Default is @code{15}.
  4939. @item blockx
  4940. @item blocky
  4941. Set the size of the x and y-axis blocks used during metric calculations.
  4942. Larger blocks give better noise suppression, but also give worse detection of
  4943. small movements. Must be a power of two. Default is @code{32}.
  4944. @item ppsrc
  4945. Mark main input as a pre-processed input and activate clean source input
  4946. stream. This allows the input to be pre-processed with various filters to help
  4947. the metrics calculation while keeping the frame selection lossless. When set to
  4948. @code{1}, the first stream is for the pre-processed input, and the second
  4949. stream is the clean source from where the kept frames are chosen. Default is
  4950. @code{0}.
  4951. @item chroma
  4952. Set whether or not chroma is considered in the metric calculations. Default is
  4953. @code{1}.
  4954. @end table
  4955. @section deflate
  4956. Apply deflate effect to the video.
  4957. This filter replaces the pixel by the local(3x3) average by taking into account
  4958. only values lower than the pixel.
  4959. It accepts the following options:
  4960. @table @option
  4961. @item threshold0
  4962. @item threshold1
  4963. @item threshold2
  4964. @item threshold3
  4965. Limit the maximum change for each plane, default is 65535.
  4966. If 0, plane will remain unchanged.
  4967. @end table
  4968. @section deflicker
  4969. Remove temporal frame luminance variations.
  4970. It accepts the following options:
  4971. @table @option
  4972. @item size, s
  4973. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  4974. @item mode, m
  4975. Set averaging mode to smooth temporal luminance variations.
  4976. Available values are:
  4977. @table @samp
  4978. @item am
  4979. Arithmetic mean
  4980. @item gm
  4981. Geometric mean
  4982. @item hm
  4983. Harmonic mean
  4984. @item qm
  4985. Quadratic mean
  4986. @item cm
  4987. Cubic mean
  4988. @item pm
  4989. Power mean
  4990. @item median
  4991. Median
  4992. @end table
  4993. @item bypass
  4994. Do not actually modify frame. Useful when one only wants metadata.
  4995. @end table
  4996. @section dejudder
  4997. Remove judder produced by partially interlaced telecined content.
  4998. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4999. source was partially telecined content then the output of @code{pullup,dejudder}
  5000. will have a variable frame rate. May change the recorded frame rate of the
  5001. container. Aside from that change, this filter will not affect constant frame
  5002. rate video.
  5003. The option available in this filter is:
  5004. @table @option
  5005. @item cycle
  5006. Specify the length of the window over which the judder repeats.
  5007. Accepts any integer greater than 1. Useful values are:
  5008. @table @samp
  5009. @item 4
  5010. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5011. @item 5
  5012. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5013. @item 20
  5014. If a mixture of the two.
  5015. @end table
  5016. The default is @samp{4}.
  5017. @end table
  5018. @section delogo
  5019. Suppress a TV station logo by a simple interpolation of the surrounding
  5020. pixels. Just set a rectangle covering the logo and watch it disappear
  5021. (and sometimes something even uglier appear - your mileage may vary).
  5022. It accepts the following parameters:
  5023. @table @option
  5024. @item x
  5025. @item y
  5026. Specify the top left corner coordinates of the logo. They must be
  5027. specified.
  5028. @item w
  5029. @item h
  5030. Specify the width and height of the logo to clear. They must be
  5031. specified.
  5032. @item band, t
  5033. Specify the thickness of the fuzzy edge of the rectangle (added to
  5034. @var{w} and @var{h}). The default value is 1. This option is
  5035. deprecated, setting higher values should no longer be necessary and
  5036. is not recommended.
  5037. @item show
  5038. When set to 1, a green rectangle is drawn on the screen to simplify
  5039. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5040. The default value is 0.
  5041. The rectangle is drawn on the outermost pixels which will be (partly)
  5042. replaced with interpolated values. The values of the next pixels
  5043. immediately outside this rectangle in each direction will be used to
  5044. compute the interpolated pixel values inside the rectangle.
  5045. @end table
  5046. @subsection Examples
  5047. @itemize
  5048. @item
  5049. Set a rectangle covering the area with top left corner coordinates 0,0
  5050. and size 100x77, and a band of size 10:
  5051. @example
  5052. delogo=x=0:y=0:w=100:h=77:band=10
  5053. @end example
  5054. @end itemize
  5055. @section deshake
  5056. Attempt to fix small changes in horizontal and/or vertical shift. This
  5057. filter helps remove camera shake from hand-holding a camera, bumping a
  5058. tripod, moving on a vehicle, etc.
  5059. The filter accepts the following options:
  5060. @table @option
  5061. @item x
  5062. @item y
  5063. @item w
  5064. @item h
  5065. Specify a rectangular area where to limit the search for motion
  5066. vectors.
  5067. If desired the search for motion vectors can be limited to a
  5068. rectangular area of the frame defined by its top left corner, width
  5069. and height. These parameters have the same meaning as the drawbox
  5070. filter which can be used to visualise the position of the bounding
  5071. box.
  5072. This is useful when simultaneous movement of subjects within the frame
  5073. might be confused for camera motion by the motion vector search.
  5074. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5075. then the full frame is used. This allows later options to be set
  5076. without specifying the bounding box for the motion vector search.
  5077. Default - search the whole frame.
  5078. @item rx
  5079. @item ry
  5080. Specify the maximum extent of movement in x and y directions in the
  5081. range 0-64 pixels. Default 16.
  5082. @item edge
  5083. Specify how to generate pixels to fill blanks at the edge of the
  5084. frame. Available values are:
  5085. @table @samp
  5086. @item blank, 0
  5087. Fill zeroes at blank locations
  5088. @item original, 1
  5089. Original image at blank locations
  5090. @item clamp, 2
  5091. Extruded edge value at blank locations
  5092. @item mirror, 3
  5093. Mirrored edge at blank locations
  5094. @end table
  5095. Default value is @samp{mirror}.
  5096. @item blocksize
  5097. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5098. default 8.
  5099. @item contrast
  5100. Specify the contrast threshold for blocks. Only blocks with more than
  5101. the specified contrast (difference between darkest and lightest
  5102. pixels) will be considered. Range 1-255, default 125.
  5103. @item search
  5104. Specify the search strategy. Available values are:
  5105. @table @samp
  5106. @item exhaustive, 0
  5107. Set exhaustive search
  5108. @item less, 1
  5109. Set less exhaustive search.
  5110. @end table
  5111. Default value is @samp{exhaustive}.
  5112. @item filename
  5113. If set then a detailed log of the motion search is written to the
  5114. specified file.
  5115. @item opencl
  5116. If set to 1, specify using OpenCL capabilities, only available if
  5117. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5118. @end table
  5119. @section detelecine
  5120. Apply an exact inverse of the telecine operation. It requires a predefined
  5121. pattern specified using the pattern option which must be the same as that passed
  5122. to the telecine filter.
  5123. This filter accepts the following options:
  5124. @table @option
  5125. @item first_field
  5126. @table @samp
  5127. @item top, t
  5128. top field first
  5129. @item bottom, b
  5130. bottom field first
  5131. The default value is @code{top}.
  5132. @end table
  5133. @item pattern
  5134. A string of numbers representing the pulldown pattern you wish to apply.
  5135. The default value is @code{23}.
  5136. @item start_frame
  5137. A number representing position of the first frame with respect to the telecine
  5138. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5139. @end table
  5140. @section dilation
  5141. Apply dilation effect to the video.
  5142. This filter replaces the pixel by the local(3x3) maximum.
  5143. It accepts the following options:
  5144. @table @option
  5145. @item threshold0
  5146. @item threshold1
  5147. @item threshold2
  5148. @item threshold3
  5149. Limit the maximum change for each plane, default is 65535.
  5150. If 0, plane will remain unchanged.
  5151. @item coordinates
  5152. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5153. pixels are used.
  5154. Flags to local 3x3 coordinates maps like this:
  5155. 1 2 3
  5156. 4 5
  5157. 6 7 8
  5158. @end table
  5159. @section displace
  5160. Displace pixels as indicated by second and third input stream.
  5161. It takes three input streams and outputs one stream, the first input is the
  5162. source, and second and third input are displacement maps.
  5163. The second input specifies how much to displace pixels along the
  5164. x-axis, while the third input specifies how much to displace pixels
  5165. along the y-axis.
  5166. If one of displacement map streams terminates, last frame from that
  5167. displacement map will be used.
  5168. Note that once generated, displacements maps can be reused over and over again.
  5169. A description of the accepted options follows.
  5170. @table @option
  5171. @item edge
  5172. Set displace behavior for pixels that are out of range.
  5173. Available values are:
  5174. @table @samp
  5175. @item blank
  5176. Missing pixels are replaced by black pixels.
  5177. @item smear
  5178. Adjacent pixels will spread out to replace missing pixels.
  5179. @item wrap
  5180. Out of range pixels are wrapped so they point to pixels of other side.
  5181. @end table
  5182. Default is @samp{smear}.
  5183. @end table
  5184. @subsection Examples
  5185. @itemize
  5186. @item
  5187. Add ripple effect to rgb input of video size hd720:
  5188. @example
  5189. 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
  5190. @end example
  5191. @item
  5192. Add wave effect to rgb input of video size hd720:
  5193. @example
  5194. 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
  5195. @end example
  5196. @end itemize
  5197. @section drawbox
  5198. Draw a colored box on the input image.
  5199. It accepts the following parameters:
  5200. @table @option
  5201. @item x
  5202. @item y
  5203. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5204. @item width, w
  5205. @item height, h
  5206. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5207. the input width and height. It defaults to 0.
  5208. @item color, c
  5209. Specify the color of the box to write. For the general syntax of this option,
  5210. check the "Color" section in the ffmpeg-utils manual. If the special
  5211. value @code{invert} is used, the box edge color is the same as the
  5212. video with inverted luma.
  5213. @item thickness, t
  5214. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5215. See below for the list of accepted constants.
  5216. @end table
  5217. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5218. following constants:
  5219. @table @option
  5220. @item dar
  5221. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5222. @item hsub
  5223. @item vsub
  5224. horizontal and vertical chroma subsample values. For example for the
  5225. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5226. @item in_h, ih
  5227. @item in_w, iw
  5228. The input width and height.
  5229. @item sar
  5230. The input sample aspect ratio.
  5231. @item x
  5232. @item y
  5233. The x and y offset coordinates where the box is drawn.
  5234. @item w
  5235. @item h
  5236. The width and height of the drawn box.
  5237. @item t
  5238. The thickness of the drawn box.
  5239. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5240. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5241. @end table
  5242. @subsection Examples
  5243. @itemize
  5244. @item
  5245. Draw a black box around the edge of the input image:
  5246. @example
  5247. drawbox
  5248. @end example
  5249. @item
  5250. Draw a box with color red and an opacity of 50%:
  5251. @example
  5252. drawbox=10:20:200:60:red@@0.5
  5253. @end example
  5254. The previous example can be specified as:
  5255. @example
  5256. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5257. @end example
  5258. @item
  5259. Fill the box with pink color:
  5260. @example
  5261. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5262. @end example
  5263. @item
  5264. Draw a 2-pixel red 2.40:1 mask:
  5265. @example
  5266. 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
  5267. @end example
  5268. @end itemize
  5269. @section drawgrid
  5270. Draw a grid on the input image.
  5271. It accepts the following parameters:
  5272. @table @option
  5273. @item x
  5274. @item y
  5275. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5276. @item width, w
  5277. @item height, h
  5278. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5279. input width and height, respectively, minus @code{thickness}, so image gets
  5280. framed. Default to 0.
  5281. @item color, c
  5282. Specify the color of the grid. For the general syntax of this option,
  5283. check the "Color" section in the ffmpeg-utils manual. If the special
  5284. value @code{invert} is used, the grid color is the same as the
  5285. video with inverted luma.
  5286. @item thickness, t
  5287. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5288. See below for the list of accepted constants.
  5289. @end table
  5290. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5291. following constants:
  5292. @table @option
  5293. @item dar
  5294. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5295. @item hsub
  5296. @item vsub
  5297. horizontal and vertical chroma subsample values. For example for the
  5298. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5299. @item in_h, ih
  5300. @item in_w, iw
  5301. The input grid cell width and height.
  5302. @item sar
  5303. The input sample aspect ratio.
  5304. @item x
  5305. @item y
  5306. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5307. @item w
  5308. @item h
  5309. The width and height of the drawn cell.
  5310. @item t
  5311. The thickness of the drawn cell.
  5312. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5313. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5314. @end table
  5315. @subsection Examples
  5316. @itemize
  5317. @item
  5318. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5319. @example
  5320. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5321. @end example
  5322. @item
  5323. Draw a white 3x3 grid with an opacity of 50%:
  5324. @example
  5325. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5326. @end example
  5327. @end itemize
  5328. @anchor{drawtext}
  5329. @section drawtext
  5330. Draw a text string or text from a specified file on top of a video, using the
  5331. libfreetype library.
  5332. To enable compilation of this filter, you need to configure FFmpeg with
  5333. @code{--enable-libfreetype}.
  5334. To enable default font fallback and the @var{font} option you need to
  5335. configure FFmpeg with @code{--enable-libfontconfig}.
  5336. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5337. @code{--enable-libfribidi}.
  5338. @subsection Syntax
  5339. It accepts the following parameters:
  5340. @table @option
  5341. @item box
  5342. Used to draw a box around text using the background color.
  5343. The value must be either 1 (enable) or 0 (disable).
  5344. The default value of @var{box} is 0.
  5345. @item boxborderw
  5346. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5347. The default value of @var{boxborderw} is 0.
  5348. @item boxcolor
  5349. The color to be used for drawing box around text. For the syntax of this
  5350. option, check the "Color" section in the ffmpeg-utils manual.
  5351. The default value of @var{boxcolor} is "white".
  5352. @item line_spacing
  5353. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5354. The default value of @var{line_spacing} is 0.
  5355. @item borderw
  5356. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5357. The default value of @var{borderw} is 0.
  5358. @item bordercolor
  5359. Set the color to be used for drawing border around text. For the syntax of this
  5360. option, check the "Color" section in the ffmpeg-utils manual.
  5361. The default value of @var{bordercolor} is "black".
  5362. @item expansion
  5363. Select how the @var{text} is expanded. Can be either @code{none},
  5364. @code{strftime} (deprecated) or
  5365. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5366. below for details.
  5367. @item basetime
  5368. Set a start time for the count. Value is in microseconds. Only applied
  5369. in the deprecated strftime expansion mode. To emulate in normal expansion
  5370. mode use the @code{pts} function, supplying the start time (in seconds)
  5371. as the second argument.
  5372. @item fix_bounds
  5373. If true, check and fix text coords to avoid clipping.
  5374. @item fontcolor
  5375. The color to be used for drawing fonts. For the syntax of this option, check
  5376. the "Color" section in the ffmpeg-utils manual.
  5377. The default value of @var{fontcolor} is "black".
  5378. @item fontcolor_expr
  5379. String which is expanded the same way as @var{text} to obtain dynamic
  5380. @var{fontcolor} value. By default this option has empty value and is not
  5381. processed. When this option is set, it overrides @var{fontcolor} option.
  5382. @item font
  5383. The font family to be used for drawing text. By default Sans.
  5384. @item fontfile
  5385. The font file to be used for drawing text. The path must be included.
  5386. This parameter is mandatory if the fontconfig support is disabled.
  5387. @item alpha
  5388. Draw the text applying alpha blending. The value can
  5389. be a number between 0.0 and 1.0.
  5390. The expression accepts the same variables @var{x, y} as well.
  5391. The default value is 1.
  5392. Please see @var{fontcolor_expr}.
  5393. @item fontsize
  5394. The font size to be used for drawing text.
  5395. The default value of @var{fontsize} is 16.
  5396. @item text_shaping
  5397. If set to 1, attempt to shape the text (for example, reverse the order of
  5398. right-to-left text and join Arabic characters) before drawing it.
  5399. Otherwise, just draw the text exactly as given.
  5400. By default 1 (if supported).
  5401. @item ft_load_flags
  5402. The flags to be used for loading the fonts.
  5403. The flags map the corresponding flags supported by libfreetype, and are
  5404. a combination of the following values:
  5405. @table @var
  5406. @item default
  5407. @item no_scale
  5408. @item no_hinting
  5409. @item render
  5410. @item no_bitmap
  5411. @item vertical_layout
  5412. @item force_autohint
  5413. @item crop_bitmap
  5414. @item pedantic
  5415. @item ignore_global_advance_width
  5416. @item no_recurse
  5417. @item ignore_transform
  5418. @item monochrome
  5419. @item linear_design
  5420. @item no_autohint
  5421. @end table
  5422. Default value is "default".
  5423. For more information consult the documentation for the FT_LOAD_*
  5424. libfreetype flags.
  5425. @item shadowcolor
  5426. The color to be used for drawing a shadow behind the drawn text. For the
  5427. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5428. The default value of @var{shadowcolor} is "black".
  5429. @item shadowx
  5430. @item shadowy
  5431. The x and y offsets for the text shadow position with respect to the
  5432. position of the text. They can be either positive or negative
  5433. values. The default value for both is "0".
  5434. @item start_number
  5435. The starting frame number for the n/frame_num variable. The default value
  5436. is "0".
  5437. @item tabsize
  5438. The size in number of spaces to use for rendering the tab.
  5439. Default value is 4.
  5440. @item timecode
  5441. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5442. format. It can be used with or without text parameter. @var{timecode_rate}
  5443. option must be specified.
  5444. @item timecode_rate, rate, r
  5445. Set the timecode frame rate (timecode only).
  5446. @item tc24hmax
  5447. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5448. Default is 0 (disabled).
  5449. @item text
  5450. The text string to be drawn. The text must be a sequence of UTF-8
  5451. encoded characters.
  5452. This parameter is mandatory if no file is specified with the parameter
  5453. @var{textfile}.
  5454. @item textfile
  5455. A text file containing text to be drawn. The text must be a sequence
  5456. of UTF-8 encoded characters.
  5457. This parameter is mandatory if no text string is specified with the
  5458. parameter @var{text}.
  5459. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5460. @item reload
  5461. If set to 1, the @var{textfile} will be reloaded before each frame.
  5462. Be sure to update it atomically, or it may be read partially, or even fail.
  5463. @item x
  5464. @item y
  5465. The expressions which specify the offsets where text will be drawn
  5466. within the video frame. They are relative to the top/left border of the
  5467. output image.
  5468. The default value of @var{x} and @var{y} is "0".
  5469. See below for the list of accepted constants and functions.
  5470. @end table
  5471. The parameters for @var{x} and @var{y} are expressions containing the
  5472. following constants and functions:
  5473. @table @option
  5474. @item dar
  5475. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5476. @item hsub
  5477. @item vsub
  5478. horizontal and vertical chroma subsample values. For example for the
  5479. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5480. @item line_h, lh
  5481. the height of each text line
  5482. @item main_h, h, H
  5483. the input height
  5484. @item main_w, w, W
  5485. the input width
  5486. @item max_glyph_a, ascent
  5487. the maximum distance from the baseline to the highest/upper grid
  5488. coordinate used to place a glyph outline point, for all the rendered
  5489. glyphs.
  5490. It is a positive value, due to the grid's orientation with the Y axis
  5491. upwards.
  5492. @item max_glyph_d, descent
  5493. the maximum distance from the baseline to the lowest grid coordinate
  5494. used to place a glyph outline point, for all the rendered glyphs.
  5495. This is a negative value, due to the grid's orientation, with the Y axis
  5496. upwards.
  5497. @item max_glyph_h
  5498. maximum glyph height, that is the maximum height for all the glyphs
  5499. contained in the rendered text, it is equivalent to @var{ascent} -
  5500. @var{descent}.
  5501. @item max_glyph_w
  5502. maximum glyph width, that is the maximum width for all the glyphs
  5503. contained in the rendered text
  5504. @item n
  5505. the number of input frame, starting from 0
  5506. @item rand(min, max)
  5507. return a random number included between @var{min} and @var{max}
  5508. @item sar
  5509. The input sample aspect ratio.
  5510. @item t
  5511. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5512. @item text_h, th
  5513. the height of the rendered text
  5514. @item text_w, tw
  5515. the width of the rendered text
  5516. @item x
  5517. @item y
  5518. the x and y offset coordinates where the text is drawn.
  5519. These parameters allow the @var{x} and @var{y} expressions to refer
  5520. each other, so you can for example specify @code{y=x/dar}.
  5521. @end table
  5522. @anchor{drawtext_expansion}
  5523. @subsection Text expansion
  5524. If @option{expansion} is set to @code{strftime},
  5525. the filter recognizes strftime() sequences in the provided text and
  5526. expands them accordingly. Check the documentation of strftime(). This
  5527. feature is deprecated.
  5528. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5529. If @option{expansion} is set to @code{normal} (which is the default),
  5530. the following expansion mechanism is used.
  5531. The backslash character @samp{\}, followed by any character, always expands to
  5532. the second character.
  5533. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5534. braces is a function name, possibly followed by arguments separated by ':'.
  5535. If the arguments contain special characters or delimiters (':' or '@}'),
  5536. they should be escaped.
  5537. Note that they probably must also be escaped as the value for the
  5538. @option{text} option in the filter argument string and as the filter
  5539. argument in the filtergraph description, and possibly also for the shell,
  5540. that makes up to four levels of escaping; using a text file avoids these
  5541. problems.
  5542. The following functions are available:
  5543. @table @command
  5544. @item expr, e
  5545. The expression evaluation result.
  5546. It must take one argument specifying the expression to be evaluated,
  5547. which accepts the same constants and functions as the @var{x} and
  5548. @var{y} values. Note that not all constants should be used, for
  5549. example the text size is not known when evaluating the expression, so
  5550. the constants @var{text_w} and @var{text_h} will have an undefined
  5551. value.
  5552. @item expr_int_format, eif
  5553. Evaluate the expression's value and output as formatted integer.
  5554. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5555. The second argument specifies the output format. Allowed values are @samp{x},
  5556. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5557. @code{printf} function.
  5558. The third parameter is optional and sets the number of positions taken by the output.
  5559. It can be used to add padding with zeros from the left.
  5560. @item gmtime
  5561. The time at which the filter is running, expressed in UTC.
  5562. It can accept an argument: a strftime() format string.
  5563. @item localtime
  5564. The time at which the filter is running, expressed in the local time zone.
  5565. It can accept an argument: a strftime() format string.
  5566. @item metadata
  5567. Frame metadata. Takes one or two arguments.
  5568. The first argument is mandatory and specifies the metadata key.
  5569. The second argument is optional and specifies a default value, used when the
  5570. metadata key is not found or empty.
  5571. @item n, frame_num
  5572. The frame number, starting from 0.
  5573. @item pict_type
  5574. A 1 character description of the current picture type.
  5575. @item pts
  5576. The timestamp of the current frame.
  5577. It can take up to three arguments.
  5578. The first argument is the format of the timestamp; it defaults to @code{flt}
  5579. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5580. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5581. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5582. @code{localtime} stands for the timestamp of the frame formatted as
  5583. local time zone time.
  5584. The second argument is an offset added to the timestamp.
  5585. If the format is set to @code{localtime} or @code{gmtime},
  5586. a third argument may be supplied: a strftime() format string.
  5587. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5588. @end table
  5589. @subsection Examples
  5590. @itemize
  5591. @item
  5592. Draw "Test Text" with font FreeSerif, using the default values for the
  5593. optional parameters.
  5594. @example
  5595. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5596. @end example
  5597. @item
  5598. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5599. and y=50 (counting from the top-left corner of the screen), text is
  5600. yellow with a red box around it. Both the text and the box have an
  5601. opacity of 20%.
  5602. @example
  5603. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5604. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5605. @end example
  5606. Note that the double quotes are not necessary if spaces are not used
  5607. within the parameter list.
  5608. @item
  5609. Show the text at the center of the video frame:
  5610. @example
  5611. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5612. @end example
  5613. @item
  5614. Show the text at a random position, switching to a new position every 30 seconds:
  5615. @example
  5616. 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)"
  5617. @end example
  5618. @item
  5619. Show a text line sliding from right to left in the last row of the video
  5620. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5621. with no newlines.
  5622. @example
  5623. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5624. @end example
  5625. @item
  5626. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5627. @example
  5628. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5629. @end example
  5630. @item
  5631. Draw a single green letter "g", at the center of the input video.
  5632. The glyph baseline is placed at half screen height.
  5633. @example
  5634. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5635. @end example
  5636. @item
  5637. Show text for 1 second every 3 seconds:
  5638. @example
  5639. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5640. @end example
  5641. @item
  5642. Use fontconfig to set the font. Note that the colons need to be escaped.
  5643. @example
  5644. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5645. @end example
  5646. @item
  5647. Print the date of a real-time encoding (see strftime(3)):
  5648. @example
  5649. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5650. @end example
  5651. @item
  5652. Show text fading in and out (appearing/disappearing):
  5653. @example
  5654. #!/bin/sh
  5655. DS=1.0 # display start
  5656. DE=10.0 # display end
  5657. FID=1.5 # fade in duration
  5658. FOD=5 # fade out duration
  5659. 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 @}"
  5660. @end example
  5661. @item
  5662. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5663. and the @option{fontsize} value are included in the @option{y} offset.
  5664. @example
  5665. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5666. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5667. @end example
  5668. @end itemize
  5669. For more information about libfreetype, check:
  5670. @url{http://www.freetype.org/}.
  5671. For more information about fontconfig, check:
  5672. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5673. For more information about libfribidi, check:
  5674. @url{http://fribidi.org/}.
  5675. @section edgedetect
  5676. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5677. The filter accepts the following options:
  5678. @table @option
  5679. @item low
  5680. @item high
  5681. Set low and high threshold values used by the Canny thresholding
  5682. algorithm.
  5683. The high threshold selects the "strong" edge pixels, which are then
  5684. connected through 8-connectivity with the "weak" edge pixels selected
  5685. by the low threshold.
  5686. @var{low} and @var{high} threshold values must be chosen in the range
  5687. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5688. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5689. is @code{50/255}.
  5690. @item mode
  5691. Define the drawing mode.
  5692. @table @samp
  5693. @item wires
  5694. Draw white/gray wires on black background.
  5695. @item colormix
  5696. Mix the colors to create a paint/cartoon effect.
  5697. @end table
  5698. Default value is @var{wires}.
  5699. @end table
  5700. @subsection Examples
  5701. @itemize
  5702. @item
  5703. Standard edge detection with custom values for the hysteresis thresholding:
  5704. @example
  5705. edgedetect=low=0.1:high=0.4
  5706. @end example
  5707. @item
  5708. Painting effect without thresholding:
  5709. @example
  5710. edgedetect=mode=colormix:high=0
  5711. @end example
  5712. @end itemize
  5713. @section eq
  5714. Set brightness, contrast, saturation and approximate gamma adjustment.
  5715. The filter accepts the following options:
  5716. @table @option
  5717. @item contrast
  5718. Set the contrast expression. The value must be a float value in range
  5719. @code{-2.0} to @code{2.0}. The default value is "1".
  5720. @item brightness
  5721. Set the brightness expression. The value must be a float value in
  5722. range @code{-1.0} to @code{1.0}. The default value is "0".
  5723. @item saturation
  5724. Set the saturation expression. The value must be a float in
  5725. range @code{0.0} to @code{3.0}. The default value is "1".
  5726. @item gamma
  5727. Set the gamma expression. The value must be a float in range
  5728. @code{0.1} to @code{10.0}. The default value is "1".
  5729. @item gamma_r
  5730. Set the gamma expression for red. The value must be a float in
  5731. range @code{0.1} to @code{10.0}. The default value is "1".
  5732. @item gamma_g
  5733. Set the gamma expression for green. The value must be a float in range
  5734. @code{0.1} to @code{10.0}. The default value is "1".
  5735. @item gamma_b
  5736. Set the gamma expression for blue. The value must be a float in range
  5737. @code{0.1} to @code{10.0}. The default value is "1".
  5738. @item gamma_weight
  5739. Set the gamma weight expression. It can be used to reduce the effect
  5740. of a high gamma value on bright image areas, e.g. keep them from
  5741. getting overamplified and just plain white. The value must be a float
  5742. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5743. gamma correction all the way down while @code{1.0} leaves it at its
  5744. full strength. Default is "1".
  5745. @item eval
  5746. Set when the expressions for brightness, contrast, saturation and
  5747. gamma expressions are evaluated.
  5748. It accepts the following values:
  5749. @table @samp
  5750. @item init
  5751. only evaluate expressions once during the filter initialization or
  5752. when a command is processed
  5753. @item frame
  5754. evaluate expressions for each incoming frame
  5755. @end table
  5756. Default value is @samp{init}.
  5757. @end table
  5758. The expressions accept the following parameters:
  5759. @table @option
  5760. @item n
  5761. frame count of the input frame starting from 0
  5762. @item pos
  5763. byte position of the corresponding packet in the input file, NAN if
  5764. unspecified
  5765. @item r
  5766. frame rate of the input video, NAN if the input frame rate is unknown
  5767. @item t
  5768. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5769. @end table
  5770. @subsection Commands
  5771. The filter supports the following commands:
  5772. @table @option
  5773. @item contrast
  5774. Set the contrast expression.
  5775. @item brightness
  5776. Set the brightness expression.
  5777. @item saturation
  5778. Set the saturation expression.
  5779. @item gamma
  5780. Set the gamma expression.
  5781. @item gamma_r
  5782. Set the gamma_r expression.
  5783. @item gamma_g
  5784. Set gamma_g expression.
  5785. @item gamma_b
  5786. Set gamma_b expression.
  5787. @item gamma_weight
  5788. Set gamma_weight expression.
  5789. The command accepts the same syntax of the corresponding option.
  5790. If the specified expression is not valid, it is kept at its current
  5791. value.
  5792. @end table
  5793. @section erosion
  5794. Apply erosion effect to the video.
  5795. This filter replaces the pixel by the local(3x3) minimum.
  5796. It accepts the following options:
  5797. @table @option
  5798. @item threshold0
  5799. @item threshold1
  5800. @item threshold2
  5801. @item threshold3
  5802. Limit the maximum change for each plane, default is 65535.
  5803. If 0, plane will remain unchanged.
  5804. @item coordinates
  5805. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5806. pixels are used.
  5807. Flags to local 3x3 coordinates maps like this:
  5808. 1 2 3
  5809. 4 5
  5810. 6 7 8
  5811. @end table
  5812. @section extractplanes
  5813. Extract color channel components from input video stream into
  5814. separate grayscale video streams.
  5815. The filter accepts the following option:
  5816. @table @option
  5817. @item planes
  5818. Set plane(s) to extract.
  5819. Available values for planes are:
  5820. @table @samp
  5821. @item y
  5822. @item u
  5823. @item v
  5824. @item a
  5825. @item r
  5826. @item g
  5827. @item b
  5828. @end table
  5829. Choosing planes not available in the input will result in an error.
  5830. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5831. with @code{y}, @code{u}, @code{v} planes at same time.
  5832. @end table
  5833. @subsection Examples
  5834. @itemize
  5835. @item
  5836. Extract luma, u and v color channel component from input video frame
  5837. into 3 grayscale outputs:
  5838. @example
  5839. 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
  5840. @end example
  5841. @end itemize
  5842. @section elbg
  5843. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5844. For each input image, the filter will compute the optimal mapping from
  5845. the input to the output given the codebook length, that is the number
  5846. of distinct output colors.
  5847. This filter accepts the following options.
  5848. @table @option
  5849. @item codebook_length, l
  5850. Set codebook length. The value must be a positive integer, and
  5851. represents the number of distinct output colors. Default value is 256.
  5852. @item nb_steps, n
  5853. Set the maximum number of iterations to apply for computing the optimal
  5854. mapping. The higher the value the better the result and the higher the
  5855. computation time. Default value is 1.
  5856. @item seed, s
  5857. Set a random seed, must be an integer included between 0 and
  5858. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5859. will try to use a good random seed on a best effort basis.
  5860. @item pal8
  5861. Set pal8 output pixel format. This option does not work with codebook
  5862. length greater than 256.
  5863. @end table
  5864. @section fade
  5865. Apply a fade-in/out effect to the input video.
  5866. It accepts the following parameters:
  5867. @table @option
  5868. @item type, t
  5869. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5870. effect.
  5871. Default is @code{in}.
  5872. @item start_frame, s
  5873. Specify the number of the frame to start applying the fade
  5874. effect at. Default is 0.
  5875. @item nb_frames, n
  5876. The number of frames that the fade effect lasts. At the end of the
  5877. fade-in effect, the output video will have the same intensity as the input video.
  5878. At the end of the fade-out transition, the output video will be filled with the
  5879. selected @option{color}.
  5880. Default is 25.
  5881. @item alpha
  5882. If set to 1, fade only alpha channel, if one exists on the input.
  5883. Default value is 0.
  5884. @item start_time, st
  5885. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5886. effect. If both start_frame and start_time are specified, the fade will start at
  5887. whichever comes last. Default is 0.
  5888. @item duration, d
  5889. The number of seconds for which the fade effect has to last. At the end of the
  5890. fade-in effect the output video will have the same intensity as the input video,
  5891. at the end of the fade-out transition the output video will be filled with the
  5892. selected @option{color}.
  5893. If both duration and nb_frames are specified, duration is used. Default is 0
  5894. (nb_frames is used by default).
  5895. @item color, c
  5896. Specify the color of the fade. Default is "black".
  5897. @end table
  5898. @subsection Examples
  5899. @itemize
  5900. @item
  5901. Fade in the first 30 frames of video:
  5902. @example
  5903. fade=in:0:30
  5904. @end example
  5905. The command above is equivalent to:
  5906. @example
  5907. fade=t=in:s=0:n=30
  5908. @end example
  5909. @item
  5910. Fade out the last 45 frames of a 200-frame video:
  5911. @example
  5912. fade=out:155:45
  5913. fade=type=out:start_frame=155:nb_frames=45
  5914. @end example
  5915. @item
  5916. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5917. @example
  5918. fade=in:0:25, fade=out:975:25
  5919. @end example
  5920. @item
  5921. Make the first 5 frames yellow, then fade in from frame 5-24:
  5922. @example
  5923. fade=in:5:20:color=yellow
  5924. @end example
  5925. @item
  5926. Fade in alpha over first 25 frames of video:
  5927. @example
  5928. fade=in:0:25:alpha=1
  5929. @end example
  5930. @item
  5931. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5932. @example
  5933. fade=t=in:st=5.5:d=0.5
  5934. @end example
  5935. @end itemize
  5936. @section fftfilt
  5937. Apply arbitrary expressions to samples in frequency domain
  5938. @table @option
  5939. @item dc_Y
  5940. Adjust the dc value (gain) of the luma plane of the image. The filter
  5941. accepts an integer value in range @code{0} to @code{1000}. The default
  5942. value is set to @code{0}.
  5943. @item dc_U
  5944. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5945. filter accepts an integer value in range @code{0} to @code{1000}. The
  5946. default value is set to @code{0}.
  5947. @item dc_V
  5948. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5949. filter accepts an integer value in range @code{0} to @code{1000}. The
  5950. default value is set to @code{0}.
  5951. @item weight_Y
  5952. Set the frequency domain weight expression for the luma plane.
  5953. @item weight_U
  5954. Set the frequency domain weight expression for the 1st chroma plane.
  5955. @item weight_V
  5956. Set the frequency domain weight expression for the 2nd chroma plane.
  5957. The filter accepts the following variables:
  5958. @item X
  5959. @item Y
  5960. The coordinates of the current sample.
  5961. @item W
  5962. @item H
  5963. The width and height of the image.
  5964. @end table
  5965. @subsection Examples
  5966. @itemize
  5967. @item
  5968. High-pass:
  5969. @example
  5970. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5971. @end example
  5972. @item
  5973. Low-pass:
  5974. @example
  5975. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5976. @end example
  5977. @item
  5978. Sharpen:
  5979. @example
  5980. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5981. @end example
  5982. @item
  5983. Blur:
  5984. @example
  5985. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5986. @end example
  5987. @end itemize
  5988. @section field
  5989. Extract a single field from an interlaced image using stride
  5990. arithmetic to avoid wasting CPU time. The output frames are marked as
  5991. non-interlaced.
  5992. The filter accepts the following options:
  5993. @table @option
  5994. @item type
  5995. Specify whether to extract the top (if the value is @code{0} or
  5996. @code{top}) or the bottom field (if the value is @code{1} or
  5997. @code{bottom}).
  5998. @end table
  5999. @section fieldhint
  6000. Create new frames by copying the top and bottom fields from surrounding frames
  6001. supplied as numbers by the hint file.
  6002. @table @option
  6003. @item hint
  6004. Set file containing hints: absolute/relative frame numbers.
  6005. There must be one line for each frame in a clip. Each line must contain two
  6006. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6007. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6008. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6009. for @code{relative} mode. First number tells from which frame to pick up top
  6010. field and second number tells from which frame to pick up bottom field.
  6011. If optionally followed by @code{+} output frame will be marked as interlaced,
  6012. else if followed by @code{-} output frame will be marked as progressive, else
  6013. it will be marked same as input frame.
  6014. If line starts with @code{#} or @code{;} that line is skipped.
  6015. @item mode
  6016. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6017. @end table
  6018. Example of first several lines of @code{hint} file for @code{relative} mode:
  6019. @example
  6020. 0,0 - # first frame
  6021. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6022. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6023. 1,0 -
  6024. 0,0 -
  6025. 0,0 -
  6026. 1,0 -
  6027. 1,0 -
  6028. 1,0 -
  6029. 0,0 -
  6030. 0,0 -
  6031. 1,0 -
  6032. 1,0 -
  6033. 1,0 -
  6034. 0,0 -
  6035. @end example
  6036. @section fieldmatch
  6037. Field matching filter for inverse telecine. It is meant to reconstruct the
  6038. progressive frames from a telecined stream. The filter does not drop duplicated
  6039. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6040. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6041. The separation of the field matching and the decimation is notably motivated by
  6042. the possibility of inserting a de-interlacing filter fallback between the two.
  6043. If the source has mixed telecined and real interlaced content,
  6044. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6045. But these remaining combed frames will be marked as interlaced, and thus can be
  6046. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6047. In addition to the various configuration options, @code{fieldmatch} can take an
  6048. optional second stream, activated through the @option{ppsrc} option. If
  6049. enabled, the frames reconstruction will be based on the fields and frames from
  6050. this second stream. This allows the first input to be pre-processed in order to
  6051. help the various algorithms of the filter, while keeping the output lossless
  6052. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6053. or brightness/contrast adjustments can help.
  6054. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6055. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6056. which @code{fieldmatch} is based on. While the semantic and usage are very
  6057. close, some behaviour and options names can differ.
  6058. The @ref{decimate} filter currently only works for constant frame rate input.
  6059. If your input has mixed telecined (30fps) and progressive content with a lower
  6060. framerate like 24fps use the following filterchain to produce the necessary cfr
  6061. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6062. The filter accepts the following options:
  6063. @table @option
  6064. @item order
  6065. Specify the assumed field order of the input stream. Available values are:
  6066. @table @samp
  6067. @item auto
  6068. Auto detect parity (use FFmpeg's internal parity value).
  6069. @item bff
  6070. Assume bottom field first.
  6071. @item tff
  6072. Assume top field first.
  6073. @end table
  6074. Note that it is sometimes recommended not to trust the parity announced by the
  6075. stream.
  6076. Default value is @var{auto}.
  6077. @item mode
  6078. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6079. sense that it won't risk creating jerkiness due to duplicate frames when
  6080. possible, but if there are bad edits or blended fields it will end up
  6081. outputting combed frames when a good match might actually exist. On the other
  6082. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6083. but will almost always find a good frame if there is one. The other values are
  6084. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6085. jerkiness and creating duplicate frames versus finding good matches in sections
  6086. with bad edits, orphaned fields, blended fields, etc.
  6087. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6088. Available values are:
  6089. @table @samp
  6090. @item pc
  6091. 2-way matching (p/c)
  6092. @item pc_n
  6093. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6094. @item pc_u
  6095. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6096. @item pc_n_ub
  6097. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6098. still combed (p/c + n + u/b)
  6099. @item pcn
  6100. 3-way matching (p/c/n)
  6101. @item pcn_ub
  6102. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6103. detected as combed (p/c/n + u/b)
  6104. @end table
  6105. The parenthesis at the end indicate the matches that would be used for that
  6106. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6107. @var{top}).
  6108. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6109. the slowest.
  6110. Default value is @var{pc_n}.
  6111. @item ppsrc
  6112. Mark the main input stream as a pre-processed input, and enable the secondary
  6113. input stream as the clean source to pick the fields from. See the filter
  6114. introduction for more details. It is similar to the @option{clip2} feature from
  6115. VFM/TFM.
  6116. Default value is @code{0} (disabled).
  6117. @item field
  6118. Set the field to match from. It is recommended to set this to the same value as
  6119. @option{order} unless you experience matching failures with that setting. In
  6120. certain circumstances changing the field that is used to match from can have a
  6121. large impact on matching performance. Available values are:
  6122. @table @samp
  6123. @item auto
  6124. Automatic (same value as @option{order}).
  6125. @item bottom
  6126. Match from the bottom field.
  6127. @item top
  6128. Match from the top field.
  6129. @end table
  6130. Default value is @var{auto}.
  6131. @item mchroma
  6132. Set whether or not chroma is included during the match comparisons. In most
  6133. cases it is recommended to leave this enabled. You should set this to @code{0}
  6134. only if your clip has bad chroma problems such as heavy rainbowing or other
  6135. artifacts. Setting this to @code{0} could also be used to speed things up at
  6136. the cost of some accuracy.
  6137. Default value is @code{1}.
  6138. @item y0
  6139. @item y1
  6140. These define an exclusion band which excludes the lines between @option{y0} and
  6141. @option{y1} from being included in the field matching decision. An exclusion
  6142. band can be used to ignore subtitles, a logo, or other things that may
  6143. interfere with the matching. @option{y0} sets the starting scan line and
  6144. @option{y1} sets the ending line; all lines in between @option{y0} and
  6145. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6146. @option{y0} and @option{y1} to the same value will disable the feature.
  6147. @option{y0} and @option{y1} defaults to @code{0}.
  6148. @item scthresh
  6149. Set the scene change detection threshold as a percentage of maximum change on
  6150. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6151. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6152. @option{scthresh} is @code{[0.0, 100.0]}.
  6153. Default value is @code{12.0}.
  6154. @item combmatch
  6155. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6156. account the combed scores of matches when deciding what match to use as the
  6157. final match. Available values are:
  6158. @table @samp
  6159. @item none
  6160. No final matching based on combed scores.
  6161. @item sc
  6162. Combed scores are only used when a scene change is detected.
  6163. @item full
  6164. Use combed scores all the time.
  6165. @end table
  6166. Default is @var{sc}.
  6167. @item combdbg
  6168. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6169. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6170. Available values are:
  6171. @table @samp
  6172. @item none
  6173. No forced calculation.
  6174. @item pcn
  6175. Force p/c/n calculations.
  6176. @item pcnub
  6177. Force p/c/n/u/b calculations.
  6178. @end table
  6179. Default value is @var{none}.
  6180. @item cthresh
  6181. This is the area combing threshold used for combed frame detection. This
  6182. essentially controls how "strong" or "visible" combing must be to be detected.
  6183. Larger values mean combing must be more visible and smaller values mean combing
  6184. can be less visible or strong and still be detected. Valid settings are from
  6185. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6186. be detected as combed). This is basically a pixel difference value. A good
  6187. range is @code{[8, 12]}.
  6188. Default value is @code{9}.
  6189. @item chroma
  6190. Sets whether or not chroma is considered in the combed frame decision. Only
  6191. disable this if your source has chroma problems (rainbowing, etc.) that are
  6192. causing problems for the combed frame detection with chroma enabled. Actually,
  6193. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6194. where there is chroma only combing in the source.
  6195. Default value is @code{0}.
  6196. @item blockx
  6197. @item blocky
  6198. Respectively set the x-axis and y-axis size of the window used during combed
  6199. frame detection. This has to do with the size of the area in which
  6200. @option{combpel} pixels are required to be detected as combed for a frame to be
  6201. declared combed. See the @option{combpel} parameter description for more info.
  6202. Possible values are any number that is a power of 2 starting at 4 and going up
  6203. to 512.
  6204. Default value is @code{16}.
  6205. @item combpel
  6206. The number of combed pixels inside any of the @option{blocky} by
  6207. @option{blockx} size blocks on the frame for the frame to be detected as
  6208. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6209. setting controls "how much" combing there must be in any localized area (a
  6210. window defined by the @option{blockx} and @option{blocky} settings) on the
  6211. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6212. which point no frames will ever be detected as combed). This setting is known
  6213. as @option{MI} in TFM/VFM vocabulary.
  6214. Default value is @code{80}.
  6215. @end table
  6216. @anchor{p/c/n/u/b meaning}
  6217. @subsection p/c/n/u/b meaning
  6218. @subsubsection p/c/n
  6219. We assume the following telecined stream:
  6220. @example
  6221. Top fields: 1 2 2 3 4
  6222. Bottom fields: 1 2 3 4 4
  6223. @end example
  6224. The numbers correspond to the progressive frame the fields relate to. Here, the
  6225. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6226. When @code{fieldmatch} is configured to run a matching from bottom
  6227. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6228. @example
  6229. Input stream:
  6230. T 1 2 2 3 4
  6231. B 1 2 3 4 4 <-- matching reference
  6232. Matches: c c n n c
  6233. Output stream:
  6234. T 1 2 3 4 4
  6235. B 1 2 3 4 4
  6236. @end example
  6237. As a result of the field matching, we can see that some frames get duplicated.
  6238. To perform a complete inverse telecine, you need to rely on a decimation filter
  6239. after this operation. See for instance the @ref{decimate} filter.
  6240. The same operation now matching from top fields (@option{field}=@var{top})
  6241. looks like this:
  6242. @example
  6243. Input stream:
  6244. T 1 2 2 3 4 <-- matching reference
  6245. B 1 2 3 4 4
  6246. Matches: c c p p c
  6247. Output stream:
  6248. T 1 2 2 3 4
  6249. B 1 2 2 3 4
  6250. @end example
  6251. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6252. basically, they refer to the frame and field of the opposite parity:
  6253. @itemize
  6254. @item @var{p} matches the field of the opposite parity in the previous frame
  6255. @item @var{c} matches the field of the opposite parity in the current frame
  6256. @item @var{n} matches the field of the opposite parity in the next frame
  6257. @end itemize
  6258. @subsubsection u/b
  6259. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6260. from the opposite parity flag. In the following examples, we assume that we are
  6261. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6262. 'x' is placed above and below each matched fields.
  6263. With bottom matching (@option{field}=@var{bottom}):
  6264. @example
  6265. Match: c p n b u
  6266. x x x x x
  6267. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6268. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6269. x x x x x
  6270. Output frames:
  6271. 2 1 2 2 2
  6272. 2 2 2 1 3
  6273. @end example
  6274. With top matching (@option{field}=@var{top}):
  6275. @example
  6276. Match: c p n b u
  6277. x x x x x
  6278. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6279. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6280. x x x x x
  6281. Output frames:
  6282. 2 2 2 1 2
  6283. 2 1 3 2 2
  6284. @end example
  6285. @subsection Examples
  6286. Simple IVTC of a top field first telecined stream:
  6287. @example
  6288. fieldmatch=order=tff:combmatch=none, decimate
  6289. @end example
  6290. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6291. @example
  6292. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6293. @end example
  6294. @section fieldorder
  6295. Transform the field order of the input video.
  6296. It accepts the following parameters:
  6297. @table @option
  6298. @item order
  6299. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6300. for bottom field first.
  6301. @end table
  6302. The default value is @samp{tff}.
  6303. The transformation is done by shifting the picture content up or down
  6304. by one line, and filling the remaining line with appropriate picture content.
  6305. This method is consistent with most broadcast field order converters.
  6306. If the input video is not flagged as being interlaced, or it is already
  6307. flagged as being of the required output field order, then this filter does
  6308. not alter the incoming video.
  6309. It is very useful when converting to or from PAL DV material,
  6310. which is bottom field first.
  6311. For example:
  6312. @example
  6313. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6314. @end example
  6315. @section fifo, afifo
  6316. Buffer input images and send them when they are requested.
  6317. It is mainly useful when auto-inserted by the libavfilter
  6318. framework.
  6319. It does not take parameters.
  6320. @section find_rect
  6321. Find a rectangular object
  6322. It accepts the following options:
  6323. @table @option
  6324. @item object
  6325. Filepath of the object image, needs to be in gray8.
  6326. @item threshold
  6327. Detection threshold, default is 0.5.
  6328. @item mipmaps
  6329. Number of mipmaps, default is 3.
  6330. @item xmin, ymin, xmax, ymax
  6331. Specifies the rectangle in which to search.
  6332. @end table
  6333. @subsection Examples
  6334. @itemize
  6335. @item
  6336. Generate a representative palette of a given video using @command{ffmpeg}:
  6337. @example
  6338. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6339. @end example
  6340. @end itemize
  6341. @section cover_rect
  6342. Cover a rectangular object
  6343. It accepts the following options:
  6344. @table @option
  6345. @item cover
  6346. Filepath of the optional cover image, needs to be in yuv420.
  6347. @item mode
  6348. Set covering mode.
  6349. It accepts the following values:
  6350. @table @samp
  6351. @item cover
  6352. cover it by the supplied image
  6353. @item blur
  6354. cover it by interpolating the surrounding pixels
  6355. @end table
  6356. Default value is @var{blur}.
  6357. @end table
  6358. @subsection Examples
  6359. @itemize
  6360. @item
  6361. Generate a representative palette of a given video using @command{ffmpeg}:
  6362. @example
  6363. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6364. @end example
  6365. @end itemize
  6366. @anchor{format}
  6367. @section format
  6368. Convert the input video to one of the specified pixel formats.
  6369. Libavfilter will try to pick one that is suitable as input to
  6370. the next filter.
  6371. It accepts the following parameters:
  6372. @table @option
  6373. @item pix_fmts
  6374. A '|'-separated list of pixel format names, such as
  6375. "pix_fmts=yuv420p|monow|rgb24".
  6376. @end table
  6377. @subsection Examples
  6378. @itemize
  6379. @item
  6380. Convert the input video to the @var{yuv420p} format
  6381. @example
  6382. format=pix_fmts=yuv420p
  6383. @end example
  6384. Convert the input video to any of the formats in the list
  6385. @example
  6386. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6387. @end example
  6388. @end itemize
  6389. @anchor{fps}
  6390. @section fps
  6391. Convert the video to specified constant frame rate by duplicating or dropping
  6392. frames as necessary.
  6393. It accepts the following parameters:
  6394. @table @option
  6395. @item fps
  6396. The desired output frame rate. The default is @code{25}.
  6397. @item round
  6398. Rounding method.
  6399. Possible values are:
  6400. @table @option
  6401. @item zero
  6402. zero round towards 0
  6403. @item inf
  6404. round away from 0
  6405. @item down
  6406. round towards -infinity
  6407. @item up
  6408. round towards +infinity
  6409. @item near
  6410. round to nearest
  6411. @end table
  6412. The default is @code{near}.
  6413. @item start_time
  6414. Assume the first PTS should be the given value, in seconds. This allows for
  6415. padding/trimming at the start of stream. By default, no assumption is made
  6416. about the first frame's expected PTS, so no padding or trimming is done.
  6417. For example, this could be set to 0 to pad the beginning with duplicates of
  6418. the first frame if a video stream starts after the audio stream or to trim any
  6419. frames with a negative PTS.
  6420. @end table
  6421. Alternatively, the options can be specified as a flat string:
  6422. @var{fps}[:@var{round}].
  6423. See also the @ref{setpts} filter.
  6424. @subsection Examples
  6425. @itemize
  6426. @item
  6427. A typical usage in order to set the fps to 25:
  6428. @example
  6429. fps=fps=25
  6430. @end example
  6431. @item
  6432. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6433. @example
  6434. fps=fps=film:round=near
  6435. @end example
  6436. @end itemize
  6437. @section framepack
  6438. Pack two different video streams into a stereoscopic video, setting proper
  6439. metadata on supported codecs. The two views should have the same size and
  6440. framerate and processing will stop when the shorter video ends. Please note
  6441. that you may conveniently adjust view properties with the @ref{scale} and
  6442. @ref{fps} filters.
  6443. It accepts the following parameters:
  6444. @table @option
  6445. @item format
  6446. The desired packing format. Supported values are:
  6447. @table @option
  6448. @item sbs
  6449. The views are next to each other (default).
  6450. @item tab
  6451. The views are on top of each other.
  6452. @item lines
  6453. The views are packed by line.
  6454. @item columns
  6455. The views are packed by column.
  6456. @item frameseq
  6457. The views are temporally interleaved.
  6458. @end table
  6459. @end table
  6460. Some examples:
  6461. @example
  6462. # Convert left and right views into a frame-sequential video
  6463. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6464. # Convert views into a side-by-side video with the same output resolution as the input
  6465. 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
  6466. @end example
  6467. @section framerate
  6468. Change the frame rate by interpolating new video output frames from the source
  6469. frames.
  6470. This filter is not designed to function correctly with interlaced media. If
  6471. you wish to change the frame rate of interlaced media then you are required
  6472. to deinterlace before this filter and re-interlace after this filter.
  6473. A description of the accepted options follows.
  6474. @table @option
  6475. @item fps
  6476. Specify the output frames per second. This option can also be specified
  6477. as a value alone. The default is @code{50}.
  6478. @item interp_start
  6479. Specify the start of a range where the output frame will be created as a
  6480. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6481. the default is @code{15}.
  6482. @item interp_end
  6483. Specify the end of a range where the output frame will be created as a
  6484. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6485. the default is @code{240}.
  6486. @item scene
  6487. Specify the level at which a scene change is detected as a value between
  6488. 0 and 100 to indicate a new scene; a low value reflects a low
  6489. probability for the current frame to introduce a new scene, while a higher
  6490. value means the current frame is more likely to be one.
  6491. The default is @code{7}.
  6492. @item flags
  6493. Specify flags influencing the filter process.
  6494. Available value for @var{flags} is:
  6495. @table @option
  6496. @item scene_change_detect, scd
  6497. Enable scene change detection using the value of the option @var{scene}.
  6498. This flag is enabled by default.
  6499. @end table
  6500. @end table
  6501. @section framestep
  6502. Select one frame every N-th frame.
  6503. This filter accepts the following option:
  6504. @table @option
  6505. @item step
  6506. Select frame after every @code{step} frames.
  6507. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6508. @end table
  6509. @anchor{frei0r}
  6510. @section frei0r
  6511. Apply a frei0r effect to the input video.
  6512. To enable the compilation of this filter, you need to install the frei0r
  6513. header and configure FFmpeg with @code{--enable-frei0r}.
  6514. It accepts the following parameters:
  6515. @table @option
  6516. @item filter_name
  6517. The name of the frei0r effect to load. If the environment variable
  6518. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6519. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6520. Otherwise, the standard frei0r paths are searched, in this order:
  6521. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6522. @file{/usr/lib/frei0r-1/}.
  6523. @item filter_params
  6524. A '|'-separated list of parameters to pass to the frei0r effect.
  6525. @end table
  6526. A frei0r effect parameter can be a boolean (its value is either
  6527. "y" or "n"), a double, a color (specified as
  6528. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6529. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6530. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6531. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6532. The number and types of parameters depend on the loaded effect. If an
  6533. effect parameter is not specified, the default value is set.
  6534. @subsection Examples
  6535. @itemize
  6536. @item
  6537. Apply the distort0r effect, setting the first two double parameters:
  6538. @example
  6539. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6540. @end example
  6541. @item
  6542. Apply the colordistance effect, taking a color as the first parameter:
  6543. @example
  6544. frei0r=colordistance:0.2/0.3/0.4
  6545. frei0r=colordistance:violet
  6546. frei0r=colordistance:0x112233
  6547. @end example
  6548. @item
  6549. Apply the perspective effect, specifying the top left and top right image
  6550. positions:
  6551. @example
  6552. frei0r=perspective:0.2/0.2|0.8/0.2
  6553. @end example
  6554. @end itemize
  6555. For more information, see
  6556. @url{http://frei0r.dyne.org}
  6557. @section fspp
  6558. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6559. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6560. processing filter, one of them is performed once per block, not per pixel.
  6561. This allows for much higher speed.
  6562. The filter accepts the following options:
  6563. @table @option
  6564. @item quality
  6565. Set quality. This option defines the number of levels for averaging. It accepts
  6566. an integer in the range 4-5. Default value is @code{4}.
  6567. @item qp
  6568. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6569. If not set, the filter will use the QP from the video stream (if available).
  6570. @item strength
  6571. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6572. more details but also more artifacts, while higher values make the image smoother
  6573. but also blurrier. Default value is @code{0} − PSNR optimal.
  6574. @item use_bframe_qp
  6575. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6576. option may cause flicker since the B-Frames have often larger QP. Default is
  6577. @code{0} (not enabled).
  6578. @end table
  6579. @section gblur
  6580. Apply Gaussian blur filter.
  6581. The filter accepts the following options:
  6582. @table @option
  6583. @item sigma
  6584. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6585. @item steps
  6586. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6587. @item planes
  6588. Set which planes to filter. By default all planes are filtered.
  6589. @item sigmaV
  6590. Set vertical sigma, if negative it will be same as @code{sigma}.
  6591. Default is @code{-1}.
  6592. @end table
  6593. @section geq
  6594. The filter accepts the following options:
  6595. @table @option
  6596. @item lum_expr, lum
  6597. Set the luminance expression.
  6598. @item cb_expr, cb
  6599. Set the chrominance blue expression.
  6600. @item cr_expr, cr
  6601. Set the chrominance red expression.
  6602. @item alpha_expr, a
  6603. Set the alpha expression.
  6604. @item red_expr, r
  6605. Set the red expression.
  6606. @item green_expr, g
  6607. Set the green expression.
  6608. @item blue_expr, b
  6609. Set the blue expression.
  6610. @end table
  6611. The colorspace is selected according to the specified options. If one
  6612. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6613. options is specified, the filter will automatically select a YCbCr
  6614. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6615. @option{blue_expr} options is specified, it will select an RGB
  6616. colorspace.
  6617. If one of the chrominance expression is not defined, it falls back on the other
  6618. one. If no alpha expression is specified it will evaluate to opaque value.
  6619. If none of chrominance expressions are specified, they will evaluate
  6620. to the luminance expression.
  6621. The expressions can use the following variables and functions:
  6622. @table @option
  6623. @item N
  6624. The sequential number of the filtered frame, starting from @code{0}.
  6625. @item X
  6626. @item Y
  6627. The coordinates of the current sample.
  6628. @item W
  6629. @item H
  6630. The width and height of the image.
  6631. @item SW
  6632. @item SH
  6633. Width and height scale depending on the currently filtered plane. It is the
  6634. ratio between the corresponding luma plane number of pixels and the current
  6635. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6636. @code{0.5,0.5} for chroma planes.
  6637. @item T
  6638. Time of the current frame, expressed in seconds.
  6639. @item p(x, y)
  6640. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6641. plane.
  6642. @item lum(x, y)
  6643. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6644. plane.
  6645. @item cb(x, y)
  6646. Return the value of the pixel at location (@var{x},@var{y}) of the
  6647. blue-difference chroma plane. Return 0 if there is no such plane.
  6648. @item cr(x, y)
  6649. Return the value of the pixel at location (@var{x},@var{y}) of the
  6650. red-difference chroma plane. Return 0 if there is no such plane.
  6651. @item r(x, y)
  6652. @item g(x, y)
  6653. @item b(x, y)
  6654. Return the value of the pixel at location (@var{x},@var{y}) of the
  6655. red/green/blue component. Return 0 if there is no such component.
  6656. @item alpha(x, y)
  6657. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6658. plane. Return 0 if there is no such plane.
  6659. @end table
  6660. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6661. automatically clipped to the closer edge.
  6662. @subsection Examples
  6663. @itemize
  6664. @item
  6665. Flip the image horizontally:
  6666. @example
  6667. geq=p(W-X\,Y)
  6668. @end example
  6669. @item
  6670. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6671. wavelength of 100 pixels:
  6672. @example
  6673. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6674. @end example
  6675. @item
  6676. Generate a fancy enigmatic moving light:
  6677. @example
  6678. 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
  6679. @end example
  6680. @item
  6681. Generate a quick emboss effect:
  6682. @example
  6683. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6684. @end example
  6685. @item
  6686. Modify RGB components depending on pixel position:
  6687. @example
  6688. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6689. @end example
  6690. @item
  6691. Create a radial gradient that is the same size as the input (also see
  6692. the @ref{vignette} filter):
  6693. @example
  6694. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6695. @end example
  6696. @end itemize
  6697. @section gradfun
  6698. Fix the banding artifacts that are sometimes introduced into nearly flat
  6699. regions by truncation to 8-bit color depth.
  6700. Interpolate the gradients that should go where the bands are, and
  6701. dither them.
  6702. It is designed for playback only. Do not use it prior to
  6703. lossy compression, because compression tends to lose the dither and
  6704. bring back the bands.
  6705. It accepts the following parameters:
  6706. @table @option
  6707. @item strength
  6708. The maximum amount by which the filter will change any one pixel. This is also
  6709. the threshold for detecting nearly flat regions. Acceptable values range from
  6710. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6711. valid range.
  6712. @item radius
  6713. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6714. gradients, but also prevents the filter from modifying the pixels near detailed
  6715. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6716. values will be clipped to the valid range.
  6717. @end table
  6718. Alternatively, the options can be specified as a flat string:
  6719. @var{strength}[:@var{radius}]
  6720. @subsection Examples
  6721. @itemize
  6722. @item
  6723. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6724. @example
  6725. gradfun=3.5:8
  6726. @end example
  6727. @item
  6728. Specify radius, omitting the strength (which will fall-back to the default
  6729. value):
  6730. @example
  6731. gradfun=radius=8
  6732. @end example
  6733. @end itemize
  6734. @anchor{haldclut}
  6735. @section haldclut
  6736. Apply a Hald CLUT to a video stream.
  6737. First input is the video stream to process, and second one is the Hald CLUT.
  6738. The Hald CLUT input can be a simple picture or a complete video stream.
  6739. The filter accepts the following options:
  6740. @table @option
  6741. @item shortest
  6742. Force termination when the shortest input terminates. Default is @code{0}.
  6743. @item repeatlast
  6744. Continue applying the last CLUT after the end of the stream. A value of
  6745. @code{0} disable the filter after the last frame of the CLUT is reached.
  6746. Default is @code{1}.
  6747. @end table
  6748. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6749. filters share the same internals).
  6750. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6751. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6752. @subsection Workflow examples
  6753. @subsubsection Hald CLUT video stream
  6754. Generate an identity Hald CLUT stream altered with various effects:
  6755. @example
  6756. 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
  6757. @end example
  6758. Note: make sure you use a lossless codec.
  6759. Then use it with @code{haldclut} to apply it on some random stream:
  6760. @example
  6761. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6762. @end example
  6763. The Hald CLUT will be applied to the 10 first seconds (duration of
  6764. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6765. to the remaining frames of the @code{mandelbrot} stream.
  6766. @subsubsection Hald CLUT with preview
  6767. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6768. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6769. biggest possible square starting at the top left of the picture. The remaining
  6770. padding pixels (bottom or right) will be ignored. This area can be used to add
  6771. a preview of the Hald CLUT.
  6772. Typically, the following generated Hald CLUT will be supported by the
  6773. @code{haldclut} filter:
  6774. @example
  6775. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6776. pad=iw+320 [padded_clut];
  6777. smptebars=s=320x256, split [a][b];
  6778. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6779. [main][b] overlay=W-320" -frames:v 1 clut.png
  6780. @end example
  6781. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6782. bars are displayed on the right-top, and below the same color bars processed by
  6783. the color changes.
  6784. Then, the effect of this Hald CLUT can be visualized with:
  6785. @example
  6786. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6787. @end example
  6788. @section hflip
  6789. Flip the input video horizontally.
  6790. For example, to horizontally flip the input video with @command{ffmpeg}:
  6791. @example
  6792. ffmpeg -i in.avi -vf "hflip" out.avi
  6793. @end example
  6794. @section histeq
  6795. This filter applies a global color histogram equalization on a
  6796. per-frame basis.
  6797. It can be used to correct video that has a compressed range of pixel
  6798. intensities. The filter redistributes the pixel intensities to
  6799. equalize their distribution across the intensity range. It may be
  6800. viewed as an "automatically adjusting contrast filter". This filter is
  6801. useful only for correcting degraded or poorly captured source
  6802. video.
  6803. The filter accepts the following options:
  6804. @table @option
  6805. @item strength
  6806. Determine the amount of equalization to be applied. As the strength
  6807. is reduced, the distribution of pixel intensities more-and-more
  6808. approaches that of the input frame. The value must be a float number
  6809. in the range [0,1] and defaults to 0.200.
  6810. @item intensity
  6811. Set the maximum intensity that can generated and scale the output
  6812. values appropriately. The strength should be set as desired and then
  6813. the intensity can be limited if needed to avoid washing-out. The value
  6814. must be a float number in the range [0,1] and defaults to 0.210.
  6815. @item antibanding
  6816. Set the antibanding level. If enabled the filter will randomly vary
  6817. the luminance of output pixels by a small amount to avoid banding of
  6818. the histogram. Possible values are @code{none}, @code{weak} or
  6819. @code{strong}. It defaults to @code{none}.
  6820. @end table
  6821. @section histogram
  6822. Compute and draw a color distribution histogram for the input video.
  6823. The computed histogram is a representation of the color component
  6824. distribution in an image.
  6825. Standard histogram displays the color components distribution in an image.
  6826. Displays color graph for each color component. Shows distribution of
  6827. the Y, U, V, A or R, G, B components, depending on input format, in the
  6828. current frame. Below each graph a color component scale meter is shown.
  6829. The filter accepts the following options:
  6830. @table @option
  6831. @item level_height
  6832. Set height of level. Default value is @code{200}.
  6833. Allowed range is [50, 2048].
  6834. @item scale_height
  6835. Set height of color scale. Default value is @code{12}.
  6836. Allowed range is [0, 40].
  6837. @item display_mode
  6838. Set display mode.
  6839. It accepts the following values:
  6840. @table @samp
  6841. @item stack
  6842. Per color component graphs are placed below each other.
  6843. @item parade
  6844. Per color component graphs are placed side by side.
  6845. @item overlay
  6846. Presents information identical to that in the @code{parade}, except
  6847. that the graphs representing color components are superimposed directly
  6848. over one another.
  6849. @end table
  6850. Default is @code{stack}.
  6851. @item levels_mode
  6852. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6853. Default is @code{linear}.
  6854. @item components
  6855. Set what color components to display.
  6856. Default is @code{7}.
  6857. @item fgopacity
  6858. Set foreground opacity. Default is @code{0.7}.
  6859. @item bgopacity
  6860. Set background opacity. Default is @code{0.5}.
  6861. @end table
  6862. @subsection Examples
  6863. @itemize
  6864. @item
  6865. Calculate and draw histogram:
  6866. @example
  6867. ffplay -i input -vf histogram
  6868. @end example
  6869. @end itemize
  6870. @anchor{hqdn3d}
  6871. @section hqdn3d
  6872. This is a high precision/quality 3d denoise filter. It aims to reduce
  6873. image noise, producing smooth images and making still images really
  6874. still. It should enhance compressibility.
  6875. It accepts the following optional parameters:
  6876. @table @option
  6877. @item luma_spatial
  6878. A non-negative floating point number which specifies spatial luma strength.
  6879. It defaults to 4.0.
  6880. @item chroma_spatial
  6881. A non-negative floating point number which specifies spatial chroma strength.
  6882. It defaults to 3.0*@var{luma_spatial}/4.0.
  6883. @item luma_tmp
  6884. A floating point number which specifies luma temporal strength. It defaults to
  6885. 6.0*@var{luma_spatial}/4.0.
  6886. @item chroma_tmp
  6887. A floating point number which specifies chroma temporal strength. It defaults to
  6888. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6889. @end table
  6890. @anchor{hwupload_cuda}
  6891. @section hwupload_cuda
  6892. Upload system memory frames to a CUDA device.
  6893. It accepts the following optional parameters:
  6894. @table @option
  6895. @item device
  6896. The number of the CUDA device to use
  6897. @end table
  6898. @section hqx
  6899. Apply a high-quality magnification filter designed for pixel art. This filter
  6900. was originally created by Maxim Stepin.
  6901. It accepts the following option:
  6902. @table @option
  6903. @item n
  6904. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6905. @code{hq3x} and @code{4} for @code{hq4x}.
  6906. Default is @code{3}.
  6907. @end table
  6908. @section hstack
  6909. Stack input videos horizontally.
  6910. All streams must be of same pixel format and of same height.
  6911. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6912. to create same output.
  6913. The filter accept the following option:
  6914. @table @option
  6915. @item inputs
  6916. Set number of input streams. Default is 2.
  6917. @item shortest
  6918. If set to 1, force the output to terminate when the shortest input
  6919. terminates. Default value is 0.
  6920. @end table
  6921. @section hue
  6922. Modify the hue and/or the saturation of the input.
  6923. It accepts the following parameters:
  6924. @table @option
  6925. @item h
  6926. Specify the hue angle as a number of degrees. It accepts an expression,
  6927. and defaults to "0".
  6928. @item s
  6929. Specify the saturation in the [-10,10] range. It accepts an expression and
  6930. defaults to "1".
  6931. @item H
  6932. Specify the hue angle as a number of radians. It accepts an
  6933. expression, and defaults to "0".
  6934. @item b
  6935. Specify the brightness in the [-10,10] range. It accepts an expression and
  6936. defaults to "0".
  6937. @end table
  6938. @option{h} and @option{H} are mutually exclusive, and can't be
  6939. specified at the same time.
  6940. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6941. expressions containing the following constants:
  6942. @table @option
  6943. @item n
  6944. frame count of the input frame starting from 0
  6945. @item pts
  6946. presentation timestamp of the input frame expressed in time base units
  6947. @item r
  6948. frame rate of the input video, NAN if the input frame rate is unknown
  6949. @item t
  6950. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6951. @item tb
  6952. time base of the input video
  6953. @end table
  6954. @subsection Examples
  6955. @itemize
  6956. @item
  6957. Set the hue to 90 degrees and the saturation to 1.0:
  6958. @example
  6959. hue=h=90:s=1
  6960. @end example
  6961. @item
  6962. Same command but expressing the hue in radians:
  6963. @example
  6964. hue=H=PI/2:s=1
  6965. @end example
  6966. @item
  6967. Rotate hue and make the saturation swing between 0
  6968. and 2 over a period of 1 second:
  6969. @example
  6970. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6971. @end example
  6972. @item
  6973. Apply a 3 seconds saturation fade-in effect starting at 0:
  6974. @example
  6975. hue="s=min(t/3\,1)"
  6976. @end example
  6977. The general fade-in expression can be written as:
  6978. @example
  6979. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6980. @end example
  6981. @item
  6982. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6983. @example
  6984. hue="s=max(0\, min(1\, (8-t)/3))"
  6985. @end example
  6986. The general fade-out expression can be written as:
  6987. @example
  6988. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6989. @end example
  6990. @end itemize
  6991. @subsection Commands
  6992. This filter supports the following commands:
  6993. @table @option
  6994. @item b
  6995. @item s
  6996. @item h
  6997. @item H
  6998. Modify the hue and/or the saturation and/or brightness of the input video.
  6999. The command accepts the same syntax of the corresponding option.
  7000. If the specified expression is not valid, it is kept at its current
  7001. value.
  7002. @end table
  7003. @section hysteresis
  7004. Grow first stream into second stream by connecting components.
  7005. This makes it possible to build more robust edge masks.
  7006. This filter accepts the following options:
  7007. @table @option
  7008. @item planes
  7009. Set which planes will be processed as bitmap, unprocessed planes will be
  7010. copied from first stream.
  7011. By default value 0xf, all planes will be processed.
  7012. @item threshold
  7013. Set threshold which is used in filtering. If pixel component value is higher than
  7014. this value filter algorithm for connecting components is activated.
  7015. By default value is 0.
  7016. @end table
  7017. @section idet
  7018. Detect video interlacing type.
  7019. This filter tries to detect if the input frames are interlaced, progressive,
  7020. top or bottom field first. It will also try to detect fields that are
  7021. repeated between adjacent frames (a sign of telecine).
  7022. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7023. Multiple frame detection incorporates the classification history of previous frames.
  7024. The filter will log these metadata values:
  7025. @table @option
  7026. @item single.current_frame
  7027. Detected type of current frame using single-frame detection. One of:
  7028. ``tff'' (top field first), ``bff'' (bottom field first),
  7029. ``progressive'', or ``undetermined''
  7030. @item single.tff
  7031. Cumulative number of frames detected as top field first using single-frame detection.
  7032. @item multiple.tff
  7033. Cumulative number of frames detected as top field first using multiple-frame detection.
  7034. @item single.bff
  7035. Cumulative number of frames detected as bottom field first using single-frame detection.
  7036. @item multiple.current_frame
  7037. Detected type of current frame using multiple-frame detection. One of:
  7038. ``tff'' (top field first), ``bff'' (bottom field first),
  7039. ``progressive'', or ``undetermined''
  7040. @item multiple.bff
  7041. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7042. @item single.progressive
  7043. Cumulative number of frames detected as progressive using single-frame detection.
  7044. @item multiple.progressive
  7045. Cumulative number of frames detected as progressive using multiple-frame detection.
  7046. @item single.undetermined
  7047. Cumulative number of frames that could not be classified using single-frame detection.
  7048. @item multiple.undetermined
  7049. Cumulative number of frames that could not be classified using multiple-frame detection.
  7050. @item repeated.current_frame
  7051. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7052. @item repeated.neither
  7053. Cumulative number of frames with no repeated field.
  7054. @item repeated.top
  7055. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7056. @item repeated.bottom
  7057. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7058. @end table
  7059. The filter accepts the following options:
  7060. @table @option
  7061. @item intl_thres
  7062. Set interlacing threshold.
  7063. @item prog_thres
  7064. Set progressive threshold.
  7065. @item rep_thres
  7066. Threshold for repeated field detection.
  7067. @item half_life
  7068. Number of frames after which a given frame's contribution to the
  7069. statistics is halved (i.e., it contributes only 0.5 to its
  7070. classification). The default of 0 means that all frames seen are given
  7071. full weight of 1.0 forever.
  7072. @item analyze_interlaced_flag
  7073. When this is not 0 then idet will use the specified number of frames to determine
  7074. if the interlaced flag is accurate, it will not count undetermined frames.
  7075. If the flag is found to be accurate it will be used without any further
  7076. computations, if it is found to be inaccurate it will be cleared without any
  7077. further computations. This allows inserting the idet filter as a low computational
  7078. method to clean up the interlaced flag
  7079. @end table
  7080. @section il
  7081. Deinterleave or interleave fields.
  7082. This filter allows one to process interlaced images fields without
  7083. deinterlacing them. Deinterleaving splits the input frame into 2
  7084. fields (so called half pictures). Odd lines are moved to the top
  7085. half of the output image, even lines to the bottom half.
  7086. You can process (filter) them independently and then re-interleave them.
  7087. The filter accepts the following options:
  7088. @table @option
  7089. @item luma_mode, l
  7090. @item chroma_mode, c
  7091. @item alpha_mode, a
  7092. Available values for @var{luma_mode}, @var{chroma_mode} and
  7093. @var{alpha_mode} are:
  7094. @table @samp
  7095. @item none
  7096. Do nothing.
  7097. @item deinterleave, d
  7098. Deinterleave fields, placing one above the other.
  7099. @item interleave, i
  7100. Interleave fields. Reverse the effect of deinterleaving.
  7101. @end table
  7102. Default value is @code{none}.
  7103. @item luma_swap, ls
  7104. @item chroma_swap, cs
  7105. @item alpha_swap, as
  7106. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7107. @end table
  7108. @section inflate
  7109. Apply inflate effect to the video.
  7110. This filter replaces the pixel by the local(3x3) average by taking into account
  7111. only values higher than the pixel.
  7112. It accepts the following options:
  7113. @table @option
  7114. @item threshold0
  7115. @item threshold1
  7116. @item threshold2
  7117. @item threshold3
  7118. Limit the maximum change for each plane, default is 65535.
  7119. If 0, plane will remain unchanged.
  7120. @end table
  7121. @section interlace
  7122. Simple interlacing filter from progressive contents. This interleaves upper (or
  7123. lower) lines from odd frames with lower (or upper) lines from even frames,
  7124. halving the frame rate and preserving image height.
  7125. @example
  7126. Original Original New Frame
  7127. Frame 'j' Frame 'j+1' (tff)
  7128. ========== =========== ==================
  7129. Line 0 --------------------> Frame 'j' Line 0
  7130. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7131. Line 2 ---------------------> Frame 'j' Line 2
  7132. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7133. ... ... ...
  7134. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7135. @end example
  7136. It accepts the following optional parameters:
  7137. @table @option
  7138. @item scan
  7139. This determines whether the interlaced frame is taken from the even
  7140. (tff - default) or odd (bff) lines of the progressive frame.
  7141. @item lowpass
  7142. Vertical lowpass filter to avoid twitter interlacing and
  7143. reduce moire patterns.
  7144. @table @samp
  7145. @item 0, off
  7146. Disable vertical lowpass filter
  7147. @item 1, linear
  7148. Enable linear filter (default)
  7149. @item 2, complex
  7150. Enable complex filter. This will slightly less reduce twitter and moire
  7151. but better retain detail and subjective sharpness impression.
  7152. @end table
  7153. @end table
  7154. @section kerndeint
  7155. Deinterlace input video by applying Donald Graft's adaptive kernel
  7156. deinterling. Work on interlaced parts of a video to produce
  7157. progressive frames.
  7158. The description of the accepted parameters follows.
  7159. @table @option
  7160. @item thresh
  7161. Set the threshold which affects the filter's tolerance when
  7162. determining if a pixel line must be processed. It must be an integer
  7163. in the range [0,255] and defaults to 10. A value of 0 will result in
  7164. applying the process on every pixels.
  7165. @item map
  7166. Paint pixels exceeding the threshold value to white if set to 1.
  7167. Default is 0.
  7168. @item order
  7169. Set the fields order. Swap fields if set to 1, leave fields alone if
  7170. 0. Default is 0.
  7171. @item sharp
  7172. Enable additional sharpening if set to 1. Default is 0.
  7173. @item twoway
  7174. Enable twoway sharpening if set to 1. Default is 0.
  7175. @end table
  7176. @subsection Examples
  7177. @itemize
  7178. @item
  7179. Apply default values:
  7180. @example
  7181. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7182. @end example
  7183. @item
  7184. Enable additional sharpening:
  7185. @example
  7186. kerndeint=sharp=1
  7187. @end example
  7188. @item
  7189. Paint processed pixels in white:
  7190. @example
  7191. kerndeint=map=1
  7192. @end example
  7193. @end itemize
  7194. @section lenscorrection
  7195. Correct radial lens distortion
  7196. This filter can be used to correct for radial distortion as can result from the use
  7197. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7198. one can use tools available for example as part of opencv or simply trial-and-error.
  7199. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7200. and extract the k1 and k2 coefficients from the resulting matrix.
  7201. Note that effectively the same filter is available in the open-source tools Krita and
  7202. Digikam from the KDE project.
  7203. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7204. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7205. brightness distribution, so you may want to use both filters together in certain
  7206. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7207. be applied before or after lens correction.
  7208. @subsection Options
  7209. The filter accepts the following options:
  7210. @table @option
  7211. @item cx
  7212. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7213. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7214. width.
  7215. @item cy
  7216. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7217. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7218. height.
  7219. @item k1
  7220. Coefficient of the quadratic correction term. 0.5 means no correction.
  7221. @item k2
  7222. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7223. @end table
  7224. The formula that generates the correction is:
  7225. @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)
  7226. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7227. distances from the focal point in the source and target images, respectively.
  7228. @section loop
  7229. Loop video frames.
  7230. The filter accepts the following options:
  7231. @table @option
  7232. @item loop
  7233. Set the number of loops.
  7234. @item size
  7235. Set maximal size in number of frames.
  7236. @item start
  7237. Set first frame of loop.
  7238. @end table
  7239. @anchor{lut3d}
  7240. @section lut3d
  7241. Apply a 3D LUT to an input video.
  7242. The filter accepts the following options:
  7243. @table @option
  7244. @item file
  7245. Set the 3D LUT file name.
  7246. Currently supported formats:
  7247. @table @samp
  7248. @item 3dl
  7249. AfterEffects
  7250. @item cube
  7251. Iridas
  7252. @item dat
  7253. DaVinci
  7254. @item m3d
  7255. Pandora
  7256. @end table
  7257. @item interp
  7258. Select interpolation mode.
  7259. Available values are:
  7260. @table @samp
  7261. @item nearest
  7262. Use values from the nearest defined point.
  7263. @item trilinear
  7264. Interpolate values using the 8 points defining a cube.
  7265. @item tetrahedral
  7266. Interpolate values using a tetrahedron.
  7267. @end table
  7268. @end table
  7269. @section lumakey
  7270. Turn certain luma values into transparency.
  7271. The filter accepts the following options:
  7272. @table @option
  7273. @item threshold
  7274. Set the luma which will be used as base for transparency.
  7275. Default value is @code{0}.
  7276. @item tolerance
  7277. Set the range of luma values to be keyed out.
  7278. Default value is @code{0}.
  7279. @item softness
  7280. Set the range of softness. Default value is @code{0}.
  7281. Use this to control gradual transition from zero to full transparency.
  7282. @end table
  7283. @section lut, lutrgb, lutyuv
  7284. Compute a look-up table for binding each pixel component input value
  7285. to an output value, and apply it to the input video.
  7286. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7287. to an RGB input video.
  7288. These filters accept the following parameters:
  7289. @table @option
  7290. @item c0
  7291. set first pixel component expression
  7292. @item c1
  7293. set second pixel component expression
  7294. @item c2
  7295. set third pixel component expression
  7296. @item c3
  7297. set fourth pixel component expression, corresponds to the alpha component
  7298. @item r
  7299. set red component expression
  7300. @item g
  7301. set green component expression
  7302. @item b
  7303. set blue component expression
  7304. @item a
  7305. alpha component expression
  7306. @item y
  7307. set Y/luminance component expression
  7308. @item u
  7309. set U/Cb component expression
  7310. @item v
  7311. set V/Cr component expression
  7312. @end table
  7313. Each of them specifies the expression to use for computing the lookup table for
  7314. the corresponding pixel component values.
  7315. The exact component associated to each of the @var{c*} options depends on the
  7316. format in input.
  7317. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7318. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7319. The expressions can contain the following constants and functions:
  7320. @table @option
  7321. @item w
  7322. @item h
  7323. The input width and height.
  7324. @item val
  7325. The input value for the pixel component.
  7326. @item clipval
  7327. The input value, clipped to the @var{minval}-@var{maxval} range.
  7328. @item maxval
  7329. The maximum value for the pixel component.
  7330. @item minval
  7331. The minimum value for the pixel component.
  7332. @item negval
  7333. The negated value for the pixel component value, clipped to the
  7334. @var{minval}-@var{maxval} range; it corresponds to the expression
  7335. "maxval-clipval+minval".
  7336. @item clip(val)
  7337. The computed value in @var{val}, clipped to the
  7338. @var{minval}-@var{maxval} range.
  7339. @item gammaval(gamma)
  7340. The computed gamma correction value of the pixel component value,
  7341. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7342. expression
  7343. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7344. @end table
  7345. All expressions default to "val".
  7346. @subsection Examples
  7347. @itemize
  7348. @item
  7349. Negate input video:
  7350. @example
  7351. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7352. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7353. @end example
  7354. The above is the same as:
  7355. @example
  7356. lutrgb="r=negval:g=negval:b=negval"
  7357. lutyuv="y=negval:u=negval:v=negval"
  7358. @end example
  7359. @item
  7360. Negate luminance:
  7361. @example
  7362. lutyuv=y=negval
  7363. @end example
  7364. @item
  7365. Remove chroma components, turning the video into a graytone image:
  7366. @example
  7367. lutyuv="u=128:v=128"
  7368. @end example
  7369. @item
  7370. Apply a luma burning effect:
  7371. @example
  7372. lutyuv="y=2*val"
  7373. @end example
  7374. @item
  7375. Remove green and blue components:
  7376. @example
  7377. lutrgb="g=0:b=0"
  7378. @end example
  7379. @item
  7380. Set a constant alpha channel value on input:
  7381. @example
  7382. format=rgba,lutrgb=a="maxval-minval/2"
  7383. @end example
  7384. @item
  7385. Correct luminance gamma by a factor of 0.5:
  7386. @example
  7387. lutyuv=y=gammaval(0.5)
  7388. @end example
  7389. @item
  7390. Discard least significant bits of luma:
  7391. @example
  7392. lutyuv=y='bitand(val, 128+64+32)'
  7393. @end example
  7394. @item
  7395. Technicolor like effect:
  7396. @example
  7397. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7398. @end example
  7399. @end itemize
  7400. @section lut2
  7401. Compute and apply a lookup table from two video inputs.
  7402. This filter accepts the following parameters:
  7403. @table @option
  7404. @item c0
  7405. set first pixel component expression
  7406. @item c1
  7407. set second pixel component expression
  7408. @item c2
  7409. set third pixel component expression
  7410. @item c3
  7411. set fourth pixel component expression, corresponds to the alpha component
  7412. @end table
  7413. Each of them specifies the expression to use for computing the lookup table for
  7414. the corresponding pixel component values.
  7415. The exact component associated to each of the @var{c*} options depends on the
  7416. format in inputs.
  7417. The expressions can contain the following constants:
  7418. @table @option
  7419. @item w
  7420. @item h
  7421. The input width and height.
  7422. @item x
  7423. The first input value for the pixel component.
  7424. @item y
  7425. The second input value for the pixel component.
  7426. @item bdx
  7427. The first input video bit depth.
  7428. @item bdy
  7429. The second input video bit depth.
  7430. @end table
  7431. All expressions default to "x".
  7432. @subsection Examples
  7433. @itemize
  7434. @item
  7435. Highlight differences between two RGB video streams:
  7436. @example
  7437. 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)'
  7438. @end example
  7439. @item
  7440. Highlight differences between two YUV video streams:
  7441. @example
  7442. 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)'
  7443. @end example
  7444. @end itemize
  7445. @section maskedclamp
  7446. Clamp the first input stream with the second input and third input stream.
  7447. Returns the value of first stream to be between second input
  7448. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7449. This filter accepts the following options:
  7450. @table @option
  7451. @item undershoot
  7452. Default value is @code{0}.
  7453. @item overshoot
  7454. Default value is @code{0}.
  7455. @item planes
  7456. Set which planes will be processed as bitmap, unprocessed planes will be
  7457. copied from first stream.
  7458. By default value 0xf, all planes will be processed.
  7459. @end table
  7460. @section maskedmerge
  7461. Merge the first input stream with the second input stream using per pixel
  7462. weights in the third input stream.
  7463. A value of 0 in the third stream pixel component means that pixel component
  7464. from first stream is returned unchanged, while maximum value (eg. 255 for
  7465. 8-bit videos) means that pixel component from second stream is returned
  7466. unchanged. Intermediate values define the amount of merging between both
  7467. input stream's pixel components.
  7468. This filter accepts the following options:
  7469. @table @option
  7470. @item planes
  7471. Set which planes will be processed as bitmap, unprocessed planes will be
  7472. copied from first stream.
  7473. By default value 0xf, all planes will be processed.
  7474. @end table
  7475. @section mcdeint
  7476. Apply motion-compensation deinterlacing.
  7477. It needs one field per frame as input and must thus be used together
  7478. with yadif=1/3 or equivalent.
  7479. This filter accepts the following options:
  7480. @table @option
  7481. @item mode
  7482. Set the deinterlacing mode.
  7483. It accepts one of the following values:
  7484. @table @samp
  7485. @item fast
  7486. @item medium
  7487. @item slow
  7488. use iterative motion estimation
  7489. @item extra_slow
  7490. like @samp{slow}, but use multiple reference frames.
  7491. @end table
  7492. Default value is @samp{fast}.
  7493. @item parity
  7494. Set the picture field parity assumed for the input video. It must be
  7495. one of the following values:
  7496. @table @samp
  7497. @item 0, tff
  7498. assume top field first
  7499. @item 1, bff
  7500. assume bottom field first
  7501. @end table
  7502. Default value is @samp{bff}.
  7503. @item qp
  7504. Set per-block quantization parameter (QP) used by the internal
  7505. encoder.
  7506. Higher values should result in a smoother motion vector field but less
  7507. optimal individual vectors. Default value is 1.
  7508. @end table
  7509. @section mergeplanes
  7510. Merge color channel components from several video streams.
  7511. The filter accepts up to 4 input streams, and merge selected input
  7512. planes to the output video.
  7513. This filter accepts the following options:
  7514. @table @option
  7515. @item mapping
  7516. Set input to output plane mapping. Default is @code{0}.
  7517. The mappings is specified as a bitmap. It should be specified as a
  7518. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7519. mapping for the first plane of the output stream. 'A' sets the number of
  7520. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7521. corresponding input to use (from 0 to 3). The rest of the mappings is
  7522. similar, 'Bb' describes the mapping for the output stream second
  7523. plane, 'Cc' describes the mapping for the output stream third plane and
  7524. 'Dd' describes the mapping for the output stream fourth plane.
  7525. @item format
  7526. Set output pixel format. Default is @code{yuva444p}.
  7527. @end table
  7528. @subsection Examples
  7529. @itemize
  7530. @item
  7531. Merge three gray video streams of same width and height into single video stream:
  7532. @example
  7533. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7534. @end example
  7535. @item
  7536. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7537. @example
  7538. [a0][a1]mergeplanes=0x00010210:yuva444p
  7539. @end example
  7540. @item
  7541. Swap Y and A plane in yuva444p stream:
  7542. @example
  7543. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7544. @end example
  7545. @item
  7546. Swap U and V plane in yuv420p stream:
  7547. @example
  7548. format=yuv420p,mergeplanes=0x000201:yuv420p
  7549. @end example
  7550. @item
  7551. Cast a rgb24 clip to yuv444p:
  7552. @example
  7553. format=rgb24,mergeplanes=0x000102:yuv444p
  7554. @end example
  7555. @end itemize
  7556. @section mestimate
  7557. Estimate and export motion vectors using block matching algorithms.
  7558. Motion vectors are stored in frame side data to be used by other filters.
  7559. This filter accepts the following options:
  7560. @table @option
  7561. @item method
  7562. Specify the motion estimation method. Accepts one of the following values:
  7563. @table @samp
  7564. @item esa
  7565. Exhaustive search algorithm.
  7566. @item tss
  7567. Three step search algorithm.
  7568. @item tdls
  7569. Two dimensional logarithmic search algorithm.
  7570. @item ntss
  7571. New three step search algorithm.
  7572. @item fss
  7573. Four step search algorithm.
  7574. @item ds
  7575. Diamond search algorithm.
  7576. @item hexbs
  7577. Hexagon-based search algorithm.
  7578. @item epzs
  7579. Enhanced predictive zonal search algorithm.
  7580. @item umh
  7581. Uneven multi-hexagon search algorithm.
  7582. @end table
  7583. Default value is @samp{esa}.
  7584. @item mb_size
  7585. Macroblock size. Default @code{16}.
  7586. @item search_param
  7587. Search parameter. Default @code{7}.
  7588. @end table
  7589. @section midequalizer
  7590. Apply Midway Image Equalization effect using two video streams.
  7591. Midway Image Equalization adjusts a pair of images to have the same
  7592. histogram, while maintaining their dynamics as much as possible. It's
  7593. useful for e.g. matching exposures from a pair of stereo cameras.
  7594. This filter has two inputs and one output, which must be of same pixel format, but
  7595. may be of different sizes. The output of filter is first input adjusted with
  7596. midway histogram of both inputs.
  7597. This filter accepts the following option:
  7598. @table @option
  7599. @item planes
  7600. Set which planes to process. Default is @code{15}, which is all available planes.
  7601. @end table
  7602. @section minterpolate
  7603. Convert the video to specified frame rate using motion interpolation.
  7604. This filter accepts the following options:
  7605. @table @option
  7606. @item fps
  7607. 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}.
  7608. @item mi_mode
  7609. Motion interpolation mode. Following values are accepted:
  7610. @table @samp
  7611. @item dup
  7612. Duplicate previous or next frame for interpolating new ones.
  7613. @item blend
  7614. Blend source frames. Interpolated frame is mean of previous and next frames.
  7615. @item mci
  7616. Motion compensated interpolation. Following options are effective when this mode is selected:
  7617. @table @samp
  7618. @item mc_mode
  7619. Motion compensation mode. Following values are accepted:
  7620. @table @samp
  7621. @item obmc
  7622. Overlapped block motion compensation.
  7623. @item aobmc
  7624. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7625. @end table
  7626. Default mode is @samp{obmc}.
  7627. @item me_mode
  7628. Motion estimation mode. Following values are accepted:
  7629. @table @samp
  7630. @item bidir
  7631. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7632. @item bilat
  7633. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7634. @end table
  7635. Default mode is @samp{bilat}.
  7636. @item me
  7637. The algorithm to be used for motion estimation. Following values are accepted:
  7638. @table @samp
  7639. @item esa
  7640. Exhaustive search algorithm.
  7641. @item tss
  7642. Three step search algorithm.
  7643. @item tdls
  7644. Two dimensional logarithmic search algorithm.
  7645. @item ntss
  7646. New three step search algorithm.
  7647. @item fss
  7648. Four step search algorithm.
  7649. @item ds
  7650. Diamond search algorithm.
  7651. @item hexbs
  7652. Hexagon-based search algorithm.
  7653. @item epzs
  7654. Enhanced predictive zonal search algorithm.
  7655. @item umh
  7656. Uneven multi-hexagon search algorithm.
  7657. @end table
  7658. Default algorithm is @samp{epzs}.
  7659. @item mb_size
  7660. Macroblock size. Default @code{16}.
  7661. @item search_param
  7662. Motion estimation search parameter. Default @code{32}.
  7663. @item vsbmc
  7664. 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).
  7665. @end table
  7666. @end table
  7667. @item scd
  7668. 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:
  7669. @table @samp
  7670. @item none
  7671. Disable scene change detection.
  7672. @item fdiff
  7673. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7674. @end table
  7675. Default method is @samp{fdiff}.
  7676. @item scd_threshold
  7677. Scene change detection threshold. Default is @code{5.0}.
  7678. @end table
  7679. @section mpdecimate
  7680. Drop frames that do not differ greatly from the previous frame in
  7681. order to reduce frame rate.
  7682. The main use of this filter is for very-low-bitrate encoding
  7683. (e.g. streaming over dialup modem), but it could in theory be used for
  7684. fixing movies that were inverse-telecined incorrectly.
  7685. A description of the accepted options follows.
  7686. @table @option
  7687. @item max
  7688. Set the maximum number of consecutive frames which can be dropped (if
  7689. positive), or the minimum interval between dropped frames (if
  7690. negative). If the value is 0, the frame is dropped unregarding the
  7691. number of previous sequentially dropped frames.
  7692. Default value is 0.
  7693. @item hi
  7694. @item lo
  7695. @item frac
  7696. Set the dropping threshold values.
  7697. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7698. represent actual pixel value differences, so a threshold of 64
  7699. corresponds to 1 unit of difference for each pixel, or the same spread
  7700. out differently over the block.
  7701. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7702. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7703. meaning the whole image) differ by more than a threshold of @option{lo}.
  7704. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7705. 64*5, and default value for @option{frac} is 0.33.
  7706. @end table
  7707. @section negate
  7708. Negate input video.
  7709. It accepts an integer in input; if non-zero it negates the
  7710. alpha component (if available). The default value in input is 0.
  7711. @section nlmeans
  7712. Denoise frames using Non-Local Means algorithm.
  7713. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7714. context similarity is defined by comparing their surrounding patches of size
  7715. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7716. around the pixel.
  7717. Note that the research area defines centers for patches, which means some
  7718. patches will be made of pixels outside that research area.
  7719. The filter accepts the following options.
  7720. @table @option
  7721. @item s
  7722. Set denoising strength.
  7723. @item p
  7724. Set patch size.
  7725. @item pc
  7726. Same as @option{p} but for chroma planes.
  7727. The default value is @var{0} and means automatic.
  7728. @item r
  7729. Set research size.
  7730. @item rc
  7731. Same as @option{r} but for chroma planes.
  7732. The default value is @var{0} and means automatic.
  7733. @end table
  7734. @section nnedi
  7735. Deinterlace video using neural network edge directed interpolation.
  7736. This filter accepts the following options:
  7737. @table @option
  7738. @item weights
  7739. Mandatory option, without binary file filter can not work.
  7740. Currently file can be found here:
  7741. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7742. @item deint
  7743. Set which frames to deinterlace, by default it is @code{all}.
  7744. Can be @code{all} or @code{interlaced}.
  7745. @item field
  7746. Set mode of operation.
  7747. Can be one of the following:
  7748. @table @samp
  7749. @item af
  7750. Use frame flags, both fields.
  7751. @item a
  7752. Use frame flags, single field.
  7753. @item t
  7754. Use top field only.
  7755. @item b
  7756. Use bottom field only.
  7757. @item tf
  7758. Use both fields, top first.
  7759. @item bf
  7760. Use both fields, bottom first.
  7761. @end table
  7762. @item planes
  7763. Set which planes to process, by default filter process all frames.
  7764. @item nsize
  7765. Set size of local neighborhood around each pixel, used by the predictor neural
  7766. network.
  7767. Can be one of the following:
  7768. @table @samp
  7769. @item s8x6
  7770. @item s16x6
  7771. @item s32x6
  7772. @item s48x6
  7773. @item s8x4
  7774. @item s16x4
  7775. @item s32x4
  7776. @end table
  7777. @item nns
  7778. Set the number of neurons in predicctor neural network.
  7779. Can be one of the following:
  7780. @table @samp
  7781. @item n16
  7782. @item n32
  7783. @item n64
  7784. @item n128
  7785. @item n256
  7786. @end table
  7787. @item qual
  7788. Controls the number of different neural network predictions that are blended
  7789. together to compute the final output value. Can be @code{fast}, default or
  7790. @code{slow}.
  7791. @item etype
  7792. Set which set of weights to use in the predictor.
  7793. Can be one of the following:
  7794. @table @samp
  7795. @item a
  7796. weights trained to minimize absolute error
  7797. @item s
  7798. weights trained to minimize squared error
  7799. @end table
  7800. @item pscrn
  7801. Controls whether or not the prescreener neural network is used to decide
  7802. which pixels should be processed by the predictor neural network and which
  7803. can be handled by simple cubic interpolation.
  7804. The prescreener is trained to know whether cubic interpolation will be
  7805. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7806. The computational complexity of the prescreener nn is much less than that of
  7807. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7808. using the prescreener generally results in much faster processing.
  7809. The prescreener is pretty accurate, so the difference between using it and not
  7810. using it is almost always unnoticeable.
  7811. Can be one of the following:
  7812. @table @samp
  7813. @item none
  7814. @item original
  7815. @item new
  7816. @end table
  7817. Default is @code{new}.
  7818. @item fapprox
  7819. Set various debugging flags.
  7820. @end table
  7821. @section noformat
  7822. Force libavfilter not to use any of the specified pixel formats for the
  7823. input to the next filter.
  7824. It accepts the following parameters:
  7825. @table @option
  7826. @item pix_fmts
  7827. A '|'-separated list of pixel format names, such as
  7828. apix_fmts=yuv420p|monow|rgb24".
  7829. @end table
  7830. @subsection Examples
  7831. @itemize
  7832. @item
  7833. Force libavfilter to use a format different from @var{yuv420p} for the
  7834. input to the vflip filter:
  7835. @example
  7836. noformat=pix_fmts=yuv420p,vflip
  7837. @end example
  7838. @item
  7839. Convert the input video to any of the formats not contained in the list:
  7840. @example
  7841. noformat=yuv420p|yuv444p|yuv410p
  7842. @end example
  7843. @end itemize
  7844. @section noise
  7845. Add noise on video input frame.
  7846. The filter accepts the following options:
  7847. @table @option
  7848. @item all_seed
  7849. @item c0_seed
  7850. @item c1_seed
  7851. @item c2_seed
  7852. @item c3_seed
  7853. Set noise seed for specific pixel component or all pixel components in case
  7854. of @var{all_seed}. Default value is @code{123457}.
  7855. @item all_strength, alls
  7856. @item c0_strength, c0s
  7857. @item c1_strength, c1s
  7858. @item c2_strength, c2s
  7859. @item c3_strength, c3s
  7860. Set noise strength for specific pixel component or all pixel components in case
  7861. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7862. @item all_flags, allf
  7863. @item c0_flags, c0f
  7864. @item c1_flags, c1f
  7865. @item c2_flags, c2f
  7866. @item c3_flags, c3f
  7867. Set pixel component flags or set flags for all components if @var{all_flags}.
  7868. Available values for component flags are:
  7869. @table @samp
  7870. @item a
  7871. averaged temporal noise (smoother)
  7872. @item p
  7873. mix random noise with a (semi)regular pattern
  7874. @item t
  7875. temporal noise (noise pattern changes between frames)
  7876. @item u
  7877. uniform noise (gaussian otherwise)
  7878. @end table
  7879. @end table
  7880. @subsection Examples
  7881. Add temporal and uniform noise to input video:
  7882. @example
  7883. noise=alls=20:allf=t+u
  7884. @end example
  7885. @section null
  7886. Pass the video source unchanged to the output.
  7887. @section ocr
  7888. Optical Character Recognition
  7889. This filter uses Tesseract for optical character recognition.
  7890. It accepts the following options:
  7891. @table @option
  7892. @item datapath
  7893. Set datapath to tesseract data. Default is to use whatever was
  7894. set at installation.
  7895. @item language
  7896. Set language, default is "eng".
  7897. @item whitelist
  7898. Set character whitelist.
  7899. @item blacklist
  7900. Set character blacklist.
  7901. @end table
  7902. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7903. @section ocv
  7904. Apply a video transform using libopencv.
  7905. To enable this filter, install the libopencv library and headers and
  7906. configure FFmpeg with @code{--enable-libopencv}.
  7907. It accepts the following parameters:
  7908. @table @option
  7909. @item filter_name
  7910. The name of the libopencv filter to apply.
  7911. @item filter_params
  7912. The parameters to pass to the libopencv filter. If not specified, the default
  7913. values are assumed.
  7914. @end table
  7915. Refer to the official libopencv documentation for more precise
  7916. information:
  7917. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7918. Several libopencv filters are supported; see the following subsections.
  7919. @anchor{dilate}
  7920. @subsection dilate
  7921. Dilate an image by using a specific structuring element.
  7922. It corresponds to the libopencv function @code{cvDilate}.
  7923. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7924. @var{struct_el} represents a structuring element, and has the syntax:
  7925. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7926. @var{cols} and @var{rows} represent the number of columns and rows of
  7927. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7928. point, and @var{shape} the shape for the structuring element. @var{shape}
  7929. must be "rect", "cross", "ellipse", or "custom".
  7930. If the value for @var{shape} is "custom", it must be followed by a
  7931. string of the form "=@var{filename}". The file with name
  7932. @var{filename} is assumed to represent a binary image, with each
  7933. printable character corresponding to a bright pixel. When a custom
  7934. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7935. or columns and rows of the read file are assumed instead.
  7936. The default value for @var{struct_el} is "3x3+0x0/rect".
  7937. @var{nb_iterations} specifies the number of times the transform is
  7938. applied to the image, and defaults to 1.
  7939. Some examples:
  7940. @example
  7941. # Use the default values
  7942. ocv=dilate
  7943. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7944. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7945. # Read the shape from the file diamond.shape, iterating two times.
  7946. # The file diamond.shape may contain a pattern of characters like this
  7947. # *
  7948. # ***
  7949. # *****
  7950. # ***
  7951. # *
  7952. # The specified columns and rows are ignored
  7953. # but the anchor point coordinates are not
  7954. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7955. @end example
  7956. @subsection erode
  7957. Erode an image by using a specific structuring element.
  7958. It corresponds to the libopencv function @code{cvErode}.
  7959. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7960. with the same syntax and semantics as the @ref{dilate} filter.
  7961. @subsection smooth
  7962. Smooth the input video.
  7963. The filter takes the following parameters:
  7964. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7965. @var{type} is the type of smooth filter to apply, and must be one of
  7966. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7967. or "bilateral". The default value is "gaussian".
  7968. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7969. depend on the smooth type. @var{param1} and
  7970. @var{param2} accept integer positive values or 0. @var{param3} and
  7971. @var{param4} accept floating point values.
  7972. The default value for @var{param1} is 3. The default value for the
  7973. other parameters is 0.
  7974. These parameters correspond to the parameters assigned to the
  7975. libopencv function @code{cvSmooth}.
  7976. @section oscilloscope
  7977. 2D Video Oscilloscope.
  7978. Useful to measure spatial impulse, step responses, chroma delays, etc.
  7979. It accepts the following parameters:
  7980. @table @option
  7981. @item x
  7982. Set scope center x position.
  7983. @item y
  7984. Set scope center y position.
  7985. @item s
  7986. Set scope size, relative to frame diagonal.
  7987. @item t
  7988. Set scope tilt/rotation.
  7989. @item o
  7990. Set trace opacity.
  7991. @item tx
  7992. Set trace center x position.
  7993. @item ty
  7994. Set trace center y position.
  7995. @item tw
  7996. Set trace width, relative to width of frame.
  7997. @item th
  7998. Set trace height, relative to height of frame.
  7999. @item c
  8000. Set which components to trace. By default it traces first three components.
  8001. @item g
  8002. Draw trace grid. By default is enabled.
  8003. @item st
  8004. Draw some statistics. By default is enabled.
  8005. @item sc
  8006. Draw scope. By default is enabled.
  8007. @end table
  8008. @subsection Examples
  8009. @itemize
  8010. @item
  8011. Inspect full first row of video frame.
  8012. @example
  8013. oscilloscope=x=0.5:y=0:s=1
  8014. @end example
  8015. @item
  8016. Inspect full last row of video frame.
  8017. @example
  8018. oscilloscope=x=0.5:y=1:s=1
  8019. @end example
  8020. @item
  8021. Inspect full 5th line of video frame of height 1080.
  8022. @example
  8023. oscilloscope=x=0.5:y=5/1080:s=1
  8024. @end example
  8025. @item
  8026. Inspect full last column of video frame.
  8027. @example
  8028. oscilloscope=x=1:y=0.5:s=1:t=1
  8029. @end example
  8030. @end itemize
  8031. @anchor{overlay}
  8032. @section overlay
  8033. Overlay one video on top of another.
  8034. It takes two inputs and has one output. The first input is the "main"
  8035. video on which the second input is overlaid.
  8036. It accepts the following parameters:
  8037. A description of the accepted options follows.
  8038. @table @option
  8039. @item x
  8040. @item y
  8041. Set the expression for the x and y coordinates of the overlaid video
  8042. on the main video. Default value is "0" for both expressions. In case
  8043. the expression is invalid, it is set to a huge value (meaning that the
  8044. overlay will not be displayed within the output visible area).
  8045. @item eof_action
  8046. The action to take when EOF is encountered on the secondary input; it accepts
  8047. one of the following values:
  8048. @table @option
  8049. @item repeat
  8050. Repeat the last frame (the default).
  8051. @item endall
  8052. End both streams.
  8053. @item pass
  8054. Pass the main input through.
  8055. @end table
  8056. @item eval
  8057. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8058. It accepts the following values:
  8059. @table @samp
  8060. @item init
  8061. only evaluate expressions once during the filter initialization or
  8062. when a command is processed
  8063. @item frame
  8064. evaluate expressions for each incoming frame
  8065. @end table
  8066. Default value is @samp{frame}.
  8067. @item shortest
  8068. If set to 1, force the output to terminate when the shortest input
  8069. terminates. Default value is 0.
  8070. @item format
  8071. Set the format for the output video.
  8072. It accepts the following values:
  8073. @table @samp
  8074. @item yuv420
  8075. force YUV420 output
  8076. @item yuv422
  8077. force YUV422 output
  8078. @item yuv444
  8079. force YUV444 output
  8080. @item rgb
  8081. force packed RGB output
  8082. @item gbrp
  8083. force planar RGB output
  8084. @end table
  8085. Default value is @samp{yuv420}.
  8086. @item rgb @emph{(deprecated)}
  8087. If set to 1, force the filter to accept inputs in the RGB
  8088. color space. Default value is 0. This option is deprecated, use
  8089. @option{format} instead.
  8090. @item repeatlast
  8091. If set to 1, force the filter to draw the last overlay frame over the
  8092. main input until the end of the stream. A value of 0 disables this
  8093. behavior. Default value is 1.
  8094. @end table
  8095. The @option{x}, and @option{y} expressions can contain the following
  8096. parameters.
  8097. @table @option
  8098. @item main_w, W
  8099. @item main_h, H
  8100. The main input width and height.
  8101. @item overlay_w, w
  8102. @item overlay_h, h
  8103. The overlay input width and height.
  8104. @item x
  8105. @item y
  8106. The computed values for @var{x} and @var{y}. They are evaluated for
  8107. each new frame.
  8108. @item hsub
  8109. @item vsub
  8110. horizontal and vertical chroma subsample values of the output
  8111. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8112. @var{vsub} is 1.
  8113. @item n
  8114. the number of input frame, starting from 0
  8115. @item pos
  8116. the position in the file of the input frame, NAN if unknown
  8117. @item t
  8118. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8119. @end table
  8120. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8121. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8122. when @option{eval} is set to @samp{init}.
  8123. Be aware that frames are taken from each input video in timestamp
  8124. order, hence, if their initial timestamps differ, it is a good idea
  8125. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8126. have them begin in the same zero timestamp, as the example for
  8127. the @var{movie} filter does.
  8128. You can chain together more overlays but you should test the
  8129. efficiency of such approach.
  8130. @subsection Commands
  8131. This filter supports the following commands:
  8132. @table @option
  8133. @item x
  8134. @item y
  8135. Modify the x and y of the overlay input.
  8136. The command accepts the same syntax of the corresponding option.
  8137. If the specified expression is not valid, it is kept at its current
  8138. value.
  8139. @end table
  8140. @subsection Examples
  8141. @itemize
  8142. @item
  8143. Draw the overlay at 10 pixels from the bottom right corner of the main
  8144. video:
  8145. @example
  8146. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8147. @end example
  8148. Using named options the example above becomes:
  8149. @example
  8150. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8151. @end example
  8152. @item
  8153. Insert a transparent PNG logo in the bottom left corner of the input,
  8154. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8155. @example
  8156. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8157. @end example
  8158. @item
  8159. Insert 2 different transparent PNG logos (second logo on bottom
  8160. right corner) using the @command{ffmpeg} tool:
  8161. @example
  8162. 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
  8163. @end example
  8164. @item
  8165. Add a transparent color layer on top of the main video; @code{WxH}
  8166. must specify the size of the main input to the overlay filter:
  8167. @example
  8168. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8169. @end example
  8170. @item
  8171. Play an original video and a filtered version (here with the deshake
  8172. filter) side by side using the @command{ffplay} tool:
  8173. @example
  8174. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8175. @end example
  8176. The above command is the same as:
  8177. @example
  8178. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8179. @end example
  8180. @item
  8181. Make a sliding overlay appearing from the left to the right top part of the
  8182. screen starting since time 2:
  8183. @example
  8184. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8185. @end example
  8186. @item
  8187. Compose output by putting two input videos side to side:
  8188. @example
  8189. ffmpeg -i left.avi -i right.avi -filter_complex "
  8190. nullsrc=size=200x100 [background];
  8191. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8192. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8193. [background][left] overlay=shortest=1 [background+left];
  8194. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8195. "
  8196. @end example
  8197. @item
  8198. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8199. @example
  8200. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8201. -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]'
  8202. masked.avi
  8203. @end example
  8204. @item
  8205. Chain several overlays in cascade:
  8206. @example
  8207. nullsrc=s=200x200 [bg];
  8208. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8209. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8210. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8211. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8212. [in3] null, [mid2] overlay=100:100 [out0]
  8213. @end example
  8214. @end itemize
  8215. @section owdenoise
  8216. Apply Overcomplete Wavelet denoiser.
  8217. The filter accepts the following options:
  8218. @table @option
  8219. @item depth
  8220. Set depth.
  8221. Larger depth values will denoise lower frequency components more, but
  8222. slow down filtering.
  8223. Must be an int in the range 8-16, default is @code{8}.
  8224. @item luma_strength, ls
  8225. Set luma strength.
  8226. Must be a double value in the range 0-1000, default is @code{1.0}.
  8227. @item chroma_strength, cs
  8228. Set chroma strength.
  8229. Must be a double value in the range 0-1000, default is @code{1.0}.
  8230. @end table
  8231. @anchor{pad}
  8232. @section pad
  8233. Add paddings to the input image, and place the original input at the
  8234. provided @var{x}, @var{y} coordinates.
  8235. It accepts the following parameters:
  8236. @table @option
  8237. @item width, w
  8238. @item height, h
  8239. Specify an expression for the size of the output image with the
  8240. paddings added. If the value for @var{width} or @var{height} is 0, the
  8241. corresponding input size is used for the output.
  8242. The @var{width} expression can reference the value set by the
  8243. @var{height} expression, and vice versa.
  8244. The default value of @var{width} and @var{height} is 0.
  8245. @item x
  8246. @item y
  8247. Specify the offsets to place the input image at within the padded area,
  8248. with respect to the top/left border of the output image.
  8249. The @var{x} expression can reference the value set by the @var{y}
  8250. expression, and vice versa.
  8251. The default value of @var{x} and @var{y} is 0.
  8252. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8253. so the input image is centered on the padded area.
  8254. @item color
  8255. Specify the color of the padded area. For the syntax of this option,
  8256. check the "Color" section in the ffmpeg-utils manual.
  8257. The default value of @var{color} is "black".
  8258. @item eval
  8259. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8260. It accepts the following values:
  8261. @table @samp
  8262. @item init
  8263. Only evaluate expressions once during the filter initialization or when
  8264. a command is processed.
  8265. @item frame
  8266. Evaluate expressions for each incoming frame.
  8267. @end table
  8268. Default value is @samp{init}.
  8269. @item aspect
  8270. Pad to aspect instead to a resolution.
  8271. @end table
  8272. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8273. options are expressions containing the following constants:
  8274. @table @option
  8275. @item in_w
  8276. @item in_h
  8277. The input video width and height.
  8278. @item iw
  8279. @item ih
  8280. These are the same as @var{in_w} and @var{in_h}.
  8281. @item out_w
  8282. @item out_h
  8283. The output width and height (the size of the padded area), as
  8284. specified by the @var{width} and @var{height} expressions.
  8285. @item ow
  8286. @item oh
  8287. These are the same as @var{out_w} and @var{out_h}.
  8288. @item x
  8289. @item y
  8290. The x and y offsets as specified by the @var{x} and @var{y}
  8291. expressions, or NAN if not yet specified.
  8292. @item a
  8293. same as @var{iw} / @var{ih}
  8294. @item sar
  8295. input sample aspect ratio
  8296. @item dar
  8297. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8298. @item hsub
  8299. @item vsub
  8300. The horizontal and vertical chroma subsample values. For example for the
  8301. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8302. @end table
  8303. @subsection Examples
  8304. @itemize
  8305. @item
  8306. Add paddings with the color "violet" to the input video. The output video
  8307. size is 640x480, and the top-left corner of the input video is placed at
  8308. column 0, row 40
  8309. @example
  8310. pad=640:480:0:40:violet
  8311. @end example
  8312. The example above is equivalent to the following command:
  8313. @example
  8314. pad=width=640:height=480:x=0:y=40:color=violet
  8315. @end example
  8316. @item
  8317. Pad the input to get an output with dimensions increased by 3/2,
  8318. and put the input video at the center of the padded area:
  8319. @example
  8320. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8321. @end example
  8322. @item
  8323. Pad the input to get a squared output with size equal to the maximum
  8324. value between the input width and height, and put the input video at
  8325. the center of the padded area:
  8326. @example
  8327. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8328. @end example
  8329. @item
  8330. Pad the input to get a final w/h ratio of 16:9:
  8331. @example
  8332. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8333. @end example
  8334. @item
  8335. In case of anamorphic video, in order to set the output display aspect
  8336. correctly, it is necessary to use @var{sar} in the expression,
  8337. according to the relation:
  8338. @example
  8339. (ih * X / ih) * sar = output_dar
  8340. X = output_dar / sar
  8341. @end example
  8342. Thus the previous example needs to be modified to:
  8343. @example
  8344. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8345. @end example
  8346. @item
  8347. Double the output size and put the input video in the bottom-right
  8348. corner of the output padded area:
  8349. @example
  8350. pad="2*iw:2*ih:ow-iw:oh-ih"
  8351. @end example
  8352. @end itemize
  8353. @anchor{palettegen}
  8354. @section palettegen
  8355. Generate one palette for a whole video stream.
  8356. It accepts the following options:
  8357. @table @option
  8358. @item max_colors
  8359. Set the maximum number of colors to quantize in the palette.
  8360. Note: the palette will still contain 256 colors; the unused palette entries
  8361. will be black.
  8362. @item reserve_transparent
  8363. Create a palette of 255 colors maximum and reserve the last one for
  8364. transparency. Reserving the transparency color is useful for GIF optimization.
  8365. If not set, the maximum of colors in the palette will be 256. You probably want
  8366. to disable this option for a standalone image.
  8367. Set by default.
  8368. @item stats_mode
  8369. Set statistics mode.
  8370. It accepts the following values:
  8371. @table @samp
  8372. @item full
  8373. Compute full frame histograms.
  8374. @item diff
  8375. Compute histograms only for the part that differs from previous frame. This
  8376. might be relevant to give more importance to the moving part of your input if
  8377. the background is static.
  8378. @item single
  8379. Compute new histogram for each frame.
  8380. @end table
  8381. Default value is @var{full}.
  8382. @end table
  8383. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8384. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8385. color quantization of the palette. This information is also visible at
  8386. @var{info} logging level.
  8387. @subsection Examples
  8388. @itemize
  8389. @item
  8390. Generate a representative palette of a given video using @command{ffmpeg}:
  8391. @example
  8392. ffmpeg -i input.mkv -vf palettegen palette.png
  8393. @end example
  8394. @end itemize
  8395. @section paletteuse
  8396. Use a palette to downsample an input video stream.
  8397. The filter takes two inputs: one video stream and a palette. The palette must
  8398. be a 256 pixels image.
  8399. It accepts the following options:
  8400. @table @option
  8401. @item dither
  8402. Select dithering mode. Available algorithms are:
  8403. @table @samp
  8404. @item bayer
  8405. Ordered 8x8 bayer dithering (deterministic)
  8406. @item heckbert
  8407. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8408. Note: this dithering is sometimes considered "wrong" and is included as a
  8409. reference.
  8410. @item floyd_steinberg
  8411. Floyd and Steingberg dithering (error diffusion)
  8412. @item sierra2
  8413. Frankie Sierra dithering v2 (error diffusion)
  8414. @item sierra2_4a
  8415. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8416. @end table
  8417. Default is @var{sierra2_4a}.
  8418. @item bayer_scale
  8419. When @var{bayer} dithering is selected, this option defines the scale of the
  8420. pattern (how much the crosshatch pattern is visible). A low value means more
  8421. visible pattern for less banding, and higher value means less visible pattern
  8422. at the cost of more banding.
  8423. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8424. @item diff_mode
  8425. If set, define the zone to process
  8426. @table @samp
  8427. @item rectangle
  8428. Only the changing rectangle will be reprocessed. This is similar to GIF
  8429. cropping/offsetting compression mechanism. This option can be useful for speed
  8430. if only a part of the image is changing, and has use cases such as limiting the
  8431. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8432. moving scene (it leads to more deterministic output if the scene doesn't change
  8433. much, and as a result less moving noise and better GIF compression).
  8434. @end table
  8435. Default is @var{none}.
  8436. @item new
  8437. Take new palette for each output frame.
  8438. @end table
  8439. @subsection Examples
  8440. @itemize
  8441. @item
  8442. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8443. using @command{ffmpeg}:
  8444. @example
  8445. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8446. @end example
  8447. @end itemize
  8448. @section perspective
  8449. Correct perspective of video not recorded perpendicular to the screen.
  8450. A description of the accepted parameters follows.
  8451. @table @option
  8452. @item x0
  8453. @item y0
  8454. @item x1
  8455. @item y1
  8456. @item x2
  8457. @item y2
  8458. @item x3
  8459. @item y3
  8460. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8461. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8462. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8463. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8464. then the corners of the source will be sent to the specified coordinates.
  8465. The expressions can use the following variables:
  8466. @table @option
  8467. @item W
  8468. @item H
  8469. the width and height of video frame.
  8470. @item in
  8471. Input frame count.
  8472. @item on
  8473. Output frame count.
  8474. @end table
  8475. @item interpolation
  8476. Set interpolation for perspective correction.
  8477. It accepts the following values:
  8478. @table @samp
  8479. @item linear
  8480. @item cubic
  8481. @end table
  8482. Default value is @samp{linear}.
  8483. @item sense
  8484. Set interpretation of coordinate options.
  8485. It accepts the following values:
  8486. @table @samp
  8487. @item 0, source
  8488. Send point in the source specified by the given coordinates to
  8489. the corners of the destination.
  8490. @item 1, destination
  8491. Send the corners of the source to the point in the destination specified
  8492. by the given coordinates.
  8493. Default value is @samp{source}.
  8494. @end table
  8495. @item eval
  8496. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8497. It accepts the following values:
  8498. @table @samp
  8499. @item init
  8500. only evaluate expressions once during the filter initialization or
  8501. when a command is processed
  8502. @item frame
  8503. evaluate expressions for each incoming frame
  8504. @end table
  8505. Default value is @samp{init}.
  8506. @end table
  8507. @section phase
  8508. Delay interlaced video by one field time so that the field order changes.
  8509. The intended use is to fix PAL movies that have been captured with the
  8510. opposite field order to the film-to-video transfer.
  8511. A description of the accepted parameters follows.
  8512. @table @option
  8513. @item mode
  8514. Set phase mode.
  8515. It accepts the following values:
  8516. @table @samp
  8517. @item t
  8518. Capture field order top-first, transfer bottom-first.
  8519. Filter will delay the bottom field.
  8520. @item b
  8521. Capture field order bottom-first, transfer top-first.
  8522. Filter will delay the top field.
  8523. @item p
  8524. Capture and transfer with the same field order. This mode only exists
  8525. for the documentation of the other options to refer to, but if you
  8526. actually select it, the filter will faithfully do nothing.
  8527. @item a
  8528. Capture field order determined automatically by field flags, transfer
  8529. opposite.
  8530. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8531. basis using field flags. If no field information is available,
  8532. then this works just like @samp{u}.
  8533. @item u
  8534. Capture unknown or varying, transfer opposite.
  8535. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8536. analyzing the images and selecting the alternative that produces best
  8537. match between the fields.
  8538. @item T
  8539. Capture top-first, transfer unknown or varying.
  8540. Filter selects among @samp{t} and @samp{p} using image analysis.
  8541. @item B
  8542. Capture bottom-first, transfer unknown or varying.
  8543. Filter selects among @samp{b} and @samp{p} using image analysis.
  8544. @item A
  8545. Capture determined by field flags, transfer unknown or varying.
  8546. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8547. image analysis. If no field information is available, then this works just
  8548. like @samp{U}. This is the default mode.
  8549. @item U
  8550. Both capture and transfer unknown or varying.
  8551. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8552. @end table
  8553. @end table
  8554. @section pixdesctest
  8555. Pixel format descriptor test filter, mainly useful for internal
  8556. testing. The output video should be equal to the input video.
  8557. For example:
  8558. @example
  8559. format=monow, pixdesctest
  8560. @end example
  8561. can be used to test the monowhite pixel format descriptor definition.
  8562. @section pixscope
  8563. Display sample values of color channels. Mainly useful for checking color and levels.
  8564. The filters accept the following options:
  8565. @table @option
  8566. @item x
  8567. Set scope X position, offset on X axis.
  8568. @item y
  8569. Set scope Y position, offset on Y axis.
  8570. @item w
  8571. Set scope width.
  8572. @item h
  8573. Set scope height.
  8574. @item o
  8575. Set window opacity. This window also holds statistics about pixel area.
  8576. @end table
  8577. @section pp
  8578. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8579. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8580. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8581. Each subfilter and some options have a short and a long name that can be used
  8582. interchangeably, i.e. dr/dering are the same.
  8583. The filters accept the following options:
  8584. @table @option
  8585. @item subfilters
  8586. Set postprocessing subfilters string.
  8587. @end table
  8588. All subfilters share common options to determine their scope:
  8589. @table @option
  8590. @item a/autoq
  8591. Honor the quality commands for this subfilter.
  8592. @item c/chrom
  8593. Do chrominance filtering, too (default).
  8594. @item y/nochrom
  8595. Do luminance filtering only (no chrominance).
  8596. @item n/noluma
  8597. Do chrominance filtering only (no luminance).
  8598. @end table
  8599. These options can be appended after the subfilter name, separated by a '|'.
  8600. Available subfilters are:
  8601. @table @option
  8602. @item hb/hdeblock[|difference[|flatness]]
  8603. Horizontal deblocking filter
  8604. @table @option
  8605. @item difference
  8606. Difference factor where higher values mean more deblocking (default: @code{32}).
  8607. @item flatness
  8608. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8609. @end table
  8610. @item vb/vdeblock[|difference[|flatness]]
  8611. Vertical deblocking filter
  8612. @table @option
  8613. @item difference
  8614. Difference factor where higher values mean more deblocking (default: @code{32}).
  8615. @item flatness
  8616. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8617. @end table
  8618. @item ha/hadeblock[|difference[|flatness]]
  8619. Accurate horizontal deblocking filter
  8620. @table @option
  8621. @item difference
  8622. Difference factor where higher values mean more deblocking (default: @code{32}).
  8623. @item flatness
  8624. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8625. @end table
  8626. @item va/vadeblock[|difference[|flatness]]
  8627. Accurate vertical deblocking filter
  8628. @table @option
  8629. @item difference
  8630. Difference factor where higher values mean more deblocking (default: @code{32}).
  8631. @item flatness
  8632. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8633. @end table
  8634. @end table
  8635. The horizontal and vertical deblocking filters share the difference and
  8636. flatness values so you cannot set different horizontal and vertical
  8637. thresholds.
  8638. @table @option
  8639. @item h1/x1hdeblock
  8640. Experimental horizontal deblocking filter
  8641. @item v1/x1vdeblock
  8642. Experimental vertical deblocking filter
  8643. @item dr/dering
  8644. Deringing filter
  8645. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8646. @table @option
  8647. @item threshold1
  8648. larger -> stronger filtering
  8649. @item threshold2
  8650. larger -> stronger filtering
  8651. @item threshold3
  8652. larger -> stronger filtering
  8653. @end table
  8654. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8655. @table @option
  8656. @item f/fullyrange
  8657. Stretch luminance to @code{0-255}.
  8658. @end table
  8659. @item lb/linblenddeint
  8660. Linear blend deinterlacing filter that deinterlaces the given block by
  8661. filtering all lines with a @code{(1 2 1)} filter.
  8662. @item li/linipoldeint
  8663. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8664. linearly interpolating every second line.
  8665. @item ci/cubicipoldeint
  8666. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8667. cubically interpolating every second line.
  8668. @item md/mediandeint
  8669. Median deinterlacing filter that deinterlaces the given block by applying a
  8670. median filter to every second line.
  8671. @item fd/ffmpegdeint
  8672. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8673. second line with a @code{(-1 4 2 4 -1)} filter.
  8674. @item l5/lowpass5
  8675. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8676. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8677. @item fq/forceQuant[|quantizer]
  8678. Overrides the quantizer table from the input with the constant quantizer you
  8679. specify.
  8680. @table @option
  8681. @item quantizer
  8682. Quantizer to use
  8683. @end table
  8684. @item de/default
  8685. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8686. @item fa/fast
  8687. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8688. @item ac
  8689. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8690. @end table
  8691. @subsection Examples
  8692. @itemize
  8693. @item
  8694. Apply horizontal and vertical deblocking, deringing and automatic
  8695. brightness/contrast:
  8696. @example
  8697. pp=hb/vb/dr/al
  8698. @end example
  8699. @item
  8700. Apply default filters without brightness/contrast correction:
  8701. @example
  8702. pp=de/-al
  8703. @end example
  8704. @item
  8705. Apply default filters and temporal denoiser:
  8706. @example
  8707. pp=default/tmpnoise|1|2|3
  8708. @end example
  8709. @item
  8710. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8711. automatically depending on available CPU time:
  8712. @example
  8713. pp=hb|y/vb|a
  8714. @end example
  8715. @end itemize
  8716. @section pp7
  8717. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8718. similar to spp = 6 with 7 point DCT, where only the center sample is
  8719. used after IDCT.
  8720. The filter accepts the following options:
  8721. @table @option
  8722. @item qp
  8723. Force a constant quantization parameter. It accepts an integer in range
  8724. 0 to 63. If not set, the filter will use the QP from the video stream
  8725. (if available).
  8726. @item mode
  8727. Set thresholding mode. Available modes are:
  8728. @table @samp
  8729. @item hard
  8730. Set hard thresholding.
  8731. @item soft
  8732. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8733. @item medium
  8734. Set medium thresholding (good results, default).
  8735. @end table
  8736. @end table
  8737. @section premultiply
  8738. Apply alpha premultiply effect to input video stream using first plane
  8739. of second stream as alpha.
  8740. Both streams must have same dimensions and same pixel format.
  8741. The filter accepts the following option:
  8742. @table @option
  8743. @item planes
  8744. Set which planes will be processed, unprocessed planes will be copied.
  8745. By default value 0xf, all planes will be processed.
  8746. @end table
  8747. @section prewitt
  8748. Apply prewitt operator to input video stream.
  8749. The filter accepts the following option:
  8750. @table @option
  8751. @item planes
  8752. Set which planes will be processed, unprocessed planes will be copied.
  8753. By default value 0xf, all planes will be processed.
  8754. @item scale
  8755. Set value which will be multiplied with filtered result.
  8756. @item delta
  8757. Set value which will be added to filtered result.
  8758. @end table
  8759. @section psnr
  8760. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8761. Ratio) between two input videos.
  8762. This filter takes in input two input videos, the first input is
  8763. considered the "main" source and is passed unchanged to the
  8764. output. The second input is used as a "reference" video for computing
  8765. the PSNR.
  8766. Both video inputs must have the same resolution and pixel format for
  8767. this filter to work correctly. Also it assumes that both inputs
  8768. have the same number of frames, which are compared one by one.
  8769. The obtained average PSNR is printed through the logging system.
  8770. The filter stores the accumulated MSE (mean squared error) of each
  8771. frame, and at the end of the processing it is averaged across all frames
  8772. equally, and the following formula is applied to obtain the PSNR:
  8773. @example
  8774. PSNR = 10*log10(MAX^2/MSE)
  8775. @end example
  8776. Where MAX is the average of the maximum values of each component of the
  8777. image.
  8778. The description of the accepted parameters follows.
  8779. @table @option
  8780. @item stats_file, f
  8781. If specified the filter will use the named file to save the PSNR of
  8782. each individual frame. When filename equals "-" the data is sent to
  8783. standard output.
  8784. @item stats_version
  8785. Specifies which version of the stats file format to use. Details of
  8786. each format are written below.
  8787. Default value is 1.
  8788. @item stats_add_max
  8789. Determines whether the max value is output to the stats log.
  8790. Default value is 0.
  8791. Requires stats_version >= 2. If this is set and stats_version < 2,
  8792. the filter will return an error.
  8793. @end table
  8794. The file printed if @var{stats_file} is selected, contains a sequence of
  8795. key/value pairs of the form @var{key}:@var{value} for each compared
  8796. couple of frames.
  8797. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8798. the list of per-frame-pair stats, with key value pairs following the frame
  8799. format with the following parameters:
  8800. @table @option
  8801. @item psnr_log_version
  8802. The version of the log file format. Will match @var{stats_version}.
  8803. @item fields
  8804. A comma separated list of the per-frame-pair parameters included in
  8805. the log.
  8806. @end table
  8807. A description of each shown per-frame-pair parameter follows:
  8808. @table @option
  8809. @item n
  8810. sequential number of the input frame, starting from 1
  8811. @item mse_avg
  8812. Mean Square Error pixel-by-pixel average difference of the compared
  8813. frames, averaged over all the image components.
  8814. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8815. Mean Square Error pixel-by-pixel average difference of the compared
  8816. frames for the component specified by the suffix.
  8817. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8818. Peak Signal to Noise ratio of the compared frames for the component
  8819. specified by the suffix.
  8820. @item max_avg, max_y, max_u, max_v
  8821. Maximum allowed value for each channel, and average over all
  8822. channels.
  8823. @end table
  8824. For example:
  8825. @example
  8826. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8827. [main][ref] psnr="stats_file=stats.log" [out]
  8828. @end example
  8829. On this example the input file being processed is compared with the
  8830. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8831. is stored in @file{stats.log}.
  8832. @anchor{pullup}
  8833. @section pullup
  8834. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8835. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8836. content.
  8837. The pullup filter is designed to take advantage of future context in making
  8838. its decisions. This filter is stateless in the sense that it does not lock
  8839. onto a pattern to follow, but it instead looks forward to the following
  8840. fields in order to identify matches and rebuild progressive frames.
  8841. To produce content with an even framerate, insert the fps filter after
  8842. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8843. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8844. The filter accepts the following options:
  8845. @table @option
  8846. @item jl
  8847. @item jr
  8848. @item jt
  8849. @item jb
  8850. These options set the amount of "junk" to ignore at the left, right, top, and
  8851. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8852. while top and bottom are in units of 2 lines.
  8853. The default is 8 pixels on each side.
  8854. @item sb
  8855. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8856. filter generating an occasional mismatched frame, but it may also cause an
  8857. excessive number of frames to be dropped during high motion sequences.
  8858. Conversely, setting it to -1 will make filter match fields more easily.
  8859. This may help processing of video where there is slight blurring between
  8860. the fields, but may also cause there to be interlaced frames in the output.
  8861. Default value is @code{0}.
  8862. @item mp
  8863. Set the metric plane to use. It accepts the following values:
  8864. @table @samp
  8865. @item l
  8866. Use luma plane.
  8867. @item u
  8868. Use chroma blue plane.
  8869. @item v
  8870. Use chroma red plane.
  8871. @end table
  8872. This option may be set to use chroma plane instead of the default luma plane
  8873. for doing filter's computations. This may improve accuracy on very clean
  8874. source material, but more likely will decrease accuracy, especially if there
  8875. is chroma noise (rainbow effect) or any grayscale video.
  8876. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8877. load and make pullup usable in realtime on slow machines.
  8878. @end table
  8879. For best results (without duplicated frames in the output file) it is
  8880. necessary to change the output frame rate. For example, to inverse
  8881. telecine NTSC input:
  8882. @example
  8883. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8884. @end example
  8885. @section qp
  8886. Change video quantization parameters (QP).
  8887. The filter accepts the following option:
  8888. @table @option
  8889. @item qp
  8890. Set expression for quantization parameter.
  8891. @end table
  8892. The expression is evaluated through the eval API and can contain, among others,
  8893. the following constants:
  8894. @table @var
  8895. @item known
  8896. 1 if index is not 129, 0 otherwise.
  8897. @item qp
  8898. Sequentional index starting from -129 to 128.
  8899. @end table
  8900. @subsection Examples
  8901. @itemize
  8902. @item
  8903. Some equation like:
  8904. @example
  8905. qp=2+2*sin(PI*qp)
  8906. @end example
  8907. @end itemize
  8908. @section random
  8909. Flush video frames from internal cache of frames into a random order.
  8910. No frame is discarded.
  8911. Inspired by @ref{frei0r} nervous filter.
  8912. @table @option
  8913. @item frames
  8914. Set size in number of frames of internal cache, in range from @code{2} to
  8915. @code{512}. Default is @code{30}.
  8916. @item seed
  8917. Set seed for random number generator, must be an integer included between
  8918. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8919. less than @code{0}, the filter will try to use a good random seed on a
  8920. best effort basis.
  8921. @end table
  8922. @section readeia608
  8923. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8924. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8925. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8926. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8927. @table @option
  8928. @item lavfi.readeia608.X.cc
  8929. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8930. @item lavfi.readeia608.X.line
  8931. The number of the line on which the EIA-608 data was identified and read.
  8932. @end table
  8933. This filter accepts the following options:
  8934. @table @option
  8935. @item scan_min
  8936. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8937. @item scan_max
  8938. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8939. @item mac
  8940. Set minimal acceptable amplitude change for sync codes detection.
  8941. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8942. @item spw
  8943. Set the ratio of width reserved for sync code detection.
  8944. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8945. @item mhd
  8946. Set the max peaks height difference for sync code detection.
  8947. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8948. @item mpd
  8949. Set max peaks period difference for sync code detection.
  8950. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8951. @item msd
  8952. Set the first two max start code bits differences.
  8953. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8954. @item bhd
  8955. Set the minimum ratio of bits height compared to 3rd start code bit.
  8956. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8957. @item th_w
  8958. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8959. @item th_b
  8960. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8961. @item chp
  8962. Enable checking the parity bit. In the event of a parity error, the filter will output
  8963. @code{0x00} for that character. Default is false.
  8964. @end table
  8965. @subsection Examples
  8966. @itemize
  8967. @item
  8968. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8969. @example
  8970. 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
  8971. @end example
  8972. @end itemize
  8973. @section readvitc
  8974. Read vertical interval timecode (VITC) information from the top lines of a
  8975. video frame.
  8976. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8977. timecode value, if a valid timecode has been detected. Further metadata key
  8978. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8979. timecode data has been found or not.
  8980. This filter accepts the following options:
  8981. @table @option
  8982. @item scan_max
  8983. Set the maximum number of lines to scan for VITC data. If the value is set to
  8984. @code{-1} the full video frame is scanned. Default is @code{45}.
  8985. @item thr_b
  8986. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8987. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8988. @item thr_w
  8989. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8990. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8991. @end table
  8992. @subsection Examples
  8993. @itemize
  8994. @item
  8995. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8996. draw @code{--:--:--:--} as a placeholder:
  8997. @example
  8998. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8999. @end example
  9000. @end itemize
  9001. @section remap
  9002. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9003. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9004. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9005. value for pixel will be used for destination pixel.
  9006. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9007. will have Xmap/Ymap video stream dimensions.
  9008. Xmap and Ymap input video streams are 16bit depth, single channel.
  9009. @section removegrain
  9010. The removegrain filter is a spatial denoiser for progressive video.
  9011. @table @option
  9012. @item m0
  9013. Set mode for the first plane.
  9014. @item m1
  9015. Set mode for the second plane.
  9016. @item m2
  9017. Set mode for the third plane.
  9018. @item m3
  9019. Set mode for the fourth plane.
  9020. @end table
  9021. Range of mode is from 0 to 24. Description of each mode follows:
  9022. @table @var
  9023. @item 0
  9024. Leave input plane unchanged. Default.
  9025. @item 1
  9026. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9027. @item 2
  9028. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9029. @item 3
  9030. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9031. @item 4
  9032. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9033. This is equivalent to a median filter.
  9034. @item 5
  9035. Line-sensitive clipping giving the minimal change.
  9036. @item 6
  9037. Line-sensitive clipping, intermediate.
  9038. @item 7
  9039. Line-sensitive clipping, intermediate.
  9040. @item 8
  9041. Line-sensitive clipping, intermediate.
  9042. @item 9
  9043. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9044. @item 10
  9045. Replaces the target pixel with the closest neighbour.
  9046. @item 11
  9047. [1 2 1] horizontal and vertical kernel blur.
  9048. @item 12
  9049. Same as mode 11.
  9050. @item 13
  9051. Bob mode, interpolates top field from the line where the neighbours
  9052. pixels are the closest.
  9053. @item 14
  9054. Bob mode, interpolates bottom field from the line where the neighbours
  9055. pixels are the closest.
  9056. @item 15
  9057. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9058. interpolation formula.
  9059. @item 16
  9060. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9061. interpolation formula.
  9062. @item 17
  9063. Clips the pixel with the minimum and maximum of respectively the maximum and
  9064. minimum of each pair of opposite neighbour pixels.
  9065. @item 18
  9066. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9067. the current pixel is minimal.
  9068. @item 19
  9069. Replaces the pixel with the average of its 8 neighbours.
  9070. @item 20
  9071. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9072. @item 21
  9073. Clips pixels using the averages of opposite neighbour.
  9074. @item 22
  9075. Same as mode 21 but simpler and faster.
  9076. @item 23
  9077. Small edge and halo removal, but reputed useless.
  9078. @item 24
  9079. Similar as 23.
  9080. @end table
  9081. @section removelogo
  9082. Suppress a TV station logo, using an image file to determine which
  9083. pixels comprise the logo. It works by filling in the pixels that
  9084. comprise the logo with neighboring pixels.
  9085. The filter accepts the following options:
  9086. @table @option
  9087. @item filename, f
  9088. Set the filter bitmap file, which can be any image format supported by
  9089. libavformat. The width and height of the image file must match those of the
  9090. video stream being processed.
  9091. @end table
  9092. Pixels in the provided bitmap image with a value of zero are not
  9093. considered part of the logo, non-zero pixels are considered part of
  9094. the logo. If you use white (255) for the logo and black (0) for the
  9095. rest, you will be safe. For making the filter bitmap, it is
  9096. recommended to take a screen capture of a black frame with the logo
  9097. visible, and then using a threshold filter followed by the erode
  9098. filter once or twice.
  9099. If needed, little splotches can be fixed manually. Remember that if
  9100. logo pixels are not covered, the filter quality will be much
  9101. reduced. Marking too many pixels as part of the logo does not hurt as
  9102. much, but it will increase the amount of blurring needed to cover over
  9103. the image and will destroy more information than necessary, and extra
  9104. pixels will slow things down on a large logo.
  9105. @section repeatfields
  9106. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9107. fields based on its value.
  9108. @section reverse
  9109. Reverse a video clip.
  9110. Warning: This filter requires memory to buffer the entire clip, so trimming
  9111. is suggested.
  9112. @subsection Examples
  9113. @itemize
  9114. @item
  9115. Take the first 5 seconds of a clip, and reverse it.
  9116. @example
  9117. trim=end=5,reverse
  9118. @end example
  9119. @end itemize
  9120. @section rotate
  9121. Rotate video by an arbitrary angle expressed in radians.
  9122. The filter accepts the following options:
  9123. A description of the optional parameters follows.
  9124. @table @option
  9125. @item angle, a
  9126. Set an expression for the angle by which to rotate the input video
  9127. clockwise, expressed as a number of radians. A negative value will
  9128. result in a counter-clockwise rotation. By default it is set to "0".
  9129. This expression is evaluated for each frame.
  9130. @item out_w, ow
  9131. Set the output width expression, default value is "iw".
  9132. This expression is evaluated just once during configuration.
  9133. @item out_h, oh
  9134. Set the output height expression, default value is "ih".
  9135. This expression is evaluated just once during configuration.
  9136. @item bilinear
  9137. Enable bilinear interpolation if set to 1, a value of 0 disables
  9138. it. Default value is 1.
  9139. @item fillcolor, c
  9140. Set the color used to fill the output area not covered by the rotated
  9141. image. For the general syntax of this option, check the "Color" section in the
  9142. ffmpeg-utils manual. If the special value "none" is selected then no
  9143. background is printed (useful for example if the background is never shown).
  9144. Default value is "black".
  9145. @end table
  9146. The expressions for the angle and the output size can contain the
  9147. following constants and functions:
  9148. @table @option
  9149. @item n
  9150. sequential number of the input frame, starting from 0. It is always NAN
  9151. before the first frame is filtered.
  9152. @item t
  9153. time in seconds of the input frame, it is set to 0 when the filter is
  9154. configured. It is always NAN before the first frame is filtered.
  9155. @item hsub
  9156. @item vsub
  9157. horizontal and vertical chroma subsample values. For example for the
  9158. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9159. @item in_w, iw
  9160. @item in_h, ih
  9161. the input video width and height
  9162. @item out_w, ow
  9163. @item out_h, oh
  9164. the output width and height, that is the size of the padded area as
  9165. specified by the @var{width} and @var{height} expressions
  9166. @item rotw(a)
  9167. @item roth(a)
  9168. the minimal width/height required for completely containing the input
  9169. video rotated by @var{a} radians.
  9170. These are only available when computing the @option{out_w} and
  9171. @option{out_h} expressions.
  9172. @end table
  9173. @subsection Examples
  9174. @itemize
  9175. @item
  9176. Rotate the input by PI/6 radians clockwise:
  9177. @example
  9178. rotate=PI/6
  9179. @end example
  9180. @item
  9181. Rotate the input by PI/6 radians counter-clockwise:
  9182. @example
  9183. rotate=-PI/6
  9184. @end example
  9185. @item
  9186. Rotate the input by 45 degrees clockwise:
  9187. @example
  9188. rotate=45*PI/180
  9189. @end example
  9190. @item
  9191. Apply a constant rotation with period T, starting from an angle of PI/3:
  9192. @example
  9193. rotate=PI/3+2*PI*t/T
  9194. @end example
  9195. @item
  9196. Make the input video rotation oscillating with a period of T
  9197. seconds and an amplitude of A radians:
  9198. @example
  9199. rotate=A*sin(2*PI/T*t)
  9200. @end example
  9201. @item
  9202. Rotate the video, output size is chosen so that the whole rotating
  9203. input video is always completely contained in the output:
  9204. @example
  9205. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9206. @end example
  9207. @item
  9208. Rotate the video, reduce the output size so that no background is ever
  9209. shown:
  9210. @example
  9211. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9212. @end example
  9213. @end itemize
  9214. @subsection Commands
  9215. The filter supports the following commands:
  9216. @table @option
  9217. @item a, angle
  9218. Set the angle expression.
  9219. The command accepts the same syntax of the corresponding option.
  9220. If the specified expression is not valid, it is kept at its current
  9221. value.
  9222. @end table
  9223. @section sab
  9224. Apply Shape Adaptive Blur.
  9225. The filter accepts the following options:
  9226. @table @option
  9227. @item luma_radius, lr
  9228. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9229. value is 1.0. A greater value will result in a more blurred image, and
  9230. in slower processing.
  9231. @item luma_pre_filter_radius, lpfr
  9232. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9233. value is 1.0.
  9234. @item luma_strength, ls
  9235. Set luma maximum difference between pixels to still be considered, must
  9236. be a value in the 0.1-100.0 range, default value is 1.0.
  9237. @item chroma_radius, cr
  9238. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9239. greater value will result in a more blurred image, and in slower
  9240. processing.
  9241. @item chroma_pre_filter_radius, cpfr
  9242. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9243. @item chroma_strength, cs
  9244. Set chroma maximum difference between pixels to still be considered,
  9245. must be a value in the -0.9-100.0 range.
  9246. @end table
  9247. Each chroma option value, if not explicitly specified, is set to the
  9248. corresponding luma option value.
  9249. @anchor{scale}
  9250. @section scale
  9251. Scale (resize) the input video, using the libswscale library.
  9252. The scale filter forces the output display aspect ratio to be the same
  9253. of the input, by changing the output sample aspect ratio.
  9254. If the input image format is different from the format requested by
  9255. the next filter, the scale filter will convert the input to the
  9256. requested format.
  9257. @subsection Options
  9258. The filter accepts the following options, or any of the options
  9259. supported by the libswscale scaler.
  9260. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9261. the complete list of scaler options.
  9262. @table @option
  9263. @item width, w
  9264. @item height, h
  9265. Set the output video dimension expression. Default value is the input
  9266. dimension.
  9267. If the value is 0, the input width is used for the output.
  9268. If one of the values is -1, the scale filter will use a value that
  9269. maintains the aspect ratio of the input image, calculated from the
  9270. other specified dimension. If both of them are -1, the input size is
  9271. used
  9272. If one of the values is -n with n > 1, the scale filter will also use a value
  9273. that maintains the aspect ratio of the input image, calculated from the other
  9274. specified dimension. After that it will, however, make sure that the calculated
  9275. dimension is divisible by n and adjust the value if necessary.
  9276. See below for the list of accepted constants for use in the dimension
  9277. expression.
  9278. @item eval
  9279. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9280. @table @samp
  9281. @item init
  9282. Only evaluate expressions once during the filter initialization or when a command is processed.
  9283. @item frame
  9284. Evaluate expressions for each incoming frame.
  9285. @end table
  9286. Default value is @samp{init}.
  9287. @item interl
  9288. Set the interlacing mode. It accepts the following values:
  9289. @table @samp
  9290. @item 1
  9291. Force interlaced aware scaling.
  9292. @item 0
  9293. Do not apply interlaced scaling.
  9294. @item -1
  9295. Select interlaced aware scaling depending on whether the source frames
  9296. are flagged as interlaced or not.
  9297. @end table
  9298. Default value is @samp{0}.
  9299. @item flags
  9300. Set libswscale scaling flags. See
  9301. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9302. complete list of values. If not explicitly specified the filter applies
  9303. the default flags.
  9304. @item param0, param1
  9305. Set libswscale input parameters for scaling algorithms that need them. See
  9306. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9307. complete documentation. If not explicitly specified the filter applies
  9308. empty parameters.
  9309. @item size, s
  9310. Set the video size. For the syntax of this option, check the
  9311. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9312. @item in_color_matrix
  9313. @item out_color_matrix
  9314. Set in/output YCbCr color space type.
  9315. This allows the autodetected value to be overridden as well as allows forcing
  9316. a specific value used for the output and encoder.
  9317. If not specified, the color space type depends on the pixel format.
  9318. Possible values:
  9319. @table @samp
  9320. @item auto
  9321. Choose automatically.
  9322. @item bt709
  9323. Format conforming to International Telecommunication Union (ITU)
  9324. Recommendation BT.709.
  9325. @item fcc
  9326. Set color space conforming to the United States Federal Communications
  9327. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9328. @item bt601
  9329. Set color space conforming to:
  9330. @itemize
  9331. @item
  9332. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9333. @item
  9334. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9335. @item
  9336. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9337. @end itemize
  9338. @item smpte240m
  9339. Set color space conforming to SMPTE ST 240:1999.
  9340. @end table
  9341. @item in_range
  9342. @item out_range
  9343. Set in/output YCbCr sample range.
  9344. This allows the autodetected value to be overridden as well as allows forcing
  9345. a specific value used for the output and encoder. If not specified, the
  9346. range depends on the pixel format. Possible values:
  9347. @table @samp
  9348. @item auto
  9349. Choose automatically.
  9350. @item jpeg/full/pc
  9351. Set full range (0-255 in case of 8-bit luma).
  9352. @item mpeg/tv
  9353. Set "MPEG" range (16-235 in case of 8-bit luma).
  9354. @end table
  9355. @item force_original_aspect_ratio
  9356. Enable decreasing or increasing output video width or height if necessary to
  9357. keep the original aspect ratio. Possible values:
  9358. @table @samp
  9359. @item disable
  9360. Scale the video as specified and disable this feature.
  9361. @item decrease
  9362. The output video dimensions will automatically be decreased if needed.
  9363. @item increase
  9364. The output video dimensions will automatically be increased if needed.
  9365. @end table
  9366. One useful instance of this option is that when you know a specific device's
  9367. maximum allowed resolution, you can use this to limit the output video to
  9368. that, while retaining the aspect ratio. For example, device A allows
  9369. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9370. decrease) and specifying 1280x720 to the command line makes the output
  9371. 1280x533.
  9372. Please note that this is a different thing than specifying -1 for @option{w}
  9373. or @option{h}, you still need to specify the output resolution for this option
  9374. to work.
  9375. @end table
  9376. The values of the @option{w} and @option{h} options are expressions
  9377. containing the following constants:
  9378. @table @var
  9379. @item in_w
  9380. @item in_h
  9381. The input width and height
  9382. @item iw
  9383. @item ih
  9384. These are the same as @var{in_w} and @var{in_h}.
  9385. @item out_w
  9386. @item out_h
  9387. The output (scaled) width and height
  9388. @item ow
  9389. @item oh
  9390. These are the same as @var{out_w} and @var{out_h}
  9391. @item a
  9392. The same as @var{iw} / @var{ih}
  9393. @item sar
  9394. input sample aspect ratio
  9395. @item dar
  9396. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9397. @item hsub
  9398. @item vsub
  9399. horizontal and vertical input chroma subsample values. For example for the
  9400. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9401. @item ohsub
  9402. @item ovsub
  9403. horizontal and vertical output chroma subsample values. For example for the
  9404. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9405. @end table
  9406. @subsection Examples
  9407. @itemize
  9408. @item
  9409. Scale the input video to a size of 200x100
  9410. @example
  9411. scale=w=200:h=100
  9412. @end example
  9413. This is equivalent to:
  9414. @example
  9415. scale=200:100
  9416. @end example
  9417. or:
  9418. @example
  9419. scale=200x100
  9420. @end example
  9421. @item
  9422. Specify a size abbreviation for the output size:
  9423. @example
  9424. scale=qcif
  9425. @end example
  9426. which can also be written as:
  9427. @example
  9428. scale=size=qcif
  9429. @end example
  9430. @item
  9431. Scale the input to 2x:
  9432. @example
  9433. scale=w=2*iw:h=2*ih
  9434. @end example
  9435. @item
  9436. The above is the same as:
  9437. @example
  9438. scale=2*in_w:2*in_h
  9439. @end example
  9440. @item
  9441. Scale the input to 2x with forced interlaced scaling:
  9442. @example
  9443. scale=2*iw:2*ih:interl=1
  9444. @end example
  9445. @item
  9446. Scale the input to half size:
  9447. @example
  9448. scale=w=iw/2:h=ih/2
  9449. @end example
  9450. @item
  9451. Increase the width, and set the height to the same size:
  9452. @example
  9453. scale=3/2*iw:ow
  9454. @end example
  9455. @item
  9456. Seek Greek harmony:
  9457. @example
  9458. scale=iw:1/PHI*iw
  9459. scale=ih*PHI:ih
  9460. @end example
  9461. @item
  9462. Increase the height, and set the width to 3/2 of the height:
  9463. @example
  9464. scale=w=3/2*oh:h=3/5*ih
  9465. @end example
  9466. @item
  9467. Increase the size, making the size a multiple of the chroma
  9468. subsample values:
  9469. @example
  9470. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9471. @end example
  9472. @item
  9473. Increase the width to a maximum of 500 pixels,
  9474. keeping the same aspect ratio as the input:
  9475. @example
  9476. scale=w='min(500\, iw*3/2):h=-1'
  9477. @end example
  9478. @end itemize
  9479. @subsection Commands
  9480. This filter supports the following commands:
  9481. @table @option
  9482. @item width, w
  9483. @item height, h
  9484. Set the output video dimension expression.
  9485. The command accepts the same syntax of the corresponding option.
  9486. If the specified expression is not valid, it is kept at its current
  9487. value.
  9488. @end table
  9489. @section scale_npp
  9490. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9491. format conversion on CUDA video frames. Setting the output width and height
  9492. works in the same way as for the @var{scale} filter.
  9493. The following additional options are accepted:
  9494. @table @option
  9495. @item format
  9496. The pixel format of the output CUDA frames. If set to the string "same" (the
  9497. default), the input format will be kept. Note that automatic format negotiation
  9498. and conversion is not yet supported for hardware frames
  9499. @item interp_algo
  9500. The interpolation algorithm used for resizing. One of the following:
  9501. @table @option
  9502. @item nn
  9503. Nearest neighbour.
  9504. @item linear
  9505. @item cubic
  9506. @item cubic2p_bspline
  9507. 2-parameter cubic (B=1, C=0)
  9508. @item cubic2p_catmullrom
  9509. 2-parameter cubic (B=0, C=1/2)
  9510. @item cubic2p_b05c03
  9511. 2-parameter cubic (B=1/2, C=3/10)
  9512. @item super
  9513. Supersampling
  9514. @item lanczos
  9515. @end table
  9516. @end table
  9517. @section scale2ref
  9518. Scale (resize) the input video, based on a reference video.
  9519. See the scale filter for available options, scale2ref supports the same but
  9520. uses the reference video instead of the main input as basis.
  9521. @subsection Examples
  9522. @itemize
  9523. @item
  9524. Scale a subtitle stream to match the main video in size before overlaying
  9525. @example
  9526. 'scale2ref[b][a];[a][b]overlay'
  9527. @end example
  9528. @end itemize
  9529. @anchor{selectivecolor}
  9530. @section selectivecolor
  9531. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9532. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9533. by the "purity" of the color (that is, how saturated it already is).
  9534. This filter is similar to the Adobe Photoshop Selective Color tool.
  9535. The filter accepts the following options:
  9536. @table @option
  9537. @item correction_method
  9538. Select color correction method.
  9539. Available values are:
  9540. @table @samp
  9541. @item absolute
  9542. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9543. component value).
  9544. @item relative
  9545. Specified adjustments are relative to the original component value.
  9546. @end table
  9547. Default is @code{absolute}.
  9548. @item reds
  9549. Adjustments for red pixels (pixels where the red component is the maximum)
  9550. @item yellows
  9551. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9552. @item greens
  9553. Adjustments for green pixels (pixels where the green component is the maximum)
  9554. @item cyans
  9555. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9556. @item blues
  9557. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9558. @item magentas
  9559. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9560. @item whites
  9561. Adjustments for white pixels (pixels where all components are greater than 128)
  9562. @item neutrals
  9563. Adjustments for all pixels except pure black and pure white
  9564. @item blacks
  9565. Adjustments for black pixels (pixels where all components are lesser than 128)
  9566. @item psfile
  9567. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9568. @end table
  9569. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9570. 4 space separated floating point adjustment values in the [-1,1] range,
  9571. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9572. pixels of its range.
  9573. @subsection Examples
  9574. @itemize
  9575. @item
  9576. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9577. increase magenta by 27% in blue areas:
  9578. @example
  9579. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9580. @end example
  9581. @item
  9582. Use a Photoshop selective color preset:
  9583. @example
  9584. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9585. @end example
  9586. @end itemize
  9587. @anchor{separatefields}
  9588. @section separatefields
  9589. The @code{separatefields} takes a frame-based video input and splits
  9590. each frame into its components fields, producing a new half height clip
  9591. with twice the frame rate and twice the frame count.
  9592. This filter use field-dominance information in frame to decide which
  9593. of each pair of fields to place first in the output.
  9594. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9595. @section setdar, setsar
  9596. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9597. output video.
  9598. This is done by changing the specified Sample (aka Pixel) Aspect
  9599. Ratio, according to the following equation:
  9600. @example
  9601. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9602. @end example
  9603. Keep in mind that the @code{setdar} filter does not modify the pixel
  9604. dimensions of the video frame. Also, the display aspect ratio set by
  9605. this filter may be changed by later filters in the filterchain,
  9606. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9607. applied.
  9608. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9609. the filter output video.
  9610. Note that as a consequence of the application of this filter, the
  9611. output display aspect ratio will change according to the equation
  9612. above.
  9613. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9614. filter may be changed by later filters in the filterchain, e.g. if
  9615. another "setsar" or a "setdar" filter is applied.
  9616. It accepts the following parameters:
  9617. @table @option
  9618. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9619. Set the aspect ratio used by the filter.
  9620. The parameter can be a floating point number string, an expression, or
  9621. a string of the form @var{num}:@var{den}, where @var{num} and
  9622. @var{den} are the numerator and denominator of the aspect ratio. If
  9623. the parameter is not specified, it is assumed the value "0".
  9624. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9625. should be escaped.
  9626. @item max
  9627. Set the maximum integer value to use for expressing numerator and
  9628. denominator when reducing the expressed aspect ratio to a rational.
  9629. Default value is @code{100}.
  9630. @end table
  9631. The parameter @var{sar} is an expression containing
  9632. the following constants:
  9633. @table @option
  9634. @item E, PI, PHI
  9635. These are approximated values for the mathematical constants e
  9636. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9637. @item w, h
  9638. The input width and height.
  9639. @item a
  9640. These are the same as @var{w} / @var{h}.
  9641. @item sar
  9642. The input sample aspect ratio.
  9643. @item dar
  9644. The input display aspect ratio. It is the same as
  9645. (@var{w} / @var{h}) * @var{sar}.
  9646. @item hsub, vsub
  9647. Horizontal and vertical chroma subsample values. For example, for the
  9648. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9649. @end table
  9650. @subsection Examples
  9651. @itemize
  9652. @item
  9653. To change the display aspect ratio to 16:9, specify one of the following:
  9654. @example
  9655. setdar=dar=1.77777
  9656. setdar=dar=16/9
  9657. @end example
  9658. @item
  9659. To change the sample aspect ratio to 10:11, specify:
  9660. @example
  9661. setsar=sar=10/11
  9662. @end example
  9663. @item
  9664. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9665. 1000 in the aspect ratio reduction, use the command:
  9666. @example
  9667. setdar=ratio=16/9:max=1000
  9668. @end example
  9669. @end itemize
  9670. @anchor{setfield}
  9671. @section setfield
  9672. Force field for the output video frame.
  9673. The @code{setfield} filter marks the interlace type field for the
  9674. output frames. It does not change the input frame, but only sets the
  9675. corresponding property, which affects how the frame is treated by
  9676. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9677. The filter accepts the following options:
  9678. @table @option
  9679. @item mode
  9680. Available values are:
  9681. @table @samp
  9682. @item auto
  9683. Keep the same field property.
  9684. @item bff
  9685. Mark the frame as bottom-field-first.
  9686. @item tff
  9687. Mark the frame as top-field-first.
  9688. @item prog
  9689. Mark the frame as progressive.
  9690. @end table
  9691. @end table
  9692. @section showinfo
  9693. Show a line containing various information for each input video frame.
  9694. The input video is not modified.
  9695. The shown line contains a sequence of key/value pairs of the form
  9696. @var{key}:@var{value}.
  9697. The following values are shown in the output:
  9698. @table @option
  9699. @item n
  9700. The (sequential) number of the input frame, starting from 0.
  9701. @item pts
  9702. The Presentation TimeStamp of the input frame, expressed as a number of
  9703. time base units. The time base unit depends on the filter input pad.
  9704. @item pts_time
  9705. The Presentation TimeStamp of the input frame, expressed as a number of
  9706. seconds.
  9707. @item pos
  9708. The position of the frame in the input stream, or -1 if this information is
  9709. unavailable and/or meaningless (for example in case of synthetic video).
  9710. @item fmt
  9711. The pixel format name.
  9712. @item sar
  9713. The sample aspect ratio of the input frame, expressed in the form
  9714. @var{num}/@var{den}.
  9715. @item s
  9716. The size of the input frame. For the syntax of this option, check the
  9717. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9718. @item i
  9719. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9720. for bottom field first).
  9721. @item iskey
  9722. This is 1 if the frame is a key frame, 0 otherwise.
  9723. @item type
  9724. The picture type of the input frame ("I" for an I-frame, "P" for a
  9725. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9726. Also refer to the documentation of the @code{AVPictureType} enum and of
  9727. the @code{av_get_picture_type_char} function defined in
  9728. @file{libavutil/avutil.h}.
  9729. @item checksum
  9730. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9731. @item plane_checksum
  9732. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9733. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9734. @end table
  9735. @section showpalette
  9736. Displays the 256 colors palette of each frame. This filter is only relevant for
  9737. @var{pal8} pixel format frames.
  9738. It accepts the following option:
  9739. @table @option
  9740. @item s
  9741. Set the size of the box used to represent one palette color entry. Default is
  9742. @code{30} (for a @code{30x30} pixel box).
  9743. @end table
  9744. @section shuffleframes
  9745. Reorder and/or duplicate and/or drop video frames.
  9746. It accepts the following parameters:
  9747. @table @option
  9748. @item mapping
  9749. Set the destination indexes of input frames.
  9750. This is space or '|' separated list of indexes that maps input frames to output
  9751. frames. Number of indexes also sets maximal value that each index may have.
  9752. '-1' index have special meaning and that is to drop frame.
  9753. @end table
  9754. The first frame has the index 0. The default is to keep the input unchanged.
  9755. @subsection Examples
  9756. @itemize
  9757. @item
  9758. Swap second and third frame of every three frames of the input:
  9759. @example
  9760. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9761. @end example
  9762. @item
  9763. Swap 10th and 1st frame of every ten frames of the input:
  9764. @example
  9765. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9766. @end example
  9767. @end itemize
  9768. @section shuffleplanes
  9769. Reorder and/or duplicate video planes.
  9770. It accepts the following parameters:
  9771. @table @option
  9772. @item map0
  9773. The index of the input plane to be used as the first output plane.
  9774. @item map1
  9775. The index of the input plane to be used as the second output plane.
  9776. @item map2
  9777. The index of the input plane to be used as the third output plane.
  9778. @item map3
  9779. The index of the input plane to be used as the fourth output plane.
  9780. @end table
  9781. The first plane has the index 0. The default is to keep the input unchanged.
  9782. @subsection Examples
  9783. @itemize
  9784. @item
  9785. Swap the second and third planes of the input:
  9786. @example
  9787. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9788. @end example
  9789. @end itemize
  9790. @anchor{signalstats}
  9791. @section signalstats
  9792. Evaluate various visual metrics that assist in determining issues associated
  9793. with the digitization of analog video media.
  9794. By default the filter will log these metadata values:
  9795. @table @option
  9796. @item YMIN
  9797. Display the minimal Y value contained within the input frame. Expressed in
  9798. range of [0-255].
  9799. @item YLOW
  9800. Display the Y value at the 10% percentile within the input frame. Expressed in
  9801. range of [0-255].
  9802. @item YAVG
  9803. Display the average Y value within the input frame. Expressed in range of
  9804. [0-255].
  9805. @item YHIGH
  9806. Display the Y value at the 90% percentile within the input frame. Expressed in
  9807. range of [0-255].
  9808. @item YMAX
  9809. Display the maximum Y value contained within the input frame. Expressed in
  9810. range of [0-255].
  9811. @item UMIN
  9812. Display the minimal U value contained within the input frame. Expressed in
  9813. range of [0-255].
  9814. @item ULOW
  9815. Display the U value at the 10% percentile within the input frame. Expressed in
  9816. range of [0-255].
  9817. @item UAVG
  9818. Display the average U value within the input frame. Expressed in range of
  9819. [0-255].
  9820. @item UHIGH
  9821. Display the U value at the 90% percentile within the input frame. Expressed in
  9822. range of [0-255].
  9823. @item UMAX
  9824. Display the maximum U value contained within the input frame. Expressed in
  9825. range of [0-255].
  9826. @item VMIN
  9827. Display the minimal V value contained within the input frame. Expressed in
  9828. range of [0-255].
  9829. @item VLOW
  9830. Display the V value at the 10% percentile within the input frame. Expressed in
  9831. range of [0-255].
  9832. @item VAVG
  9833. Display the average V value within the input frame. Expressed in range of
  9834. [0-255].
  9835. @item VHIGH
  9836. Display the V value at the 90% percentile within the input frame. Expressed in
  9837. range of [0-255].
  9838. @item VMAX
  9839. Display the maximum V value contained within the input frame. Expressed in
  9840. range of [0-255].
  9841. @item SATMIN
  9842. Display the minimal saturation value contained within the input frame.
  9843. Expressed in range of [0-~181.02].
  9844. @item SATLOW
  9845. Display the saturation value at the 10% percentile within the input frame.
  9846. Expressed in range of [0-~181.02].
  9847. @item SATAVG
  9848. Display the average saturation value within the input frame. Expressed in range
  9849. of [0-~181.02].
  9850. @item SATHIGH
  9851. Display the saturation value at the 90% percentile within the input frame.
  9852. Expressed in range of [0-~181.02].
  9853. @item SATMAX
  9854. Display the maximum saturation value contained within the input frame.
  9855. Expressed in range of [0-~181.02].
  9856. @item HUEMED
  9857. Display the median value for hue within the input frame. Expressed in range of
  9858. [0-360].
  9859. @item HUEAVG
  9860. Display the average value for hue within the input frame. Expressed in range of
  9861. [0-360].
  9862. @item YDIF
  9863. Display the average of sample value difference between all values of the Y
  9864. plane in the current frame and corresponding values of the previous input frame.
  9865. Expressed in range of [0-255].
  9866. @item UDIF
  9867. Display the average of sample value difference between all values of the U
  9868. plane in the current frame and corresponding values of the previous input frame.
  9869. Expressed in range of [0-255].
  9870. @item VDIF
  9871. Display the average of sample value difference between all values of the V
  9872. plane in the current frame and corresponding values of the previous input frame.
  9873. Expressed in range of [0-255].
  9874. @item YBITDEPTH
  9875. Display bit depth of Y plane in current frame.
  9876. Expressed in range of [0-16].
  9877. @item UBITDEPTH
  9878. Display bit depth of U plane in current frame.
  9879. Expressed in range of [0-16].
  9880. @item VBITDEPTH
  9881. Display bit depth of V plane in current frame.
  9882. Expressed in range of [0-16].
  9883. @end table
  9884. The filter accepts the following options:
  9885. @table @option
  9886. @item stat
  9887. @item out
  9888. @option{stat} specify an additional form of image analysis.
  9889. @option{out} output video with the specified type of pixel highlighted.
  9890. Both options accept the following values:
  9891. @table @samp
  9892. @item tout
  9893. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9894. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9895. include the results of video dropouts, head clogs, or tape tracking issues.
  9896. @item vrep
  9897. Identify @var{vertical line repetition}. Vertical line repetition includes
  9898. similar rows of pixels within a frame. In born-digital video vertical line
  9899. repetition is common, but this pattern is uncommon in video digitized from an
  9900. analog source. When it occurs in video that results from the digitization of an
  9901. analog source it can indicate concealment from a dropout compensator.
  9902. @item brng
  9903. Identify pixels that fall outside of legal broadcast range.
  9904. @end table
  9905. @item color, c
  9906. Set the highlight color for the @option{out} option. The default color is
  9907. yellow.
  9908. @end table
  9909. @subsection Examples
  9910. @itemize
  9911. @item
  9912. Output data of various video metrics:
  9913. @example
  9914. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9915. @end example
  9916. @item
  9917. Output specific data about the minimum and maximum values of the Y plane per frame:
  9918. @example
  9919. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9920. @end example
  9921. @item
  9922. Playback video while highlighting pixels that are outside of broadcast range in red.
  9923. @example
  9924. ffplay example.mov -vf signalstats="out=brng:color=red"
  9925. @end example
  9926. @item
  9927. Playback video with signalstats metadata drawn over the frame.
  9928. @example
  9929. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9930. @end example
  9931. The contents of signalstat_drawtext.txt used in the command are:
  9932. @example
  9933. time %@{pts:hms@}
  9934. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9935. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9936. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9937. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9938. @end example
  9939. @end itemize
  9940. @anchor{signature}
  9941. @section signature
  9942. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  9943. input. In this case the matching between the inputs can be calculated additionally.
  9944. The filter always passes through the first input. The signature of each stream can
  9945. be written into a file.
  9946. It accepts the following options:
  9947. @table @option
  9948. @item detectmode
  9949. Enable or disable the matching process.
  9950. Available values are:
  9951. @table @samp
  9952. @item off
  9953. Disable the calculation of a matching (default).
  9954. @item full
  9955. Calculate the matching for the whole video and output whether the whole video
  9956. matches or only parts.
  9957. @item fast
  9958. Calculate only until a matching is found or the video ends. Should be faster in
  9959. some cases.
  9960. @end table
  9961. @item nb_inputs
  9962. Set the number of inputs. The option value must be a non negative integer.
  9963. Default value is 1.
  9964. @item filename
  9965. Set the path to which the output is written. If there is more than one input,
  9966. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  9967. integer), that will be replaced with the input number. If no filename is
  9968. specified, no output will be written. This is the default.
  9969. @item format
  9970. Choose the output format.
  9971. Available values are:
  9972. @table @samp
  9973. @item binary
  9974. Use the specified binary representation (default).
  9975. @item xml
  9976. Use the specified xml representation.
  9977. @end table
  9978. @item th_d
  9979. Set threshold to detect one word as similar. The option value must be an integer
  9980. greater than zero. The default value is 9000.
  9981. @item th_dc
  9982. Set threshold to detect all words as similar. The option value must be an integer
  9983. greater than zero. The default value is 60000.
  9984. @item th_xh
  9985. Set threshold to detect frames as similar. The option value must be an integer
  9986. greater than zero. The default value is 116.
  9987. @item th_di
  9988. Set the minimum length of a sequence in frames to recognize it as matching
  9989. sequence. The option value must be a non negative integer value.
  9990. The default value is 0.
  9991. @item th_it
  9992. Set the minimum relation, that matching frames to all frames must have.
  9993. The option value must be a double value between 0 and 1. The default value is 0.5.
  9994. @end table
  9995. @subsection Examples
  9996. @itemize
  9997. @item
  9998. To calculate the signature of an input video and store it in signature.bin:
  9999. @example
  10000. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10001. @end example
  10002. @item
  10003. To detect whether two videos match and store the signatures in XML format in
  10004. signature0.xml and signature1.xml:
  10005. @example
  10006. 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 -
  10007. @end example
  10008. @end itemize
  10009. @anchor{smartblur}
  10010. @section smartblur
  10011. Blur the input video without impacting the outlines.
  10012. It accepts the following options:
  10013. @table @option
  10014. @item luma_radius, lr
  10015. Set the luma radius. The option value must be a float number in
  10016. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10017. used to blur the image (slower if larger). Default value is 1.0.
  10018. @item luma_strength, ls
  10019. Set the luma strength. The option value must be a float number
  10020. in the range [-1.0,1.0] that configures the blurring. A value included
  10021. in [0.0,1.0] will blur the image whereas a value included in
  10022. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10023. @item luma_threshold, lt
  10024. Set the luma threshold used as a coefficient to determine
  10025. whether a pixel should be blurred or not. The option value must be an
  10026. integer in the range [-30,30]. A value of 0 will filter all the image,
  10027. a value included in [0,30] will filter flat areas and a value included
  10028. in [-30,0] will filter edges. Default value is 0.
  10029. @item chroma_radius, cr
  10030. Set the chroma radius. The option value must be a float number in
  10031. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10032. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10033. @item chroma_strength, cs
  10034. Set the chroma strength. The option value must be a float number
  10035. in the range [-1.0,1.0] that configures the blurring. A value included
  10036. in [0.0,1.0] will blur the image whereas a value included in
  10037. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10038. @item chroma_threshold, ct
  10039. Set the chroma threshold used as a coefficient to determine
  10040. whether a pixel should be blurred or not. The option value must be an
  10041. integer in the range [-30,30]. A value of 0 will filter all the image,
  10042. a value included in [0,30] will filter flat areas and a value included
  10043. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10044. @end table
  10045. If a chroma option is not explicitly set, the corresponding luma value
  10046. is set.
  10047. @section ssim
  10048. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10049. This filter takes in input two input videos, the first input is
  10050. considered the "main" source and is passed unchanged to the
  10051. output. The second input is used as a "reference" video for computing
  10052. the SSIM.
  10053. Both video inputs must have the same resolution and pixel format for
  10054. this filter to work correctly. Also it assumes that both inputs
  10055. have the same number of frames, which are compared one by one.
  10056. The filter stores the calculated SSIM of each frame.
  10057. The description of the accepted parameters follows.
  10058. @table @option
  10059. @item stats_file, f
  10060. If specified the filter will use the named file to save the SSIM of
  10061. each individual frame. When filename equals "-" the data is sent to
  10062. standard output.
  10063. @end table
  10064. The file printed if @var{stats_file} is selected, contains a sequence of
  10065. key/value pairs of the form @var{key}:@var{value} for each compared
  10066. couple of frames.
  10067. A description of each shown parameter follows:
  10068. @table @option
  10069. @item n
  10070. sequential number of the input frame, starting from 1
  10071. @item Y, U, V, R, G, B
  10072. SSIM of the compared frames for the component specified by the suffix.
  10073. @item All
  10074. SSIM of the compared frames for the whole frame.
  10075. @item dB
  10076. Same as above but in dB representation.
  10077. @end table
  10078. For example:
  10079. @example
  10080. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10081. [main][ref] ssim="stats_file=stats.log" [out]
  10082. @end example
  10083. On this example the input file being processed is compared with the
  10084. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10085. is stored in @file{stats.log}.
  10086. Another example with both psnr and ssim at same time:
  10087. @example
  10088. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10089. @end example
  10090. @section stereo3d
  10091. Convert between different stereoscopic image formats.
  10092. The filters accept the following options:
  10093. @table @option
  10094. @item in
  10095. Set stereoscopic image format of input.
  10096. Available values for input image formats are:
  10097. @table @samp
  10098. @item sbsl
  10099. side by side parallel (left eye left, right eye right)
  10100. @item sbsr
  10101. side by side crosseye (right eye left, left eye right)
  10102. @item sbs2l
  10103. side by side parallel with half width resolution
  10104. (left eye left, right eye right)
  10105. @item sbs2r
  10106. side by side crosseye with half width resolution
  10107. (right eye left, left eye right)
  10108. @item abl
  10109. above-below (left eye above, right eye below)
  10110. @item abr
  10111. above-below (right eye above, left eye below)
  10112. @item ab2l
  10113. above-below with half height resolution
  10114. (left eye above, right eye below)
  10115. @item ab2r
  10116. above-below with half height resolution
  10117. (right eye above, left eye below)
  10118. @item al
  10119. alternating frames (left eye first, right eye second)
  10120. @item ar
  10121. alternating frames (right eye first, left eye second)
  10122. @item irl
  10123. interleaved rows (left eye has top row, right eye starts on next row)
  10124. @item irr
  10125. interleaved rows (right eye has top row, left eye starts on next row)
  10126. @item icl
  10127. interleaved columns, left eye first
  10128. @item icr
  10129. interleaved columns, right eye first
  10130. Default value is @samp{sbsl}.
  10131. @end table
  10132. @item out
  10133. Set stereoscopic image format of output.
  10134. @table @samp
  10135. @item sbsl
  10136. side by side parallel (left eye left, right eye right)
  10137. @item sbsr
  10138. side by side crosseye (right eye left, left eye right)
  10139. @item sbs2l
  10140. side by side parallel with half width resolution
  10141. (left eye left, right eye right)
  10142. @item sbs2r
  10143. side by side crosseye with half width resolution
  10144. (right eye left, left eye right)
  10145. @item abl
  10146. above-below (left eye above, right eye below)
  10147. @item abr
  10148. above-below (right eye above, left eye below)
  10149. @item ab2l
  10150. above-below with half height resolution
  10151. (left eye above, right eye below)
  10152. @item ab2r
  10153. above-below with half height resolution
  10154. (right eye above, left eye below)
  10155. @item al
  10156. alternating frames (left eye first, right eye second)
  10157. @item ar
  10158. alternating frames (right eye first, left eye second)
  10159. @item irl
  10160. interleaved rows (left eye has top row, right eye starts on next row)
  10161. @item irr
  10162. interleaved rows (right eye has top row, left eye starts on next row)
  10163. @item arbg
  10164. anaglyph red/blue gray
  10165. (red filter on left eye, blue filter on right eye)
  10166. @item argg
  10167. anaglyph red/green gray
  10168. (red filter on left eye, green filter on right eye)
  10169. @item arcg
  10170. anaglyph red/cyan gray
  10171. (red filter on left eye, cyan filter on right eye)
  10172. @item arch
  10173. anaglyph red/cyan half colored
  10174. (red filter on left eye, cyan filter on right eye)
  10175. @item arcc
  10176. anaglyph red/cyan color
  10177. (red filter on left eye, cyan filter on right eye)
  10178. @item arcd
  10179. anaglyph red/cyan color optimized with the least squares projection of dubois
  10180. (red filter on left eye, cyan filter on right eye)
  10181. @item agmg
  10182. anaglyph green/magenta gray
  10183. (green filter on left eye, magenta filter on right eye)
  10184. @item agmh
  10185. anaglyph green/magenta half colored
  10186. (green filter on left eye, magenta filter on right eye)
  10187. @item agmc
  10188. anaglyph green/magenta colored
  10189. (green filter on left eye, magenta filter on right eye)
  10190. @item agmd
  10191. anaglyph green/magenta color optimized with the least squares projection of dubois
  10192. (green filter on left eye, magenta filter on right eye)
  10193. @item aybg
  10194. anaglyph yellow/blue gray
  10195. (yellow filter on left eye, blue filter on right eye)
  10196. @item aybh
  10197. anaglyph yellow/blue half colored
  10198. (yellow filter on left eye, blue filter on right eye)
  10199. @item aybc
  10200. anaglyph yellow/blue colored
  10201. (yellow filter on left eye, blue filter on right eye)
  10202. @item aybd
  10203. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10204. (yellow filter on left eye, blue filter on right eye)
  10205. @item ml
  10206. mono output (left eye only)
  10207. @item mr
  10208. mono output (right eye only)
  10209. @item chl
  10210. checkerboard, left eye first
  10211. @item chr
  10212. checkerboard, right eye first
  10213. @item icl
  10214. interleaved columns, left eye first
  10215. @item icr
  10216. interleaved columns, right eye first
  10217. @item hdmi
  10218. HDMI frame pack
  10219. @end table
  10220. Default value is @samp{arcd}.
  10221. @end table
  10222. @subsection Examples
  10223. @itemize
  10224. @item
  10225. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10226. @example
  10227. stereo3d=sbsl:aybd
  10228. @end example
  10229. @item
  10230. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10231. @example
  10232. stereo3d=abl:sbsr
  10233. @end example
  10234. @end itemize
  10235. @section streamselect, astreamselect
  10236. Select video or audio streams.
  10237. The filter accepts the following options:
  10238. @table @option
  10239. @item inputs
  10240. Set number of inputs. Default is 2.
  10241. @item map
  10242. Set input indexes to remap to outputs.
  10243. @end table
  10244. @subsection Commands
  10245. The @code{streamselect} and @code{astreamselect} filter supports the following
  10246. commands:
  10247. @table @option
  10248. @item map
  10249. Set input indexes to remap to outputs.
  10250. @end table
  10251. @subsection Examples
  10252. @itemize
  10253. @item
  10254. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10255. @example
  10256. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10257. @end example
  10258. @item
  10259. Same as above, but for audio:
  10260. @example
  10261. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10262. @end example
  10263. @end itemize
  10264. @section sobel
  10265. Apply sobel operator to input video stream.
  10266. The filter accepts the following option:
  10267. @table @option
  10268. @item planes
  10269. Set which planes will be processed, unprocessed planes will be copied.
  10270. By default value 0xf, all planes will be processed.
  10271. @item scale
  10272. Set value which will be multiplied with filtered result.
  10273. @item delta
  10274. Set value which will be added to filtered result.
  10275. @end table
  10276. @anchor{spp}
  10277. @section spp
  10278. Apply a simple postprocessing filter that compresses and decompresses the image
  10279. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10280. and average the results.
  10281. The filter accepts the following options:
  10282. @table @option
  10283. @item quality
  10284. Set quality. This option defines the number of levels for averaging. It accepts
  10285. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10286. effect. A value of @code{6} means the higher quality. For each increment of
  10287. that value the speed drops by a factor of approximately 2. Default value is
  10288. @code{3}.
  10289. @item qp
  10290. Force a constant quantization parameter. If not set, the filter will use the QP
  10291. from the video stream (if available).
  10292. @item mode
  10293. Set thresholding mode. Available modes are:
  10294. @table @samp
  10295. @item hard
  10296. Set hard thresholding (default).
  10297. @item soft
  10298. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10299. @end table
  10300. @item use_bframe_qp
  10301. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10302. option may cause flicker since the B-Frames have often larger QP. Default is
  10303. @code{0} (not enabled).
  10304. @end table
  10305. @anchor{subtitles}
  10306. @section subtitles
  10307. Draw subtitles on top of input video using the libass library.
  10308. To enable compilation of this filter you need to configure FFmpeg with
  10309. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10310. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10311. Alpha) subtitles format.
  10312. The filter accepts the following options:
  10313. @table @option
  10314. @item filename, f
  10315. Set the filename of the subtitle file to read. It must be specified.
  10316. @item original_size
  10317. Specify the size of the original video, the video for which the ASS file
  10318. was composed. For the syntax of this option, check the
  10319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10320. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10321. correctly scale the fonts if the aspect ratio has been changed.
  10322. @item fontsdir
  10323. Set a directory path containing fonts that can be used by the filter.
  10324. These fonts will be used in addition to whatever the font provider uses.
  10325. @item charenc
  10326. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10327. useful if not UTF-8.
  10328. @item stream_index, si
  10329. Set subtitles stream index. @code{subtitles} filter only.
  10330. @item force_style
  10331. Override default style or script info parameters of the subtitles. It accepts a
  10332. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10333. @end table
  10334. If the first key is not specified, it is assumed that the first value
  10335. specifies the @option{filename}.
  10336. For example, to render the file @file{sub.srt} on top of the input
  10337. video, use the command:
  10338. @example
  10339. subtitles=sub.srt
  10340. @end example
  10341. which is equivalent to:
  10342. @example
  10343. subtitles=filename=sub.srt
  10344. @end example
  10345. To render the default subtitles stream from file @file{video.mkv}, use:
  10346. @example
  10347. subtitles=video.mkv
  10348. @end example
  10349. To render the second subtitles stream from that file, use:
  10350. @example
  10351. subtitles=video.mkv:si=1
  10352. @end example
  10353. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10354. @code{DejaVu Serif}, use:
  10355. @example
  10356. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10357. @end example
  10358. @section super2xsai
  10359. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10360. Interpolate) pixel art scaling algorithm.
  10361. Useful for enlarging pixel art images without reducing sharpness.
  10362. @section swaprect
  10363. Swap two rectangular objects in video.
  10364. This filter accepts the following options:
  10365. @table @option
  10366. @item w
  10367. Set object width.
  10368. @item h
  10369. Set object height.
  10370. @item x1
  10371. Set 1st rect x coordinate.
  10372. @item y1
  10373. Set 1st rect y coordinate.
  10374. @item x2
  10375. Set 2nd rect x coordinate.
  10376. @item y2
  10377. Set 2nd rect y coordinate.
  10378. All expressions are evaluated once for each frame.
  10379. @end table
  10380. The all options are expressions containing the following constants:
  10381. @table @option
  10382. @item w
  10383. @item h
  10384. The input width and height.
  10385. @item a
  10386. same as @var{w} / @var{h}
  10387. @item sar
  10388. input sample aspect ratio
  10389. @item dar
  10390. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10391. @item n
  10392. The number of the input frame, starting from 0.
  10393. @item t
  10394. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10395. @item pos
  10396. the position in the file of the input frame, NAN if unknown
  10397. @end table
  10398. @section swapuv
  10399. Swap U & V plane.
  10400. @section telecine
  10401. Apply telecine process to the video.
  10402. This filter accepts the following options:
  10403. @table @option
  10404. @item first_field
  10405. @table @samp
  10406. @item top, t
  10407. top field first
  10408. @item bottom, b
  10409. bottom field first
  10410. The default value is @code{top}.
  10411. @end table
  10412. @item pattern
  10413. A string of numbers representing the pulldown pattern you wish to apply.
  10414. The default value is @code{23}.
  10415. @end table
  10416. @example
  10417. Some typical patterns:
  10418. NTSC output (30i):
  10419. 27.5p: 32222
  10420. 24p: 23 (classic)
  10421. 24p: 2332 (preferred)
  10422. 20p: 33
  10423. 18p: 334
  10424. 16p: 3444
  10425. PAL output (25i):
  10426. 27.5p: 12222
  10427. 24p: 222222222223 ("Euro pulldown")
  10428. 16.67p: 33
  10429. 16p: 33333334
  10430. @end example
  10431. @section threshold
  10432. Apply threshold effect to video stream.
  10433. This filter needs four video streams to perform thresholding.
  10434. First stream is stream we are filtering.
  10435. Second stream is holding threshold values, third stream is holding min values,
  10436. and last, fourth stream is holding max values.
  10437. The filter accepts the following option:
  10438. @table @option
  10439. @item planes
  10440. Set which planes will be processed, unprocessed planes will be copied.
  10441. By default value 0xf, all planes will be processed.
  10442. @end table
  10443. For example if first stream pixel's component value is less then threshold value
  10444. of pixel component from 2nd threshold stream, third stream value will picked,
  10445. otherwise fourth stream pixel component value will be picked.
  10446. Using color source filter one can perform various types of thresholding:
  10447. @subsection Examples
  10448. @itemize
  10449. @item
  10450. Binary threshold, using gray color as threshold:
  10451. @example
  10452. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10453. @end example
  10454. @item
  10455. Inverted binary threshold, using gray color as threshold:
  10456. @example
  10457. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10458. @end example
  10459. @item
  10460. Truncate binary threshold, using gray color as threshold:
  10461. @example
  10462. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10463. @end example
  10464. @item
  10465. Threshold to zero, using gray color as threshold:
  10466. @example
  10467. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10468. @end example
  10469. @item
  10470. Inverted threshold to zero, using gray color as threshold:
  10471. @example
  10472. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10473. @end example
  10474. @end itemize
  10475. @section thumbnail
  10476. Select the most representative frame in a given sequence of consecutive frames.
  10477. The filter accepts the following options:
  10478. @table @option
  10479. @item n
  10480. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10481. will pick one of them, and then handle the next batch of @var{n} frames until
  10482. the end. Default is @code{100}.
  10483. @end table
  10484. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10485. value will result in a higher memory usage, so a high value is not recommended.
  10486. @subsection Examples
  10487. @itemize
  10488. @item
  10489. Extract one picture each 50 frames:
  10490. @example
  10491. thumbnail=50
  10492. @end example
  10493. @item
  10494. Complete example of a thumbnail creation with @command{ffmpeg}:
  10495. @example
  10496. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10497. @end example
  10498. @end itemize
  10499. @section tile
  10500. Tile several successive frames together.
  10501. The filter accepts the following options:
  10502. @table @option
  10503. @item layout
  10504. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10505. this option, check the
  10506. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10507. @item nb_frames
  10508. Set the maximum number of frames to render in the given area. It must be less
  10509. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10510. the area will be used.
  10511. @item margin
  10512. Set the outer border margin in pixels.
  10513. @item padding
  10514. Set the inner border thickness (i.e. the number of pixels between frames). For
  10515. more advanced padding options (such as having different values for the edges),
  10516. refer to the pad video filter.
  10517. @item color
  10518. Specify the color of the unused area. For the syntax of this option, check the
  10519. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10520. is "black".
  10521. @end table
  10522. @subsection Examples
  10523. @itemize
  10524. @item
  10525. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10526. @example
  10527. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10528. @end example
  10529. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10530. duplicating each output frame to accommodate the originally detected frame
  10531. rate.
  10532. @item
  10533. Display @code{5} pictures in an area of @code{3x2} frames,
  10534. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10535. mixed flat and named options:
  10536. @example
  10537. tile=3x2:nb_frames=5:padding=7:margin=2
  10538. @end example
  10539. @end itemize
  10540. @section tinterlace
  10541. Perform various types of temporal field interlacing.
  10542. Frames are counted starting from 1, so the first input frame is
  10543. considered odd.
  10544. The filter accepts the following options:
  10545. @table @option
  10546. @item mode
  10547. Specify the mode of the interlacing. This option can also be specified
  10548. as a value alone. See below for a list of values for this option.
  10549. Available values are:
  10550. @table @samp
  10551. @item merge, 0
  10552. Move odd frames into the upper field, even into the lower field,
  10553. generating a double height frame at half frame rate.
  10554. @example
  10555. ------> time
  10556. Input:
  10557. Frame 1 Frame 2 Frame 3 Frame 4
  10558. 11111 22222 33333 44444
  10559. 11111 22222 33333 44444
  10560. 11111 22222 33333 44444
  10561. 11111 22222 33333 44444
  10562. Output:
  10563. 11111 33333
  10564. 22222 44444
  10565. 11111 33333
  10566. 22222 44444
  10567. 11111 33333
  10568. 22222 44444
  10569. 11111 33333
  10570. 22222 44444
  10571. @end example
  10572. @item drop_even, 1
  10573. Only output odd frames, even frames are dropped, generating a frame with
  10574. unchanged height at half frame rate.
  10575. @example
  10576. ------> time
  10577. Input:
  10578. Frame 1 Frame 2 Frame 3 Frame 4
  10579. 11111 22222 33333 44444
  10580. 11111 22222 33333 44444
  10581. 11111 22222 33333 44444
  10582. 11111 22222 33333 44444
  10583. Output:
  10584. 11111 33333
  10585. 11111 33333
  10586. 11111 33333
  10587. 11111 33333
  10588. @end example
  10589. @item drop_odd, 2
  10590. Only output even frames, odd frames are dropped, generating a frame with
  10591. unchanged height at half frame rate.
  10592. @example
  10593. ------> time
  10594. Input:
  10595. Frame 1 Frame 2 Frame 3 Frame 4
  10596. 11111 22222 33333 44444
  10597. 11111 22222 33333 44444
  10598. 11111 22222 33333 44444
  10599. 11111 22222 33333 44444
  10600. Output:
  10601. 22222 44444
  10602. 22222 44444
  10603. 22222 44444
  10604. 22222 44444
  10605. @end example
  10606. @item pad, 3
  10607. Expand each frame to full height, but pad alternate lines with black,
  10608. generating a frame with double height at the same input frame rate.
  10609. @example
  10610. ------> time
  10611. Input:
  10612. Frame 1 Frame 2 Frame 3 Frame 4
  10613. 11111 22222 33333 44444
  10614. 11111 22222 33333 44444
  10615. 11111 22222 33333 44444
  10616. 11111 22222 33333 44444
  10617. Output:
  10618. 11111 ..... 33333 .....
  10619. ..... 22222 ..... 44444
  10620. 11111 ..... 33333 .....
  10621. ..... 22222 ..... 44444
  10622. 11111 ..... 33333 .....
  10623. ..... 22222 ..... 44444
  10624. 11111 ..... 33333 .....
  10625. ..... 22222 ..... 44444
  10626. @end example
  10627. @item interleave_top, 4
  10628. Interleave the upper field from odd frames with the lower field from
  10629. even frames, generating a frame with unchanged height at half frame rate.
  10630. @example
  10631. ------> time
  10632. Input:
  10633. Frame 1 Frame 2 Frame 3 Frame 4
  10634. 11111<- 22222 33333<- 44444
  10635. 11111 22222<- 33333 44444<-
  10636. 11111<- 22222 33333<- 44444
  10637. 11111 22222<- 33333 44444<-
  10638. Output:
  10639. 11111 33333
  10640. 22222 44444
  10641. 11111 33333
  10642. 22222 44444
  10643. @end example
  10644. @item interleave_bottom, 5
  10645. Interleave the lower field from odd frames with the upper field from
  10646. even frames, generating a frame with unchanged height at half frame rate.
  10647. @example
  10648. ------> time
  10649. Input:
  10650. Frame 1 Frame 2 Frame 3 Frame 4
  10651. 11111 22222<- 33333 44444<-
  10652. 11111<- 22222 33333<- 44444
  10653. 11111 22222<- 33333 44444<-
  10654. 11111<- 22222 33333<- 44444
  10655. Output:
  10656. 22222 44444
  10657. 11111 33333
  10658. 22222 44444
  10659. 11111 33333
  10660. @end example
  10661. @item interlacex2, 6
  10662. Double frame rate with unchanged height. Frames are inserted each
  10663. containing the second temporal field from the previous input frame and
  10664. the first temporal field from the next input frame. This mode relies on
  10665. the top_field_first flag. Useful for interlaced video displays with no
  10666. field synchronisation.
  10667. @example
  10668. ------> time
  10669. Input:
  10670. Frame 1 Frame 2 Frame 3 Frame 4
  10671. 11111 22222 33333 44444
  10672. 11111 22222 33333 44444
  10673. 11111 22222 33333 44444
  10674. 11111 22222 33333 44444
  10675. Output:
  10676. 11111 22222 22222 33333 33333 44444 44444
  10677. 11111 11111 22222 22222 33333 33333 44444
  10678. 11111 22222 22222 33333 33333 44444 44444
  10679. 11111 11111 22222 22222 33333 33333 44444
  10680. @end example
  10681. @item mergex2, 7
  10682. Move odd frames into the upper field, even into the lower field,
  10683. generating a double height frame at same frame rate.
  10684. @example
  10685. ------> time
  10686. Input:
  10687. Frame 1 Frame 2 Frame 3 Frame 4
  10688. 11111 22222 33333 44444
  10689. 11111 22222 33333 44444
  10690. 11111 22222 33333 44444
  10691. 11111 22222 33333 44444
  10692. Output:
  10693. 11111 33333 33333 55555
  10694. 22222 22222 44444 44444
  10695. 11111 33333 33333 55555
  10696. 22222 22222 44444 44444
  10697. 11111 33333 33333 55555
  10698. 22222 22222 44444 44444
  10699. 11111 33333 33333 55555
  10700. 22222 22222 44444 44444
  10701. @end example
  10702. @end table
  10703. Numeric values are deprecated but are accepted for backward
  10704. compatibility reasons.
  10705. Default mode is @code{merge}.
  10706. @item flags
  10707. Specify flags influencing the filter process.
  10708. Available value for @var{flags} is:
  10709. @table @option
  10710. @item low_pass_filter, vlfp
  10711. Enable linear vertical low-pass filtering in the filter.
  10712. Vertical low-pass filtering is required when creating an interlaced
  10713. destination from a progressive source which contains high-frequency
  10714. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10715. patterning.
  10716. @item complex_filter, cvlfp
  10717. Enable complex vertical low-pass filtering.
  10718. This will slightly less reduce interlace 'twitter' and Moire
  10719. patterning but better retain detail and subjective sharpness impression.
  10720. @end table
  10721. Vertical low-pass filtering can only be enabled for @option{mode}
  10722. @var{interleave_top} and @var{interleave_bottom}.
  10723. @end table
  10724. @section transpose
  10725. Transpose rows with columns in the input video and optionally flip it.
  10726. It accepts the following parameters:
  10727. @table @option
  10728. @item dir
  10729. Specify the transposition direction.
  10730. Can assume the following values:
  10731. @table @samp
  10732. @item 0, 4, cclock_flip
  10733. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10734. @example
  10735. L.R L.l
  10736. . . -> . .
  10737. l.r R.r
  10738. @end example
  10739. @item 1, 5, clock
  10740. Rotate by 90 degrees clockwise, that is:
  10741. @example
  10742. L.R l.L
  10743. . . -> . .
  10744. l.r r.R
  10745. @end example
  10746. @item 2, 6, cclock
  10747. Rotate by 90 degrees counterclockwise, that is:
  10748. @example
  10749. L.R R.r
  10750. . . -> . .
  10751. l.r L.l
  10752. @end example
  10753. @item 3, 7, clock_flip
  10754. Rotate by 90 degrees clockwise and vertically flip, that is:
  10755. @example
  10756. L.R r.R
  10757. . . -> . .
  10758. l.r l.L
  10759. @end example
  10760. @end table
  10761. For values between 4-7, the transposition is only done if the input
  10762. video geometry is portrait and not landscape. These values are
  10763. deprecated, the @code{passthrough} option should be used instead.
  10764. Numerical values are deprecated, and should be dropped in favor of
  10765. symbolic constants.
  10766. @item passthrough
  10767. Do not apply the transposition if the input geometry matches the one
  10768. specified by the specified value. It accepts the following values:
  10769. @table @samp
  10770. @item none
  10771. Always apply transposition.
  10772. @item portrait
  10773. Preserve portrait geometry (when @var{height} >= @var{width}).
  10774. @item landscape
  10775. Preserve landscape geometry (when @var{width} >= @var{height}).
  10776. @end table
  10777. Default value is @code{none}.
  10778. @end table
  10779. For example to rotate by 90 degrees clockwise and preserve portrait
  10780. layout:
  10781. @example
  10782. transpose=dir=1:passthrough=portrait
  10783. @end example
  10784. The command above can also be specified as:
  10785. @example
  10786. transpose=1:portrait
  10787. @end example
  10788. @section trim
  10789. Trim the input so that the output contains one continuous subpart of the input.
  10790. It accepts the following parameters:
  10791. @table @option
  10792. @item start
  10793. Specify the time of the start of the kept section, i.e. the frame with the
  10794. timestamp @var{start} will be the first frame in the output.
  10795. @item end
  10796. Specify the time of the first frame that will be dropped, i.e. the frame
  10797. immediately preceding the one with the timestamp @var{end} will be the last
  10798. frame in the output.
  10799. @item start_pts
  10800. This is the same as @var{start}, except this option sets the start timestamp
  10801. in timebase units instead of seconds.
  10802. @item end_pts
  10803. This is the same as @var{end}, except this option sets the end timestamp
  10804. in timebase units instead of seconds.
  10805. @item duration
  10806. The maximum duration of the output in seconds.
  10807. @item start_frame
  10808. The number of the first frame that should be passed to the output.
  10809. @item end_frame
  10810. The number of the first frame that should be dropped.
  10811. @end table
  10812. @option{start}, @option{end}, and @option{duration} are expressed as time
  10813. duration specifications; see
  10814. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10815. for the accepted syntax.
  10816. Note that the first two sets of the start/end options and the @option{duration}
  10817. option look at the frame timestamp, while the _frame variants simply count the
  10818. frames that pass through the filter. Also note that this filter does not modify
  10819. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10820. setpts filter after the trim filter.
  10821. If multiple start or end options are set, this filter tries to be greedy and
  10822. keep all the frames that match at least one of the specified constraints. To keep
  10823. only the part that matches all the constraints at once, chain multiple trim
  10824. filters.
  10825. The defaults are such that all the input is kept. So it is possible to set e.g.
  10826. just the end values to keep everything before the specified time.
  10827. Examples:
  10828. @itemize
  10829. @item
  10830. Drop everything except the second minute of input:
  10831. @example
  10832. ffmpeg -i INPUT -vf trim=60:120
  10833. @end example
  10834. @item
  10835. Keep only the first second:
  10836. @example
  10837. ffmpeg -i INPUT -vf trim=duration=1
  10838. @end example
  10839. @end itemize
  10840. @anchor{unsharp}
  10841. @section unsharp
  10842. Sharpen or blur the input video.
  10843. It accepts the following parameters:
  10844. @table @option
  10845. @item luma_msize_x, lx
  10846. Set the luma matrix horizontal size. It must be an odd integer between
  10847. 3 and 23. The default value is 5.
  10848. @item luma_msize_y, ly
  10849. Set the luma matrix vertical size. It must be an odd integer between 3
  10850. and 23. The default value is 5.
  10851. @item luma_amount, la
  10852. Set the luma effect strength. It must be a floating point number, reasonable
  10853. values lay between -1.5 and 1.5.
  10854. Negative values will blur the input video, while positive values will
  10855. sharpen it, a value of zero will disable the effect.
  10856. Default value is 1.0.
  10857. @item chroma_msize_x, cx
  10858. Set the chroma matrix horizontal size. It must be an odd integer
  10859. between 3 and 23. The default value is 5.
  10860. @item chroma_msize_y, cy
  10861. Set the chroma matrix vertical size. It must be an odd integer
  10862. between 3 and 23. The default value is 5.
  10863. @item chroma_amount, ca
  10864. Set the chroma effect strength. It must be a floating point number, reasonable
  10865. values lay between -1.5 and 1.5.
  10866. Negative values will blur the input video, while positive values will
  10867. sharpen it, a value of zero will disable the effect.
  10868. Default value is 0.0.
  10869. @item opencl
  10870. If set to 1, specify using OpenCL capabilities, only available if
  10871. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10872. @end table
  10873. All parameters are optional and default to the equivalent of the
  10874. string '5:5:1.0:5:5:0.0'.
  10875. @subsection Examples
  10876. @itemize
  10877. @item
  10878. Apply strong luma sharpen effect:
  10879. @example
  10880. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10881. @end example
  10882. @item
  10883. Apply a strong blur of both luma and chroma parameters:
  10884. @example
  10885. unsharp=7:7:-2:7:7:-2
  10886. @end example
  10887. @end itemize
  10888. @section uspp
  10889. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10890. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10891. shifts and average the results.
  10892. The way this differs from the behavior of spp is that uspp actually encodes &
  10893. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10894. DCT similar to MJPEG.
  10895. The filter accepts the following options:
  10896. @table @option
  10897. @item quality
  10898. Set quality. This option defines the number of levels for averaging. It accepts
  10899. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10900. effect. A value of @code{8} means the higher quality. For each increment of
  10901. that value the speed drops by a factor of approximately 2. Default value is
  10902. @code{3}.
  10903. @item qp
  10904. Force a constant quantization parameter. If not set, the filter will use the QP
  10905. from the video stream (if available).
  10906. @end table
  10907. @section vaguedenoiser
  10908. Apply a wavelet based denoiser.
  10909. It transforms each frame from the video input into the wavelet domain,
  10910. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10911. the obtained coefficients. It does an inverse wavelet transform after.
  10912. Due to wavelet properties, it should give a nice smoothed result, and
  10913. reduced noise, without blurring picture features.
  10914. This filter accepts the following options:
  10915. @table @option
  10916. @item threshold
  10917. The filtering strength. The higher, the more filtered the video will be.
  10918. Hard thresholding can use a higher threshold than soft thresholding
  10919. before the video looks overfiltered.
  10920. @item method
  10921. The filtering method the filter will use.
  10922. It accepts the following values:
  10923. @table @samp
  10924. @item hard
  10925. All values under the threshold will be zeroed.
  10926. @item soft
  10927. All values under the threshold will be zeroed. All values above will be
  10928. reduced by the threshold.
  10929. @item garrote
  10930. Scales or nullifies coefficients - intermediary between (more) soft and
  10931. (less) hard thresholding.
  10932. @end table
  10933. @item nsteps
  10934. Number of times, the wavelet will decompose the picture. Picture can't
  10935. be decomposed beyond a particular point (typically, 8 for a 640x480
  10936. frame - as 2^9 = 512 > 480)
  10937. @item percent
  10938. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10939. @item planes
  10940. A list of the planes to process. By default all planes are processed.
  10941. @end table
  10942. @section vectorscope
  10943. Display 2 color component values in the two dimensional graph (which is called
  10944. a vectorscope).
  10945. This filter accepts the following options:
  10946. @table @option
  10947. @item mode, m
  10948. Set vectorscope mode.
  10949. It accepts the following values:
  10950. @table @samp
  10951. @item gray
  10952. Gray values are displayed on graph, higher brightness means more pixels have
  10953. same component color value on location in graph. This is the default mode.
  10954. @item color
  10955. Gray values are displayed on graph. Surrounding pixels values which are not
  10956. present in video frame are drawn in gradient of 2 color components which are
  10957. set by option @code{x} and @code{y}. The 3rd color component is static.
  10958. @item color2
  10959. Actual color components values present in video frame are displayed on graph.
  10960. @item color3
  10961. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10962. on graph increases value of another color component, which is luminance by
  10963. default values of @code{x} and @code{y}.
  10964. @item color4
  10965. Actual colors present in video frame are displayed on graph. If two different
  10966. colors map to same position on graph then color with higher value of component
  10967. not present in graph is picked.
  10968. @item color5
  10969. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10970. component picked from radial gradient.
  10971. @end table
  10972. @item x
  10973. Set which color component will be represented on X-axis. Default is @code{1}.
  10974. @item y
  10975. Set which color component will be represented on Y-axis. Default is @code{2}.
  10976. @item intensity, i
  10977. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10978. of color component which represents frequency of (X, Y) location in graph.
  10979. @item envelope, e
  10980. @table @samp
  10981. @item none
  10982. No envelope, this is default.
  10983. @item instant
  10984. Instant envelope, even darkest single pixel will be clearly highlighted.
  10985. @item peak
  10986. Hold maximum and minimum values presented in graph over time. This way you
  10987. can still spot out of range values without constantly looking at vectorscope.
  10988. @item peak+instant
  10989. Peak and instant envelope combined together.
  10990. @end table
  10991. @item graticule, g
  10992. Set what kind of graticule to draw.
  10993. @table @samp
  10994. @item none
  10995. @item green
  10996. @item color
  10997. @end table
  10998. @item opacity, o
  10999. Set graticule opacity.
  11000. @item flags, f
  11001. Set graticule flags.
  11002. @table @samp
  11003. @item white
  11004. Draw graticule for white point.
  11005. @item black
  11006. Draw graticule for black point.
  11007. @item name
  11008. Draw color points short names.
  11009. @end table
  11010. @item bgopacity, b
  11011. Set background opacity.
  11012. @item lthreshold, l
  11013. Set low threshold for color component not represented on X or Y axis.
  11014. Values lower than this value will be ignored. Default is 0.
  11015. Note this value is multiplied with actual max possible value one pixel component
  11016. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11017. is 0.1 * 255 = 25.
  11018. @item hthreshold, h
  11019. Set high threshold for color component not represented on X or Y axis.
  11020. Values higher than this value will be ignored. Default is 1.
  11021. Note this value is multiplied with actual max possible value one pixel component
  11022. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11023. is 0.9 * 255 = 230.
  11024. @item colorspace, c
  11025. Set what kind of colorspace to use when drawing graticule.
  11026. @table @samp
  11027. @item auto
  11028. @item 601
  11029. @item 709
  11030. @end table
  11031. Default is auto.
  11032. @end table
  11033. @anchor{vidstabdetect}
  11034. @section vidstabdetect
  11035. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11036. @ref{vidstabtransform} for pass 2.
  11037. This filter generates a file with relative translation and rotation
  11038. transform information about subsequent frames, which is then used by
  11039. the @ref{vidstabtransform} filter.
  11040. To enable compilation of this filter you need to configure FFmpeg with
  11041. @code{--enable-libvidstab}.
  11042. This filter accepts the following options:
  11043. @table @option
  11044. @item result
  11045. Set the path to the file used to write the transforms information.
  11046. Default value is @file{transforms.trf}.
  11047. @item shakiness
  11048. Set how shaky the video is and how quick the camera is. It accepts an
  11049. integer in the range 1-10, a value of 1 means little shakiness, a
  11050. value of 10 means strong shakiness. Default value is 5.
  11051. @item accuracy
  11052. Set the accuracy of the detection process. It must be a value in the
  11053. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11054. accuracy. Default value is 15.
  11055. @item stepsize
  11056. Set stepsize of the search process. The region around minimum is
  11057. scanned with 1 pixel resolution. Default value is 6.
  11058. @item mincontrast
  11059. Set minimum contrast. Below this value a local measurement field is
  11060. discarded. Must be a floating point value in the range 0-1. Default
  11061. value is 0.3.
  11062. @item tripod
  11063. Set reference frame number for tripod mode.
  11064. If enabled, the motion of the frames is compared to a reference frame
  11065. in the filtered stream, identified by the specified number. The idea
  11066. is to compensate all movements in a more-or-less static scene and keep
  11067. the camera view absolutely still.
  11068. If set to 0, it is disabled. The frames are counted starting from 1.
  11069. @item show
  11070. Show fields and transforms in the resulting frames. It accepts an
  11071. integer in the range 0-2. Default value is 0, which disables any
  11072. visualization.
  11073. @end table
  11074. @subsection Examples
  11075. @itemize
  11076. @item
  11077. Use default values:
  11078. @example
  11079. vidstabdetect
  11080. @end example
  11081. @item
  11082. Analyze strongly shaky movie and put the results in file
  11083. @file{mytransforms.trf}:
  11084. @example
  11085. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11086. @end example
  11087. @item
  11088. Visualize the result of internal transformations in the resulting
  11089. video:
  11090. @example
  11091. vidstabdetect=show=1
  11092. @end example
  11093. @item
  11094. Analyze a video with medium shakiness using @command{ffmpeg}:
  11095. @example
  11096. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11097. @end example
  11098. @end itemize
  11099. @anchor{vidstabtransform}
  11100. @section vidstabtransform
  11101. Video stabilization/deshaking: pass 2 of 2,
  11102. see @ref{vidstabdetect} for pass 1.
  11103. Read a file with transform information for each frame and
  11104. apply/compensate them. Together with the @ref{vidstabdetect}
  11105. filter this can be used to deshake videos. See also
  11106. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11107. the @ref{unsharp} filter, see below.
  11108. To enable compilation of this filter you need to configure FFmpeg with
  11109. @code{--enable-libvidstab}.
  11110. @subsection Options
  11111. @table @option
  11112. @item input
  11113. Set path to the file used to read the transforms. Default value is
  11114. @file{transforms.trf}.
  11115. @item smoothing
  11116. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11117. camera movements. Default value is 10.
  11118. For example a number of 10 means that 21 frames are used (10 in the
  11119. past and 10 in the future) to smoothen the motion in the video. A
  11120. larger value leads to a smoother video, but limits the acceleration of
  11121. the camera (pan/tilt movements). 0 is a special case where a static
  11122. camera is simulated.
  11123. @item optalgo
  11124. Set the camera path optimization algorithm.
  11125. Accepted values are:
  11126. @table @samp
  11127. @item gauss
  11128. gaussian kernel low-pass filter on camera motion (default)
  11129. @item avg
  11130. averaging on transformations
  11131. @end table
  11132. @item maxshift
  11133. Set maximal number of pixels to translate frames. Default value is -1,
  11134. meaning no limit.
  11135. @item maxangle
  11136. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11137. value is -1, meaning no limit.
  11138. @item crop
  11139. Specify how to deal with borders that may be visible due to movement
  11140. compensation.
  11141. Available values are:
  11142. @table @samp
  11143. @item keep
  11144. keep image information from previous frame (default)
  11145. @item black
  11146. fill the border black
  11147. @end table
  11148. @item invert
  11149. Invert transforms if set to 1. Default value is 0.
  11150. @item relative
  11151. Consider transforms as relative to previous frame if set to 1,
  11152. absolute if set to 0. Default value is 0.
  11153. @item zoom
  11154. Set percentage to zoom. A positive value will result in a zoom-in
  11155. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11156. zoom).
  11157. @item optzoom
  11158. Set optimal zooming to avoid borders.
  11159. Accepted values are:
  11160. @table @samp
  11161. @item 0
  11162. disabled
  11163. @item 1
  11164. optimal static zoom value is determined (only very strong movements
  11165. will lead to visible borders) (default)
  11166. @item 2
  11167. optimal adaptive zoom value is determined (no borders will be
  11168. visible), see @option{zoomspeed}
  11169. @end table
  11170. Note that the value given at zoom is added to the one calculated here.
  11171. @item zoomspeed
  11172. Set percent to zoom maximally each frame (enabled when
  11173. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11174. 0.25.
  11175. @item interpol
  11176. Specify type of interpolation.
  11177. Available values are:
  11178. @table @samp
  11179. @item no
  11180. no interpolation
  11181. @item linear
  11182. linear only horizontal
  11183. @item bilinear
  11184. linear in both directions (default)
  11185. @item bicubic
  11186. cubic in both directions (slow)
  11187. @end table
  11188. @item tripod
  11189. Enable virtual tripod mode if set to 1, which is equivalent to
  11190. @code{relative=0:smoothing=0}. Default value is 0.
  11191. Use also @code{tripod} option of @ref{vidstabdetect}.
  11192. @item debug
  11193. Increase log verbosity if set to 1. Also the detected global motions
  11194. are written to the temporary file @file{global_motions.trf}. Default
  11195. value is 0.
  11196. @end table
  11197. @subsection Examples
  11198. @itemize
  11199. @item
  11200. Use @command{ffmpeg} for a typical stabilization with default values:
  11201. @example
  11202. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11203. @end example
  11204. Note the use of the @ref{unsharp} filter which is always recommended.
  11205. @item
  11206. Zoom in a bit more and load transform data from a given file:
  11207. @example
  11208. vidstabtransform=zoom=5:input="mytransforms.trf"
  11209. @end example
  11210. @item
  11211. Smoothen the video even more:
  11212. @example
  11213. vidstabtransform=smoothing=30
  11214. @end example
  11215. @end itemize
  11216. @section vflip
  11217. Flip the input video vertically.
  11218. For example, to vertically flip a video with @command{ffmpeg}:
  11219. @example
  11220. ffmpeg -i in.avi -vf "vflip" out.avi
  11221. @end example
  11222. @anchor{vignette}
  11223. @section vignette
  11224. Make or reverse a natural vignetting effect.
  11225. The filter accepts the following options:
  11226. @table @option
  11227. @item angle, a
  11228. Set lens angle expression as a number of radians.
  11229. The value is clipped in the @code{[0,PI/2]} range.
  11230. Default value: @code{"PI/5"}
  11231. @item x0
  11232. @item y0
  11233. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11234. by default.
  11235. @item mode
  11236. Set forward/backward mode.
  11237. Available modes are:
  11238. @table @samp
  11239. @item forward
  11240. The larger the distance from the central point, the darker the image becomes.
  11241. @item backward
  11242. The larger the distance from the central point, the brighter the image becomes.
  11243. This can be used to reverse a vignette effect, though there is no automatic
  11244. detection to extract the lens @option{angle} and other settings (yet). It can
  11245. also be used to create a burning effect.
  11246. @end table
  11247. Default value is @samp{forward}.
  11248. @item eval
  11249. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11250. It accepts the following values:
  11251. @table @samp
  11252. @item init
  11253. Evaluate expressions only once during the filter initialization.
  11254. @item frame
  11255. Evaluate expressions for each incoming frame. This is way slower than the
  11256. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11257. allows advanced dynamic expressions.
  11258. @end table
  11259. Default value is @samp{init}.
  11260. @item dither
  11261. Set dithering to reduce the circular banding effects. Default is @code{1}
  11262. (enabled).
  11263. @item aspect
  11264. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11265. Setting this value to the SAR of the input will make a rectangular vignetting
  11266. following the dimensions of the video.
  11267. Default is @code{1/1}.
  11268. @end table
  11269. @subsection Expressions
  11270. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11271. following parameters.
  11272. @table @option
  11273. @item w
  11274. @item h
  11275. input width and height
  11276. @item n
  11277. the number of input frame, starting from 0
  11278. @item pts
  11279. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11280. @var{TB} units, NAN if undefined
  11281. @item r
  11282. frame rate of the input video, NAN if the input frame rate is unknown
  11283. @item t
  11284. the PTS (Presentation TimeStamp) of the filtered video frame,
  11285. expressed in seconds, NAN if undefined
  11286. @item tb
  11287. time base of the input video
  11288. @end table
  11289. @subsection Examples
  11290. @itemize
  11291. @item
  11292. Apply simple strong vignetting effect:
  11293. @example
  11294. vignette=PI/4
  11295. @end example
  11296. @item
  11297. Make a flickering vignetting:
  11298. @example
  11299. vignette='PI/4+random(1)*PI/50':eval=frame
  11300. @end example
  11301. @end itemize
  11302. @section vstack
  11303. Stack input videos vertically.
  11304. All streams must be of same pixel format and of same width.
  11305. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11306. to create same output.
  11307. The filter accept the following option:
  11308. @table @option
  11309. @item inputs
  11310. Set number of input streams. Default is 2.
  11311. @item shortest
  11312. If set to 1, force the output to terminate when the shortest input
  11313. terminates. Default value is 0.
  11314. @end table
  11315. @section w3fdif
  11316. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11317. Deinterlacing Filter").
  11318. Based on the process described by Martin Weston for BBC R&D, and
  11319. implemented based on the de-interlace algorithm written by Jim
  11320. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11321. uses filter coefficients calculated by BBC R&D.
  11322. There are two sets of filter coefficients, so called "simple":
  11323. and "complex". Which set of filter coefficients is used can
  11324. be set by passing an optional parameter:
  11325. @table @option
  11326. @item filter
  11327. Set the interlacing filter coefficients. Accepts one of the following values:
  11328. @table @samp
  11329. @item simple
  11330. Simple filter coefficient set.
  11331. @item complex
  11332. More-complex filter coefficient set.
  11333. @end table
  11334. Default value is @samp{complex}.
  11335. @item deint
  11336. Specify which frames to deinterlace. Accept one of the following values:
  11337. @table @samp
  11338. @item all
  11339. Deinterlace all frames,
  11340. @item interlaced
  11341. Only deinterlace frames marked as interlaced.
  11342. @end table
  11343. Default value is @samp{all}.
  11344. @end table
  11345. @section waveform
  11346. Video waveform monitor.
  11347. The waveform monitor plots color component intensity. By default luminance
  11348. only. Each column of the waveform corresponds to a column of pixels in the
  11349. source video.
  11350. It accepts the following options:
  11351. @table @option
  11352. @item mode, m
  11353. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11354. In row mode, the graph on the left side represents color component value 0 and
  11355. the right side represents value = 255. In column mode, the top side represents
  11356. color component value = 0 and bottom side represents value = 255.
  11357. @item intensity, i
  11358. Set intensity. Smaller values are useful to find out how many values of the same
  11359. luminance are distributed across input rows/columns.
  11360. Default value is @code{0.04}. Allowed range is [0, 1].
  11361. @item mirror, r
  11362. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11363. In mirrored mode, higher values will be represented on the left
  11364. side for @code{row} mode and at the top for @code{column} mode. Default is
  11365. @code{1} (mirrored).
  11366. @item display, d
  11367. Set display mode.
  11368. It accepts the following values:
  11369. @table @samp
  11370. @item overlay
  11371. Presents information identical to that in the @code{parade}, except
  11372. that the graphs representing color components are superimposed directly
  11373. over one another.
  11374. This display mode makes it easier to spot relative differences or similarities
  11375. in overlapping areas of the color components that are supposed to be identical,
  11376. such as neutral whites, grays, or blacks.
  11377. @item stack
  11378. Display separate graph for the color components side by side in
  11379. @code{row} mode or one below the other in @code{column} mode.
  11380. @item parade
  11381. Display separate graph for the color components side by side in
  11382. @code{column} mode or one below the other in @code{row} mode.
  11383. Using this display mode makes it easy to spot color casts in the highlights
  11384. and shadows of an image, by comparing the contours of the top and the bottom
  11385. graphs of each waveform. Since whites, grays, and blacks are characterized
  11386. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11387. should display three waveforms of roughly equal width/height. If not, the
  11388. correction is easy to perform by making level adjustments the three waveforms.
  11389. @end table
  11390. Default is @code{stack}.
  11391. @item components, c
  11392. Set which color components to display. Default is 1, which means only luminance
  11393. or red color component if input is in RGB colorspace. If is set for example to
  11394. 7 it will display all 3 (if) available color components.
  11395. @item envelope, e
  11396. @table @samp
  11397. @item none
  11398. No envelope, this is default.
  11399. @item instant
  11400. Instant envelope, minimum and maximum values presented in graph will be easily
  11401. visible even with small @code{step} value.
  11402. @item peak
  11403. Hold minimum and maximum values presented in graph across time. This way you
  11404. can still spot out of range values without constantly looking at waveforms.
  11405. @item peak+instant
  11406. Peak and instant envelope combined together.
  11407. @end table
  11408. @item filter, f
  11409. @table @samp
  11410. @item lowpass
  11411. No filtering, this is default.
  11412. @item flat
  11413. Luma and chroma combined together.
  11414. @item aflat
  11415. Similar as above, but shows difference between blue and red chroma.
  11416. @item chroma
  11417. Displays only chroma.
  11418. @item color
  11419. Displays actual color value on waveform.
  11420. @item acolor
  11421. Similar as above, but with luma showing frequency of chroma values.
  11422. @end table
  11423. @item graticule, g
  11424. Set which graticule to display.
  11425. @table @samp
  11426. @item none
  11427. Do not display graticule.
  11428. @item green
  11429. Display green graticule showing legal broadcast ranges.
  11430. @end table
  11431. @item opacity, o
  11432. Set graticule opacity.
  11433. @item flags, fl
  11434. Set graticule flags.
  11435. @table @samp
  11436. @item numbers
  11437. Draw numbers above lines. By default enabled.
  11438. @item dots
  11439. Draw dots instead of lines.
  11440. @end table
  11441. @item scale, s
  11442. Set scale used for displaying graticule.
  11443. @table @samp
  11444. @item digital
  11445. @item millivolts
  11446. @item ire
  11447. @end table
  11448. Default is digital.
  11449. @item bgopacity, b
  11450. Set background opacity.
  11451. @end table
  11452. @section weave, doubleweave
  11453. The @code{weave} takes a field-based video input and join
  11454. each two sequential fields into single frame, producing a new double
  11455. height clip with half the frame rate and half the frame count.
  11456. The @code{doubleweave} works same as @code{weave} but without
  11457. halving frame rate and frame count.
  11458. It accepts the following option:
  11459. @table @option
  11460. @item first_field
  11461. Set first field. Available values are:
  11462. @table @samp
  11463. @item top, t
  11464. Set the frame as top-field-first.
  11465. @item bottom, b
  11466. Set the frame as bottom-field-first.
  11467. @end table
  11468. @end table
  11469. @subsection Examples
  11470. @itemize
  11471. @item
  11472. Interlace video using @ref{select} and @ref{separatefields} filter:
  11473. @example
  11474. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11475. @end example
  11476. @end itemize
  11477. @section xbr
  11478. Apply the xBR high-quality magnification filter which is designed for pixel
  11479. art. It follows a set of edge-detection rules, see
  11480. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11481. It accepts the following option:
  11482. @table @option
  11483. @item n
  11484. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11485. @code{3xBR} and @code{4} for @code{4xBR}.
  11486. Default is @code{3}.
  11487. @end table
  11488. @anchor{yadif}
  11489. @section yadif
  11490. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11491. filter").
  11492. It accepts the following parameters:
  11493. @table @option
  11494. @item mode
  11495. The interlacing mode to adopt. It accepts one of the following values:
  11496. @table @option
  11497. @item 0, send_frame
  11498. Output one frame for each frame.
  11499. @item 1, send_field
  11500. Output one frame for each field.
  11501. @item 2, send_frame_nospatial
  11502. Like @code{send_frame}, but it skips the spatial interlacing check.
  11503. @item 3, send_field_nospatial
  11504. Like @code{send_field}, but it skips the spatial interlacing check.
  11505. @end table
  11506. The default value is @code{send_frame}.
  11507. @item parity
  11508. The picture field parity assumed for the input interlaced video. It accepts one
  11509. of the following values:
  11510. @table @option
  11511. @item 0, tff
  11512. Assume the top field is first.
  11513. @item 1, bff
  11514. Assume the bottom field is first.
  11515. @item -1, auto
  11516. Enable automatic detection of field parity.
  11517. @end table
  11518. The default value is @code{auto}.
  11519. If the interlacing is unknown or the decoder does not export this information,
  11520. top field first will be assumed.
  11521. @item deint
  11522. Specify which frames to deinterlace. Accept one of the following
  11523. values:
  11524. @table @option
  11525. @item 0, all
  11526. Deinterlace all frames.
  11527. @item 1, interlaced
  11528. Only deinterlace frames marked as interlaced.
  11529. @end table
  11530. The default value is @code{all}.
  11531. @end table
  11532. @section zoompan
  11533. Apply Zoom & Pan effect.
  11534. This filter accepts the following options:
  11535. @table @option
  11536. @item zoom, z
  11537. Set the zoom expression. Default is 1.
  11538. @item x
  11539. @item y
  11540. Set the x and y expression. Default is 0.
  11541. @item d
  11542. Set the duration expression in number of frames.
  11543. This sets for how many number of frames effect will last for
  11544. single input image.
  11545. @item s
  11546. Set the output image size, default is 'hd720'.
  11547. @item fps
  11548. Set the output frame rate, default is '25'.
  11549. @end table
  11550. Each expression can contain the following constants:
  11551. @table @option
  11552. @item in_w, iw
  11553. Input width.
  11554. @item in_h, ih
  11555. Input height.
  11556. @item out_w, ow
  11557. Output width.
  11558. @item out_h, oh
  11559. Output height.
  11560. @item in
  11561. Input frame count.
  11562. @item on
  11563. Output frame count.
  11564. @item x
  11565. @item y
  11566. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11567. for current input frame.
  11568. @item px
  11569. @item py
  11570. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11571. not yet such frame (first input frame).
  11572. @item zoom
  11573. Last calculated zoom from 'z' expression for current input frame.
  11574. @item pzoom
  11575. Last calculated zoom of last output frame of previous input frame.
  11576. @item duration
  11577. Number of output frames for current input frame. Calculated from 'd' expression
  11578. for each input frame.
  11579. @item pduration
  11580. number of output frames created for previous input frame
  11581. @item a
  11582. Rational number: input width / input height
  11583. @item sar
  11584. sample aspect ratio
  11585. @item dar
  11586. display aspect ratio
  11587. @end table
  11588. @subsection Examples
  11589. @itemize
  11590. @item
  11591. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11592. @example
  11593. 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
  11594. @end example
  11595. @item
  11596. Zoom-in up to 1.5 and pan always at center of picture:
  11597. @example
  11598. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11599. @end example
  11600. @item
  11601. Same as above but without pausing:
  11602. @example
  11603. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11604. @end example
  11605. @end itemize
  11606. @section zscale
  11607. Scale (resize) the input video, using the z.lib library:
  11608. https://github.com/sekrit-twc/zimg.
  11609. The zscale filter forces the output display aspect ratio to be the same
  11610. as the input, by changing the output sample aspect ratio.
  11611. If the input image format is different from the format requested by
  11612. the next filter, the zscale filter will convert the input to the
  11613. requested format.
  11614. @subsection Options
  11615. The filter accepts the following options.
  11616. @table @option
  11617. @item width, w
  11618. @item height, h
  11619. Set the output video dimension expression. Default value is the input
  11620. dimension.
  11621. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11622. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11623. If one of the values is -1, the zscale filter will use a value that
  11624. maintains the aspect ratio of the input image, calculated from the
  11625. other specified dimension. If both of them are -1, the input size is
  11626. used
  11627. If one of the values is -n with n > 1, the zscale filter will also use a value
  11628. that maintains the aspect ratio of the input image, calculated from the other
  11629. specified dimension. After that it will, however, make sure that the calculated
  11630. dimension is divisible by n and adjust the value if necessary.
  11631. See below for the list of accepted constants for use in the dimension
  11632. expression.
  11633. @item size, s
  11634. Set the video size. For the syntax of this option, check the
  11635. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11636. @item dither, d
  11637. Set the dither type.
  11638. Possible values are:
  11639. @table @var
  11640. @item none
  11641. @item ordered
  11642. @item random
  11643. @item error_diffusion
  11644. @end table
  11645. Default is none.
  11646. @item filter, f
  11647. Set the resize filter type.
  11648. Possible values are:
  11649. @table @var
  11650. @item point
  11651. @item bilinear
  11652. @item bicubic
  11653. @item spline16
  11654. @item spline36
  11655. @item lanczos
  11656. @end table
  11657. Default is bilinear.
  11658. @item range, r
  11659. Set the color range.
  11660. Possible values are:
  11661. @table @var
  11662. @item input
  11663. @item limited
  11664. @item full
  11665. @end table
  11666. Default is same as input.
  11667. @item primaries, p
  11668. Set the color primaries.
  11669. Possible values are:
  11670. @table @var
  11671. @item input
  11672. @item 709
  11673. @item unspecified
  11674. @item 170m
  11675. @item 240m
  11676. @item 2020
  11677. @end table
  11678. Default is same as input.
  11679. @item transfer, t
  11680. Set the transfer characteristics.
  11681. Possible values are:
  11682. @table @var
  11683. @item input
  11684. @item 709
  11685. @item unspecified
  11686. @item 601
  11687. @item linear
  11688. @item 2020_10
  11689. @item 2020_12
  11690. @item smpte2084
  11691. @item iec61966-2-1
  11692. @item arib-std-b67
  11693. @end table
  11694. Default is same as input.
  11695. @item matrix, m
  11696. Set the colorspace matrix.
  11697. Possible value are:
  11698. @table @var
  11699. @item input
  11700. @item 709
  11701. @item unspecified
  11702. @item 470bg
  11703. @item 170m
  11704. @item 2020_ncl
  11705. @item 2020_cl
  11706. @end table
  11707. Default is same as input.
  11708. @item rangein, rin
  11709. Set the input color range.
  11710. Possible values are:
  11711. @table @var
  11712. @item input
  11713. @item limited
  11714. @item full
  11715. @end table
  11716. Default is same as input.
  11717. @item primariesin, pin
  11718. Set the input color primaries.
  11719. Possible values are:
  11720. @table @var
  11721. @item input
  11722. @item 709
  11723. @item unspecified
  11724. @item 170m
  11725. @item 240m
  11726. @item 2020
  11727. @end table
  11728. Default is same as input.
  11729. @item transferin, tin
  11730. Set the input transfer characteristics.
  11731. Possible values are:
  11732. @table @var
  11733. @item input
  11734. @item 709
  11735. @item unspecified
  11736. @item 601
  11737. @item linear
  11738. @item 2020_10
  11739. @item 2020_12
  11740. @end table
  11741. Default is same as input.
  11742. @item matrixin, min
  11743. Set the input colorspace matrix.
  11744. Possible value are:
  11745. @table @var
  11746. @item input
  11747. @item 709
  11748. @item unspecified
  11749. @item 470bg
  11750. @item 170m
  11751. @item 2020_ncl
  11752. @item 2020_cl
  11753. @end table
  11754. @item chromal, c
  11755. Set the output chroma location.
  11756. Possible values are:
  11757. @table @var
  11758. @item input
  11759. @item left
  11760. @item center
  11761. @item topleft
  11762. @item top
  11763. @item bottomleft
  11764. @item bottom
  11765. @end table
  11766. @item chromalin, cin
  11767. Set the input chroma location.
  11768. Possible values are:
  11769. @table @var
  11770. @item input
  11771. @item left
  11772. @item center
  11773. @item topleft
  11774. @item top
  11775. @item bottomleft
  11776. @item bottom
  11777. @end table
  11778. @item npl
  11779. Set the nominal peak luminance.
  11780. @end table
  11781. The values of the @option{w} and @option{h} options are expressions
  11782. containing the following constants:
  11783. @table @var
  11784. @item in_w
  11785. @item in_h
  11786. The input width and height
  11787. @item iw
  11788. @item ih
  11789. These are the same as @var{in_w} and @var{in_h}.
  11790. @item out_w
  11791. @item out_h
  11792. The output (scaled) width and height
  11793. @item ow
  11794. @item oh
  11795. These are the same as @var{out_w} and @var{out_h}
  11796. @item a
  11797. The same as @var{iw} / @var{ih}
  11798. @item sar
  11799. input sample aspect ratio
  11800. @item dar
  11801. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11802. @item hsub
  11803. @item vsub
  11804. horizontal and vertical input chroma subsample values. For example for the
  11805. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11806. @item ohsub
  11807. @item ovsub
  11808. horizontal and vertical output chroma subsample values. For example for the
  11809. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11810. @end table
  11811. @table @option
  11812. @end table
  11813. @c man end VIDEO FILTERS
  11814. @chapter Video Sources
  11815. @c man begin VIDEO SOURCES
  11816. Below is a description of the currently available video sources.
  11817. @section buffer
  11818. Buffer video frames, and make them available to the filter chain.
  11819. This source is mainly intended for a programmatic use, in particular
  11820. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11821. It accepts the following parameters:
  11822. @table @option
  11823. @item video_size
  11824. Specify the size (width and height) of the buffered video frames. For the
  11825. syntax of this option, check the
  11826. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11827. @item width
  11828. The input video width.
  11829. @item height
  11830. The input video height.
  11831. @item pix_fmt
  11832. A string representing the pixel format of the buffered video frames.
  11833. It may be a number corresponding to a pixel format, or a pixel format
  11834. name.
  11835. @item time_base
  11836. Specify the timebase assumed by the timestamps of the buffered frames.
  11837. @item frame_rate
  11838. Specify the frame rate expected for the video stream.
  11839. @item pixel_aspect, sar
  11840. The sample (pixel) aspect ratio of the input video.
  11841. @item sws_param
  11842. Specify the optional parameters to be used for the scale filter which
  11843. is automatically inserted when an input change is detected in the
  11844. input size or format.
  11845. @item hw_frames_ctx
  11846. When using a hardware pixel format, this should be a reference to an
  11847. AVHWFramesContext describing input frames.
  11848. @end table
  11849. For example:
  11850. @example
  11851. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11852. @end example
  11853. will instruct the source to accept video frames with size 320x240 and
  11854. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11855. square pixels (1:1 sample aspect ratio).
  11856. Since the pixel format with name "yuv410p" corresponds to the number 6
  11857. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11858. this example corresponds to:
  11859. @example
  11860. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11861. @end example
  11862. Alternatively, the options can be specified as a flat string, but this
  11863. syntax is deprecated:
  11864. @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}]
  11865. @section cellauto
  11866. Create a pattern generated by an elementary cellular automaton.
  11867. The initial state of the cellular automaton can be defined through the
  11868. @option{filename} and @option{pattern} options. If such options are
  11869. not specified an initial state is created randomly.
  11870. At each new frame a new row in the video is filled with the result of
  11871. the cellular automaton next generation. The behavior when the whole
  11872. frame is filled is defined by the @option{scroll} option.
  11873. This source accepts the following options:
  11874. @table @option
  11875. @item filename, f
  11876. Read the initial cellular automaton state, i.e. the starting row, from
  11877. the specified file.
  11878. In the file, each non-whitespace character is considered an alive
  11879. cell, a newline will terminate the row, and further characters in the
  11880. file will be ignored.
  11881. @item pattern, p
  11882. Read the initial cellular automaton state, i.e. the starting row, from
  11883. the specified string.
  11884. Each non-whitespace character in the string is considered an alive
  11885. cell, a newline will terminate the row, and further characters in the
  11886. string will be ignored.
  11887. @item rate, r
  11888. Set the video rate, that is the number of frames generated per second.
  11889. Default is 25.
  11890. @item random_fill_ratio, ratio
  11891. Set the random fill ratio for the initial cellular automaton row. It
  11892. is a floating point number value ranging from 0 to 1, defaults to
  11893. 1/PHI.
  11894. This option is ignored when a file or a pattern is specified.
  11895. @item random_seed, seed
  11896. Set the seed for filling randomly the initial row, must be an integer
  11897. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11898. set to -1, the filter will try to use a good random seed on a best
  11899. effort basis.
  11900. @item rule
  11901. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11902. Default value is 110.
  11903. @item size, s
  11904. Set the size of the output video. For the syntax of this option, check the
  11905. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11906. If @option{filename} or @option{pattern} is specified, the size is set
  11907. by default to the width of the specified initial state row, and the
  11908. height is set to @var{width} * PHI.
  11909. If @option{size} is set, it must contain the width of the specified
  11910. pattern string, and the specified pattern will be centered in the
  11911. larger row.
  11912. If a filename or a pattern string is not specified, the size value
  11913. defaults to "320x518" (used for a randomly generated initial state).
  11914. @item scroll
  11915. If set to 1, scroll the output upward when all the rows in the output
  11916. have been already filled. If set to 0, the new generated row will be
  11917. written over the top row just after the bottom row is filled.
  11918. Defaults to 1.
  11919. @item start_full, full
  11920. If set to 1, completely fill the output with generated rows before
  11921. outputting the first frame.
  11922. This is the default behavior, for disabling set the value to 0.
  11923. @item stitch
  11924. If set to 1, stitch the left and right row edges together.
  11925. This is the default behavior, for disabling set the value to 0.
  11926. @end table
  11927. @subsection Examples
  11928. @itemize
  11929. @item
  11930. Read the initial state from @file{pattern}, and specify an output of
  11931. size 200x400.
  11932. @example
  11933. cellauto=f=pattern:s=200x400
  11934. @end example
  11935. @item
  11936. Generate a random initial row with a width of 200 cells, with a fill
  11937. ratio of 2/3:
  11938. @example
  11939. cellauto=ratio=2/3:s=200x200
  11940. @end example
  11941. @item
  11942. Create a pattern generated by rule 18 starting by a single alive cell
  11943. centered on an initial row with width 100:
  11944. @example
  11945. cellauto=p=@@:s=100x400:full=0:rule=18
  11946. @end example
  11947. @item
  11948. Specify a more elaborated initial pattern:
  11949. @example
  11950. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11951. @end example
  11952. @end itemize
  11953. @anchor{coreimagesrc}
  11954. @section coreimagesrc
  11955. Video source generated on GPU using Apple's CoreImage API on OSX.
  11956. This video source is a specialized version of the @ref{coreimage} video filter.
  11957. Use a core image generator at the beginning of the applied filterchain to
  11958. generate the content.
  11959. The coreimagesrc video source accepts the following options:
  11960. @table @option
  11961. @item list_generators
  11962. List all available generators along with all their respective options as well as
  11963. possible minimum and maximum values along with the default values.
  11964. @example
  11965. list_generators=true
  11966. @end example
  11967. @item size, s
  11968. Specify the size of the sourced video. For the syntax of this option, check the
  11969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11970. The default value is @code{320x240}.
  11971. @item rate, r
  11972. Specify the frame rate of the sourced video, as the number of frames
  11973. generated per second. It has to be a string in the format
  11974. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11975. number or a valid video frame rate abbreviation. The default value is
  11976. "25".
  11977. @item sar
  11978. Set the sample aspect ratio of the sourced video.
  11979. @item duration, d
  11980. Set the duration of the sourced video. See
  11981. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11982. for the accepted syntax.
  11983. If not specified, or the expressed duration is negative, the video is
  11984. supposed to be generated forever.
  11985. @end table
  11986. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11987. A complete filterchain can be used for further processing of the
  11988. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11989. and examples for details.
  11990. @subsection Examples
  11991. @itemize
  11992. @item
  11993. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11994. given as complete and escaped command-line for Apple's standard bash shell:
  11995. @example
  11996. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11997. @end example
  11998. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11999. need for a nullsrc video source.
  12000. @end itemize
  12001. @section mandelbrot
  12002. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12003. point specified with @var{start_x} and @var{start_y}.
  12004. This source accepts the following options:
  12005. @table @option
  12006. @item end_pts
  12007. Set the terminal pts value. Default value is 400.
  12008. @item end_scale
  12009. Set the terminal scale value.
  12010. Must be a floating point value. Default value is 0.3.
  12011. @item inner
  12012. Set the inner coloring mode, that is the algorithm used to draw the
  12013. Mandelbrot fractal internal region.
  12014. It shall assume one of the following values:
  12015. @table @option
  12016. @item black
  12017. Set black mode.
  12018. @item convergence
  12019. Show time until convergence.
  12020. @item mincol
  12021. Set color based on point closest to the origin of the iterations.
  12022. @item period
  12023. Set period mode.
  12024. @end table
  12025. Default value is @var{mincol}.
  12026. @item bailout
  12027. Set the bailout value. Default value is 10.0.
  12028. @item maxiter
  12029. Set the maximum of iterations performed by the rendering
  12030. algorithm. Default value is 7189.
  12031. @item outer
  12032. Set outer coloring mode.
  12033. It shall assume one of following values:
  12034. @table @option
  12035. @item iteration_count
  12036. Set iteration cound mode.
  12037. @item normalized_iteration_count
  12038. set normalized iteration count mode.
  12039. @end table
  12040. Default value is @var{normalized_iteration_count}.
  12041. @item rate, r
  12042. Set frame rate, expressed as number of frames per second. Default
  12043. value is "25".
  12044. @item size, s
  12045. Set frame size. For the syntax of this option, check the "Video
  12046. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12047. @item start_scale
  12048. Set the initial scale value. Default value is 3.0.
  12049. @item start_x
  12050. Set the initial x position. Must be a floating point value between
  12051. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12052. @item start_y
  12053. Set the initial y position. Must be a floating point value between
  12054. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12055. @end table
  12056. @section mptestsrc
  12057. Generate various test patterns, as generated by the MPlayer test filter.
  12058. The size of the generated video is fixed, and is 256x256.
  12059. This source is useful in particular for testing encoding features.
  12060. This source accepts the following options:
  12061. @table @option
  12062. @item rate, r
  12063. Specify the frame rate of the sourced video, as the number of frames
  12064. generated per second. It has to be a string in the format
  12065. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12066. number or a valid video frame rate abbreviation. The default value is
  12067. "25".
  12068. @item duration, d
  12069. Set the duration of the sourced video. See
  12070. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12071. for the accepted syntax.
  12072. If not specified, or the expressed duration is negative, the video is
  12073. supposed to be generated forever.
  12074. @item test, t
  12075. Set the number or the name of the test to perform. Supported tests are:
  12076. @table @option
  12077. @item dc_luma
  12078. @item dc_chroma
  12079. @item freq_luma
  12080. @item freq_chroma
  12081. @item amp_luma
  12082. @item amp_chroma
  12083. @item cbp
  12084. @item mv
  12085. @item ring1
  12086. @item ring2
  12087. @item all
  12088. @end table
  12089. Default value is "all", which will cycle through the list of all tests.
  12090. @end table
  12091. Some examples:
  12092. @example
  12093. mptestsrc=t=dc_luma
  12094. @end example
  12095. will generate a "dc_luma" test pattern.
  12096. @section frei0r_src
  12097. Provide a frei0r source.
  12098. To enable compilation of this filter you need to install the frei0r
  12099. header and configure FFmpeg with @code{--enable-frei0r}.
  12100. This source accepts the following parameters:
  12101. @table @option
  12102. @item size
  12103. The size of the video to generate. For the syntax of this option, check the
  12104. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12105. @item framerate
  12106. The framerate of the generated video. It may be a string of the form
  12107. @var{num}/@var{den} or a frame rate abbreviation.
  12108. @item filter_name
  12109. The name to the frei0r source to load. For more information regarding frei0r and
  12110. how to set the parameters, read the @ref{frei0r} section in the video filters
  12111. documentation.
  12112. @item filter_params
  12113. A '|'-separated list of parameters to pass to the frei0r source.
  12114. @end table
  12115. For example, to generate a frei0r partik0l source with size 200x200
  12116. and frame rate 10 which is overlaid on the overlay filter main input:
  12117. @example
  12118. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12119. @end example
  12120. @section life
  12121. Generate a life pattern.
  12122. This source is based on a generalization of John Conway's life game.
  12123. The sourced input represents a life grid, each pixel represents a cell
  12124. which can be in one of two possible states, alive or dead. Every cell
  12125. interacts with its eight neighbours, which are the cells that are
  12126. horizontally, vertically, or diagonally adjacent.
  12127. At each interaction the grid evolves according to the adopted rule,
  12128. which specifies the number of neighbor alive cells which will make a
  12129. cell stay alive or born. The @option{rule} option allows one to specify
  12130. the rule to adopt.
  12131. This source accepts the following options:
  12132. @table @option
  12133. @item filename, f
  12134. Set the file from which to read the initial grid state. In the file,
  12135. each non-whitespace character is considered an alive cell, and newline
  12136. is used to delimit the end of each row.
  12137. If this option is not specified, the initial grid is generated
  12138. randomly.
  12139. @item rate, r
  12140. Set the video rate, that is the number of frames generated per second.
  12141. Default is 25.
  12142. @item random_fill_ratio, ratio
  12143. Set the random fill ratio for the initial random grid. It is a
  12144. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12145. It is ignored when a file is specified.
  12146. @item random_seed, seed
  12147. Set the seed for filling the initial random grid, must be an integer
  12148. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12149. set to -1, the filter will try to use a good random seed on a best
  12150. effort basis.
  12151. @item rule
  12152. Set the life rule.
  12153. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12154. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12155. @var{NS} specifies the number of alive neighbor cells which make a
  12156. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12157. which make a dead cell to become alive (i.e. to "born").
  12158. "s" and "b" can be used in place of "S" and "B", respectively.
  12159. Alternatively a rule can be specified by an 18-bits integer. The 9
  12160. high order bits are used to encode the next cell state if it is alive
  12161. for each number of neighbor alive cells, the low order bits specify
  12162. the rule for "borning" new cells. Higher order bits encode for an
  12163. higher number of neighbor cells.
  12164. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12165. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12166. Default value is "S23/B3", which is the original Conway's game of life
  12167. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12168. cells, and will born a new cell if there are three alive cells around
  12169. a dead cell.
  12170. @item size, s
  12171. Set the size of the output video. For the syntax of this option, check the
  12172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12173. If @option{filename} is specified, the size is set by default to the
  12174. same size of the input file. If @option{size} is set, it must contain
  12175. the size specified in the input file, and the initial grid defined in
  12176. that file is centered in the larger resulting area.
  12177. If a filename is not specified, the size value defaults to "320x240"
  12178. (used for a randomly generated initial grid).
  12179. @item stitch
  12180. If set to 1, stitch the left and right grid edges together, and the
  12181. top and bottom edges also. Defaults to 1.
  12182. @item mold
  12183. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12184. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12185. value from 0 to 255.
  12186. @item life_color
  12187. Set the color of living (or new born) cells.
  12188. @item death_color
  12189. Set the color of dead cells. If @option{mold} is set, this is the first color
  12190. used to represent a dead cell.
  12191. @item mold_color
  12192. Set mold color, for definitely dead and moldy cells.
  12193. For the syntax of these 3 color options, check the "Color" section in the
  12194. ffmpeg-utils manual.
  12195. @end table
  12196. @subsection Examples
  12197. @itemize
  12198. @item
  12199. Read a grid from @file{pattern}, and center it on a grid of size
  12200. 300x300 pixels:
  12201. @example
  12202. life=f=pattern:s=300x300
  12203. @end example
  12204. @item
  12205. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12206. @example
  12207. life=ratio=2/3:s=200x200
  12208. @end example
  12209. @item
  12210. Specify a custom rule for evolving a randomly generated grid:
  12211. @example
  12212. life=rule=S14/B34
  12213. @end example
  12214. @item
  12215. Full example with slow death effect (mold) using @command{ffplay}:
  12216. @example
  12217. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12218. @end example
  12219. @end itemize
  12220. @anchor{allrgb}
  12221. @anchor{allyuv}
  12222. @anchor{color}
  12223. @anchor{haldclutsrc}
  12224. @anchor{nullsrc}
  12225. @anchor{rgbtestsrc}
  12226. @anchor{smptebars}
  12227. @anchor{smptehdbars}
  12228. @anchor{testsrc}
  12229. @anchor{testsrc2}
  12230. @anchor{yuvtestsrc}
  12231. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12232. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12233. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12234. The @code{color} source provides an uniformly colored input.
  12235. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12236. @ref{haldclut} filter.
  12237. The @code{nullsrc} source returns unprocessed video frames. It is
  12238. mainly useful to be employed in analysis / debugging tools, or as the
  12239. source for filters which ignore the input data.
  12240. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12241. detecting RGB vs BGR issues. You should see a red, green and blue
  12242. stripe from top to bottom.
  12243. The @code{smptebars} source generates a color bars pattern, based on
  12244. the SMPTE Engineering Guideline EG 1-1990.
  12245. The @code{smptehdbars} source generates a color bars pattern, based on
  12246. the SMPTE RP 219-2002.
  12247. The @code{testsrc} source generates a test video pattern, showing a
  12248. color pattern, a scrolling gradient and a timestamp. This is mainly
  12249. intended for testing purposes.
  12250. The @code{testsrc2} source is similar to testsrc, but supports more
  12251. pixel formats instead of just @code{rgb24}. This allows using it as an
  12252. input for other tests without requiring a format conversion.
  12253. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12254. see a y, cb and cr stripe from top to bottom.
  12255. The sources accept the following parameters:
  12256. @table @option
  12257. @item color, c
  12258. Specify the color of the source, only available in the @code{color}
  12259. source. For the syntax of this option, check the "Color" section in the
  12260. ffmpeg-utils manual.
  12261. @item level
  12262. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12263. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12264. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12265. coded on a @code{1/(N*N)} scale.
  12266. @item size, s
  12267. Specify the size of the sourced video. For the syntax of this option, check the
  12268. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12269. The default value is @code{320x240}.
  12270. This option is not available with the @code{haldclutsrc} filter.
  12271. @item rate, r
  12272. Specify the frame rate of the sourced video, as the number of frames
  12273. generated per second. It has to be a string in the format
  12274. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12275. number or a valid video frame rate abbreviation. The default value is
  12276. "25".
  12277. @item sar
  12278. Set the sample aspect ratio of the sourced video.
  12279. @item duration, d
  12280. Set the duration of the sourced video. See
  12281. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12282. for the accepted syntax.
  12283. If not specified, or the expressed duration is negative, the video is
  12284. supposed to be generated forever.
  12285. @item decimals, n
  12286. Set the number of decimals to show in the timestamp, only available in the
  12287. @code{testsrc} source.
  12288. The displayed timestamp value will correspond to the original
  12289. timestamp value multiplied by the power of 10 of the specified
  12290. value. Default value is 0.
  12291. @end table
  12292. For example the following:
  12293. @example
  12294. testsrc=duration=5.3:size=qcif:rate=10
  12295. @end example
  12296. will generate a video with a duration of 5.3 seconds, with size
  12297. 176x144 and a frame rate of 10 frames per second.
  12298. The following graph description will generate a red source
  12299. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12300. frames per second.
  12301. @example
  12302. color=c=red@@0.2:s=qcif:r=10
  12303. @end example
  12304. If the input content is to be ignored, @code{nullsrc} can be used. The
  12305. following command generates noise in the luminance plane by employing
  12306. the @code{geq} filter:
  12307. @example
  12308. nullsrc=s=256x256, geq=random(1)*255:128:128
  12309. @end example
  12310. @subsection Commands
  12311. The @code{color} source supports the following commands:
  12312. @table @option
  12313. @item c, color
  12314. Set the color of the created image. Accepts the same syntax of the
  12315. corresponding @option{color} option.
  12316. @end table
  12317. @c man end VIDEO SOURCES
  12318. @chapter Video Sinks
  12319. @c man begin VIDEO SINKS
  12320. Below is a description of the currently available video sinks.
  12321. @section buffersink
  12322. Buffer video frames, and make them available to the end of the filter
  12323. graph.
  12324. This sink is mainly intended for programmatic use, in particular
  12325. through the interface defined in @file{libavfilter/buffersink.h}
  12326. or the options system.
  12327. It accepts a pointer to an AVBufferSinkContext structure, which
  12328. defines the incoming buffers' formats, to be passed as the opaque
  12329. parameter to @code{avfilter_init_filter} for initialization.
  12330. @section nullsink
  12331. Null video sink: do absolutely nothing with the input video. It is
  12332. mainly useful as a template and for use in analysis / debugging
  12333. tools.
  12334. @c man end VIDEO SINKS
  12335. @chapter Multimedia Filters
  12336. @c man begin MULTIMEDIA FILTERS
  12337. Below is a description of the currently available multimedia filters.
  12338. @section abitscope
  12339. Convert input audio to a video output, displaying the audio bit scope.
  12340. The filter accepts the following options:
  12341. @table @option
  12342. @item rate, r
  12343. Set frame rate, expressed as number of frames per second. Default
  12344. value is "25".
  12345. @item size, s
  12346. Specify the video size for the output. For the syntax of this option, check the
  12347. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12348. Default value is @code{1024x256}.
  12349. @item colors
  12350. Specify list of colors separated by space or by '|' which will be used to
  12351. draw channels. Unrecognized or missing colors will be replaced
  12352. by white color.
  12353. @end table
  12354. @section ahistogram
  12355. Convert input audio to a video output, displaying the volume histogram.
  12356. The filter accepts the following options:
  12357. @table @option
  12358. @item dmode
  12359. Specify how histogram is calculated.
  12360. It accepts the following values:
  12361. @table @samp
  12362. @item single
  12363. Use single histogram for all channels.
  12364. @item separate
  12365. Use separate histogram for each channel.
  12366. @end table
  12367. Default is @code{single}.
  12368. @item rate, r
  12369. Set frame rate, expressed as number of frames per second. Default
  12370. value is "25".
  12371. @item size, s
  12372. Specify the video size for the output. For the syntax of this option, check the
  12373. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12374. Default value is @code{hd720}.
  12375. @item scale
  12376. Set display scale.
  12377. It accepts the following values:
  12378. @table @samp
  12379. @item log
  12380. logarithmic
  12381. @item sqrt
  12382. square root
  12383. @item cbrt
  12384. cubic root
  12385. @item lin
  12386. linear
  12387. @item rlog
  12388. reverse logarithmic
  12389. @end table
  12390. Default is @code{log}.
  12391. @item ascale
  12392. Set amplitude scale.
  12393. It accepts the following values:
  12394. @table @samp
  12395. @item log
  12396. logarithmic
  12397. @item lin
  12398. linear
  12399. @end table
  12400. Default is @code{log}.
  12401. @item acount
  12402. Set how much frames to accumulate in histogram.
  12403. Defauls is 1. Setting this to -1 accumulates all frames.
  12404. @item rheight
  12405. Set histogram ratio of window height.
  12406. @item slide
  12407. Set sonogram sliding.
  12408. It accepts the following values:
  12409. @table @samp
  12410. @item replace
  12411. replace old rows with new ones.
  12412. @item scroll
  12413. scroll from top to bottom.
  12414. @end table
  12415. Default is @code{replace}.
  12416. @end table
  12417. @section aphasemeter
  12418. Convert input audio to a video output, displaying the audio phase.
  12419. The filter accepts the following options:
  12420. @table @option
  12421. @item rate, r
  12422. Set the output frame rate. Default value is @code{25}.
  12423. @item size, s
  12424. Set the video size for the output. For the syntax of this option, check the
  12425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12426. Default value is @code{800x400}.
  12427. @item rc
  12428. @item gc
  12429. @item bc
  12430. Specify the red, green, blue contrast. Default values are @code{2},
  12431. @code{7} and @code{1}.
  12432. Allowed range is @code{[0, 255]}.
  12433. @item mpc
  12434. Set color which will be used for drawing median phase. If color is
  12435. @code{none} which is default, no median phase value will be drawn.
  12436. @item video
  12437. Enable video output. Default is enabled.
  12438. @end table
  12439. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12440. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12441. The @code{-1} means left and right channels are completely out of phase and
  12442. @code{1} means channels are in phase.
  12443. @section avectorscope
  12444. Convert input audio to a video output, representing the audio vector
  12445. scope.
  12446. The filter is used to measure the difference between channels of stereo
  12447. audio stream. A monoaural signal, consisting of identical left and right
  12448. signal, results in straight vertical line. Any stereo separation is visible
  12449. as a deviation from this line, creating a Lissajous figure.
  12450. If the straight (or deviation from it) but horizontal line appears this
  12451. indicates that the left and right channels are out of phase.
  12452. The filter accepts the following options:
  12453. @table @option
  12454. @item mode, m
  12455. Set the vectorscope mode.
  12456. Available values are:
  12457. @table @samp
  12458. @item lissajous
  12459. Lissajous rotated by 45 degrees.
  12460. @item lissajous_xy
  12461. Same as above but not rotated.
  12462. @item polar
  12463. Shape resembling half of circle.
  12464. @end table
  12465. Default value is @samp{lissajous}.
  12466. @item size, s
  12467. Set the video size for the output. For the syntax of this option, check the
  12468. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12469. Default value is @code{400x400}.
  12470. @item rate, r
  12471. Set the output frame rate. Default value is @code{25}.
  12472. @item rc
  12473. @item gc
  12474. @item bc
  12475. @item ac
  12476. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12477. @code{160}, @code{80} and @code{255}.
  12478. Allowed range is @code{[0, 255]}.
  12479. @item rf
  12480. @item gf
  12481. @item bf
  12482. @item af
  12483. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12484. @code{10}, @code{5} and @code{5}.
  12485. Allowed range is @code{[0, 255]}.
  12486. @item zoom
  12487. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12488. @item draw
  12489. Set the vectorscope drawing mode.
  12490. Available values are:
  12491. @table @samp
  12492. @item dot
  12493. Draw dot for each sample.
  12494. @item line
  12495. Draw line between previous and current sample.
  12496. @end table
  12497. Default value is @samp{dot}.
  12498. @item scale
  12499. Specify amplitude scale of audio samples.
  12500. Available values are:
  12501. @table @samp
  12502. @item lin
  12503. Linear.
  12504. @item sqrt
  12505. Square root.
  12506. @item cbrt
  12507. Cubic root.
  12508. @item log
  12509. Logarithmic.
  12510. @end table
  12511. @end table
  12512. @subsection Examples
  12513. @itemize
  12514. @item
  12515. Complete example using @command{ffplay}:
  12516. @example
  12517. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12518. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12519. @end example
  12520. @end itemize
  12521. @section bench, abench
  12522. Benchmark part of a filtergraph.
  12523. The filter accepts the following options:
  12524. @table @option
  12525. @item action
  12526. Start or stop a timer.
  12527. Available values are:
  12528. @table @samp
  12529. @item start
  12530. Get the current time, set it as frame metadata (using the key
  12531. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12532. @item stop
  12533. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12534. the input frame metadata to get the time difference. Time difference, average,
  12535. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12536. @code{min}) are then printed. The timestamps are expressed in seconds.
  12537. @end table
  12538. @end table
  12539. @subsection Examples
  12540. @itemize
  12541. @item
  12542. Benchmark @ref{selectivecolor} filter:
  12543. @example
  12544. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12545. @end example
  12546. @end itemize
  12547. @section concat
  12548. Concatenate audio and video streams, joining them together one after the
  12549. other.
  12550. The filter works on segments of synchronized video and audio streams. All
  12551. segments must have the same number of streams of each type, and that will
  12552. also be the number of streams at output.
  12553. The filter accepts the following options:
  12554. @table @option
  12555. @item n
  12556. Set the number of segments. Default is 2.
  12557. @item v
  12558. Set the number of output video streams, that is also the number of video
  12559. streams in each segment. Default is 1.
  12560. @item a
  12561. Set the number of output audio streams, that is also the number of audio
  12562. streams in each segment. Default is 0.
  12563. @item unsafe
  12564. Activate unsafe mode: do not fail if segments have a different format.
  12565. @end table
  12566. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12567. @var{a} audio outputs.
  12568. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12569. segment, in the same order as the outputs, then the inputs for the second
  12570. segment, etc.
  12571. Related streams do not always have exactly the same duration, for various
  12572. reasons including codec frame size or sloppy authoring. For that reason,
  12573. related synchronized streams (e.g. a video and its audio track) should be
  12574. concatenated at once. The concat filter will use the duration of the longest
  12575. stream in each segment (except the last one), and if necessary pad shorter
  12576. audio streams with silence.
  12577. For this filter to work correctly, all segments must start at timestamp 0.
  12578. All corresponding streams must have the same parameters in all segments; the
  12579. filtering system will automatically select a common pixel format for video
  12580. streams, and a common sample format, sample rate and channel layout for
  12581. audio streams, but other settings, such as resolution, must be converted
  12582. explicitly by the user.
  12583. Different frame rates are acceptable but will result in variable frame rate
  12584. at output; be sure to configure the output file to handle it.
  12585. @subsection Examples
  12586. @itemize
  12587. @item
  12588. Concatenate an opening, an episode and an ending, all in bilingual version
  12589. (video in stream 0, audio in streams 1 and 2):
  12590. @example
  12591. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12592. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12593. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12594. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12595. @end example
  12596. @item
  12597. Concatenate two parts, handling audio and video separately, using the
  12598. (a)movie sources, and adjusting the resolution:
  12599. @example
  12600. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12601. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12602. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12603. @end example
  12604. Note that a desync will happen at the stitch if the audio and video streams
  12605. do not have exactly the same duration in the first file.
  12606. @end itemize
  12607. @section drawgraph, adrawgraph
  12608. Draw a graph using input video or audio metadata.
  12609. It accepts the following parameters:
  12610. @table @option
  12611. @item m1
  12612. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12613. @item fg1
  12614. Set 1st foreground color expression.
  12615. @item m2
  12616. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12617. @item fg2
  12618. Set 2nd foreground color expression.
  12619. @item m3
  12620. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12621. @item fg3
  12622. Set 3rd foreground color expression.
  12623. @item m4
  12624. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12625. @item fg4
  12626. Set 4th foreground color expression.
  12627. @item min
  12628. Set minimal value of metadata value.
  12629. @item max
  12630. Set maximal value of metadata value.
  12631. @item bg
  12632. Set graph background color. Default is white.
  12633. @item mode
  12634. Set graph mode.
  12635. Available values for mode is:
  12636. @table @samp
  12637. @item bar
  12638. @item dot
  12639. @item line
  12640. @end table
  12641. Default is @code{line}.
  12642. @item slide
  12643. Set slide mode.
  12644. Available values for slide is:
  12645. @table @samp
  12646. @item frame
  12647. Draw new frame when right border is reached.
  12648. @item replace
  12649. Replace old columns with new ones.
  12650. @item scroll
  12651. Scroll from right to left.
  12652. @item rscroll
  12653. Scroll from left to right.
  12654. @item picture
  12655. Draw single picture.
  12656. @end table
  12657. Default is @code{frame}.
  12658. @item size
  12659. Set size of graph video. For the syntax of this option, check the
  12660. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12661. The default value is @code{900x256}.
  12662. The foreground color expressions can use the following variables:
  12663. @table @option
  12664. @item MIN
  12665. Minimal value of metadata value.
  12666. @item MAX
  12667. Maximal value of metadata value.
  12668. @item VAL
  12669. Current metadata key value.
  12670. @end table
  12671. The color is defined as 0xAABBGGRR.
  12672. @end table
  12673. Example using metadata from @ref{signalstats} filter:
  12674. @example
  12675. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12676. @end example
  12677. Example using metadata from @ref{ebur128} filter:
  12678. @example
  12679. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12680. @end example
  12681. @anchor{ebur128}
  12682. @section ebur128
  12683. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12684. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12685. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12686. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12687. The filter also has a video output (see the @var{video} option) with a real
  12688. time graph to observe the loudness evolution. The graphic contains the logged
  12689. message mentioned above, so it is not printed anymore when this option is set,
  12690. unless the verbose logging is set. The main graphing area contains the
  12691. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12692. the momentary loudness (400 milliseconds).
  12693. More information about the Loudness Recommendation EBU R128 on
  12694. @url{http://tech.ebu.ch/loudness}.
  12695. The filter accepts the following options:
  12696. @table @option
  12697. @item video
  12698. Activate the video output. The audio stream is passed unchanged whether this
  12699. option is set or no. The video stream will be the first output stream if
  12700. activated. Default is @code{0}.
  12701. @item size
  12702. Set the video size. This option is for video only. For the syntax of this
  12703. option, check the
  12704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12705. Default and minimum resolution is @code{640x480}.
  12706. @item meter
  12707. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12708. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12709. other integer value between this range is allowed.
  12710. @item metadata
  12711. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12712. into 100ms output frames, each of them containing various loudness information
  12713. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12714. Default is @code{0}.
  12715. @item framelog
  12716. Force the frame logging level.
  12717. Available values are:
  12718. @table @samp
  12719. @item info
  12720. information logging level
  12721. @item verbose
  12722. verbose logging level
  12723. @end table
  12724. By default, the logging level is set to @var{info}. If the @option{video} or
  12725. the @option{metadata} options are set, it switches to @var{verbose}.
  12726. @item peak
  12727. Set peak mode(s).
  12728. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12729. values are:
  12730. @table @samp
  12731. @item none
  12732. Disable any peak mode (default).
  12733. @item sample
  12734. Enable sample-peak mode.
  12735. Simple peak mode looking for the higher sample value. It logs a message
  12736. for sample-peak (identified by @code{SPK}).
  12737. @item true
  12738. Enable true-peak mode.
  12739. If enabled, the peak lookup is done on an over-sampled version of the input
  12740. stream for better peak accuracy. It logs a message for true-peak.
  12741. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12742. This mode requires a build with @code{libswresample}.
  12743. @end table
  12744. @item dualmono
  12745. Treat mono input files as "dual mono". If a mono file is intended for playback
  12746. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12747. If set to @code{true}, this option will compensate for this effect.
  12748. Multi-channel input files are not affected by this option.
  12749. @item panlaw
  12750. Set a specific pan law to be used for the measurement of dual mono files.
  12751. This parameter is optional, and has a default value of -3.01dB.
  12752. @end table
  12753. @subsection Examples
  12754. @itemize
  12755. @item
  12756. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12757. @example
  12758. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12759. @end example
  12760. @item
  12761. Run an analysis with @command{ffmpeg}:
  12762. @example
  12763. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12764. @end example
  12765. @end itemize
  12766. @section interleave, ainterleave
  12767. Temporally interleave frames from several inputs.
  12768. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12769. These filters read frames from several inputs and send the oldest
  12770. queued frame to the output.
  12771. Input streams must have well defined, monotonically increasing frame
  12772. timestamp values.
  12773. In order to submit one frame to output, these filters need to enqueue
  12774. at least one frame for each input, so they cannot work in case one
  12775. input is not yet terminated and will not receive incoming frames.
  12776. For example consider the case when one input is a @code{select} filter
  12777. which always drops input frames. The @code{interleave} filter will keep
  12778. reading from that input, but it will never be able to send new frames
  12779. to output until the input sends an end-of-stream signal.
  12780. Also, depending on inputs synchronization, the filters will drop
  12781. frames in case one input receives more frames than the other ones, and
  12782. the queue is already filled.
  12783. These filters accept the following options:
  12784. @table @option
  12785. @item nb_inputs, n
  12786. Set the number of different inputs, it is 2 by default.
  12787. @end table
  12788. @subsection Examples
  12789. @itemize
  12790. @item
  12791. Interleave frames belonging to different streams using @command{ffmpeg}:
  12792. @example
  12793. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12794. @end example
  12795. @item
  12796. Add flickering blur effect:
  12797. @example
  12798. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12799. @end example
  12800. @end itemize
  12801. @section metadata, ametadata
  12802. Manipulate frame metadata.
  12803. This filter accepts the following options:
  12804. @table @option
  12805. @item mode
  12806. Set mode of operation of the filter.
  12807. Can be one of the following:
  12808. @table @samp
  12809. @item select
  12810. If both @code{value} and @code{key} is set, select frames
  12811. which have such metadata. If only @code{key} is set, select
  12812. every frame that has such key in metadata.
  12813. @item add
  12814. Add new metadata @code{key} and @code{value}. If key is already available
  12815. do nothing.
  12816. @item modify
  12817. Modify value of already present key.
  12818. @item delete
  12819. If @code{value} is set, delete only keys that have such value.
  12820. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12821. the frame.
  12822. @item print
  12823. Print key and its value if metadata was found. If @code{key} is not set print all
  12824. metadata values available in frame.
  12825. @end table
  12826. @item key
  12827. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12828. @item value
  12829. Set metadata value which will be used. This option is mandatory for
  12830. @code{modify} and @code{add} mode.
  12831. @item function
  12832. Which function to use when comparing metadata value and @code{value}.
  12833. Can be one of following:
  12834. @table @samp
  12835. @item same_str
  12836. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12837. @item starts_with
  12838. Values are interpreted as strings, returns true if metadata value starts with
  12839. the @code{value} option string.
  12840. @item less
  12841. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12842. @item equal
  12843. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12844. @item greater
  12845. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12846. @item expr
  12847. Values are interpreted as floats, returns true if expression from option @code{expr}
  12848. evaluates to true.
  12849. @end table
  12850. @item expr
  12851. Set expression which is used when @code{function} is set to @code{expr}.
  12852. The expression is evaluated through the eval API and can contain the following
  12853. constants:
  12854. @table @option
  12855. @item VALUE1
  12856. Float representation of @code{value} from metadata key.
  12857. @item VALUE2
  12858. Float representation of @code{value} as supplied by user in @code{value} option.
  12859. @end table
  12860. @item file
  12861. If specified in @code{print} mode, output is written to the named file. Instead of
  12862. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12863. for standard output. If @code{file} option is not set, output is written to the log
  12864. with AV_LOG_INFO loglevel.
  12865. @end table
  12866. @subsection Examples
  12867. @itemize
  12868. @item
  12869. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12870. between 0 and 1.
  12871. @example
  12872. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12873. @end example
  12874. @item
  12875. Print silencedetect output to file @file{metadata.txt}.
  12876. @example
  12877. silencedetect,ametadata=mode=print:file=metadata.txt
  12878. @end example
  12879. @item
  12880. Direct all metadata to a pipe with file descriptor 4.
  12881. @example
  12882. metadata=mode=print:file='pipe\:4'
  12883. @end example
  12884. @end itemize
  12885. @section perms, aperms
  12886. Set read/write permissions for the output frames.
  12887. These filters are mainly aimed at developers to test direct path in the
  12888. following filter in the filtergraph.
  12889. The filters accept the following options:
  12890. @table @option
  12891. @item mode
  12892. Select the permissions mode.
  12893. It accepts the following values:
  12894. @table @samp
  12895. @item none
  12896. Do nothing. This is the default.
  12897. @item ro
  12898. Set all the output frames read-only.
  12899. @item rw
  12900. Set all the output frames directly writable.
  12901. @item toggle
  12902. Make the frame read-only if writable, and writable if read-only.
  12903. @item random
  12904. Set each output frame read-only or writable randomly.
  12905. @end table
  12906. @item seed
  12907. Set the seed for the @var{random} mode, must be an integer included between
  12908. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12909. @code{-1}, the filter will try to use a good random seed on a best effort
  12910. basis.
  12911. @end table
  12912. Note: in case of auto-inserted filter between the permission filter and the
  12913. following one, the permission might not be received as expected in that
  12914. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12915. perms/aperms filter can avoid this problem.
  12916. @section realtime, arealtime
  12917. Slow down filtering to match real time approximatively.
  12918. These filters will pause the filtering for a variable amount of time to
  12919. match the output rate with the input timestamps.
  12920. They are similar to the @option{re} option to @code{ffmpeg}.
  12921. They accept the following options:
  12922. @table @option
  12923. @item limit
  12924. Time limit for the pauses. Any pause longer than that will be considered
  12925. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12926. @end table
  12927. @anchor{select}
  12928. @section select, aselect
  12929. Select frames to pass in output.
  12930. This filter accepts the following options:
  12931. @table @option
  12932. @item expr, e
  12933. Set expression, which is evaluated for each input frame.
  12934. If the expression is evaluated to zero, the frame is discarded.
  12935. If the evaluation result is negative or NaN, the frame is sent to the
  12936. first output; otherwise it is sent to the output with index
  12937. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12938. For example a value of @code{1.2} corresponds to the output with index
  12939. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12940. @item outputs, n
  12941. Set the number of outputs. The output to which to send the selected
  12942. frame is based on the result of the evaluation. Default value is 1.
  12943. @end table
  12944. The expression can contain the following constants:
  12945. @table @option
  12946. @item n
  12947. The (sequential) number of the filtered frame, starting from 0.
  12948. @item selected_n
  12949. The (sequential) number of the selected frame, starting from 0.
  12950. @item prev_selected_n
  12951. The sequential number of the last selected frame. It's NAN if undefined.
  12952. @item TB
  12953. The timebase of the input timestamps.
  12954. @item pts
  12955. The PTS (Presentation TimeStamp) of the filtered video frame,
  12956. expressed in @var{TB} units. It's NAN if undefined.
  12957. @item t
  12958. The PTS of the filtered video frame,
  12959. expressed in seconds. It's NAN if undefined.
  12960. @item prev_pts
  12961. The PTS of the previously filtered video frame. It's NAN if undefined.
  12962. @item prev_selected_pts
  12963. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12964. @item prev_selected_t
  12965. The PTS of the last previously selected video frame. It's NAN if undefined.
  12966. @item start_pts
  12967. The PTS of the first video frame in the video. It's NAN if undefined.
  12968. @item start_t
  12969. The time of the first video frame in the video. It's NAN if undefined.
  12970. @item pict_type @emph{(video only)}
  12971. The type of the filtered frame. It can assume one of the following
  12972. values:
  12973. @table @option
  12974. @item I
  12975. @item P
  12976. @item B
  12977. @item S
  12978. @item SI
  12979. @item SP
  12980. @item BI
  12981. @end table
  12982. @item interlace_type @emph{(video only)}
  12983. The frame interlace type. It can assume one of the following values:
  12984. @table @option
  12985. @item PROGRESSIVE
  12986. The frame is progressive (not interlaced).
  12987. @item TOPFIRST
  12988. The frame is top-field-first.
  12989. @item BOTTOMFIRST
  12990. The frame is bottom-field-first.
  12991. @end table
  12992. @item consumed_sample_n @emph{(audio only)}
  12993. the number of selected samples before the current frame
  12994. @item samples_n @emph{(audio only)}
  12995. the number of samples in the current frame
  12996. @item sample_rate @emph{(audio only)}
  12997. the input sample rate
  12998. @item key
  12999. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13000. @item pos
  13001. the position in the file of the filtered frame, -1 if the information
  13002. is not available (e.g. for synthetic video)
  13003. @item scene @emph{(video only)}
  13004. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13005. probability for the current frame to introduce a new scene, while a higher
  13006. value means the current frame is more likely to be one (see the example below)
  13007. @item concatdec_select
  13008. The concat demuxer can select only part of a concat input file by setting an
  13009. inpoint and an outpoint, but the output packets may not be entirely contained
  13010. in the selected interval. By using this variable, it is possible to skip frames
  13011. generated by the concat demuxer which are not exactly contained in the selected
  13012. interval.
  13013. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13014. and the @var{lavf.concat.duration} packet metadata values which are also
  13015. present in the decoded frames.
  13016. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13017. start_time and either the duration metadata is missing or the frame pts is less
  13018. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13019. missing.
  13020. That basically means that an input frame is selected if its pts is within the
  13021. interval set by the concat demuxer.
  13022. @end table
  13023. The default value of the select expression is "1".
  13024. @subsection Examples
  13025. @itemize
  13026. @item
  13027. Select all frames in input:
  13028. @example
  13029. select
  13030. @end example
  13031. The example above is the same as:
  13032. @example
  13033. select=1
  13034. @end example
  13035. @item
  13036. Skip all frames:
  13037. @example
  13038. select=0
  13039. @end example
  13040. @item
  13041. Select only I-frames:
  13042. @example
  13043. select='eq(pict_type\,I)'
  13044. @end example
  13045. @item
  13046. Select one frame every 100:
  13047. @example
  13048. select='not(mod(n\,100))'
  13049. @end example
  13050. @item
  13051. Select only frames contained in the 10-20 time interval:
  13052. @example
  13053. select=between(t\,10\,20)
  13054. @end example
  13055. @item
  13056. Select only I-frames contained in the 10-20 time interval:
  13057. @example
  13058. select=between(t\,10\,20)*eq(pict_type\,I)
  13059. @end example
  13060. @item
  13061. Select frames with a minimum distance of 10 seconds:
  13062. @example
  13063. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13064. @end example
  13065. @item
  13066. Use aselect to select only audio frames with samples number > 100:
  13067. @example
  13068. aselect='gt(samples_n\,100)'
  13069. @end example
  13070. @item
  13071. Create a mosaic of the first scenes:
  13072. @example
  13073. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13074. @end example
  13075. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13076. choice.
  13077. @item
  13078. Send even and odd frames to separate outputs, and compose them:
  13079. @example
  13080. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13081. @end example
  13082. @item
  13083. Select useful frames from an ffconcat file which is using inpoints and
  13084. outpoints but where the source files are not intra frame only.
  13085. @example
  13086. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13087. @end example
  13088. @end itemize
  13089. @section sendcmd, asendcmd
  13090. Send commands to filters in the filtergraph.
  13091. These filters read commands to be sent to other filters in the
  13092. filtergraph.
  13093. @code{sendcmd} must be inserted between two video filters,
  13094. @code{asendcmd} must be inserted between two audio filters, but apart
  13095. from that they act the same way.
  13096. The specification of commands can be provided in the filter arguments
  13097. with the @var{commands} option, or in a file specified by the
  13098. @var{filename} option.
  13099. These filters accept the following options:
  13100. @table @option
  13101. @item commands, c
  13102. Set the commands to be read and sent to the other filters.
  13103. @item filename, f
  13104. Set the filename of the commands to be read and sent to the other
  13105. filters.
  13106. @end table
  13107. @subsection Commands syntax
  13108. A commands description consists of a sequence of interval
  13109. specifications, comprising a list of commands to be executed when a
  13110. particular event related to that interval occurs. The occurring event
  13111. is typically the current frame time entering or leaving a given time
  13112. interval.
  13113. An interval is specified by the following syntax:
  13114. @example
  13115. @var{START}[-@var{END}] @var{COMMANDS};
  13116. @end example
  13117. The time interval is specified by the @var{START} and @var{END} times.
  13118. @var{END} is optional and defaults to the maximum time.
  13119. The current frame time is considered within the specified interval if
  13120. it is included in the interval [@var{START}, @var{END}), that is when
  13121. the time is greater or equal to @var{START} and is lesser than
  13122. @var{END}.
  13123. @var{COMMANDS} consists of a sequence of one or more command
  13124. specifications, separated by ",", relating to that interval. The
  13125. syntax of a command specification is given by:
  13126. @example
  13127. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13128. @end example
  13129. @var{FLAGS} is optional and specifies the type of events relating to
  13130. the time interval which enable sending the specified command, and must
  13131. be a non-null sequence of identifier flags separated by "+" or "|" and
  13132. enclosed between "[" and "]".
  13133. The following flags are recognized:
  13134. @table @option
  13135. @item enter
  13136. The command is sent when the current frame timestamp enters the
  13137. specified interval. In other words, the command is sent when the
  13138. previous frame timestamp was not in the given interval, and the
  13139. current is.
  13140. @item leave
  13141. The command is sent when the current frame timestamp leaves the
  13142. specified interval. In other words, the command is sent when the
  13143. previous frame timestamp was in the given interval, and the
  13144. current is not.
  13145. @end table
  13146. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13147. assumed.
  13148. @var{TARGET} specifies the target of the command, usually the name of
  13149. the filter class or a specific filter instance name.
  13150. @var{COMMAND} specifies the name of the command for the target filter.
  13151. @var{ARG} is optional and specifies the optional list of argument for
  13152. the given @var{COMMAND}.
  13153. Between one interval specification and another, whitespaces, or
  13154. sequences of characters starting with @code{#} until the end of line,
  13155. are ignored and can be used to annotate comments.
  13156. A simplified BNF description of the commands specification syntax
  13157. follows:
  13158. @example
  13159. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13160. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13161. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13162. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13163. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13164. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13165. @end example
  13166. @subsection Examples
  13167. @itemize
  13168. @item
  13169. Specify audio tempo change at second 4:
  13170. @example
  13171. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13172. @end example
  13173. @item
  13174. Target a specific filter instance:
  13175. @example
  13176. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13177. @end example
  13178. @item
  13179. Specify a list of drawtext and hue commands in a file.
  13180. @example
  13181. # show text in the interval 5-10
  13182. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13183. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13184. # desaturate the image in the interval 15-20
  13185. 15.0-20.0 [enter] hue s 0,
  13186. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13187. [leave] hue s 1,
  13188. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13189. # apply an exponential saturation fade-out effect, starting from time 25
  13190. 25 [enter] hue s exp(25-t)
  13191. @end example
  13192. A filtergraph allowing to read and process the above command list
  13193. stored in a file @file{test.cmd}, can be specified with:
  13194. @example
  13195. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13196. @end example
  13197. @end itemize
  13198. @anchor{setpts}
  13199. @section setpts, asetpts
  13200. Change the PTS (presentation timestamp) of the input frames.
  13201. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13202. This filter accepts the following options:
  13203. @table @option
  13204. @item expr
  13205. The expression which is evaluated for each frame to construct its timestamp.
  13206. @end table
  13207. The expression is evaluated through the eval API and can contain the following
  13208. constants:
  13209. @table @option
  13210. @item FRAME_RATE
  13211. frame rate, only defined for constant frame-rate video
  13212. @item PTS
  13213. The presentation timestamp in input
  13214. @item N
  13215. The count of the input frame for video or the number of consumed samples,
  13216. not including the current frame for audio, starting from 0.
  13217. @item NB_CONSUMED_SAMPLES
  13218. The number of consumed samples, not including the current frame (only
  13219. audio)
  13220. @item NB_SAMPLES, S
  13221. The number of samples in the current frame (only audio)
  13222. @item SAMPLE_RATE, SR
  13223. The audio sample rate.
  13224. @item STARTPTS
  13225. The PTS of the first frame.
  13226. @item STARTT
  13227. the time in seconds of the first frame
  13228. @item INTERLACED
  13229. State whether the current frame is interlaced.
  13230. @item T
  13231. the time in seconds of the current frame
  13232. @item POS
  13233. original position in the file of the frame, or undefined if undefined
  13234. for the current frame
  13235. @item PREV_INPTS
  13236. The previous input PTS.
  13237. @item PREV_INT
  13238. previous input time in seconds
  13239. @item PREV_OUTPTS
  13240. The previous output PTS.
  13241. @item PREV_OUTT
  13242. previous output time in seconds
  13243. @item RTCTIME
  13244. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13245. instead.
  13246. @item RTCSTART
  13247. The wallclock (RTC) time at the start of the movie in microseconds.
  13248. @item TB
  13249. The timebase of the input timestamps.
  13250. @end table
  13251. @subsection Examples
  13252. @itemize
  13253. @item
  13254. Start counting PTS from zero
  13255. @example
  13256. setpts=PTS-STARTPTS
  13257. @end example
  13258. @item
  13259. Apply fast motion effect:
  13260. @example
  13261. setpts=0.5*PTS
  13262. @end example
  13263. @item
  13264. Apply slow motion effect:
  13265. @example
  13266. setpts=2.0*PTS
  13267. @end example
  13268. @item
  13269. Set fixed rate of 25 frames per second:
  13270. @example
  13271. setpts=N/(25*TB)
  13272. @end example
  13273. @item
  13274. Set fixed rate 25 fps with some jitter:
  13275. @example
  13276. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13277. @end example
  13278. @item
  13279. Apply an offset of 10 seconds to the input PTS:
  13280. @example
  13281. setpts=PTS+10/TB
  13282. @end example
  13283. @item
  13284. Generate timestamps from a "live source" and rebase onto the current timebase:
  13285. @example
  13286. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13287. @end example
  13288. @item
  13289. Generate timestamps by counting samples:
  13290. @example
  13291. asetpts=N/SR/TB
  13292. @end example
  13293. @end itemize
  13294. @section settb, asettb
  13295. Set the timebase to use for the output frames timestamps.
  13296. It is mainly useful for testing timebase configuration.
  13297. It accepts the following parameters:
  13298. @table @option
  13299. @item expr, tb
  13300. The expression which is evaluated into the output timebase.
  13301. @end table
  13302. The value for @option{tb} is an arithmetic expression representing a
  13303. rational. The expression can contain the constants "AVTB" (the default
  13304. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13305. audio only). Default value is "intb".
  13306. @subsection Examples
  13307. @itemize
  13308. @item
  13309. Set the timebase to 1/25:
  13310. @example
  13311. settb=expr=1/25
  13312. @end example
  13313. @item
  13314. Set the timebase to 1/10:
  13315. @example
  13316. settb=expr=0.1
  13317. @end example
  13318. @item
  13319. Set the timebase to 1001/1000:
  13320. @example
  13321. settb=1+0.001
  13322. @end example
  13323. @item
  13324. Set the timebase to 2*intb:
  13325. @example
  13326. settb=2*intb
  13327. @end example
  13328. @item
  13329. Set the default timebase value:
  13330. @example
  13331. settb=AVTB
  13332. @end example
  13333. @end itemize
  13334. @section showcqt
  13335. Convert input audio to a video output representing frequency spectrum
  13336. logarithmically using Brown-Puckette constant Q transform algorithm with
  13337. direct frequency domain coefficient calculation (but the transform itself
  13338. is not really constant Q, instead the Q factor is actually variable/clamped),
  13339. with musical tone scale, from E0 to D#10.
  13340. The filter accepts the following options:
  13341. @table @option
  13342. @item size, s
  13343. Specify the video size for the output. It must be even. For the syntax of this option,
  13344. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13345. Default value is @code{1920x1080}.
  13346. @item fps, rate, r
  13347. Set the output frame rate. Default value is @code{25}.
  13348. @item bar_h
  13349. Set the bargraph height. It must be even. Default value is @code{-1} which
  13350. computes the bargraph height automatically.
  13351. @item axis_h
  13352. Set the axis height. It must be even. Default value is @code{-1} which computes
  13353. the axis height automatically.
  13354. @item sono_h
  13355. Set the sonogram height. It must be even. Default value is @code{-1} which
  13356. computes the sonogram height automatically.
  13357. @item fullhd
  13358. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13359. instead. Default value is @code{1}.
  13360. @item sono_v, volume
  13361. Specify the sonogram volume expression. It can contain variables:
  13362. @table @option
  13363. @item bar_v
  13364. the @var{bar_v} evaluated expression
  13365. @item frequency, freq, f
  13366. the frequency where it is evaluated
  13367. @item timeclamp, tc
  13368. the value of @var{timeclamp} option
  13369. @end table
  13370. and functions:
  13371. @table @option
  13372. @item a_weighting(f)
  13373. A-weighting of equal loudness
  13374. @item b_weighting(f)
  13375. B-weighting of equal loudness
  13376. @item c_weighting(f)
  13377. C-weighting of equal loudness.
  13378. @end table
  13379. Default value is @code{16}.
  13380. @item bar_v, volume2
  13381. Specify the bargraph volume expression. It can contain variables:
  13382. @table @option
  13383. @item sono_v
  13384. the @var{sono_v} evaluated expression
  13385. @item frequency, freq, f
  13386. the frequency where it is evaluated
  13387. @item timeclamp, tc
  13388. the value of @var{timeclamp} option
  13389. @end table
  13390. and functions:
  13391. @table @option
  13392. @item a_weighting(f)
  13393. A-weighting of equal loudness
  13394. @item b_weighting(f)
  13395. B-weighting of equal loudness
  13396. @item c_weighting(f)
  13397. C-weighting of equal loudness.
  13398. @end table
  13399. Default value is @code{sono_v}.
  13400. @item sono_g, gamma
  13401. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13402. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13403. Acceptable range is @code{[1, 7]}.
  13404. @item bar_g, gamma2
  13405. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13406. @code{[1, 7]}.
  13407. @item bar_t
  13408. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13409. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13410. @item timeclamp, tc
  13411. Specify the transform timeclamp. At low frequency, there is trade-off between
  13412. accuracy in time domain and frequency domain. If timeclamp is lower,
  13413. event in time domain is represented more accurately (such as fast bass drum),
  13414. otherwise event in frequency domain is represented more accurately
  13415. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13416. @item attack
  13417. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13418. limits future samples by applying asymmetric windowing in time domain, useful
  13419. when low latency is required. Accepted range is @code{[0, 1]}.
  13420. @item basefreq
  13421. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13422. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13423. @item endfreq
  13424. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13425. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13426. @item coeffclamp
  13427. This option is deprecated and ignored.
  13428. @item tlength
  13429. Specify the transform length in time domain. Use this option to control accuracy
  13430. trade-off between time domain and frequency domain at every frequency sample.
  13431. It can contain variables:
  13432. @table @option
  13433. @item frequency, freq, f
  13434. the frequency where it is evaluated
  13435. @item timeclamp, tc
  13436. the value of @var{timeclamp} option.
  13437. @end table
  13438. Default value is @code{384*tc/(384+tc*f)}.
  13439. @item count
  13440. Specify the transform count for every video frame. Default value is @code{6}.
  13441. Acceptable range is @code{[1, 30]}.
  13442. @item fcount
  13443. Specify the transform count for every single pixel. Default value is @code{0},
  13444. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13445. @item fontfile
  13446. Specify font file for use with freetype to draw the axis. If not specified,
  13447. use embedded font. Note that drawing with font file or embedded font is not
  13448. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13449. option instead.
  13450. @item font
  13451. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13452. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13453. @item fontcolor
  13454. Specify font color expression. This is arithmetic expression that should return
  13455. integer value 0xRRGGBB. It can contain variables:
  13456. @table @option
  13457. @item frequency, freq, f
  13458. the frequency where it is evaluated
  13459. @item timeclamp, tc
  13460. the value of @var{timeclamp} option
  13461. @end table
  13462. and functions:
  13463. @table @option
  13464. @item midi(f)
  13465. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13466. @item r(x), g(x), b(x)
  13467. red, green, and blue value of intensity x.
  13468. @end table
  13469. Default value is @code{st(0, (midi(f)-59.5)/12);
  13470. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13471. r(1-ld(1)) + b(ld(1))}.
  13472. @item axisfile
  13473. Specify image file to draw the axis. This option override @var{fontfile} and
  13474. @var{fontcolor} option.
  13475. @item axis, text
  13476. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13477. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13478. Default value is @code{1}.
  13479. @item csp
  13480. Set colorspace. The accepted values are:
  13481. @table @samp
  13482. @item unspecified
  13483. Unspecified (default)
  13484. @item bt709
  13485. BT.709
  13486. @item fcc
  13487. FCC
  13488. @item bt470bg
  13489. BT.470BG or BT.601-6 625
  13490. @item smpte170m
  13491. SMPTE-170M or BT.601-6 525
  13492. @item smpte240m
  13493. SMPTE-240M
  13494. @item bt2020ncl
  13495. BT.2020 with non-constant luminance
  13496. @end table
  13497. @item cscheme
  13498. Set spectrogram color scheme. This is list of floating point values with format
  13499. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13500. The default is @code{1|0.5|0|0|0.5|1}.
  13501. @end table
  13502. @subsection Examples
  13503. @itemize
  13504. @item
  13505. Playing audio while showing the spectrum:
  13506. @example
  13507. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13508. @end example
  13509. @item
  13510. Same as above, but with frame rate 30 fps:
  13511. @example
  13512. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13513. @end example
  13514. @item
  13515. Playing at 1280x720:
  13516. @example
  13517. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13518. @end example
  13519. @item
  13520. Disable sonogram display:
  13521. @example
  13522. sono_h=0
  13523. @end example
  13524. @item
  13525. A1 and its harmonics: A1, A2, (near)E3, A3:
  13526. @example
  13527. 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),
  13528. asplit[a][out1]; [a] showcqt [out0]'
  13529. @end example
  13530. @item
  13531. Same as above, but with more accuracy in frequency domain:
  13532. @example
  13533. 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),
  13534. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13535. @end example
  13536. @item
  13537. Custom volume:
  13538. @example
  13539. bar_v=10:sono_v=bar_v*a_weighting(f)
  13540. @end example
  13541. @item
  13542. Custom gamma, now spectrum is linear to the amplitude.
  13543. @example
  13544. bar_g=2:sono_g=2
  13545. @end example
  13546. @item
  13547. Custom tlength equation:
  13548. @example
  13549. 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)))'
  13550. @end example
  13551. @item
  13552. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13553. @example
  13554. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13555. @end example
  13556. @item
  13557. Custom font using fontconfig:
  13558. @example
  13559. font='Courier New,Monospace,mono|bold'
  13560. @end example
  13561. @item
  13562. Custom frequency range with custom axis using image file:
  13563. @example
  13564. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13565. @end example
  13566. @end itemize
  13567. @section showfreqs
  13568. Convert input audio to video output representing the audio power spectrum.
  13569. Audio amplitude is on Y-axis while frequency is on X-axis.
  13570. The filter accepts the following options:
  13571. @table @option
  13572. @item size, s
  13573. Specify size of video. For the syntax of this option, check the
  13574. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13575. Default is @code{1024x512}.
  13576. @item mode
  13577. Set display mode.
  13578. This set how each frequency bin will be represented.
  13579. It accepts the following values:
  13580. @table @samp
  13581. @item line
  13582. @item bar
  13583. @item dot
  13584. @end table
  13585. Default is @code{bar}.
  13586. @item ascale
  13587. Set amplitude scale.
  13588. It accepts the following values:
  13589. @table @samp
  13590. @item lin
  13591. Linear scale.
  13592. @item sqrt
  13593. Square root scale.
  13594. @item cbrt
  13595. Cubic root scale.
  13596. @item log
  13597. Logarithmic scale.
  13598. @end table
  13599. Default is @code{log}.
  13600. @item fscale
  13601. Set frequency scale.
  13602. It accepts the following values:
  13603. @table @samp
  13604. @item lin
  13605. Linear scale.
  13606. @item log
  13607. Logarithmic scale.
  13608. @item rlog
  13609. Reverse logarithmic scale.
  13610. @end table
  13611. Default is @code{lin}.
  13612. @item win_size
  13613. Set window size.
  13614. It accepts the following values:
  13615. @table @samp
  13616. @item w16
  13617. @item w32
  13618. @item w64
  13619. @item w128
  13620. @item w256
  13621. @item w512
  13622. @item w1024
  13623. @item w2048
  13624. @item w4096
  13625. @item w8192
  13626. @item w16384
  13627. @item w32768
  13628. @item w65536
  13629. @end table
  13630. Default is @code{w2048}
  13631. @item win_func
  13632. Set windowing function.
  13633. It accepts the following values:
  13634. @table @samp
  13635. @item rect
  13636. @item bartlett
  13637. @item hanning
  13638. @item hamming
  13639. @item blackman
  13640. @item welch
  13641. @item flattop
  13642. @item bharris
  13643. @item bnuttall
  13644. @item bhann
  13645. @item sine
  13646. @item nuttall
  13647. @item lanczos
  13648. @item gauss
  13649. @item tukey
  13650. @item dolph
  13651. @item cauchy
  13652. @item parzen
  13653. @item poisson
  13654. @end table
  13655. Default is @code{hanning}.
  13656. @item overlap
  13657. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13658. which means optimal overlap for selected window function will be picked.
  13659. @item averaging
  13660. Set time averaging. Setting this to 0 will display current maximal peaks.
  13661. Default is @code{1}, which means time averaging is disabled.
  13662. @item colors
  13663. Specify list of colors separated by space or by '|' which will be used to
  13664. draw channel frequencies. Unrecognized or missing colors will be replaced
  13665. by white color.
  13666. @item cmode
  13667. Set channel display mode.
  13668. It accepts the following values:
  13669. @table @samp
  13670. @item combined
  13671. @item separate
  13672. @end table
  13673. Default is @code{combined}.
  13674. @item minamp
  13675. Set minimum amplitude used in @code{log} amplitude scaler.
  13676. @end table
  13677. @anchor{showspectrum}
  13678. @section showspectrum
  13679. Convert input audio to a video output, representing the audio frequency
  13680. spectrum.
  13681. The filter accepts the following options:
  13682. @table @option
  13683. @item size, s
  13684. Specify the video size for the output. For the syntax of this option, check the
  13685. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13686. Default value is @code{640x512}.
  13687. @item slide
  13688. Specify how the spectrum should slide along the window.
  13689. It accepts the following values:
  13690. @table @samp
  13691. @item replace
  13692. the samples start again on the left when they reach the right
  13693. @item scroll
  13694. the samples scroll from right to left
  13695. @item fullframe
  13696. frames are only produced when the samples reach the right
  13697. @item rscroll
  13698. the samples scroll from left to right
  13699. @end table
  13700. Default value is @code{replace}.
  13701. @item mode
  13702. Specify display mode.
  13703. It accepts the following values:
  13704. @table @samp
  13705. @item combined
  13706. all channels are displayed in the same row
  13707. @item separate
  13708. all channels are displayed in separate rows
  13709. @end table
  13710. Default value is @samp{combined}.
  13711. @item color
  13712. Specify display color mode.
  13713. It accepts the following values:
  13714. @table @samp
  13715. @item channel
  13716. each channel is displayed in a separate color
  13717. @item intensity
  13718. each channel is displayed using the same color scheme
  13719. @item rainbow
  13720. each channel is displayed using the rainbow color scheme
  13721. @item moreland
  13722. each channel is displayed using the moreland color scheme
  13723. @item nebulae
  13724. each channel is displayed using the nebulae color scheme
  13725. @item fire
  13726. each channel is displayed using the fire color scheme
  13727. @item fiery
  13728. each channel is displayed using the fiery color scheme
  13729. @item fruit
  13730. each channel is displayed using the fruit color scheme
  13731. @item cool
  13732. each channel is displayed using the cool color scheme
  13733. @end table
  13734. Default value is @samp{channel}.
  13735. @item scale
  13736. Specify scale used for calculating intensity color values.
  13737. It accepts the following values:
  13738. @table @samp
  13739. @item lin
  13740. linear
  13741. @item sqrt
  13742. square root, default
  13743. @item cbrt
  13744. cubic root
  13745. @item log
  13746. logarithmic
  13747. @item 4thrt
  13748. 4th root
  13749. @item 5thrt
  13750. 5th root
  13751. @end table
  13752. Default value is @samp{sqrt}.
  13753. @item saturation
  13754. Set saturation modifier for displayed colors. Negative values provide
  13755. alternative color scheme. @code{0} is no saturation at all.
  13756. Saturation must be in [-10.0, 10.0] range.
  13757. Default value is @code{1}.
  13758. @item win_func
  13759. Set window function.
  13760. It accepts the following values:
  13761. @table @samp
  13762. @item rect
  13763. @item bartlett
  13764. @item hann
  13765. @item hanning
  13766. @item hamming
  13767. @item blackman
  13768. @item welch
  13769. @item flattop
  13770. @item bharris
  13771. @item bnuttall
  13772. @item bhann
  13773. @item sine
  13774. @item nuttall
  13775. @item lanczos
  13776. @item gauss
  13777. @item tukey
  13778. @item dolph
  13779. @item cauchy
  13780. @item parzen
  13781. @item poisson
  13782. @end table
  13783. Default value is @code{hann}.
  13784. @item orientation
  13785. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13786. @code{horizontal}. Default is @code{vertical}.
  13787. @item overlap
  13788. Set ratio of overlap window. Default value is @code{0}.
  13789. When value is @code{1} overlap is set to recommended size for specific
  13790. window function currently used.
  13791. @item gain
  13792. Set scale gain for calculating intensity color values.
  13793. Default value is @code{1}.
  13794. @item data
  13795. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13796. @item rotation
  13797. Set color rotation, must be in [-1.0, 1.0] range.
  13798. Default value is @code{0}.
  13799. @end table
  13800. The usage is very similar to the showwaves filter; see the examples in that
  13801. section.
  13802. @subsection Examples
  13803. @itemize
  13804. @item
  13805. Large window with logarithmic color scaling:
  13806. @example
  13807. showspectrum=s=1280x480:scale=log
  13808. @end example
  13809. @item
  13810. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13811. @example
  13812. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13813. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13814. @end example
  13815. @end itemize
  13816. @section showspectrumpic
  13817. Convert input audio to a single video frame, representing the audio frequency
  13818. spectrum.
  13819. The filter accepts the following options:
  13820. @table @option
  13821. @item size, s
  13822. Specify the video size for the output. For the syntax of this option, check the
  13823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13824. Default value is @code{4096x2048}.
  13825. @item mode
  13826. Specify display mode.
  13827. It accepts the following values:
  13828. @table @samp
  13829. @item combined
  13830. all channels are displayed in the same row
  13831. @item separate
  13832. all channels are displayed in separate rows
  13833. @end table
  13834. Default value is @samp{combined}.
  13835. @item color
  13836. Specify display color mode.
  13837. It accepts the following values:
  13838. @table @samp
  13839. @item channel
  13840. each channel is displayed in a separate color
  13841. @item intensity
  13842. each channel is displayed using the same color scheme
  13843. @item rainbow
  13844. each channel is displayed using the rainbow color scheme
  13845. @item moreland
  13846. each channel is displayed using the moreland color scheme
  13847. @item nebulae
  13848. each channel is displayed using the nebulae color scheme
  13849. @item fire
  13850. each channel is displayed using the fire color scheme
  13851. @item fiery
  13852. each channel is displayed using the fiery color scheme
  13853. @item fruit
  13854. each channel is displayed using the fruit color scheme
  13855. @item cool
  13856. each channel is displayed using the cool color scheme
  13857. @end table
  13858. Default value is @samp{intensity}.
  13859. @item scale
  13860. Specify scale used for calculating intensity color values.
  13861. It accepts the following values:
  13862. @table @samp
  13863. @item lin
  13864. linear
  13865. @item sqrt
  13866. square root, default
  13867. @item cbrt
  13868. cubic root
  13869. @item log
  13870. logarithmic
  13871. @item 4thrt
  13872. 4th root
  13873. @item 5thrt
  13874. 5th root
  13875. @end table
  13876. Default value is @samp{log}.
  13877. @item saturation
  13878. Set saturation modifier for displayed colors. Negative values provide
  13879. alternative color scheme. @code{0} is no saturation at all.
  13880. Saturation must be in [-10.0, 10.0] range.
  13881. Default value is @code{1}.
  13882. @item win_func
  13883. Set window function.
  13884. It accepts the following values:
  13885. @table @samp
  13886. @item rect
  13887. @item bartlett
  13888. @item hann
  13889. @item hanning
  13890. @item hamming
  13891. @item blackman
  13892. @item welch
  13893. @item flattop
  13894. @item bharris
  13895. @item bnuttall
  13896. @item bhann
  13897. @item sine
  13898. @item nuttall
  13899. @item lanczos
  13900. @item gauss
  13901. @item tukey
  13902. @item dolph
  13903. @item cauchy
  13904. @item parzen
  13905. @item poisson
  13906. @end table
  13907. Default value is @code{hann}.
  13908. @item orientation
  13909. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13910. @code{horizontal}. Default is @code{vertical}.
  13911. @item gain
  13912. Set scale gain for calculating intensity color values.
  13913. Default value is @code{1}.
  13914. @item legend
  13915. Draw time and frequency axes and legends. Default is enabled.
  13916. @item rotation
  13917. Set color rotation, must be in [-1.0, 1.0] range.
  13918. Default value is @code{0}.
  13919. @end table
  13920. @subsection Examples
  13921. @itemize
  13922. @item
  13923. Extract an audio spectrogram of a whole audio track
  13924. in a 1024x1024 picture using @command{ffmpeg}:
  13925. @example
  13926. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13927. @end example
  13928. @end itemize
  13929. @section showvolume
  13930. Convert input audio volume to a video output.
  13931. The filter accepts the following options:
  13932. @table @option
  13933. @item rate, r
  13934. Set video rate.
  13935. @item b
  13936. Set border width, allowed range is [0, 5]. Default is 1.
  13937. @item w
  13938. Set channel width, allowed range is [80, 8192]. Default is 400.
  13939. @item h
  13940. Set channel height, allowed range is [1, 900]. Default is 20.
  13941. @item f
  13942. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13943. @item c
  13944. Set volume color expression.
  13945. The expression can use the following variables:
  13946. @table @option
  13947. @item VOLUME
  13948. Current max volume of channel in dB.
  13949. @item PEAK
  13950. Current peak.
  13951. @item CHANNEL
  13952. Current channel number, starting from 0.
  13953. @end table
  13954. @item t
  13955. If set, displays channel names. Default is enabled.
  13956. @item v
  13957. If set, displays volume values. Default is enabled.
  13958. @item o
  13959. Set orientation, can be @code{horizontal} or @code{vertical},
  13960. default is @code{horizontal}.
  13961. @item s
  13962. Set step size, allowed range s [0, 5]. Default is 0, which means
  13963. step is disabled.
  13964. @end table
  13965. @section showwaves
  13966. Convert input audio to a video output, representing the samples waves.
  13967. The filter accepts the following options:
  13968. @table @option
  13969. @item size, s
  13970. Specify the video size for the output. For the syntax of this option, check the
  13971. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13972. Default value is @code{600x240}.
  13973. @item mode
  13974. Set display mode.
  13975. Available values are:
  13976. @table @samp
  13977. @item point
  13978. Draw a point for each sample.
  13979. @item line
  13980. Draw a vertical line for each sample.
  13981. @item p2p
  13982. Draw a point for each sample and a line between them.
  13983. @item cline
  13984. Draw a centered vertical line for each sample.
  13985. @end table
  13986. Default value is @code{point}.
  13987. @item n
  13988. Set the number of samples which are printed on the same column. A
  13989. larger value will decrease the frame rate. Must be a positive
  13990. integer. This option can be set only if the value for @var{rate}
  13991. is not explicitly specified.
  13992. @item rate, r
  13993. Set the (approximate) output frame rate. This is done by setting the
  13994. option @var{n}. Default value is "25".
  13995. @item split_channels
  13996. Set if channels should be drawn separately or overlap. Default value is 0.
  13997. @item colors
  13998. Set colors separated by '|' which are going to be used for drawing of each channel.
  13999. @item scale
  14000. Set amplitude scale.
  14001. Available values are:
  14002. @table @samp
  14003. @item lin
  14004. Linear.
  14005. @item log
  14006. Logarithmic.
  14007. @item sqrt
  14008. Square root.
  14009. @item cbrt
  14010. Cubic root.
  14011. @end table
  14012. Default is linear.
  14013. @end table
  14014. @subsection Examples
  14015. @itemize
  14016. @item
  14017. Output the input file audio and the corresponding video representation
  14018. at the same time:
  14019. @example
  14020. amovie=a.mp3,asplit[out0],showwaves[out1]
  14021. @end example
  14022. @item
  14023. Create a synthetic signal and show it with showwaves, forcing a
  14024. frame rate of 30 frames per second:
  14025. @example
  14026. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14027. @end example
  14028. @end itemize
  14029. @section showwavespic
  14030. Convert input audio to a single video frame, representing the samples waves.
  14031. The filter accepts the following options:
  14032. @table @option
  14033. @item size, s
  14034. Specify the video size for the output. For the syntax of this option, check the
  14035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14036. Default value is @code{600x240}.
  14037. @item split_channels
  14038. Set if channels should be drawn separately or overlap. Default value is 0.
  14039. @item colors
  14040. Set colors separated by '|' which are going to be used for drawing of each channel.
  14041. @item scale
  14042. Set amplitude scale.
  14043. Available values are:
  14044. @table @samp
  14045. @item lin
  14046. Linear.
  14047. @item log
  14048. Logarithmic.
  14049. @item sqrt
  14050. Square root.
  14051. @item cbrt
  14052. Cubic root.
  14053. @end table
  14054. Default is linear.
  14055. @end table
  14056. @subsection Examples
  14057. @itemize
  14058. @item
  14059. Extract a channel split representation of the wave form of a whole audio track
  14060. in a 1024x800 picture using @command{ffmpeg}:
  14061. @example
  14062. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14063. @end example
  14064. @end itemize
  14065. @section sidedata, asidedata
  14066. Delete frame side data, or select frames based on it.
  14067. This filter accepts the following options:
  14068. @table @option
  14069. @item mode
  14070. Set mode of operation of the filter.
  14071. Can be one of the following:
  14072. @table @samp
  14073. @item select
  14074. Select every frame with side data of @code{type}.
  14075. @item delete
  14076. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14077. data in the frame.
  14078. @end table
  14079. @item type
  14080. Set side data type used with all modes. Must be set for @code{select} mode. For
  14081. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14082. in @file{libavutil/frame.h}. For example, to choose
  14083. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14084. @end table
  14085. @section spectrumsynth
  14086. Sythesize audio from 2 input video spectrums, first input stream represents
  14087. magnitude across time and second represents phase across time.
  14088. The filter will transform from frequency domain as displayed in videos back
  14089. to time domain as presented in audio output.
  14090. This filter is primarily created for reversing processed @ref{showspectrum}
  14091. filter outputs, but can synthesize sound from other spectrograms too.
  14092. But in such case results are going to be poor if the phase data is not
  14093. available, because in such cases phase data need to be recreated, usually
  14094. its just recreated from random noise.
  14095. For best results use gray only output (@code{channel} color mode in
  14096. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14097. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14098. @code{data} option. Inputs videos should generally use @code{fullframe}
  14099. slide mode as that saves resources needed for decoding video.
  14100. The filter accepts the following options:
  14101. @table @option
  14102. @item sample_rate
  14103. Specify sample rate of output audio, the sample rate of audio from which
  14104. spectrum was generated may differ.
  14105. @item channels
  14106. Set number of channels represented in input video spectrums.
  14107. @item scale
  14108. Set scale which was used when generating magnitude input spectrum.
  14109. Can be @code{lin} or @code{log}. Default is @code{log}.
  14110. @item slide
  14111. Set slide which was used when generating inputs spectrums.
  14112. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14113. Default is @code{fullframe}.
  14114. @item win_func
  14115. Set window function used for resynthesis.
  14116. @item overlap
  14117. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14118. which means optimal overlap for selected window function will be picked.
  14119. @item orientation
  14120. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14121. Default is @code{vertical}.
  14122. @end table
  14123. @subsection Examples
  14124. @itemize
  14125. @item
  14126. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14127. then resynthesize videos back to audio with spectrumsynth:
  14128. @example
  14129. 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
  14130. 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
  14131. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14132. @end example
  14133. @end itemize
  14134. @section split, asplit
  14135. Split input into several identical outputs.
  14136. @code{asplit} works with audio input, @code{split} with video.
  14137. The filter accepts a single parameter which specifies the number of outputs. If
  14138. unspecified, it defaults to 2.
  14139. @subsection Examples
  14140. @itemize
  14141. @item
  14142. Create two separate outputs from the same input:
  14143. @example
  14144. [in] split [out0][out1]
  14145. @end example
  14146. @item
  14147. To create 3 or more outputs, you need to specify the number of
  14148. outputs, like in:
  14149. @example
  14150. [in] asplit=3 [out0][out1][out2]
  14151. @end example
  14152. @item
  14153. Create two separate outputs from the same input, one cropped and
  14154. one padded:
  14155. @example
  14156. [in] split [splitout1][splitout2];
  14157. [splitout1] crop=100:100:0:0 [cropout];
  14158. [splitout2] pad=200:200:100:100 [padout];
  14159. @end example
  14160. @item
  14161. Create 5 copies of the input audio with @command{ffmpeg}:
  14162. @example
  14163. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14164. @end example
  14165. @end itemize
  14166. @section zmq, azmq
  14167. Receive commands sent through a libzmq client, and forward them to
  14168. filters in the filtergraph.
  14169. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14170. must be inserted between two video filters, @code{azmq} between two
  14171. audio filters.
  14172. To enable these filters you need to install the libzmq library and
  14173. headers and configure FFmpeg with @code{--enable-libzmq}.
  14174. For more information about libzmq see:
  14175. @url{http://www.zeromq.org/}
  14176. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14177. receives messages sent through a network interface defined by the
  14178. @option{bind_address} option.
  14179. The received message must be in the form:
  14180. @example
  14181. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14182. @end example
  14183. @var{TARGET} specifies the target of the command, usually the name of
  14184. the filter class or a specific filter instance name.
  14185. @var{COMMAND} specifies the name of the command for the target filter.
  14186. @var{ARG} is optional and specifies the optional argument list for the
  14187. given @var{COMMAND}.
  14188. Upon reception, the message is processed and the corresponding command
  14189. is injected into the filtergraph. Depending on the result, the filter
  14190. will send a reply to the client, adopting the format:
  14191. @example
  14192. @var{ERROR_CODE} @var{ERROR_REASON}
  14193. @var{MESSAGE}
  14194. @end example
  14195. @var{MESSAGE} is optional.
  14196. @subsection Examples
  14197. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14198. be used to send commands processed by these filters.
  14199. Consider the following filtergraph generated by @command{ffplay}
  14200. @example
  14201. ffplay -dumpgraph 1 -f lavfi "
  14202. color=s=100x100:c=red [l];
  14203. color=s=100x100:c=blue [r];
  14204. nullsrc=s=200x100, zmq [bg];
  14205. [bg][l] overlay [bg+l];
  14206. [bg+l][r] overlay=x=100 "
  14207. @end example
  14208. To change the color of the left side of the video, the following
  14209. command can be used:
  14210. @example
  14211. echo Parsed_color_0 c yellow | tools/zmqsend
  14212. @end example
  14213. To change the right side:
  14214. @example
  14215. echo Parsed_color_1 c pink | tools/zmqsend
  14216. @end example
  14217. @c man end MULTIMEDIA FILTERS
  14218. @chapter Multimedia Sources
  14219. @c man begin MULTIMEDIA SOURCES
  14220. Below is a description of the currently available multimedia sources.
  14221. @section amovie
  14222. This is the same as @ref{movie} source, except it selects an audio
  14223. stream by default.
  14224. @anchor{movie}
  14225. @section movie
  14226. Read audio and/or video stream(s) from a movie container.
  14227. It accepts the following parameters:
  14228. @table @option
  14229. @item filename
  14230. The name of the resource to read (not necessarily a file; it can also be a
  14231. device or a stream accessed through some protocol).
  14232. @item format_name, f
  14233. Specifies the format assumed for the movie to read, and can be either
  14234. the name of a container or an input device. If not specified, the
  14235. format is guessed from @var{movie_name} or by probing.
  14236. @item seek_point, sp
  14237. Specifies the seek point in seconds. The frames will be output
  14238. starting from this seek point. The parameter is evaluated with
  14239. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14240. postfix. The default value is "0".
  14241. @item streams, s
  14242. Specifies the streams to read. Several streams can be specified,
  14243. separated by "+". The source will then have as many outputs, in the
  14244. same order. The syntax is explained in the ``Stream specifiers''
  14245. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14246. respectively the default (best suited) video and audio stream. Default
  14247. is "dv", or "da" if the filter is called as "amovie".
  14248. @item stream_index, si
  14249. Specifies the index of the video stream to read. If the value is -1,
  14250. the most suitable video stream will be automatically selected. The default
  14251. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14252. audio instead of video.
  14253. @item loop
  14254. Specifies how many times to read the stream in sequence.
  14255. If the value is 0, the stream will be looped infinitely.
  14256. Default value is "1".
  14257. Note that when the movie is looped the source timestamps are not
  14258. changed, so it will generate non monotonically increasing timestamps.
  14259. @item discontinuity
  14260. Specifies the time difference between frames above which the point is
  14261. considered a timestamp discontinuity which is removed by adjusting the later
  14262. timestamps.
  14263. @end table
  14264. It allows overlaying a second video on top of the main input of
  14265. a filtergraph, as shown in this graph:
  14266. @example
  14267. input -----------> deltapts0 --> overlay --> output
  14268. ^
  14269. |
  14270. movie --> scale--> deltapts1 -------+
  14271. @end example
  14272. @subsection Examples
  14273. @itemize
  14274. @item
  14275. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14276. on top of the input labelled "in":
  14277. @example
  14278. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14279. [in] setpts=PTS-STARTPTS [main];
  14280. [main][over] overlay=16:16 [out]
  14281. @end example
  14282. @item
  14283. Read from a video4linux2 device, and overlay it on top of the input
  14284. labelled "in":
  14285. @example
  14286. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14287. [in] setpts=PTS-STARTPTS [main];
  14288. [main][over] overlay=16:16 [out]
  14289. @end example
  14290. @item
  14291. Read the first video stream and the audio stream with id 0x81 from
  14292. dvd.vob; the video is connected to the pad named "video" and the audio is
  14293. connected to the pad named "audio":
  14294. @example
  14295. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14296. @end example
  14297. @end itemize
  14298. @subsection Commands
  14299. Both movie and amovie support the following commands:
  14300. @table @option
  14301. @item seek
  14302. Perform seek using "av_seek_frame".
  14303. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14304. @itemize
  14305. @item
  14306. @var{stream_index}: If stream_index is -1, a default
  14307. stream is selected, and @var{timestamp} is automatically converted
  14308. from AV_TIME_BASE units to the stream specific time_base.
  14309. @item
  14310. @var{timestamp}: Timestamp in AVStream.time_base units
  14311. or, if no stream is specified, in AV_TIME_BASE units.
  14312. @item
  14313. @var{flags}: Flags which select direction and seeking mode.
  14314. @end itemize
  14315. @item get_duration
  14316. Get movie duration in AV_TIME_BASE units.
  14317. @end table
  14318. @c man end MULTIMEDIA SOURCES