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.

20000 lines
530KB

  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. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @subsection Commands
  891. This filter supports the following commands:
  892. @table @option
  893. @item frequency, f
  894. Change allpass frequency.
  895. Syntax for the command is : "@var{frequency}"
  896. @item width_type, t
  897. Change allpass width_type.
  898. Syntax for the command is : "@var{width_type}"
  899. @item width, w
  900. Change allpass width.
  901. Syntax for the command is : "@var{width}"
  902. @end table
  903. @section aloop
  904. Loop audio samples.
  905. The filter accepts the following options:
  906. @table @option
  907. @item loop
  908. Set the number of loops. Setting this value to -1 will result in infinite loops.
  909. Default is 0.
  910. @item size
  911. Set maximal number of samples. Default is 0.
  912. @item start
  913. Set first sample of loop. Default is 0.
  914. @end table
  915. @anchor{amerge}
  916. @section amerge
  917. Merge two or more audio streams into a single multi-channel stream.
  918. The filter accepts the following options:
  919. @table @option
  920. @item inputs
  921. Set the number of inputs. Default is 2.
  922. @end table
  923. If the channel layouts of the inputs are disjoint, and therefore compatible,
  924. the channel layout of the output will be set accordingly and the channels
  925. will be reordered as necessary. If the channel layouts of the inputs are not
  926. disjoint, the output will have all the channels of the first input then all
  927. the channels of the second input, in that order, and the channel layout of
  928. the output will be the default value corresponding to the total number of
  929. channels.
  930. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  931. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  932. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  933. first input, b1 is the first channel of the second input).
  934. On the other hand, if both input are in stereo, the output channels will be
  935. in the default order: a1, a2, b1, b2, and the channel layout will be
  936. arbitrarily set to 4.0, which may or may not be the expected value.
  937. All inputs must have the same sample rate, and format.
  938. If inputs do not have the same duration, the output will stop with the
  939. shortest.
  940. @subsection Examples
  941. @itemize
  942. @item
  943. Merge two mono files into a stereo stream:
  944. @example
  945. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  946. @end example
  947. @item
  948. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  949. @example
  950. 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
  951. @end example
  952. @end itemize
  953. @section amix
  954. Mixes multiple audio inputs into a single output.
  955. Note that this filter only supports float samples (the @var{amerge}
  956. and @var{pan} audio filters support many formats). If the @var{amix}
  957. input has integer samples then @ref{aresample} will be automatically
  958. inserted to perform the conversion to float samples.
  959. For example
  960. @example
  961. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  962. @end example
  963. will mix 3 input audio streams to a single output with the same duration as the
  964. first input and a dropout transition time of 3 seconds.
  965. It accepts the following parameters:
  966. @table @option
  967. @item inputs
  968. The number of inputs. If unspecified, it defaults to 2.
  969. @item duration
  970. How to determine the end-of-stream.
  971. @table @option
  972. @item longest
  973. The duration of the longest input. (default)
  974. @item shortest
  975. The duration of the shortest input.
  976. @item first
  977. The duration of the first input.
  978. @end table
  979. @item dropout_transition
  980. The transition time, in seconds, for volume renormalization when an input
  981. stream ends. The default value is 2 seconds.
  982. @end table
  983. @section anequalizer
  984. High-order parametric multiband equalizer for each channel.
  985. It accepts the following parameters:
  986. @table @option
  987. @item params
  988. This option string is in format:
  989. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  990. Each equalizer band is separated by '|'.
  991. @table @option
  992. @item chn
  993. Set channel number to which equalization will be applied.
  994. If input doesn't have that channel the entry is ignored.
  995. @item f
  996. Set central frequency for band.
  997. If input doesn't have that frequency the entry is ignored.
  998. @item w
  999. Set band width in hertz.
  1000. @item g
  1001. Set band gain in dB.
  1002. @item t
  1003. Set filter type for band, optional, can be:
  1004. @table @samp
  1005. @item 0
  1006. Butterworth, this is default.
  1007. @item 1
  1008. Chebyshev type 1.
  1009. @item 2
  1010. Chebyshev type 2.
  1011. @end table
  1012. @end table
  1013. @item curves
  1014. With this option activated frequency response of anequalizer is displayed
  1015. in video stream.
  1016. @item size
  1017. Set video stream size. Only useful if curves option is activated.
  1018. @item mgain
  1019. Set max gain that will be displayed. Only useful if curves option is activated.
  1020. Setting this to a reasonable value makes it possible to display gain which is derived from
  1021. neighbour bands which are too close to each other and thus produce higher gain
  1022. when both are activated.
  1023. @item fscale
  1024. Set frequency scale used to draw frequency response in video output.
  1025. Can be linear or logarithmic. Default is logarithmic.
  1026. @item colors
  1027. Set color for each channel curve which is going to be displayed in video stream.
  1028. This is list of color names separated by space or by '|'.
  1029. Unrecognised or missing colors will be replaced by white color.
  1030. @end table
  1031. @subsection Examples
  1032. @itemize
  1033. @item
  1034. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1035. for first 2 channels using Chebyshev type 1 filter:
  1036. @example
  1037. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1038. @end example
  1039. @end itemize
  1040. @subsection Commands
  1041. This filter supports the following commands:
  1042. @table @option
  1043. @item change
  1044. Alter existing filter parameters.
  1045. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1046. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1047. error is returned.
  1048. @var{freq} set new frequency parameter.
  1049. @var{width} set new width parameter in herz.
  1050. @var{gain} set new gain parameter in dB.
  1051. Full filter invocation with asendcmd may look like this:
  1052. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1053. @end table
  1054. @section anull
  1055. Pass the audio source unchanged to the output.
  1056. @section apad
  1057. Pad the end of an audio stream with silence.
  1058. This can be used together with @command{ffmpeg} @option{-shortest} to
  1059. extend audio streams to the same length as the video stream.
  1060. A description of the accepted options follows.
  1061. @table @option
  1062. @item packet_size
  1063. Set silence packet size. Default value is 4096.
  1064. @item pad_len
  1065. Set the number of samples of silence to add to the end. After the
  1066. value is reached, the stream is terminated. This option is mutually
  1067. exclusive with @option{whole_len}.
  1068. @item whole_len
  1069. Set the minimum total number of samples in the output audio stream. If
  1070. the value is longer than the input audio length, silence is added to
  1071. the end, until the value is reached. This option is mutually exclusive
  1072. with @option{pad_len}.
  1073. @end table
  1074. If neither the @option{pad_len} nor the @option{whole_len} option is
  1075. set, the filter will add silence to the end of the input stream
  1076. indefinitely.
  1077. @subsection Examples
  1078. @itemize
  1079. @item
  1080. Add 1024 samples of silence to the end of the input:
  1081. @example
  1082. apad=pad_len=1024
  1083. @end example
  1084. @item
  1085. Make sure the audio output will contain at least 10000 samples, pad
  1086. the input with silence if required:
  1087. @example
  1088. apad=whole_len=10000
  1089. @end example
  1090. @item
  1091. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1092. video stream will always result the shortest and will be converted
  1093. until the end in the output file when using the @option{shortest}
  1094. option:
  1095. @example
  1096. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1097. @end example
  1098. @end itemize
  1099. @section aphaser
  1100. Add a phasing effect to the input audio.
  1101. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1102. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1103. A description of the accepted parameters follows.
  1104. @table @option
  1105. @item in_gain
  1106. Set input gain. Default is 0.4.
  1107. @item out_gain
  1108. Set output gain. Default is 0.74
  1109. @item delay
  1110. Set delay in milliseconds. Default is 3.0.
  1111. @item decay
  1112. Set decay. Default is 0.4.
  1113. @item speed
  1114. Set modulation speed in Hz. Default is 0.5.
  1115. @item type
  1116. Set modulation type. Default is triangular.
  1117. It accepts the following values:
  1118. @table @samp
  1119. @item triangular, t
  1120. @item sinusoidal, s
  1121. @end table
  1122. @end table
  1123. @section apulsator
  1124. Audio pulsator is something between an autopanner and a tremolo.
  1125. But it can produce funny stereo effects as well. Pulsator changes the volume
  1126. of the left and right channel based on a LFO (low frequency oscillator) with
  1127. different waveforms and shifted phases.
  1128. This filter have the ability to define an offset between left and right
  1129. channel. An offset of 0 means that both LFO shapes match each other.
  1130. The left and right channel are altered equally - a conventional tremolo.
  1131. An offset of 50% means that the shape of the right channel is exactly shifted
  1132. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1133. an autopanner. At 1 both curves match again. Every setting in between moves the
  1134. phase shift gapless between all stages and produces some "bypassing" sounds with
  1135. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1136. the 0.5) the faster the signal passes from the left to the right speaker.
  1137. The filter accepts the following options:
  1138. @table @option
  1139. @item level_in
  1140. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1141. @item level_out
  1142. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1143. @item mode
  1144. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1145. sawup or sawdown. Default is sine.
  1146. @item amount
  1147. Set modulation. Define how much of original signal is affected by the LFO.
  1148. @item offset_l
  1149. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1150. @item offset_r
  1151. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1152. @item width
  1153. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1154. @item timing
  1155. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1156. @item bpm
  1157. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1158. is set to bpm.
  1159. @item ms
  1160. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1161. is set to ms.
  1162. @item hz
  1163. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1164. if timing is set to hz.
  1165. @end table
  1166. @anchor{aresample}
  1167. @section aresample
  1168. Resample the input audio to the specified parameters, using the
  1169. libswresample library. If none are specified then the filter will
  1170. automatically convert between its input and output.
  1171. This filter is also able to stretch/squeeze the audio data to make it match
  1172. the timestamps or to inject silence / cut out audio to make it match the
  1173. timestamps, do a combination of both or do neither.
  1174. The filter accepts the syntax
  1175. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1176. expresses a sample rate and @var{resampler_options} is a list of
  1177. @var{key}=@var{value} pairs, separated by ":". See the
  1178. @ref{Resampler Options,,the "Resampler Options" section in the
  1179. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1180. for the complete list of supported options.
  1181. @subsection Examples
  1182. @itemize
  1183. @item
  1184. Resample the input audio to 44100Hz:
  1185. @example
  1186. aresample=44100
  1187. @end example
  1188. @item
  1189. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1190. samples per second compensation:
  1191. @example
  1192. aresample=async=1000
  1193. @end example
  1194. @end itemize
  1195. @section areverse
  1196. Reverse an audio clip.
  1197. Warning: This filter requires memory to buffer the entire clip, so trimming
  1198. is suggested.
  1199. @subsection Examples
  1200. @itemize
  1201. @item
  1202. Take the first 5 seconds of a clip, and reverse it.
  1203. @example
  1204. atrim=end=5,areverse
  1205. @end example
  1206. @end itemize
  1207. @section asetnsamples
  1208. Set the number of samples per each output audio frame.
  1209. The last output packet may contain a different number of samples, as
  1210. the filter will flush all the remaining samples when the input audio
  1211. signals its end.
  1212. The filter accepts the following options:
  1213. @table @option
  1214. @item nb_out_samples, n
  1215. Set the number of frames per each output audio frame. The number is
  1216. intended as the number of samples @emph{per each channel}.
  1217. Default value is 1024.
  1218. @item pad, p
  1219. If set to 1, the filter will pad the last audio frame with zeroes, so
  1220. that the last frame will contain the same number of samples as the
  1221. previous ones. Default value is 1.
  1222. @end table
  1223. For example, to set the number of per-frame samples to 1234 and
  1224. disable padding for the last frame, use:
  1225. @example
  1226. asetnsamples=n=1234:p=0
  1227. @end example
  1228. @section asetrate
  1229. Set the sample rate without altering the PCM data.
  1230. This will result in a change of speed and pitch.
  1231. The filter accepts the following options:
  1232. @table @option
  1233. @item sample_rate, r
  1234. Set the output sample rate. Default is 44100 Hz.
  1235. @end table
  1236. @section ashowinfo
  1237. Show a line containing various information for each input audio frame.
  1238. The input audio is not modified.
  1239. The shown line contains a sequence of key/value pairs of the form
  1240. @var{key}:@var{value}.
  1241. The following values are shown in the output:
  1242. @table @option
  1243. @item n
  1244. The (sequential) number of the input frame, starting from 0.
  1245. @item pts
  1246. The presentation timestamp of the input frame, in time base units; the time base
  1247. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1248. @item pts_time
  1249. The presentation timestamp of the input frame in seconds.
  1250. @item pos
  1251. position of the frame in the input stream, -1 if this information in
  1252. unavailable and/or meaningless (for example in case of synthetic audio)
  1253. @item fmt
  1254. The sample format.
  1255. @item chlayout
  1256. The channel layout.
  1257. @item rate
  1258. The sample rate for the audio frame.
  1259. @item nb_samples
  1260. The number of samples (per channel) in the frame.
  1261. @item checksum
  1262. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1263. audio, the data is treated as if all the planes were concatenated.
  1264. @item plane_checksums
  1265. A list of Adler-32 checksums for each data plane.
  1266. @end table
  1267. @anchor{astats}
  1268. @section astats
  1269. Display time domain statistical information about the audio channels.
  1270. Statistics are calculated and displayed for each audio channel and,
  1271. where applicable, an overall figure is also given.
  1272. It accepts the following option:
  1273. @table @option
  1274. @item length
  1275. Short window length in seconds, used for peak and trough RMS measurement.
  1276. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1277. @item metadata
  1278. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1279. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1280. disabled.
  1281. Available keys for each channel are:
  1282. DC_offset
  1283. Min_level
  1284. Max_level
  1285. Min_difference
  1286. Max_difference
  1287. Mean_difference
  1288. RMS_difference
  1289. Peak_level
  1290. RMS_peak
  1291. RMS_trough
  1292. Crest_factor
  1293. Flat_factor
  1294. Peak_count
  1295. Bit_depth
  1296. Dynamic_range
  1297. and for Overall:
  1298. DC_offset
  1299. Min_level
  1300. Max_level
  1301. Min_difference
  1302. Max_difference
  1303. Mean_difference
  1304. RMS_difference
  1305. Peak_level
  1306. RMS_level
  1307. RMS_peak
  1308. RMS_trough
  1309. Flat_factor
  1310. Peak_count
  1311. Bit_depth
  1312. Number_of_samples
  1313. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1314. this @code{lavfi.astats.Overall.Peak_count}.
  1315. For description what each key means read below.
  1316. @item reset
  1317. Set number of frame after which stats are going to be recalculated.
  1318. Default is disabled.
  1319. @end table
  1320. A description of each shown parameter follows:
  1321. @table @option
  1322. @item DC offset
  1323. Mean amplitude displacement from zero.
  1324. @item Min level
  1325. Minimal sample level.
  1326. @item Max level
  1327. Maximal sample level.
  1328. @item Min difference
  1329. Minimal difference between two consecutive samples.
  1330. @item Max difference
  1331. Maximal difference between two consecutive samples.
  1332. @item Mean difference
  1333. Mean difference between two consecutive samples.
  1334. The average of each difference between two consecutive samples.
  1335. @item RMS difference
  1336. Root Mean Square difference between two consecutive samples.
  1337. @item Peak level dB
  1338. @item RMS level dB
  1339. Standard peak and RMS level measured in dBFS.
  1340. @item RMS peak dB
  1341. @item RMS trough dB
  1342. Peak and trough values for RMS level measured over a short window.
  1343. @item Crest factor
  1344. Standard ratio of peak to RMS level (note: not in dB).
  1345. @item Flat factor
  1346. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1347. (i.e. either @var{Min level} or @var{Max level}).
  1348. @item Peak count
  1349. Number of occasions (not the number of samples) that the signal attained either
  1350. @var{Min level} or @var{Max level}.
  1351. @item Bit depth
  1352. Overall bit depth of audio. Number of bits used for each sample.
  1353. @item Dynamic range
  1354. Measured dynamic range of audio in dB.
  1355. @end table
  1356. @section atempo
  1357. Adjust audio tempo.
  1358. The filter accepts exactly one parameter, the audio tempo. If not
  1359. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1360. be in the [0.5, 2.0] range.
  1361. @subsection Examples
  1362. @itemize
  1363. @item
  1364. Slow down audio to 80% tempo:
  1365. @example
  1366. atempo=0.8
  1367. @end example
  1368. @item
  1369. To speed up audio to 125% tempo:
  1370. @example
  1371. atempo=1.25
  1372. @end example
  1373. @end itemize
  1374. @section atrim
  1375. Trim the input so that the output contains one continuous subpart of the input.
  1376. It accepts the following parameters:
  1377. @table @option
  1378. @item start
  1379. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1380. sample with the timestamp @var{start} will be the first sample in the output.
  1381. @item end
  1382. Specify time of the first audio sample that will be dropped, i.e. the
  1383. audio sample immediately preceding the one with the timestamp @var{end} will be
  1384. the last sample in the output.
  1385. @item start_pts
  1386. Same as @var{start}, except this option sets the start timestamp in samples
  1387. instead of seconds.
  1388. @item end_pts
  1389. Same as @var{end}, except this option sets the end timestamp in samples instead
  1390. of seconds.
  1391. @item duration
  1392. The maximum duration of the output in seconds.
  1393. @item start_sample
  1394. The number of the first sample that should be output.
  1395. @item end_sample
  1396. The number of the first sample that should be dropped.
  1397. @end table
  1398. @option{start}, @option{end}, and @option{duration} are expressed as time
  1399. duration specifications; see
  1400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1401. Note that the first two sets of the start/end options and the @option{duration}
  1402. option look at the frame timestamp, while the _sample options simply count the
  1403. samples that pass through the filter. So start/end_pts and start/end_sample will
  1404. give different results when the timestamps are wrong, inexact or do not start at
  1405. zero. Also note that this filter does not modify the timestamps. If you wish
  1406. to have the output timestamps start at zero, insert the asetpts filter after the
  1407. atrim filter.
  1408. If multiple start or end options are set, this filter tries to be greedy and
  1409. keep all samples that match at least one of the specified constraints. To keep
  1410. only the part that matches all the constraints at once, chain multiple atrim
  1411. filters.
  1412. The defaults are such that all the input is kept. So it is possible to set e.g.
  1413. just the end values to keep everything before the specified time.
  1414. Examples:
  1415. @itemize
  1416. @item
  1417. Drop everything except the second minute of input:
  1418. @example
  1419. ffmpeg -i INPUT -af atrim=60:120
  1420. @end example
  1421. @item
  1422. Keep only the first 1000 samples:
  1423. @example
  1424. ffmpeg -i INPUT -af atrim=end_sample=1000
  1425. @end example
  1426. @end itemize
  1427. @section bandpass
  1428. Apply a two-pole Butterworth band-pass filter with central
  1429. frequency @var{frequency}, and (3dB-point) band-width width.
  1430. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1431. instead of the default: constant 0dB peak gain.
  1432. The filter roll off at 6dB per octave (20dB per decade).
  1433. The filter accepts the following options:
  1434. @table @option
  1435. @item frequency, f
  1436. Set the filter's central frequency. Default is @code{3000}.
  1437. @item csg
  1438. Constant skirt gain if set to 1. Defaults to 0.
  1439. @item width_type, t
  1440. Set method to specify band-width of filter.
  1441. @table @option
  1442. @item h
  1443. Hz
  1444. @item q
  1445. Q-Factor
  1446. @item o
  1447. octave
  1448. @item s
  1449. slope
  1450. @end table
  1451. @item width, w
  1452. Specify the band-width of a filter in width_type units.
  1453. @item channels, c
  1454. Specify which channels to filter, by default all available are filtered.
  1455. @end table
  1456. @subsection Commands
  1457. This filter supports the following commands:
  1458. @table @option
  1459. @item frequency, f
  1460. Change bandpass frequency.
  1461. Syntax for the command is : "@var{frequency}"
  1462. @item width_type, t
  1463. Change bandpass width_type.
  1464. Syntax for the command is : "@var{width_type}"
  1465. @item width, w
  1466. Change bandpass width.
  1467. Syntax for the command is : "@var{width}"
  1468. @end table
  1469. @section bandreject
  1470. Apply a two-pole Butterworth band-reject filter with central
  1471. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1472. The filter roll off at 6dB per octave (20dB per decade).
  1473. The filter accepts the following options:
  1474. @table @option
  1475. @item frequency, f
  1476. Set the filter's central frequency. Default is @code{3000}.
  1477. @item width_type, t
  1478. Set method to specify band-width of filter.
  1479. @table @option
  1480. @item h
  1481. Hz
  1482. @item q
  1483. Q-Factor
  1484. @item o
  1485. octave
  1486. @item s
  1487. slope
  1488. @end table
  1489. @item width, w
  1490. Specify the band-width of a filter in width_type units.
  1491. @item channels, c
  1492. Specify which channels to filter, by default all available are filtered.
  1493. @end table
  1494. @subsection Commands
  1495. This filter supports the following commands:
  1496. @table @option
  1497. @item frequency, f
  1498. Change bandreject frequency.
  1499. Syntax for the command is : "@var{frequency}"
  1500. @item width_type, t
  1501. Change bandreject width_type.
  1502. Syntax for the command is : "@var{width_type}"
  1503. @item width, w
  1504. Change bandreject width.
  1505. Syntax for the command is : "@var{width}"
  1506. @end table
  1507. @section bass
  1508. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1509. shelving filter with a response similar to that of a standard
  1510. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1511. The filter accepts the following options:
  1512. @table @option
  1513. @item gain, g
  1514. Give the gain at 0 Hz. Its useful range is about -20
  1515. (for a large cut) to +20 (for a large boost).
  1516. Beware of clipping when using a positive gain.
  1517. @item frequency, f
  1518. Set the filter's central frequency and so can be used
  1519. to extend or reduce the frequency range to be boosted or cut.
  1520. The default value is @code{100} Hz.
  1521. @item width_type, t
  1522. Set method to specify band-width of filter.
  1523. @table @option
  1524. @item h
  1525. Hz
  1526. @item q
  1527. Q-Factor
  1528. @item o
  1529. octave
  1530. @item s
  1531. slope
  1532. @end table
  1533. @item width, w
  1534. Determine how steep is the filter's shelf transition.
  1535. @item channels, c
  1536. Specify which channels to filter, by default all available are filtered.
  1537. @end table
  1538. @subsection Commands
  1539. This filter supports the following commands:
  1540. @table @option
  1541. @item frequency, f
  1542. Change bass frequency.
  1543. Syntax for the command is : "@var{frequency}"
  1544. @item width_type, t
  1545. Change bass width_type.
  1546. Syntax for the command is : "@var{width_type}"
  1547. @item width, w
  1548. Change bass width.
  1549. Syntax for the command is : "@var{width}"
  1550. @item gain, g
  1551. Change bass gain.
  1552. Syntax for the command is : "@var{gain}"
  1553. @end table
  1554. @section biquad
  1555. Apply a biquad IIR filter with the given coefficients.
  1556. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1557. are the numerator and denominator coefficients respectively.
  1558. and @var{channels}, @var{c} specify which channels to filter, by default all
  1559. available are filtered.
  1560. @subsection Commands
  1561. This filter supports the following commands:
  1562. @table @option
  1563. @item a0
  1564. @item a1
  1565. @item a2
  1566. @item b0
  1567. @item b1
  1568. @item b2
  1569. Change biquad parameter.
  1570. Syntax for the command is : "@var{value}"
  1571. @end table
  1572. @section bs2b
  1573. Bauer stereo to binaural transformation, which improves headphone listening of
  1574. stereo audio records.
  1575. To enable compilation of this filter you need to configure FFmpeg with
  1576. @code{--enable-libbs2b}.
  1577. It accepts the following parameters:
  1578. @table @option
  1579. @item profile
  1580. Pre-defined crossfeed level.
  1581. @table @option
  1582. @item default
  1583. Default level (fcut=700, feed=50).
  1584. @item cmoy
  1585. Chu Moy circuit (fcut=700, feed=60).
  1586. @item jmeier
  1587. Jan Meier circuit (fcut=650, feed=95).
  1588. @end table
  1589. @item fcut
  1590. Cut frequency (in Hz).
  1591. @item feed
  1592. Feed level (in Hz).
  1593. @end table
  1594. @section channelmap
  1595. Remap input channels to new locations.
  1596. It accepts the following parameters:
  1597. @table @option
  1598. @item map
  1599. Map channels from input to output. The argument is a '|'-separated list of
  1600. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1601. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1602. channel (e.g. FL for front left) or its index in the input channel layout.
  1603. @var{out_channel} is the name of the output channel or its index in the output
  1604. channel layout. If @var{out_channel} is not given then it is implicitly an
  1605. index, starting with zero and increasing by one for each mapping.
  1606. @item channel_layout
  1607. The channel layout of the output stream.
  1608. @end table
  1609. If no mapping is present, the filter will implicitly map input channels to
  1610. output channels, preserving indices.
  1611. For example, assuming a 5.1+downmix input MOV file,
  1612. @example
  1613. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1614. @end example
  1615. will create an output WAV file tagged as stereo from the downmix channels of
  1616. the input.
  1617. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1618. @example
  1619. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1620. @end example
  1621. @section channelsplit
  1622. Split each channel from an input audio stream into a separate output stream.
  1623. It accepts the following parameters:
  1624. @table @option
  1625. @item channel_layout
  1626. The channel layout of the input stream. The default is "stereo".
  1627. @end table
  1628. For example, assuming a stereo input MP3 file,
  1629. @example
  1630. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1631. @end example
  1632. will create an output Matroska file with two audio streams, one containing only
  1633. the left channel and the other the right channel.
  1634. Split a 5.1 WAV file into per-channel files:
  1635. @example
  1636. ffmpeg -i in.wav -filter_complex
  1637. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1638. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1639. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1640. side_right.wav
  1641. @end example
  1642. @section chorus
  1643. Add a chorus effect to the audio.
  1644. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1645. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1646. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1647. The modulation depth defines the range the modulated delay is played before or after
  1648. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1649. sound tuned around the original one, like in a chorus where some vocals are slightly
  1650. off key.
  1651. It accepts the following parameters:
  1652. @table @option
  1653. @item in_gain
  1654. Set input gain. Default is 0.4.
  1655. @item out_gain
  1656. Set output gain. Default is 0.4.
  1657. @item delays
  1658. Set delays. A typical delay is around 40ms to 60ms.
  1659. @item decays
  1660. Set decays.
  1661. @item speeds
  1662. Set speeds.
  1663. @item depths
  1664. Set depths.
  1665. @end table
  1666. @subsection Examples
  1667. @itemize
  1668. @item
  1669. A single delay:
  1670. @example
  1671. chorus=0.7:0.9:55:0.4:0.25:2
  1672. @end example
  1673. @item
  1674. Two delays:
  1675. @example
  1676. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1677. @end example
  1678. @item
  1679. Fuller sounding chorus with three delays:
  1680. @example
  1681. 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
  1682. @end example
  1683. @end itemize
  1684. @section compand
  1685. Compress or expand the audio's dynamic range.
  1686. It accepts the following parameters:
  1687. @table @option
  1688. @item attacks
  1689. @item decays
  1690. A list of times in seconds for each channel over which the instantaneous level
  1691. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1692. increase of volume and @var{decays} refers to decrease of volume. For most
  1693. situations, the attack time (response to the audio getting louder) should be
  1694. shorter than the decay time, because the human ear is more sensitive to sudden
  1695. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1696. a typical value for decay is 0.8 seconds.
  1697. If specified number of attacks & decays is lower than number of channels, the last
  1698. set attack/decay will be used for all remaining channels.
  1699. @item points
  1700. A list of points for the transfer function, specified in dB relative to the
  1701. maximum possible signal amplitude. Each key points list must be defined using
  1702. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1703. @code{x0/y0 x1/y1 x2/y2 ....}
  1704. The input values must be in strictly increasing order but the transfer function
  1705. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1706. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1707. function are @code{-70/-70|-60/-20|1/0}.
  1708. @item soft-knee
  1709. Set the curve radius in dB for all joints. It defaults to 0.01.
  1710. @item gain
  1711. Set the additional gain in dB to be applied at all points on the transfer
  1712. function. This allows for easy adjustment of the overall gain.
  1713. It defaults to 0.
  1714. @item volume
  1715. Set an initial volume, in dB, to be assumed for each channel when filtering
  1716. starts. This permits the user to supply a nominal level initially, so that, for
  1717. example, a very large gain is not applied to initial signal levels before the
  1718. companding has begun to operate. A typical value for audio which is initially
  1719. quiet is -90 dB. It defaults to 0.
  1720. @item delay
  1721. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1722. delayed before being fed to the volume adjuster. Specifying a delay
  1723. approximately equal to the attack/decay times allows the filter to effectively
  1724. operate in predictive rather than reactive mode. It defaults to 0.
  1725. @end table
  1726. @subsection Examples
  1727. @itemize
  1728. @item
  1729. Make music with both quiet and loud passages suitable for listening to in a
  1730. noisy environment:
  1731. @example
  1732. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1733. @end example
  1734. Another example for audio with whisper and explosion parts:
  1735. @example
  1736. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1737. @end example
  1738. @item
  1739. A noise gate for when the noise is at a lower level than the signal:
  1740. @example
  1741. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1742. @end example
  1743. @item
  1744. Here is another noise gate, this time for when the noise is at a higher level
  1745. than the signal (making it, in some ways, similar to squelch):
  1746. @example
  1747. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1748. @end example
  1749. @item
  1750. 2:1 compression starting at -6dB:
  1751. @example
  1752. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1753. @end example
  1754. @item
  1755. 2:1 compression starting at -9dB:
  1756. @example
  1757. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1758. @end example
  1759. @item
  1760. 2:1 compression starting at -12dB:
  1761. @example
  1762. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1763. @end example
  1764. @item
  1765. 2:1 compression starting at -18dB:
  1766. @example
  1767. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1768. @end example
  1769. @item
  1770. 3:1 compression starting at -15dB:
  1771. @example
  1772. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1773. @end example
  1774. @item
  1775. Compressor/Gate:
  1776. @example
  1777. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1778. @end example
  1779. @item
  1780. Expander:
  1781. @example
  1782. 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
  1783. @end example
  1784. @item
  1785. Hard limiter at -6dB:
  1786. @example
  1787. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1788. @end example
  1789. @item
  1790. Hard limiter at -12dB:
  1791. @example
  1792. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1793. @end example
  1794. @item
  1795. Hard noise gate at -35 dB:
  1796. @example
  1797. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1798. @end example
  1799. @item
  1800. Soft limiter:
  1801. @example
  1802. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1803. @end example
  1804. @end itemize
  1805. @section compensationdelay
  1806. Compensation Delay Line is a metric based delay to compensate differing
  1807. positions of microphones or speakers.
  1808. For example, you have recorded guitar with two microphones placed in
  1809. different location. Because the front of sound wave has fixed speed in
  1810. normal conditions, the phasing of microphones can vary and depends on
  1811. their location and interposition. The best sound mix can be achieved when
  1812. these microphones are in phase (synchronized). Note that distance of
  1813. ~30 cm between microphones makes one microphone to capture signal in
  1814. antiphase to another microphone. That makes the final mix sounding moody.
  1815. This filter helps to solve phasing problems by adding different delays
  1816. to each microphone track and make them synchronized.
  1817. The best result can be reached when you take one track as base and
  1818. synchronize other tracks one by one with it.
  1819. Remember that synchronization/delay tolerance depends on sample rate, too.
  1820. Higher sample rates will give more tolerance.
  1821. It accepts the following parameters:
  1822. @table @option
  1823. @item mm
  1824. Set millimeters distance. This is compensation distance for fine tuning.
  1825. Default is 0.
  1826. @item cm
  1827. Set cm distance. This is compensation distance for tightening distance setup.
  1828. Default is 0.
  1829. @item m
  1830. Set meters distance. This is compensation distance for hard distance setup.
  1831. Default is 0.
  1832. @item dry
  1833. Set dry amount. Amount of unprocessed (dry) signal.
  1834. Default is 0.
  1835. @item wet
  1836. Set wet amount. Amount of processed (wet) signal.
  1837. Default is 1.
  1838. @item temp
  1839. Set temperature degree in Celsius. This is the temperature of the environment.
  1840. Default is 20.
  1841. @end table
  1842. @section crossfeed
  1843. Apply headphone crossfeed filter.
  1844. Crossfeed is the process of blending the left and right channels of stereo
  1845. audio recording.
  1846. It is mainly used to reduce extreme stereo separation of low frequencies.
  1847. The intent is to produce more speaker like sound to the listener.
  1848. The filter accepts the following options:
  1849. @table @option
  1850. @item strength
  1851. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1852. This sets gain of low shelf filter for side part of stereo image.
  1853. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1854. @item range
  1855. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1856. This sets cut off frequency of low shelf filter. Default is cut off near
  1857. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1858. @item level_in
  1859. Set input gain. Default is 0.9.
  1860. @item level_out
  1861. Set output gain. Default is 1.
  1862. @end table
  1863. @section crystalizer
  1864. Simple algorithm to expand audio dynamic range.
  1865. The filter accepts the following options:
  1866. @table @option
  1867. @item i
  1868. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1869. (unchanged sound) to 10.0 (maximum effect).
  1870. @item c
  1871. Enable clipping. By default is enabled.
  1872. @end table
  1873. @section dcshift
  1874. Apply a DC shift to the audio.
  1875. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1876. in the recording chain) from the audio. The effect of a DC offset is reduced
  1877. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1878. a signal has a DC offset.
  1879. @table @option
  1880. @item shift
  1881. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1882. the audio.
  1883. @item limitergain
  1884. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1885. used to prevent clipping.
  1886. @end table
  1887. @section dynaudnorm
  1888. Dynamic Audio Normalizer.
  1889. This filter applies a certain amount of gain to the input audio in order
  1890. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1891. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1892. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1893. This allows for applying extra gain to the "quiet" sections of the audio
  1894. while avoiding distortions or clipping the "loud" sections. In other words:
  1895. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1896. sections, in the sense that the volume of each section is brought to the
  1897. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1898. this goal *without* applying "dynamic range compressing". It will retain 100%
  1899. of the dynamic range *within* each section of the audio file.
  1900. @table @option
  1901. @item f
  1902. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1903. Default is 500 milliseconds.
  1904. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1905. referred to as frames. This is required, because a peak magnitude has no
  1906. meaning for just a single sample value. Instead, we need to determine the
  1907. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1908. normalizer would simply use the peak magnitude of the complete file, the
  1909. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1910. frame. The length of a frame is specified in milliseconds. By default, the
  1911. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1912. been found to give good results with most files.
  1913. Note that the exact frame length, in number of samples, will be determined
  1914. automatically, based on the sampling rate of the individual input audio file.
  1915. @item g
  1916. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1917. number. Default is 31.
  1918. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1919. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1920. is specified in frames, centered around the current frame. For the sake of
  1921. simplicity, this must be an odd number. Consequently, the default value of 31
  1922. takes into account the current frame, as well as the 15 preceding frames and
  1923. the 15 subsequent frames. Using a larger window results in a stronger
  1924. smoothing effect and thus in less gain variation, i.e. slower gain
  1925. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1926. effect and thus in more gain variation, i.e. faster gain adaptation.
  1927. In other words, the more you increase this value, the more the Dynamic Audio
  1928. Normalizer will behave like a "traditional" normalization filter. On the
  1929. contrary, the more you decrease this value, the more the Dynamic Audio
  1930. Normalizer will behave like a dynamic range compressor.
  1931. @item p
  1932. Set the target peak value. This specifies the highest permissible magnitude
  1933. level for the normalized audio input. This filter will try to approach the
  1934. target peak magnitude as closely as possible, but at the same time it also
  1935. makes sure that the normalized signal will never exceed the peak magnitude.
  1936. A frame's maximum local gain factor is imposed directly by the target peak
  1937. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1938. It is not recommended to go above this value.
  1939. @item m
  1940. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1941. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1942. factor for each input frame, i.e. the maximum gain factor that does not
  1943. result in clipping or distortion. The maximum gain factor is determined by
  1944. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1945. additionally bounds the frame's maximum gain factor by a predetermined
  1946. (global) maximum gain factor. This is done in order to avoid excessive gain
  1947. factors in "silent" or almost silent frames. By default, the maximum gain
  1948. factor is 10.0, For most inputs the default value should be sufficient and
  1949. it usually is not recommended to increase this value. Though, for input
  1950. with an extremely low overall volume level, it may be necessary to allow even
  1951. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1952. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1953. Instead, a "sigmoid" threshold function will be applied. This way, the
  1954. gain factors will smoothly approach the threshold value, but never exceed that
  1955. value.
  1956. @item r
  1957. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1958. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1959. This means that the maximum local gain factor for each frame is defined
  1960. (only) by the frame's highest magnitude sample. This way, the samples can
  1961. be amplified as much as possible without exceeding the maximum signal
  1962. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1963. Normalizer can also take into account the frame's root mean square,
  1964. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1965. determine the power of a time-varying signal. It is therefore considered
  1966. that the RMS is a better approximation of the "perceived loudness" than
  1967. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1968. frames to a constant RMS value, a uniform "perceived loudness" can be
  1969. established. If a target RMS value has been specified, a frame's local gain
  1970. factor is defined as the factor that would result in exactly that RMS value.
  1971. Note, however, that the maximum local gain factor is still restricted by the
  1972. frame's highest magnitude sample, in order to prevent clipping.
  1973. @item n
  1974. Enable channels coupling. By default is enabled.
  1975. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1976. amount. This means the same gain factor will be applied to all channels, i.e.
  1977. the maximum possible gain factor is determined by the "loudest" channel.
  1978. However, in some recordings, it may happen that the volume of the different
  1979. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1980. In this case, this option can be used to disable the channel coupling. This way,
  1981. the gain factor will be determined independently for each channel, depending
  1982. only on the individual channel's highest magnitude sample. This allows for
  1983. harmonizing the volume of the different channels.
  1984. @item c
  1985. Enable DC bias correction. By default is disabled.
  1986. An audio signal (in the time domain) is a sequence of sample values.
  1987. In the Dynamic Audio Normalizer these sample values are represented in the
  1988. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1989. audio signal, or "waveform", should be centered around the zero point.
  1990. That means if we calculate the mean value of all samples in a file, or in a
  1991. single frame, then the result should be 0.0 or at least very close to that
  1992. value. If, however, there is a significant deviation of the mean value from
  1993. 0.0, in either positive or negative direction, this is referred to as a
  1994. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1995. Audio Normalizer provides optional DC bias correction.
  1996. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1997. the mean value, or "DC correction" offset, of each input frame and subtract
  1998. that value from all of the frame's sample values which ensures those samples
  1999. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2000. boundaries, the DC correction offset values will be interpolated smoothly
  2001. between neighbouring frames.
  2002. @item b
  2003. Enable alternative boundary mode. By default is disabled.
  2004. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2005. around each frame. This includes the preceding frames as well as the
  2006. subsequent frames. However, for the "boundary" frames, located at the very
  2007. beginning and at the very end of the audio file, not all neighbouring
  2008. frames are available. In particular, for the first few frames in the audio
  2009. file, the preceding frames are not known. And, similarly, for the last few
  2010. frames in the audio file, the subsequent frames are not known. Thus, the
  2011. question arises which gain factors should be assumed for the missing frames
  2012. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2013. to deal with this situation. The default boundary mode assumes a gain factor
  2014. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2015. "fade out" at the beginning and at the end of the input, respectively.
  2016. @item s
  2017. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2018. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2019. compression. This means that signal peaks will not be pruned and thus the
  2020. full dynamic range will be retained within each local neighbourhood. However,
  2021. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2022. normalization algorithm with a more "traditional" compression.
  2023. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2024. (thresholding) function. If (and only if) the compression feature is enabled,
  2025. all input frames will be processed by a soft knee thresholding function prior
  2026. to the actual normalization process. Put simply, the thresholding function is
  2027. going to prune all samples whose magnitude exceeds a certain threshold value.
  2028. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2029. value. Instead, the threshold value will be adjusted for each individual
  2030. frame.
  2031. In general, smaller parameters result in stronger compression, and vice versa.
  2032. Values below 3.0 are not recommended, because audible distortion may appear.
  2033. @end table
  2034. @section earwax
  2035. Make audio easier to listen to on headphones.
  2036. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2037. so that when listened to on headphones the stereo image is moved from
  2038. inside your head (standard for headphones) to outside and in front of
  2039. the listener (standard for speakers).
  2040. Ported from SoX.
  2041. @section equalizer
  2042. Apply a two-pole peaking equalisation (EQ) filter. With this
  2043. filter, the signal-level at and around a selected frequency can
  2044. be increased or decreased, whilst (unlike bandpass and bandreject
  2045. filters) that at all other frequencies is unchanged.
  2046. In order to produce complex equalisation curves, this filter can
  2047. be given several times, each with a different central frequency.
  2048. The filter accepts the following options:
  2049. @table @option
  2050. @item frequency, f
  2051. Set the filter's central frequency in Hz.
  2052. @item width_type, t
  2053. Set method to specify band-width of filter.
  2054. @table @option
  2055. @item h
  2056. Hz
  2057. @item q
  2058. Q-Factor
  2059. @item o
  2060. octave
  2061. @item s
  2062. slope
  2063. @end table
  2064. @item width, w
  2065. Specify the band-width of a filter in width_type units.
  2066. @item gain, g
  2067. Set the required gain or attenuation in dB.
  2068. Beware of clipping when using a positive gain.
  2069. @item channels, c
  2070. Specify which channels to filter, by default all available are filtered.
  2071. @end table
  2072. @subsection Examples
  2073. @itemize
  2074. @item
  2075. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2076. @example
  2077. equalizer=f=1000:t=h:width=200:g=-10
  2078. @end example
  2079. @item
  2080. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2081. @example
  2082. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2083. @end example
  2084. @end itemize
  2085. @subsection Commands
  2086. This filter supports the following commands:
  2087. @table @option
  2088. @item frequency, f
  2089. Change equalizer frequency.
  2090. Syntax for the command is : "@var{frequency}"
  2091. @item width_type, t
  2092. Change equalizer width_type.
  2093. Syntax for the command is : "@var{width_type}"
  2094. @item width, w
  2095. Change equalizer width.
  2096. Syntax for the command is : "@var{width}"
  2097. @item gain, g
  2098. Change equalizer gain.
  2099. Syntax for the command is : "@var{gain}"
  2100. @end table
  2101. @section extrastereo
  2102. Linearly increases the difference between left and right channels which
  2103. adds some sort of "live" effect to playback.
  2104. The filter accepts the following options:
  2105. @table @option
  2106. @item m
  2107. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2108. (average of both channels), with 1.0 sound will be unchanged, with
  2109. -1.0 left and right channels will be swapped.
  2110. @item c
  2111. Enable clipping. By default is enabled.
  2112. @end table
  2113. @section firequalizer
  2114. Apply FIR Equalization using arbitrary frequency response.
  2115. The filter accepts the following option:
  2116. @table @option
  2117. @item gain
  2118. Set gain curve equation (in dB). The expression can contain variables:
  2119. @table @option
  2120. @item f
  2121. the evaluated frequency
  2122. @item sr
  2123. sample rate
  2124. @item ch
  2125. channel number, set to 0 when multichannels evaluation is disabled
  2126. @item chid
  2127. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2128. multichannels evaluation is disabled
  2129. @item chs
  2130. number of channels
  2131. @item chlayout
  2132. channel_layout, see libavutil/channel_layout.h
  2133. @end table
  2134. and functions:
  2135. @table @option
  2136. @item gain_interpolate(f)
  2137. interpolate gain on frequency f based on gain_entry
  2138. @item cubic_interpolate(f)
  2139. same as gain_interpolate, but smoother
  2140. @end table
  2141. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2142. @item gain_entry
  2143. Set gain entry for gain_interpolate function. The expression can
  2144. contain functions:
  2145. @table @option
  2146. @item entry(f, g)
  2147. store gain entry at frequency f with value g
  2148. @end table
  2149. This option is also available as command.
  2150. @item delay
  2151. Set filter delay in seconds. Higher value means more accurate.
  2152. Default is @code{0.01}.
  2153. @item accuracy
  2154. Set filter accuracy in Hz. Lower value means more accurate.
  2155. Default is @code{5}.
  2156. @item wfunc
  2157. Set window function. Acceptable values are:
  2158. @table @option
  2159. @item rectangular
  2160. rectangular window, useful when gain curve is already smooth
  2161. @item hann
  2162. hann window (default)
  2163. @item hamming
  2164. hamming window
  2165. @item blackman
  2166. blackman window
  2167. @item nuttall3
  2168. 3-terms continuous 1st derivative nuttall window
  2169. @item mnuttall3
  2170. minimum 3-terms discontinuous nuttall window
  2171. @item nuttall
  2172. 4-terms continuous 1st derivative nuttall window
  2173. @item bnuttall
  2174. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2175. @item bharris
  2176. blackman-harris window
  2177. @item tukey
  2178. tukey window
  2179. @end table
  2180. @item fixed
  2181. If enabled, use fixed number of audio samples. This improves speed when
  2182. filtering with large delay. Default is disabled.
  2183. @item multi
  2184. Enable multichannels evaluation on gain. Default is disabled.
  2185. @item zero_phase
  2186. Enable zero phase mode by subtracting timestamp to compensate delay.
  2187. Default is disabled.
  2188. @item scale
  2189. Set scale used by gain. Acceptable values are:
  2190. @table @option
  2191. @item linlin
  2192. linear frequency, linear gain
  2193. @item linlog
  2194. linear frequency, logarithmic (in dB) gain (default)
  2195. @item loglin
  2196. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2197. @item loglog
  2198. logarithmic frequency, logarithmic gain
  2199. @end table
  2200. @item dumpfile
  2201. Set file for dumping, suitable for gnuplot.
  2202. @item dumpscale
  2203. Set scale for dumpfile. Acceptable values are same with scale option.
  2204. Default is linlog.
  2205. @item fft2
  2206. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2207. Default is disabled.
  2208. @item min_phase
  2209. Enable minimum phase impulse response. Default is disabled.
  2210. @end table
  2211. @subsection Examples
  2212. @itemize
  2213. @item
  2214. lowpass at 1000 Hz:
  2215. @example
  2216. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2217. @end example
  2218. @item
  2219. lowpass at 1000 Hz with gain_entry:
  2220. @example
  2221. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2222. @end example
  2223. @item
  2224. custom equalization:
  2225. @example
  2226. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2227. @end example
  2228. @item
  2229. higher delay with zero phase to compensate delay:
  2230. @example
  2231. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2232. @end example
  2233. @item
  2234. lowpass on left channel, highpass on right channel:
  2235. @example
  2236. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2237. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2238. @end example
  2239. @end itemize
  2240. @section flanger
  2241. Apply a flanging effect to the audio.
  2242. The filter accepts the following options:
  2243. @table @option
  2244. @item delay
  2245. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2246. @item depth
  2247. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2248. @item regen
  2249. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2250. Default value is 0.
  2251. @item width
  2252. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2253. Default value is 71.
  2254. @item speed
  2255. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2256. @item shape
  2257. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2258. Default value is @var{sinusoidal}.
  2259. @item phase
  2260. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2261. Default value is 25.
  2262. @item interp
  2263. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2264. Default is @var{linear}.
  2265. @end table
  2266. @section haas
  2267. Apply Haas effect to audio.
  2268. Note that this makes most sense to apply on mono signals.
  2269. With this filter applied to mono signals it give some directionality and
  2270. stretches its stereo image.
  2271. The filter accepts the following options:
  2272. @table @option
  2273. @item level_in
  2274. Set input level. By default is @var{1}, or 0dB
  2275. @item level_out
  2276. Set output level. By default is @var{1}, or 0dB.
  2277. @item side_gain
  2278. Set gain applied to side part of signal. By default is @var{1}.
  2279. @item middle_source
  2280. Set kind of middle source. Can be one of the following:
  2281. @table @samp
  2282. @item left
  2283. Pick left channel.
  2284. @item right
  2285. Pick right channel.
  2286. @item mid
  2287. Pick middle part signal of stereo image.
  2288. @item side
  2289. Pick side part signal of stereo image.
  2290. @end table
  2291. @item middle_phase
  2292. Change middle phase. By default is disabled.
  2293. @item left_delay
  2294. Set left channel delay. By default is @var{2.05} milliseconds.
  2295. @item left_balance
  2296. Set left channel balance. By default is @var{-1}.
  2297. @item left_gain
  2298. Set left channel gain. By default is @var{1}.
  2299. @item left_phase
  2300. Change left phase. By default is disabled.
  2301. @item right_delay
  2302. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2303. @item right_balance
  2304. Set right channel balance. By default is @var{1}.
  2305. @item right_gain
  2306. Set right channel gain. By default is @var{1}.
  2307. @item right_phase
  2308. Change right phase. By default is enabled.
  2309. @end table
  2310. @section hdcd
  2311. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2312. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2313. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2314. of HDCD, and detects the Transient Filter flag.
  2315. @example
  2316. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2317. @end example
  2318. When using the filter with wav, note the default encoding for wav is 16-bit,
  2319. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2320. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2321. @example
  2322. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2323. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2324. @end example
  2325. The filter accepts the following options:
  2326. @table @option
  2327. @item disable_autoconvert
  2328. Disable any automatic format conversion or resampling in the filter graph.
  2329. @item process_stereo
  2330. Process the stereo channels together. If target_gain does not match between
  2331. channels, consider it invalid and use the last valid target_gain.
  2332. @item cdt_ms
  2333. Set the code detect timer period in ms.
  2334. @item force_pe
  2335. Always extend peaks above -3dBFS even if PE isn't signaled.
  2336. @item analyze_mode
  2337. Replace audio with a solid tone and adjust the amplitude to signal some
  2338. specific aspect of the decoding process. The output file can be loaded in
  2339. an audio editor alongside the original to aid analysis.
  2340. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2341. Modes are:
  2342. @table @samp
  2343. @item 0, off
  2344. Disabled
  2345. @item 1, lle
  2346. Gain adjustment level at each sample
  2347. @item 2, pe
  2348. Samples where peak extend occurs
  2349. @item 3, cdt
  2350. Samples where the code detect timer is active
  2351. @item 4, tgm
  2352. Samples where the target gain does not match between channels
  2353. @end table
  2354. @end table
  2355. @section headphone
  2356. Apply head-related transfer functions (HRTFs) to create virtual
  2357. loudspeakers around the user for binaural listening via headphones.
  2358. The HRIRs are provided via additional streams, for each channel
  2359. one stereo input stream is needed.
  2360. The filter accepts the following options:
  2361. @table @option
  2362. @item map
  2363. Set mapping of input streams for convolution.
  2364. The argument is a '|'-separated list of channel names in order as they
  2365. are given as additional stream inputs for filter.
  2366. This also specify number of input streams. Number of input streams
  2367. must be not less than number of channels in first stream plus one.
  2368. @item gain
  2369. Set gain applied to audio. Value is in dB. Default is 0.
  2370. @item type
  2371. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2372. processing audio in time domain which is slow.
  2373. @var{freq} is processing audio in frequency domain which is fast.
  2374. Default is @var{freq}.
  2375. @item lfe
  2376. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2377. @end table
  2378. @subsection Examples
  2379. @itemize
  2380. @item
  2381. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2382. each amovie filter use stereo file with IR coefficients as input.
  2383. The files give coefficients for each position of virtual loudspeaker:
  2384. @example
  2385. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2386. output.wav
  2387. @end example
  2388. @end itemize
  2389. @section highpass
  2390. Apply a high-pass filter with 3dB point frequency.
  2391. The filter can be either single-pole, or double-pole (the default).
  2392. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2393. The filter accepts the following options:
  2394. @table @option
  2395. @item frequency, f
  2396. Set frequency in Hz. Default is 3000.
  2397. @item poles, p
  2398. Set number of poles. Default is 2.
  2399. @item width_type, t
  2400. Set method to specify band-width of filter.
  2401. @table @option
  2402. @item h
  2403. Hz
  2404. @item q
  2405. Q-Factor
  2406. @item o
  2407. octave
  2408. @item s
  2409. slope
  2410. @end table
  2411. @item width, w
  2412. Specify the band-width of a filter in width_type units.
  2413. Applies only to double-pole filter.
  2414. The default is 0.707q and gives a Butterworth response.
  2415. @item channels, c
  2416. Specify which channels to filter, by default all available are filtered.
  2417. @end table
  2418. @subsection Commands
  2419. This filter supports the following commands:
  2420. @table @option
  2421. @item frequency, f
  2422. Change highpass frequency.
  2423. Syntax for the command is : "@var{frequency}"
  2424. @item width_type, t
  2425. Change highpass width_type.
  2426. Syntax for the command is : "@var{width_type}"
  2427. @item width, w
  2428. Change highpass width.
  2429. Syntax for the command is : "@var{width}"
  2430. @end table
  2431. @section join
  2432. Join multiple input streams into one multi-channel stream.
  2433. It accepts the following parameters:
  2434. @table @option
  2435. @item inputs
  2436. The number of input streams. It defaults to 2.
  2437. @item channel_layout
  2438. The desired output channel layout. It defaults to stereo.
  2439. @item map
  2440. Map channels from inputs to output. The argument is a '|'-separated list of
  2441. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2442. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2443. can be either the name of the input channel (e.g. FL for front left) or its
  2444. index in the specified input stream. @var{out_channel} is the name of the output
  2445. channel.
  2446. @end table
  2447. The filter will attempt to guess the mappings when they are not specified
  2448. explicitly. It does so by first trying to find an unused matching input channel
  2449. and if that fails it picks the first unused input channel.
  2450. Join 3 inputs (with properly set channel layouts):
  2451. @example
  2452. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2453. @end example
  2454. Build a 5.1 output from 6 single-channel streams:
  2455. @example
  2456. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2457. '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'
  2458. out
  2459. @end example
  2460. @section ladspa
  2461. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2462. To enable compilation of this filter you need to configure FFmpeg with
  2463. @code{--enable-ladspa}.
  2464. @table @option
  2465. @item file, f
  2466. Specifies the name of LADSPA plugin library to load. If the environment
  2467. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2468. each one of the directories specified by the colon separated list in
  2469. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2470. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2471. @file{/usr/lib/ladspa/}.
  2472. @item plugin, p
  2473. Specifies the plugin within the library. Some libraries contain only
  2474. one plugin, but others contain many of them. If this is not set filter
  2475. will list all available plugins within the specified library.
  2476. @item controls, c
  2477. Set the '|' separated list of controls which are zero or more floating point
  2478. values that determine the behavior of the loaded plugin (for example delay,
  2479. threshold or gain).
  2480. Controls need to be defined using the following syntax:
  2481. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2482. @var{valuei} is the value set on the @var{i}-th control.
  2483. Alternatively they can be also defined using the following syntax:
  2484. @var{value0}|@var{value1}|@var{value2}|..., where
  2485. @var{valuei} is the value set on the @var{i}-th control.
  2486. If @option{controls} is set to @code{help}, all available controls and
  2487. their valid ranges are printed.
  2488. @item sample_rate, s
  2489. Specify the sample rate, default to 44100. Only used if plugin have
  2490. zero inputs.
  2491. @item nb_samples, n
  2492. Set the number of samples per channel per each output frame, default
  2493. is 1024. Only used if plugin have zero inputs.
  2494. @item duration, d
  2495. Set the minimum duration of the sourced audio. See
  2496. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2497. for the accepted syntax.
  2498. Note that the resulting duration may be greater than the specified duration,
  2499. as the generated audio is always cut at the end of a complete frame.
  2500. If not specified, or the expressed duration is negative, the audio is
  2501. supposed to be generated forever.
  2502. Only used if plugin have zero inputs.
  2503. @end table
  2504. @subsection Examples
  2505. @itemize
  2506. @item
  2507. List all available plugins within amp (LADSPA example plugin) library:
  2508. @example
  2509. ladspa=file=amp
  2510. @end example
  2511. @item
  2512. List all available controls and their valid ranges for @code{vcf_notch}
  2513. plugin from @code{VCF} library:
  2514. @example
  2515. ladspa=f=vcf:p=vcf_notch:c=help
  2516. @end example
  2517. @item
  2518. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2519. plugin library:
  2520. @example
  2521. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2522. @end example
  2523. @item
  2524. Add reverberation to the audio using TAP-plugins
  2525. (Tom's Audio Processing plugins):
  2526. @example
  2527. ladspa=file=tap_reverb:tap_reverb
  2528. @end example
  2529. @item
  2530. Generate white noise, with 0.2 amplitude:
  2531. @example
  2532. ladspa=file=cmt:noise_source_white:c=c0=.2
  2533. @end example
  2534. @item
  2535. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2536. @code{C* Audio Plugin Suite} (CAPS) library:
  2537. @example
  2538. ladspa=file=caps:Click:c=c1=20'
  2539. @end example
  2540. @item
  2541. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2542. @example
  2543. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2544. @end example
  2545. @item
  2546. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2547. @code{SWH Plugins} collection:
  2548. @example
  2549. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2550. @end example
  2551. @item
  2552. Attenuate low frequencies using Multiband EQ from Steve Harris
  2553. @code{SWH Plugins} collection:
  2554. @example
  2555. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2556. @end example
  2557. @item
  2558. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2559. (CAPS) library:
  2560. @example
  2561. ladspa=caps:Narrower
  2562. @end example
  2563. @item
  2564. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2565. @example
  2566. ladspa=caps:White:.2
  2567. @end example
  2568. @item
  2569. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2570. @example
  2571. ladspa=caps:Fractal:c=c1=1
  2572. @end example
  2573. @item
  2574. Dynamic volume normalization using @code{VLevel} plugin:
  2575. @example
  2576. ladspa=vlevel-ladspa:vlevel_mono
  2577. @end example
  2578. @end itemize
  2579. @subsection Commands
  2580. This filter supports the following commands:
  2581. @table @option
  2582. @item cN
  2583. Modify the @var{N}-th control value.
  2584. If the specified value is not valid, it is ignored and prior one is kept.
  2585. @end table
  2586. @section loudnorm
  2587. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2588. Support for both single pass (livestreams, files) and double pass (files) modes.
  2589. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2590. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2591. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2592. The filter accepts the following options:
  2593. @table @option
  2594. @item I, i
  2595. Set integrated loudness target.
  2596. Range is -70.0 - -5.0. Default value is -24.0.
  2597. @item LRA, lra
  2598. Set loudness range target.
  2599. Range is 1.0 - 20.0. Default value is 7.0.
  2600. @item TP, tp
  2601. Set maximum true peak.
  2602. Range is -9.0 - +0.0. Default value is -2.0.
  2603. @item measured_I, measured_i
  2604. Measured IL of input file.
  2605. Range is -99.0 - +0.0.
  2606. @item measured_LRA, measured_lra
  2607. Measured LRA of input file.
  2608. Range is 0.0 - 99.0.
  2609. @item measured_TP, measured_tp
  2610. Measured true peak of input file.
  2611. Range is -99.0 - +99.0.
  2612. @item measured_thresh
  2613. Measured threshold of input file.
  2614. Range is -99.0 - +0.0.
  2615. @item offset
  2616. Set offset gain. Gain is applied before the true-peak limiter.
  2617. Range is -99.0 - +99.0. Default is +0.0.
  2618. @item linear
  2619. Normalize linearly if possible.
  2620. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2621. to be specified in order to use this mode.
  2622. Options are true or false. Default is true.
  2623. @item dual_mono
  2624. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2625. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2626. If set to @code{true}, this option will compensate for this effect.
  2627. Multi-channel input files are not affected by this option.
  2628. Options are true or false. Default is false.
  2629. @item print_format
  2630. Set print format for stats. Options are summary, json, or none.
  2631. Default value is none.
  2632. @end table
  2633. @section lowpass
  2634. Apply a low-pass filter with 3dB point frequency.
  2635. The filter can be either single-pole or double-pole (the default).
  2636. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2637. The filter accepts the following options:
  2638. @table @option
  2639. @item frequency, f
  2640. Set frequency in Hz. Default is 500.
  2641. @item poles, p
  2642. Set number of poles. Default is 2.
  2643. @item width_type, t
  2644. Set method to specify band-width of filter.
  2645. @table @option
  2646. @item h
  2647. Hz
  2648. @item q
  2649. Q-Factor
  2650. @item o
  2651. octave
  2652. @item s
  2653. slope
  2654. @end table
  2655. @item width, w
  2656. Specify the band-width of a filter in width_type units.
  2657. Applies only to double-pole filter.
  2658. The default is 0.707q and gives a Butterworth response.
  2659. @item channels, c
  2660. Specify which channels to filter, by default all available are filtered.
  2661. @end table
  2662. @subsection Examples
  2663. @itemize
  2664. @item
  2665. Lowpass only LFE channel, it LFE is not present it does nothing:
  2666. @example
  2667. lowpass=c=LFE
  2668. @end example
  2669. @end itemize
  2670. @subsection Commands
  2671. This filter supports the following commands:
  2672. @table @option
  2673. @item frequency, f
  2674. Change lowpass frequency.
  2675. Syntax for the command is : "@var{frequency}"
  2676. @item width_type, t
  2677. Change lowpass width_type.
  2678. Syntax for the command is : "@var{width_type}"
  2679. @item width, w
  2680. Change lowpass width.
  2681. Syntax for the command is : "@var{width}"
  2682. @end table
  2683. @section lv2
  2684. Load a LV2 (LADSPA Version 2) plugin.
  2685. To enable compilation of this filter you need to configure FFmpeg with
  2686. @code{--enable-lv2}.
  2687. @table @option
  2688. @item plugin, p
  2689. Specifies the plugin URI. You may need to escape ':'.
  2690. @item controls, c
  2691. Set the '|' separated list of controls which are zero or more floating point
  2692. values that determine the behavior of the loaded plugin (for example delay,
  2693. threshold or gain).
  2694. If @option{controls} is set to @code{help}, all available controls and
  2695. their valid ranges are printed.
  2696. @item sample_rate, s
  2697. Specify the sample rate, default to 44100. Only used if plugin have
  2698. zero inputs.
  2699. @item nb_samples, n
  2700. Set the number of samples per channel per each output frame, default
  2701. is 1024. Only used if plugin have zero inputs.
  2702. @item duration, d
  2703. Set the minimum duration of the sourced audio. See
  2704. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2705. for the accepted syntax.
  2706. Note that the resulting duration may be greater than the specified duration,
  2707. as the generated audio is always cut at the end of a complete frame.
  2708. If not specified, or the expressed duration is negative, the audio is
  2709. supposed to be generated forever.
  2710. Only used if plugin have zero inputs.
  2711. @end table
  2712. @subsection Examples
  2713. @itemize
  2714. @item
  2715. Apply bass enhancer plugin from Calf:
  2716. @example
  2717. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2718. @end example
  2719. @item
  2720. Apply bass vinyl plugin from Calf:
  2721. @example
  2722. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2723. @end example
  2724. @item
  2725. Apply bit crusher plugin from ArtyFX:
  2726. @example
  2727. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2728. @end example
  2729. @end itemize
  2730. @section mcompand
  2731. Multiband Compress or expand the audio's dynamic range.
  2732. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2733. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2734. response when absent compander action.
  2735. It accepts the following parameters:
  2736. @table @option
  2737. @item args
  2738. This option syntax is:
  2739. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2740. For explanation of each item refer to compand filter documentation.
  2741. @end table
  2742. @anchor{pan}
  2743. @section pan
  2744. Mix channels with specific gain levels. The filter accepts the output
  2745. channel layout followed by a set of channels definitions.
  2746. This filter is also designed to efficiently remap the channels of an audio
  2747. stream.
  2748. The filter accepts parameters of the form:
  2749. "@var{l}|@var{outdef}|@var{outdef}|..."
  2750. @table @option
  2751. @item l
  2752. output channel layout or number of channels
  2753. @item outdef
  2754. output channel specification, of the form:
  2755. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2756. @item out_name
  2757. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2758. number (c0, c1, etc.)
  2759. @item gain
  2760. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2761. @item in_name
  2762. input channel to use, see out_name for details; it is not possible to mix
  2763. named and numbered input channels
  2764. @end table
  2765. If the `=' in a channel specification is replaced by `<', then the gains for
  2766. that specification will be renormalized so that the total is 1, thus
  2767. avoiding clipping noise.
  2768. @subsection Mixing examples
  2769. For example, if you want to down-mix from stereo to mono, but with a bigger
  2770. factor for the left channel:
  2771. @example
  2772. pan=1c|c0=0.9*c0+0.1*c1
  2773. @end example
  2774. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2775. 7-channels surround:
  2776. @example
  2777. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2778. @end example
  2779. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2780. that should be preferred (see "-ac" option) unless you have very specific
  2781. needs.
  2782. @subsection Remapping examples
  2783. The channel remapping will be effective if, and only if:
  2784. @itemize
  2785. @item gain coefficients are zeroes or ones,
  2786. @item only one input per channel output,
  2787. @end itemize
  2788. If all these conditions are satisfied, the filter will notify the user ("Pure
  2789. channel mapping detected"), and use an optimized and lossless method to do the
  2790. remapping.
  2791. For example, if you have a 5.1 source and want a stereo audio stream by
  2792. dropping the extra channels:
  2793. @example
  2794. pan="stereo| c0=FL | c1=FR"
  2795. @end example
  2796. Given the same source, you can also switch front left and front right channels
  2797. and keep the input channel layout:
  2798. @example
  2799. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2800. @end example
  2801. If the input is a stereo audio stream, you can mute the front left channel (and
  2802. still keep the stereo channel layout) with:
  2803. @example
  2804. pan="stereo|c1=c1"
  2805. @end example
  2806. Still with a stereo audio stream input, you can copy the right channel in both
  2807. front left and right:
  2808. @example
  2809. pan="stereo| c0=FR | c1=FR"
  2810. @end example
  2811. @section replaygain
  2812. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2813. outputs it unchanged.
  2814. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2815. @section resample
  2816. Convert the audio sample format, sample rate and channel layout. It is
  2817. not meant to be used directly.
  2818. @section rubberband
  2819. Apply time-stretching and pitch-shifting with librubberband.
  2820. The filter accepts the following options:
  2821. @table @option
  2822. @item tempo
  2823. Set tempo scale factor.
  2824. @item pitch
  2825. Set pitch scale factor.
  2826. @item transients
  2827. Set transients detector.
  2828. Possible values are:
  2829. @table @var
  2830. @item crisp
  2831. @item mixed
  2832. @item smooth
  2833. @end table
  2834. @item detector
  2835. Set detector.
  2836. Possible values are:
  2837. @table @var
  2838. @item compound
  2839. @item percussive
  2840. @item soft
  2841. @end table
  2842. @item phase
  2843. Set phase.
  2844. Possible values are:
  2845. @table @var
  2846. @item laminar
  2847. @item independent
  2848. @end table
  2849. @item window
  2850. Set processing window size.
  2851. Possible values are:
  2852. @table @var
  2853. @item standard
  2854. @item short
  2855. @item long
  2856. @end table
  2857. @item smoothing
  2858. Set smoothing.
  2859. Possible values are:
  2860. @table @var
  2861. @item off
  2862. @item on
  2863. @end table
  2864. @item formant
  2865. Enable formant preservation when shift pitching.
  2866. Possible values are:
  2867. @table @var
  2868. @item shifted
  2869. @item preserved
  2870. @end table
  2871. @item pitchq
  2872. Set pitch quality.
  2873. Possible values are:
  2874. @table @var
  2875. @item quality
  2876. @item speed
  2877. @item consistency
  2878. @end table
  2879. @item channels
  2880. Set channels.
  2881. Possible values are:
  2882. @table @var
  2883. @item apart
  2884. @item together
  2885. @end table
  2886. @end table
  2887. @section sidechaincompress
  2888. This filter acts like normal compressor but has the ability to compress
  2889. detected signal using second input signal.
  2890. It needs two input streams and returns one output stream.
  2891. First input stream will be processed depending on second stream signal.
  2892. The filtered signal then can be filtered with other filters in later stages of
  2893. processing. See @ref{pan} and @ref{amerge} filter.
  2894. The filter accepts the following options:
  2895. @table @option
  2896. @item level_in
  2897. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2898. @item threshold
  2899. If a signal of second stream raises above this level it will affect the gain
  2900. reduction of first stream.
  2901. By default is 0.125. Range is between 0.00097563 and 1.
  2902. @item ratio
  2903. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2904. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2905. Default is 2. Range is between 1 and 20.
  2906. @item attack
  2907. Amount of milliseconds the signal has to rise above the threshold before gain
  2908. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2909. @item release
  2910. Amount of milliseconds the signal has to fall below the threshold before
  2911. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2912. @item makeup
  2913. Set the amount by how much signal will be amplified after processing.
  2914. Default is 1. Range is from 1 to 64.
  2915. @item knee
  2916. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2917. Default is 2.82843. Range is between 1 and 8.
  2918. @item link
  2919. Choose if the @code{average} level between all channels of side-chain stream
  2920. or the louder(@code{maximum}) channel of side-chain stream affects the
  2921. reduction. Default is @code{average}.
  2922. @item detection
  2923. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2924. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2925. @item level_sc
  2926. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2927. @item mix
  2928. How much to use compressed signal in output. Default is 1.
  2929. Range is between 0 and 1.
  2930. @end table
  2931. @subsection Examples
  2932. @itemize
  2933. @item
  2934. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2935. depending on the signal of 2nd input and later compressed signal to be
  2936. merged with 2nd input:
  2937. @example
  2938. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2939. @end example
  2940. @end itemize
  2941. @section sidechaingate
  2942. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2943. filter the detected signal before sending it to the gain reduction stage.
  2944. Normally a gate uses the full range signal to detect a level above the
  2945. threshold.
  2946. For example: If you cut all lower frequencies from your sidechain signal
  2947. the gate will decrease the volume of your track only if not enough highs
  2948. appear. With this technique you are able to reduce the resonation of a
  2949. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2950. guitar.
  2951. It needs two input streams and returns one output stream.
  2952. First input stream will be processed depending on second stream signal.
  2953. The filter accepts the following options:
  2954. @table @option
  2955. @item level_in
  2956. Set input level before filtering.
  2957. Default is 1. Allowed range is from 0.015625 to 64.
  2958. @item range
  2959. Set the level of gain reduction when the signal is below the threshold.
  2960. Default is 0.06125. Allowed range is from 0 to 1.
  2961. @item threshold
  2962. If a signal rises above this level the gain reduction is released.
  2963. Default is 0.125. Allowed range is from 0 to 1.
  2964. @item ratio
  2965. Set a ratio about which the signal is reduced.
  2966. Default is 2. Allowed range is from 1 to 9000.
  2967. @item attack
  2968. Amount of milliseconds the signal has to rise above the threshold before gain
  2969. reduction stops.
  2970. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2971. @item release
  2972. Amount of milliseconds the signal has to fall below the threshold before the
  2973. reduction is increased again. Default is 250 milliseconds.
  2974. Allowed range is from 0.01 to 9000.
  2975. @item makeup
  2976. Set amount of amplification of signal after processing.
  2977. Default is 1. Allowed range is from 1 to 64.
  2978. @item knee
  2979. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2980. Default is 2.828427125. Allowed range is from 1 to 8.
  2981. @item detection
  2982. Choose if exact signal should be taken for detection or an RMS like one.
  2983. Default is rms. Can be peak or rms.
  2984. @item link
  2985. Choose if the average level between all channels or the louder channel affects
  2986. the reduction.
  2987. Default is average. Can be average or maximum.
  2988. @item level_sc
  2989. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2990. @end table
  2991. @section silencedetect
  2992. Detect silence in an audio stream.
  2993. This filter logs a message when it detects that the input audio volume is less
  2994. or equal to a noise tolerance value for a duration greater or equal to the
  2995. minimum detected noise duration.
  2996. The printed times and duration are expressed in seconds.
  2997. The filter accepts the following options:
  2998. @table @option
  2999. @item duration, d
  3000. Set silence duration until notification (default is 2 seconds).
  3001. @item noise, n
  3002. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3003. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3004. @end table
  3005. @subsection Examples
  3006. @itemize
  3007. @item
  3008. Detect 5 seconds of silence with -50dB noise tolerance:
  3009. @example
  3010. silencedetect=n=-50dB:d=5
  3011. @end example
  3012. @item
  3013. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3014. tolerance in @file{silence.mp3}:
  3015. @example
  3016. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3017. @end example
  3018. @end itemize
  3019. @section silenceremove
  3020. Remove silence from the beginning, middle or end of the audio.
  3021. The filter accepts the following options:
  3022. @table @option
  3023. @item start_periods
  3024. This value is used to indicate if audio should be trimmed at beginning of
  3025. the audio. A value of zero indicates no silence should be trimmed from the
  3026. beginning. When specifying a non-zero value, it trims audio up until it
  3027. finds non-silence. Normally, when trimming silence from beginning of audio
  3028. the @var{start_periods} will be @code{1} but it can be increased to higher
  3029. values to trim all audio up to specific count of non-silence periods.
  3030. Default value is @code{0}.
  3031. @item start_duration
  3032. Specify the amount of time that non-silence must be detected before it stops
  3033. trimming audio. By increasing the duration, bursts of noises can be treated
  3034. as silence and trimmed off. Default value is @code{0}.
  3035. @item start_threshold
  3036. This indicates what sample value should be treated as silence. For digital
  3037. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3038. you may wish to increase the value to account for background noise.
  3039. Can be specified in dB (in case "dB" is appended to the specified value)
  3040. or amplitude ratio. Default value is @code{0}.
  3041. @item stop_periods
  3042. Set the count for trimming silence from the end of audio.
  3043. To remove silence from the middle of a file, specify a @var{stop_periods}
  3044. that is negative. This value is then treated as a positive value and is
  3045. used to indicate the effect should restart processing as specified by
  3046. @var{start_periods}, making it suitable for removing periods of silence
  3047. in the middle of the audio.
  3048. Default value is @code{0}.
  3049. @item stop_duration
  3050. Specify a duration of silence that must exist before audio is not copied any
  3051. more. By specifying a higher duration, silence that is wanted can be left in
  3052. the audio.
  3053. Default value is @code{0}.
  3054. @item stop_threshold
  3055. This is the same as @option{start_threshold} but for trimming silence from
  3056. the end of audio.
  3057. Can be specified in dB (in case "dB" is appended to the specified value)
  3058. or amplitude ratio. Default value is @code{0}.
  3059. @item leave_silence
  3060. This indicates that @var{stop_duration} length of audio should be left intact
  3061. at the beginning of each period of silence.
  3062. For example, if you want to remove long pauses between words but do not want
  3063. to remove the pauses completely. Default value is @code{0}.
  3064. @item detection
  3065. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3066. and works better with digital silence which is exactly 0.
  3067. Default value is @code{rms}.
  3068. @item window
  3069. Set ratio used to calculate size of window for detecting silence.
  3070. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3071. @end table
  3072. @subsection Examples
  3073. @itemize
  3074. @item
  3075. The following example shows how this filter can be used to start a recording
  3076. that does not contain the delay at the start which usually occurs between
  3077. pressing the record button and the start of the performance:
  3078. @example
  3079. silenceremove=1:5:0.02
  3080. @end example
  3081. @item
  3082. Trim all silence encountered from beginning to end where there is more than 1
  3083. second of silence in audio:
  3084. @example
  3085. silenceremove=0:0:0:-1:1:-90dB
  3086. @end example
  3087. @end itemize
  3088. @section sofalizer
  3089. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3090. loudspeakers around the user for binaural listening via headphones (audio
  3091. formats up to 9 channels supported).
  3092. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3093. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3094. Austrian Academy of Sciences.
  3095. To enable compilation of this filter you need to configure FFmpeg with
  3096. @code{--enable-libmysofa}.
  3097. The filter accepts the following options:
  3098. @table @option
  3099. @item sofa
  3100. Set the SOFA file used for rendering.
  3101. @item gain
  3102. Set gain applied to audio. Value is in dB. Default is 0.
  3103. @item rotation
  3104. Set rotation of virtual loudspeakers in deg. Default is 0.
  3105. @item elevation
  3106. Set elevation of virtual speakers in deg. Default is 0.
  3107. @item radius
  3108. Set distance in meters between loudspeakers and the listener with near-field
  3109. HRTFs. Default is 1.
  3110. @item type
  3111. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3112. processing audio in time domain which is slow.
  3113. @var{freq} is processing audio in frequency domain which is fast.
  3114. Default is @var{freq}.
  3115. @item speakers
  3116. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3117. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3118. Each virtual loudspeaker is described with short channel name following with
  3119. azimuth and elevation in degrees.
  3120. Each virtual loudspeaker description is separated by '|'.
  3121. For example to override front left and front right channel positions use:
  3122. 'speakers=FL 45 15|FR 345 15'.
  3123. Descriptions with unrecognised channel names are ignored.
  3124. @item lfegain
  3125. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3126. @end table
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. Using ClubFritz6 sofa file:
  3131. @example
  3132. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3133. @end example
  3134. @item
  3135. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3136. @example
  3137. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3138. @end example
  3139. @item
  3140. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3141. and also with custom gain:
  3142. @example
  3143. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3144. @end example
  3145. @end itemize
  3146. @section stereotools
  3147. This filter has some handy utilities to manage stereo signals, for converting
  3148. M/S stereo recordings to L/R signal while having control over the parameters
  3149. or spreading the stereo image of master track.
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item level_in
  3153. Set input level before filtering for both channels. Defaults is 1.
  3154. Allowed range is from 0.015625 to 64.
  3155. @item level_out
  3156. Set output level after filtering for both channels. Defaults is 1.
  3157. Allowed range is from 0.015625 to 64.
  3158. @item balance_in
  3159. Set input balance between both channels. Default is 0.
  3160. Allowed range is from -1 to 1.
  3161. @item balance_out
  3162. Set output balance between both channels. Default is 0.
  3163. Allowed range is from -1 to 1.
  3164. @item softclip
  3165. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3166. clipping. Disabled by default.
  3167. @item mutel
  3168. Mute the left channel. Disabled by default.
  3169. @item muter
  3170. Mute the right channel. Disabled by default.
  3171. @item phasel
  3172. Change the phase of the left channel. Disabled by default.
  3173. @item phaser
  3174. Change the phase of the right channel. Disabled by default.
  3175. @item mode
  3176. Set stereo mode. Available values are:
  3177. @table @samp
  3178. @item lr>lr
  3179. Left/Right to Left/Right, this is default.
  3180. @item lr>ms
  3181. Left/Right to Mid/Side.
  3182. @item ms>lr
  3183. Mid/Side to Left/Right.
  3184. @item lr>ll
  3185. Left/Right to Left/Left.
  3186. @item lr>rr
  3187. Left/Right to Right/Right.
  3188. @item lr>l+r
  3189. Left/Right to Left + Right.
  3190. @item lr>rl
  3191. Left/Right to Right/Left.
  3192. @item ms>ll
  3193. Mid/Side to Left/Left.
  3194. @item ms>rr
  3195. Mid/Side to Right/Right.
  3196. @end table
  3197. @item slev
  3198. Set level of side signal. Default is 1.
  3199. Allowed range is from 0.015625 to 64.
  3200. @item sbal
  3201. Set balance of side signal. Default is 0.
  3202. Allowed range is from -1 to 1.
  3203. @item mlev
  3204. Set level of the middle signal. Default is 1.
  3205. Allowed range is from 0.015625 to 64.
  3206. @item mpan
  3207. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3208. @item base
  3209. Set stereo base between mono and inversed channels. Default is 0.
  3210. Allowed range is from -1 to 1.
  3211. @item delay
  3212. Set delay in milliseconds how much to delay left from right channel and
  3213. vice versa. Default is 0. Allowed range is from -20 to 20.
  3214. @item sclevel
  3215. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3216. @item phase
  3217. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3218. @item bmode_in, bmode_out
  3219. Set balance mode for balance_in/balance_out option.
  3220. Can be one of the following:
  3221. @table @samp
  3222. @item balance
  3223. Classic balance mode. Attenuate one channel at time.
  3224. Gain is raised up to 1.
  3225. @item amplitude
  3226. Similar as classic mode above but gain is raised up to 2.
  3227. @item power
  3228. Equal power distribution, from -6dB to +6dB range.
  3229. @end table
  3230. @end table
  3231. @subsection Examples
  3232. @itemize
  3233. @item
  3234. Apply karaoke like effect:
  3235. @example
  3236. stereotools=mlev=0.015625
  3237. @end example
  3238. @item
  3239. Convert M/S signal to L/R:
  3240. @example
  3241. "stereotools=mode=ms>lr"
  3242. @end example
  3243. @end itemize
  3244. @section stereowiden
  3245. This filter enhance the stereo effect by suppressing signal common to both
  3246. channels and by delaying the signal of left into right and vice versa,
  3247. thereby widening the stereo effect.
  3248. The filter accepts the following options:
  3249. @table @option
  3250. @item delay
  3251. Time in milliseconds of the delay of left signal into right and vice versa.
  3252. Default is 20 milliseconds.
  3253. @item feedback
  3254. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3255. effect of left signal in right output and vice versa which gives widening
  3256. effect. Default is 0.3.
  3257. @item crossfeed
  3258. Cross feed of left into right with inverted phase. This helps in suppressing
  3259. the mono. If the value is 1 it will cancel all the signal common to both
  3260. channels. Default is 0.3.
  3261. @item drymix
  3262. Set level of input signal of original channel. Default is 0.8.
  3263. @end table
  3264. @section superequalizer
  3265. Apply 18 band equalizer.
  3266. The filter accepts the following options:
  3267. @table @option
  3268. @item 1b
  3269. Set 65Hz band gain.
  3270. @item 2b
  3271. Set 92Hz band gain.
  3272. @item 3b
  3273. Set 131Hz band gain.
  3274. @item 4b
  3275. Set 185Hz band gain.
  3276. @item 5b
  3277. Set 262Hz band gain.
  3278. @item 6b
  3279. Set 370Hz band gain.
  3280. @item 7b
  3281. Set 523Hz band gain.
  3282. @item 8b
  3283. Set 740Hz band gain.
  3284. @item 9b
  3285. Set 1047Hz band gain.
  3286. @item 10b
  3287. Set 1480Hz band gain.
  3288. @item 11b
  3289. Set 2093Hz band gain.
  3290. @item 12b
  3291. Set 2960Hz band gain.
  3292. @item 13b
  3293. Set 4186Hz band gain.
  3294. @item 14b
  3295. Set 5920Hz band gain.
  3296. @item 15b
  3297. Set 8372Hz band gain.
  3298. @item 16b
  3299. Set 11840Hz band gain.
  3300. @item 17b
  3301. Set 16744Hz band gain.
  3302. @item 18b
  3303. Set 20000Hz band gain.
  3304. @end table
  3305. @section surround
  3306. Apply audio surround upmix filter.
  3307. This filter allows to produce multichannel output from audio stream.
  3308. The filter accepts the following options:
  3309. @table @option
  3310. @item chl_out
  3311. Set output channel layout. By default, this is @var{5.1}.
  3312. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3313. for the required syntax.
  3314. @item chl_in
  3315. Set input channel layout. By default, this is @var{stereo}.
  3316. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3317. for the required syntax.
  3318. @item level_in
  3319. Set input volume level. By default, this is @var{1}.
  3320. @item level_out
  3321. Set output volume level. By default, this is @var{1}.
  3322. @item lfe
  3323. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3324. @item lfe_low
  3325. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3326. @item lfe_high
  3327. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3328. @item fc_in
  3329. Set front center input volume. By default, this is @var{1}.
  3330. @item fc_out
  3331. Set front center output volume. By default, this is @var{1}.
  3332. @item lfe_in
  3333. Set LFE input volume. By default, this is @var{1}.
  3334. @item lfe_out
  3335. Set LFE output volume. By default, this is @var{1}.
  3336. @end table
  3337. @section treble
  3338. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3339. shelving filter with a response similar to that of a standard
  3340. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3341. The filter accepts the following options:
  3342. @table @option
  3343. @item gain, g
  3344. Give the gain at whichever is the lower of ~22 kHz and the
  3345. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3346. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3347. @item frequency, f
  3348. Set the filter's central frequency and so can be used
  3349. to extend or reduce the frequency range to be boosted or cut.
  3350. The default value is @code{3000} Hz.
  3351. @item width_type, t
  3352. Set method to specify band-width of filter.
  3353. @table @option
  3354. @item h
  3355. Hz
  3356. @item q
  3357. Q-Factor
  3358. @item o
  3359. octave
  3360. @item s
  3361. slope
  3362. @end table
  3363. @item width, w
  3364. Determine how steep is the filter's shelf transition.
  3365. @item channels, c
  3366. Specify which channels to filter, by default all available are filtered.
  3367. @end table
  3368. @subsection Commands
  3369. This filter supports the following commands:
  3370. @table @option
  3371. @item frequency, f
  3372. Change treble frequency.
  3373. Syntax for the command is : "@var{frequency}"
  3374. @item width_type, t
  3375. Change treble width_type.
  3376. Syntax for the command is : "@var{width_type}"
  3377. @item width, w
  3378. Change treble width.
  3379. Syntax for the command is : "@var{width}"
  3380. @item gain, g
  3381. Change treble gain.
  3382. Syntax for the command is : "@var{gain}"
  3383. @end table
  3384. @section tremolo
  3385. Sinusoidal amplitude modulation.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item f
  3389. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3390. (20 Hz or lower) will result in a tremolo effect.
  3391. This filter may also be used as a ring modulator by specifying
  3392. a modulation frequency higher than 20 Hz.
  3393. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3394. @item d
  3395. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3396. Default value is 0.5.
  3397. @end table
  3398. @section vibrato
  3399. Sinusoidal phase modulation.
  3400. The filter accepts the following options:
  3401. @table @option
  3402. @item f
  3403. Modulation frequency in Hertz.
  3404. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3405. @item d
  3406. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3407. Default value is 0.5.
  3408. @end table
  3409. @section volume
  3410. Adjust the input audio volume.
  3411. It accepts the following parameters:
  3412. @table @option
  3413. @item volume
  3414. Set audio volume expression.
  3415. Output values are clipped to the maximum value.
  3416. The output audio volume is given by the relation:
  3417. @example
  3418. @var{output_volume} = @var{volume} * @var{input_volume}
  3419. @end example
  3420. The default value for @var{volume} is "1.0".
  3421. @item precision
  3422. This parameter represents the mathematical precision.
  3423. It determines which input sample formats will be allowed, which affects the
  3424. precision of the volume scaling.
  3425. @table @option
  3426. @item fixed
  3427. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3428. @item float
  3429. 32-bit floating-point; this limits input sample format to FLT. (default)
  3430. @item double
  3431. 64-bit floating-point; this limits input sample format to DBL.
  3432. @end table
  3433. @item replaygain
  3434. Choose the behaviour on encountering ReplayGain side data in input frames.
  3435. @table @option
  3436. @item drop
  3437. Remove ReplayGain side data, ignoring its contents (the default).
  3438. @item ignore
  3439. Ignore ReplayGain side data, but leave it in the frame.
  3440. @item track
  3441. Prefer the track gain, if present.
  3442. @item album
  3443. Prefer the album gain, if present.
  3444. @end table
  3445. @item replaygain_preamp
  3446. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3447. Default value for @var{replaygain_preamp} is 0.0.
  3448. @item eval
  3449. Set when the volume expression is evaluated.
  3450. It accepts the following values:
  3451. @table @samp
  3452. @item once
  3453. only evaluate expression once during the filter initialization, or
  3454. when the @samp{volume} command is sent
  3455. @item frame
  3456. evaluate expression for each incoming frame
  3457. @end table
  3458. Default value is @samp{once}.
  3459. @end table
  3460. The volume expression can contain the following parameters.
  3461. @table @option
  3462. @item n
  3463. frame number (starting at zero)
  3464. @item nb_channels
  3465. number of channels
  3466. @item nb_consumed_samples
  3467. number of samples consumed by the filter
  3468. @item nb_samples
  3469. number of samples in the current frame
  3470. @item pos
  3471. original frame position in the file
  3472. @item pts
  3473. frame PTS
  3474. @item sample_rate
  3475. sample rate
  3476. @item startpts
  3477. PTS at start of stream
  3478. @item startt
  3479. time at start of stream
  3480. @item t
  3481. frame time
  3482. @item tb
  3483. timestamp timebase
  3484. @item volume
  3485. last set volume value
  3486. @end table
  3487. Note that when @option{eval} is set to @samp{once} only the
  3488. @var{sample_rate} and @var{tb} variables are available, all other
  3489. variables will evaluate to NAN.
  3490. @subsection Commands
  3491. This filter supports the following commands:
  3492. @table @option
  3493. @item volume
  3494. Modify the volume expression.
  3495. The command accepts the same syntax of the corresponding option.
  3496. If the specified expression is not valid, it is kept at its current
  3497. value.
  3498. @item replaygain_noclip
  3499. Prevent clipping by limiting the gain applied.
  3500. Default value for @var{replaygain_noclip} is 1.
  3501. @end table
  3502. @subsection Examples
  3503. @itemize
  3504. @item
  3505. Halve the input audio volume:
  3506. @example
  3507. volume=volume=0.5
  3508. volume=volume=1/2
  3509. volume=volume=-6.0206dB
  3510. @end example
  3511. In all the above example the named key for @option{volume} can be
  3512. omitted, for example like in:
  3513. @example
  3514. volume=0.5
  3515. @end example
  3516. @item
  3517. Increase input audio power by 6 decibels using fixed-point precision:
  3518. @example
  3519. volume=volume=6dB:precision=fixed
  3520. @end example
  3521. @item
  3522. Fade volume after time 10 with an annihilation period of 5 seconds:
  3523. @example
  3524. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3525. @end example
  3526. @end itemize
  3527. @section volumedetect
  3528. Detect the volume of the input video.
  3529. The filter has no parameters. The input is not modified. Statistics about
  3530. the volume will be printed in the log when the input stream end is reached.
  3531. In particular it will show the mean volume (root mean square), maximum
  3532. volume (on a per-sample basis), and the beginning of a histogram of the
  3533. registered volume values (from the maximum value to a cumulated 1/1000 of
  3534. the samples).
  3535. All volumes are in decibels relative to the maximum PCM value.
  3536. @subsection Examples
  3537. Here is an excerpt of the output:
  3538. @example
  3539. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3540. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3541. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3542. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3543. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3544. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3545. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3546. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3547. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3548. @end example
  3549. It means that:
  3550. @itemize
  3551. @item
  3552. The mean square energy is approximately -27 dB, or 10^-2.7.
  3553. @item
  3554. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3555. @item
  3556. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3557. @end itemize
  3558. In other words, raising the volume by +4 dB does not cause any clipping,
  3559. raising it by +5 dB causes clipping for 6 samples, etc.
  3560. @c man end AUDIO FILTERS
  3561. @chapter Audio Sources
  3562. @c man begin AUDIO SOURCES
  3563. Below is a description of the currently available audio sources.
  3564. @section abuffer
  3565. Buffer audio frames, and make them available to the filter chain.
  3566. This source is mainly intended for a programmatic use, in particular
  3567. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3568. It accepts the following parameters:
  3569. @table @option
  3570. @item time_base
  3571. The timebase which will be used for timestamps of submitted frames. It must be
  3572. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3573. @item sample_rate
  3574. The sample rate of the incoming audio buffers.
  3575. @item sample_fmt
  3576. The sample format of the incoming audio buffers.
  3577. Either a sample format name or its corresponding integer representation from
  3578. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3579. @item channel_layout
  3580. The channel layout of the incoming audio buffers.
  3581. Either a channel layout name from channel_layout_map in
  3582. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3583. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3584. @item channels
  3585. The number of channels of the incoming audio buffers.
  3586. If both @var{channels} and @var{channel_layout} are specified, then they
  3587. must be consistent.
  3588. @end table
  3589. @subsection Examples
  3590. @example
  3591. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3592. @end example
  3593. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3594. Since the sample format with name "s16p" corresponds to the number
  3595. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3596. equivalent to:
  3597. @example
  3598. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3599. @end example
  3600. @section aevalsrc
  3601. Generate an audio signal specified by an expression.
  3602. This source accepts in input one or more expressions (one for each
  3603. channel), which are evaluated and used to generate a corresponding
  3604. audio signal.
  3605. This source accepts the following options:
  3606. @table @option
  3607. @item exprs
  3608. Set the '|'-separated expressions list for each separate channel. In case the
  3609. @option{channel_layout} option is not specified, the selected channel layout
  3610. depends on the number of provided expressions. Otherwise the last
  3611. specified expression is applied to the remaining output channels.
  3612. @item channel_layout, c
  3613. Set the channel layout. The number of channels in the specified layout
  3614. must be equal to the number of specified expressions.
  3615. @item duration, d
  3616. Set the minimum duration of the sourced audio. See
  3617. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3618. for the accepted syntax.
  3619. Note that the resulting duration may be greater than the specified
  3620. duration, as the generated audio is always cut at the end of a
  3621. complete frame.
  3622. If not specified, or the expressed duration is negative, the audio is
  3623. supposed to be generated forever.
  3624. @item nb_samples, n
  3625. Set the number of samples per channel per each output frame,
  3626. default to 1024.
  3627. @item sample_rate, s
  3628. Specify the sample rate, default to 44100.
  3629. @end table
  3630. Each expression in @var{exprs} can contain the following constants:
  3631. @table @option
  3632. @item n
  3633. number of the evaluated sample, starting from 0
  3634. @item t
  3635. time of the evaluated sample expressed in seconds, starting from 0
  3636. @item s
  3637. sample rate
  3638. @end table
  3639. @subsection Examples
  3640. @itemize
  3641. @item
  3642. Generate silence:
  3643. @example
  3644. aevalsrc=0
  3645. @end example
  3646. @item
  3647. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3648. 8000 Hz:
  3649. @example
  3650. aevalsrc="sin(440*2*PI*t):s=8000"
  3651. @end example
  3652. @item
  3653. Generate a two channels signal, specify the channel layout (Front
  3654. Center + Back Center) explicitly:
  3655. @example
  3656. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3657. @end example
  3658. @item
  3659. Generate white noise:
  3660. @example
  3661. aevalsrc="-2+random(0)"
  3662. @end example
  3663. @item
  3664. Generate an amplitude modulated signal:
  3665. @example
  3666. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3667. @end example
  3668. @item
  3669. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3670. @example
  3671. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3672. @end example
  3673. @end itemize
  3674. @section anullsrc
  3675. The null audio source, return unprocessed audio frames. It is mainly useful
  3676. as a template and to be employed in analysis / debugging tools, or as
  3677. the source for filters which ignore the input data (for example the sox
  3678. synth filter).
  3679. This source accepts the following options:
  3680. @table @option
  3681. @item channel_layout, cl
  3682. Specifies the channel layout, and can be either an integer or a string
  3683. representing a channel layout. The default value of @var{channel_layout}
  3684. is "stereo".
  3685. Check the channel_layout_map definition in
  3686. @file{libavutil/channel_layout.c} for the mapping between strings and
  3687. channel layout values.
  3688. @item sample_rate, r
  3689. Specifies the sample rate, and defaults to 44100.
  3690. @item nb_samples, n
  3691. Set the number of samples per requested frames.
  3692. @end table
  3693. @subsection Examples
  3694. @itemize
  3695. @item
  3696. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3697. @example
  3698. anullsrc=r=48000:cl=4
  3699. @end example
  3700. @item
  3701. Do the same operation with a more obvious syntax:
  3702. @example
  3703. anullsrc=r=48000:cl=mono
  3704. @end example
  3705. @end itemize
  3706. All the parameters need to be explicitly defined.
  3707. @section flite
  3708. Synthesize a voice utterance using the libflite library.
  3709. To enable compilation of this filter you need to configure FFmpeg with
  3710. @code{--enable-libflite}.
  3711. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3712. The filter accepts the following options:
  3713. @table @option
  3714. @item list_voices
  3715. If set to 1, list the names of the available voices and exit
  3716. immediately. Default value is 0.
  3717. @item nb_samples, n
  3718. Set the maximum number of samples per frame. Default value is 512.
  3719. @item textfile
  3720. Set the filename containing the text to speak.
  3721. @item text
  3722. Set the text to speak.
  3723. @item voice, v
  3724. Set the voice to use for the speech synthesis. Default value is
  3725. @code{kal}. See also the @var{list_voices} option.
  3726. @end table
  3727. @subsection Examples
  3728. @itemize
  3729. @item
  3730. Read from file @file{speech.txt}, and synthesize the text using the
  3731. standard flite voice:
  3732. @example
  3733. flite=textfile=speech.txt
  3734. @end example
  3735. @item
  3736. Read the specified text selecting the @code{slt} voice:
  3737. @example
  3738. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3739. @end example
  3740. @item
  3741. Input text to ffmpeg:
  3742. @example
  3743. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3744. @end example
  3745. @item
  3746. Make @file{ffplay} speak the specified text, using @code{flite} and
  3747. the @code{lavfi} device:
  3748. @example
  3749. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3750. @end example
  3751. @end itemize
  3752. For more information about libflite, check:
  3753. @url{http://www.festvox.org/flite/}
  3754. @section anoisesrc
  3755. Generate a noise audio signal.
  3756. The filter accepts the following options:
  3757. @table @option
  3758. @item sample_rate, r
  3759. Specify the sample rate. Default value is 48000 Hz.
  3760. @item amplitude, a
  3761. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3762. is 1.0.
  3763. @item duration, d
  3764. Specify the duration of the generated audio stream. Not specifying this option
  3765. results in noise with an infinite length.
  3766. @item color, colour, c
  3767. Specify the color of noise. Available noise colors are white, pink, brown,
  3768. blue and violet. Default color is white.
  3769. @item seed, s
  3770. Specify a value used to seed the PRNG.
  3771. @item nb_samples, n
  3772. Set the number of samples per each output frame, default is 1024.
  3773. @end table
  3774. @subsection Examples
  3775. @itemize
  3776. @item
  3777. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3778. @example
  3779. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3780. @end example
  3781. @end itemize
  3782. @section sine
  3783. Generate an audio signal made of a sine wave with amplitude 1/8.
  3784. The audio signal is bit-exact.
  3785. The filter accepts the following options:
  3786. @table @option
  3787. @item frequency, f
  3788. Set the carrier frequency. Default is 440 Hz.
  3789. @item beep_factor, b
  3790. Enable a periodic beep every second with frequency @var{beep_factor} times
  3791. the carrier frequency. Default is 0, meaning the beep is disabled.
  3792. @item sample_rate, r
  3793. Specify the sample rate, default is 44100.
  3794. @item duration, d
  3795. Specify the duration of the generated audio stream.
  3796. @item samples_per_frame
  3797. Set the number of samples per output frame.
  3798. The expression can contain the following constants:
  3799. @table @option
  3800. @item n
  3801. The (sequential) number of the output audio frame, starting from 0.
  3802. @item pts
  3803. The PTS (Presentation TimeStamp) of the output audio frame,
  3804. expressed in @var{TB} units.
  3805. @item t
  3806. The PTS of the output audio frame, expressed in seconds.
  3807. @item TB
  3808. The timebase of the output audio frames.
  3809. @end table
  3810. Default is @code{1024}.
  3811. @end table
  3812. @subsection Examples
  3813. @itemize
  3814. @item
  3815. Generate a simple 440 Hz sine wave:
  3816. @example
  3817. sine
  3818. @end example
  3819. @item
  3820. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3821. @example
  3822. sine=220:4:d=5
  3823. sine=f=220:b=4:d=5
  3824. sine=frequency=220:beep_factor=4:duration=5
  3825. @end example
  3826. @item
  3827. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3828. pattern:
  3829. @example
  3830. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3831. @end example
  3832. @end itemize
  3833. @c man end AUDIO SOURCES
  3834. @chapter Audio Sinks
  3835. @c man begin AUDIO SINKS
  3836. Below is a description of the currently available audio sinks.
  3837. @section abuffersink
  3838. Buffer audio frames, and make them available to the end of filter chain.
  3839. This sink is mainly intended for programmatic use, in particular
  3840. through the interface defined in @file{libavfilter/buffersink.h}
  3841. or the options system.
  3842. It accepts a pointer to an AVABufferSinkContext structure, which
  3843. defines the incoming buffers' formats, to be passed as the opaque
  3844. parameter to @code{avfilter_init_filter} for initialization.
  3845. @section anullsink
  3846. Null audio sink; do absolutely nothing with the input audio. It is
  3847. mainly useful as a template and for use in analysis / debugging
  3848. tools.
  3849. @c man end AUDIO SINKS
  3850. @chapter Video Filters
  3851. @c man begin VIDEO FILTERS
  3852. When you configure your FFmpeg build, you can disable any of the
  3853. existing filters using @code{--disable-filters}.
  3854. The configure output will show the video filters included in your
  3855. build.
  3856. Below is a description of the currently available video filters.
  3857. @section alphaextract
  3858. Extract the alpha component from the input as a grayscale video. This
  3859. is especially useful with the @var{alphamerge} filter.
  3860. @section alphamerge
  3861. Add or replace the alpha component of the primary input with the
  3862. grayscale value of a second input. This is intended for use with
  3863. @var{alphaextract} to allow the transmission or storage of frame
  3864. sequences that have alpha in a format that doesn't support an alpha
  3865. channel.
  3866. For example, to reconstruct full frames from a normal YUV-encoded video
  3867. and a separate video created with @var{alphaextract}, you might use:
  3868. @example
  3869. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3870. @end example
  3871. Since this filter is designed for reconstruction, it operates on frame
  3872. sequences without considering timestamps, and terminates when either
  3873. input reaches end of stream. This will cause problems if your encoding
  3874. pipeline drops frames. If you're trying to apply an image as an
  3875. overlay to a video stream, consider the @var{overlay} filter instead.
  3876. @section ass
  3877. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3878. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3879. Substation Alpha) subtitles files.
  3880. This filter accepts the following option in addition to the common options from
  3881. the @ref{subtitles} filter:
  3882. @table @option
  3883. @item shaping
  3884. Set the shaping engine
  3885. Available values are:
  3886. @table @samp
  3887. @item auto
  3888. The default libass shaping engine, which is the best available.
  3889. @item simple
  3890. Fast, font-agnostic shaper that can do only substitutions
  3891. @item complex
  3892. Slower shaper using OpenType for substitutions and positioning
  3893. @end table
  3894. The default is @code{auto}.
  3895. @end table
  3896. @section atadenoise
  3897. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3898. The filter accepts the following options:
  3899. @table @option
  3900. @item 0a
  3901. Set threshold A for 1st plane. Default is 0.02.
  3902. Valid range is 0 to 0.3.
  3903. @item 0b
  3904. Set threshold B for 1st plane. Default is 0.04.
  3905. Valid range is 0 to 5.
  3906. @item 1a
  3907. Set threshold A for 2nd plane. Default is 0.02.
  3908. Valid range is 0 to 0.3.
  3909. @item 1b
  3910. Set threshold B for 2nd plane. Default is 0.04.
  3911. Valid range is 0 to 5.
  3912. @item 2a
  3913. Set threshold A for 3rd plane. Default is 0.02.
  3914. Valid range is 0 to 0.3.
  3915. @item 2b
  3916. Set threshold B for 3rd plane. Default is 0.04.
  3917. Valid range is 0 to 5.
  3918. Threshold A is designed to react on abrupt changes in the input signal and
  3919. threshold B is designed to react on continuous changes in the input signal.
  3920. @item s
  3921. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3922. number in range [5, 129].
  3923. @item p
  3924. Set what planes of frame filter will use for averaging. Default is all.
  3925. @end table
  3926. @section avgblur
  3927. Apply average blur filter.
  3928. The filter accepts the following options:
  3929. @table @option
  3930. @item sizeX
  3931. Set horizontal kernel size.
  3932. @item planes
  3933. Set which planes to filter. By default all planes are filtered.
  3934. @item sizeY
  3935. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3936. Default is @code{0}.
  3937. @end table
  3938. @section bbox
  3939. Compute the bounding box for the non-black pixels in the input frame
  3940. luminance plane.
  3941. This filter computes the bounding box containing all the pixels with a
  3942. luminance value greater than the minimum allowed value.
  3943. The parameters describing the bounding box are printed on the filter
  3944. log.
  3945. The filter accepts the following option:
  3946. @table @option
  3947. @item min_val
  3948. Set the minimal luminance value. Default is @code{16}.
  3949. @end table
  3950. @section bitplanenoise
  3951. Show and measure bit plane noise.
  3952. The filter accepts the following options:
  3953. @table @option
  3954. @item bitplane
  3955. Set which plane to analyze. Default is @code{1}.
  3956. @item filter
  3957. Filter out noisy pixels from @code{bitplane} set above.
  3958. Default is disabled.
  3959. @end table
  3960. @section blackdetect
  3961. Detect video intervals that are (almost) completely black. Can be
  3962. useful to detect chapter transitions, commercials, or invalid
  3963. recordings. Output lines contains the time for the start, end and
  3964. duration of the detected black interval expressed in seconds.
  3965. In order to display the output lines, you need to set the loglevel at
  3966. least to the AV_LOG_INFO value.
  3967. The filter accepts the following options:
  3968. @table @option
  3969. @item black_min_duration, d
  3970. Set the minimum detected black duration expressed in seconds. It must
  3971. be a non-negative floating point number.
  3972. Default value is 2.0.
  3973. @item picture_black_ratio_th, pic_th
  3974. Set the threshold for considering a picture "black".
  3975. Express the minimum value for the ratio:
  3976. @example
  3977. @var{nb_black_pixels} / @var{nb_pixels}
  3978. @end example
  3979. for which a picture is considered black.
  3980. Default value is 0.98.
  3981. @item pixel_black_th, pix_th
  3982. Set the threshold for considering a pixel "black".
  3983. The threshold expresses the maximum pixel luminance value for which a
  3984. pixel is considered "black". The provided value is scaled according to
  3985. the following equation:
  3986. @example
  3987. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3988. @end example
  3989. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3990. the input video format, the range is [0-255] for YUV full-range
  3991. formats and [16-235] for YUV non full-range formats.
  3992. Default value is 0.10.
  3993. @end table
  3994. The following example sets the maximum pixel threshold to the minimum
  3995. value, and detects only black intervals of 2 or more seconds:
  3996. @example
  3997. blackdetect=d=2:pix_th=0.00
  3998. @end example
  3999. @section blackframe
  4000. Detect frames that are (almost) completely black. Can be useful to
  4001. detect chapter transitions or commercials. Output lines consist of
  4002. the frame number of the detected frame, the percentage of blackness,
  4003. the position in the file if known or -1 and the timestamp in seconds.
  4004. In order to display the output lines, you need to set the loglevel at
  4005. least to the AV_LOG_INFO value.
  4006. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4007. The value represents the percentage of pixels in the picture that
  4008. are below the threshold value.
  4009. It accepts the following parameters:
  4010. @table @option
  4011. @item amount
  4012. The percentage of the pixels that have to be below the threshold; it defaults to
  4013. @code{98}.
  4014. @item threshold, thresh
  4015. The threshold below which a pixel value is considered black; it defaults to
  4016. @code{32}.
  4017. @end table
  4018. @section blend, tblend
  4019. Blend two video frames into each other.
  4020. The @code{blend} filter takes two input streams and outputs one
  4021. stream, the first input is the "top" layer and second input is
  4022. "bottom" layer. By default, the output terminates when the longest input terminates.
  4023. The @code{tblend} (time blend) filter takes two consecutive frames
  4024. from one single stream, and outputs the result obtained by blending
  4025. the new frame on top of the old frame.
  4026. A description of the accepted options follows.
  4027. @table @option
  4028. @item c0_mode
  4029. @item c1_mode
  4030. @item c2_mode
  4031. @item c3_mode
  4032. @item all_mode
  4033. Set blend mode for specific pixel component or all pixel components in case
  4034. of @var{all_mode}. Default value is @code{normal}.
  4035. Available values for component modes are:
  4036. @table @samp
  4037. @item addition
  4038. @item grainmerge
  4039. @item and
  4040. @item average
  4041. @item burn
  4042. @item darken
  4043. @item difference
  4044. @item grainextract
  4045. @item divide
  4046. @item dodge
  4047. @item freeze
  4048. @item exclusion
  4049. @item extremity
  4050. @item glow
  4051. @item hardlight
  4052. @item hardmix
  4053. @item heat
  4054. @item lighten
  4055. @item linearlight
  4056. @item multiply
  4057. @item multiply128
  4058. @item negation
  4059. @item normal
  4060. @item or
  4061. @item overlay
  4062. @item phoenix
  4063. @item pinlight
  4064. @item reflect
  4065. @item screen
  4066. @item softlight
  4067. @item subtract
  4068. @item vividlight
  4069. @item xor
  4070. @end table
  4071. @item c0_opacity
  4072. @item c1_opacity
  4073. @item c2_opacity
  4074. @item c3_opacity
  4075. @item all_opacity
  4076. Set blend opacity for specific pixel component or all pixel components in case
  4077. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4078. @item c0_expr
  4079. @item c1_expr
  4080. @item c2_expr
  4081. @item c3_expr
  4082. @item all_expr
  4083. Set blend expression for specific pixel component or all pixel components in case
  4084. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4085. The expressions can use the following variables:
  4086. @table @option
  4087. @item N
  4088. The sequential number of the filtered frame, starting from @code{0}.
  4089. @item X
  4090. @item Y
  4091. the coordinates of the current sample
  4092. @item W
  4093. @item H
  4094. the width and height of currently filtered plane
  4095. @item SW
  4096. @item SH
  4097. Width and height scale depending on the currently filtered plane. It is the
  4098. ratio between the corresponding luma plane number of pixels and the current
  4099. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4100. @code{0.5,0.5} for chroma planes.
  4101. @item T
  4102. Time of the current frame, expressed in seconds.
  4103. @item TOP, A
  4104. Value of pixel component at current location for first video frame (top layer).
  4105. @item BOTTOM, B
  4106. Value of pixel component at current location for second video frame (bottom layer).
  4107. @end table
  4108. @end table
  4109. The @code{blend} filter also supports the @ref{framesync} options.
  4110. @subsection Examples
  4111. @itemize
  4112. @item
  4113. Apply transition from bottom layer to top layer in first 10 seconds:
  4114. @example
  4115. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4116. @end example
  4117. @item
  4118. Apply linear horizontal transition from top layer to bottom layer:
  4119. @example
  4120. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4121. @end example
  4122. @item
  4123. Apply 1x1 checkerboard effect:
  4124. @example
  4125. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4126. @end example
  4127. @item
  4128. Apply uncover left effect:
  4129. @example
  4130. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4131. @end example
  4132. @item
  4133. Apply uncover down effect:
  4134. @example
  4135. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4136. @end example
  4137. @item
  4138. Apply uncover up-left effect:
  4139. @example
  4140. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4141. @end example
  4142. @item
  4143. Split diagonally video and shows top and bottom layer on each side:
  4144. @example
  4145. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4146. @end example
  4147. @item
  4148. Display differences between the current and the previous frame:
  4149. @example
  4150. tblend=all_mode=grainextract
  4151. @end example
  4152. @end itemize
  4153. @section boxblur
  4154. Apply a boxblur algorithm to the input video.
  4155. It accepts the following parameters:
  4156. @table @option
  4157. @item luma_radius, lr
  4158. @item luma_power, lp
  4159. @item chroma_radius, cr
  4160. @item chroma_power, cp
  4161. @item alpha_radius, ar
  4162. @item alpha_power, ap
  4163. @end table
  4164. A description of the accepted options follows.
  4165. @table @option
  4166. @item luma_radius, lr
  4167. @item chroma_radius, cr
  4168. @item alpha_radius, ar
  4169. Set an expression for the box radius in pixels used for blurring the
  4170. corresponding input plane.
  4171. The radius value must be a non-negative number, and must not be
  4172. greater than the value of the expression @code{min(w,h)/2} for the
  4173. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4174. planes.
  4175. Default value for @option{luma_radius} is "2". If not specified,
  4176. @option{chroma_radius} and @option{alpha_radius} default to the
  4177. corresponding value set for @option{luma_radius}.
  4178. The expressions can contain the following constants:
  4179. @table @option
  4180. @item w
  4181. @item h
  4182. The input width and height in pixels.
  4183. @item cw
  4184. @item ch
  4185. The input chroma image width and height in pixels.
  4186. @item hsub
  4187. @item vsub
  4188. The horizontal and vertical chroma subsample values. For example, for the
  4189. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4190. @end table
  4191. @item luma_power, lp
  4192. @item chroma_power, cp
  4193. @item alpha_power, ap
  4194. Specify how many times the boxblur filter is applied to the
  4195. corresponding plane.
  4196. Default value for @option{luma_power} is 2. If not specified,
  4197. @option{chroma_power} and @option{alpha_power} default to the
  4198. corresponding value set for @option{luma_power}.
  4199. A value of 0 will disable the effect.
  4200. @end table
  4201. @subsection Examples
  4202. @itemize
  4203. @item
  4204. Apply a boxblur filter with the luma, chroma, and alpha radii
  4205. set to 2:
  4206. @example
  4207. boxblur=luma_radius=2:luma_power=1
  4208. boxblur=2:1
  4209. @end example
  4210. @item
  4211. Set the luma radius to 2, and alpha and chroma radius to 0:
  4212. @example
  4213. boxblur=2:1:cr=0:ar=0
  4214. @end example
  4215. @item
  4216. Set the luma and chroma radii to a fraction of the video dimension:
  4217. @example
  4218. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4219. @end example
  4220. @end itemize
  4221. @section bwdif
  4222. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4223. Deinterlacing Filter").
  4224. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4225. interpolation algorithms.
  4226. It accepts the following parameters:
  4227. @table @option
  4228. @item mode
  4229. The interlacing mode to adopt. It accepts one of the following values:
  4230. @table @option
  4231. @item 0, send_frame
  4232. Output one frame for each frame.
  4233. @item 1, send_field
  4234. Output one frame for each field.
  4235. @end table
  4236. The default value is @code{send_field}.
  4237. @item parity
  4238. The picture field parity assumed for the input interlaced video. It accepts one
  4239. of the following values:
  4240. @table @option
  4241. @item 0, tff
  4242. Assume the top field is first.
  4243. @item 1, bff
  4244. Assume the bottom field is first.
  4245. @item -1, auto
  4246. Enable automatic detection of field parity.
  4247. @end table
  4248. The default value is @code{auto}.
  4249. If the interlacing is unknown or the decoder does not export this information,
  4250. top field first will be assumed.
  4251. @item deint
  4252. Specify which frames to deinterlace. Accept one of the following
  4253. values:
  4254. @table @option
  4255. @item 0, all
  4256. Deinterlace all frames.
  4257. @item 1, interlaced
  4258. Only deinterlace frames marked as interlaced.
  4259. @end table
  4260. The default value is @code{all}.
  4261. @end table
  4262. @section chromakey
  4263. YUV colorspace color/chroma keying.
  4264. The filter accepts the following options:
  4265. @table @option
  4266. @item color
  4267. The color which will be replaced with transparency.
  4268. @item similarity
  4269. Similarity percentage with the key color.
  4270. 0.01 matches only the exact key color, while 1.0 matches everything.
  4271. @item blend
  4272. Blend percentage.
  4273. 0.0 makes pixels either fully transparent, or not transparent at all.
  4274. Higher values result in semi-transparent pixels, with a higher transparency
  4275. the more similar the pixels color is to the key color.
  4276. @item yuv
  4277. Signals that the color passed is already in YUV instead of RGB.
  4278. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4279. This can be used to pass exact YUV values as hexadecimal numbers.
  4280. @end table
  4281. @subsection Examples
  4282. @itemize
  4283. @item
  4284. Make every green pixel in the input image transparent:
  4285. @example
  4286. ffmpeg -i input.png -vf chromakey=green out.png
  4287. @end example
  4288. @item
  4289. Overlay a greenscreen-video on top of a static black background.
  4290. @example
  4291. 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
  4292. @end example
  4293. @end itemize
  4294. @section ciescope
  4295. Display CIE color diagram with pixels overlaid onto it.
  4296. The filter accepts the following options:
  4297. @table @option
  4298. @item system
  4299. Set color system.
  4300. @table @samp
  4301. @item ntsc, 470m
  4302. @item ebu, 470bg
  4303. @item smpte
  4304. @item 240m
  4305. @item apple
  4306. @item widergb
  4307. @item cie1931
  4308. @item rec709, hdtv
  4309. @item uhdtv, rec2020
  4310. @end table
  4311. @item cie
  4312. Set CIE system.
  4313. @table @samp
  4314. @item xyy
  4315. @item ucs
  4316. @item luv
  4317. @end table
  4318. @item gamuts
  4319. Set what gamuts to draw.
  4320. See @code{system} option for available values.
  4321. @item size, s
  4322. Set ciescope size, by default set to 512.
  4323. @item intensity, i
  4324. Set intensity used to map input pixel values to CIE diagram.
  4325. @item contrast
  4326. Set contrast used to draw tongue colors that are out of active color system gamut.
  4327. @item corrgamma
  4328. Correct gamma displayed on scope, by default enabled.
  4329. @item showwhite
  4330. Show white point on CIE diagram, by default disabled.
  4331. @item gamma
  4332. Set input gamma. Used only with XYZ input color space.
  4333. @end table
  4334. @section codecview
  4335. Visualize information exported by some codecs.
  4336. Some codecs can export information through frames using side-data or other
  4337. means. For example, some MPEG based codecs export motion vectors through the
  4338. @var{export_mvs} flag in the codec @option{flags2} option.
  4339. The filter accepts the following option:
  4340. @table @option
  4341. @item mv
  4342. Set motion vectors to visualize.
  4343. Available flags for @var{mv} are:
  4344. @table @samp
  4345. @item pf
  4346. forward predicted MVs of P-frames
  4347. @item bf
  4348. forward predicted MVs of B-frames
  4349. @item bb
  4350. backward predicted MVs of B-frames
  4351. @end table
  4352. @item qp
  4353. Display quantization parameters using the chroma planes.
  4354. @item mv_type, mvt
  4355. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4356. Available flags for @var{mv_type} are:
  4357. @table @samp
  4358. @item fp
  4359. forward predicted MVs
  4360. @item bp
  4361. backward predicted MVs
  4362. @end table
  4363. @item frame_type, ft
  4364. Set frame type to visualize motion vectors of.
  4365. Available flags for @var{frame_type} are:
  4366. @table @samp
  4367. @item if
  4368. intra-coded frames (I-frames)
  4369. @item pf
  4370. predicted frames (P-frames)
  4371. @item bf
  4372. bi-directionally predicted frames (B-frames)
  4373. @end table
  4374. @end table
  4375. @subsection Examples
  4376. @itemize
  4377. @item
  4378. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4379. @example
  4380. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4381. @end example
  4382. @item
  4383. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4384. @example
  4385. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4386. @end example
  4387. @end itemize
  4388. @section colorbalance
  4389. Modify intensity of primary colors (red, green and blue) of input frames.
  4390. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4391. regions for the red-cyan, green-magenta or blue-yellow balance.
  4392. A positive adjustment value shifts the balance towards the primary color, a negative
  4393. value towards the complementary color.
  4394. The filter accepts the following options:
  4395. @table @option
  4396. @item rs
  4397. @item gs
  4398. @item bs
  4399. Adjust red, green and blue shadows (darkest pixels).
  4400. @item rm
  4401. @item gm
  4402. @item bm
  4403. Adjust red, green and blue midtones (medium pixels).
  4404. @item rh
  4405. @item gh
  4406. @item bh
  4407. Adjust red, green and blue highlights (brightest pixels).
  4408. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4409. @end table
  4410. @subsection Examples
  4411. @itemize
  4412. @item
  4413. Add red color cast to shadows:
  4414. @example
  4415. colorbalance=rs=.3
  4416. @end example
  4417. @end itemize
  4418. @section colorkey
  4419. RGB colorspace color keying.
  4420. The filter accepts the following options:
  4421. @table @option
  4422. @item color
  4423. The color which will be replaced with transparency.
  4424. @item similarity
  4425. Similarity percentage with the key color.
  4426. 0.01 matches only the exact key color, while 1.0 matches everything.
  4427. @item blend
  4428. Blend percentage.
  4429. 0.0 makes pixels either fully transparent, or not transparent at all.
  4430. Higher values result in semi-transparent pixels, with a higher transparency
  4431. the more similar the pixels color is to the key color.
  4432. @end table
  4433. @subsection Examples
  4434. @itemize
  4435. @item
  4436. Make every green pixel in the input image transparent:
  4437. @example
  4438. ffmpeg -i input.png -vf colorkey=green out.png
  4439. @end example
  4440. @item
  4441. Overlay a greenscreen-video on top of a static background image.
  4442. @example
  4443. 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
  4444. @end example
  4445. @end itemize
  4446. @section colorlevels
  4447. Adjust video input frames using levels.
  4448. The filter accepts the following options:
  4449. @table @option
  4450. @item rimin
  4451. @item gimin
  4452. @item bimin
  4453. @item aimin
  4454. Adjust red, green, blue and alpha input black point.
  4455. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4456. @item rimax
  4457. @item gimax
  4458. @item bimax
  4459. @item aimax
  4460. Adjust red, green, blue and alpha input white point.
  4461. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4462. Input levels are used to lighten highlights (bright tones), darken shadows
  4463. (dark tones), change the balance of bright and dark tones.
  4464. @item romin
  4465. @item gomin
  4466. @item bomin
  4467. @item aomin
  4468. Adjust red, green, blue and alpha output black point.
  4469. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4470. @item romax
  4471. @item gomax
  4472. @item bomax
  4473. @item aomax
  4474. Adjust red, green, blue and alpha output white point.
  4475. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4476. Output levels allows manual selection of a constrained output level range.
  4477. @end table
  4478. @subsection Examples
  4479. @itemize
  4480. @item
  4481. Make video output darker:
  4482. @example
  4483. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4484. @end example
  4485. @item
  4486. Increase contrast:
  4487. @example
  4488. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4489. @end example
  4490. @item
  4491. Make video output lighter:
  4492. @example
  4493. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4494. @end example
  4495. @item
  4496. Increase brightness:
  4497. @example
  4498. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4499. @end example
  4500. @end itemize
  4501. @section colorchannelmixer
  4502. Adjust video input frames by re-mixing color channels.
  4503. This filter modifies a color channel by adding the values associated to
  4504. the other channels of the same pixels. For example if the value to
  4505. modify is red, the output value will be:
  4506. @example
  4507. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4508. @end example
  4509. The filter accepts the following options:
  4510. @table @option
  4511. @item rr
  4512. @item rg
  4513. @item rb
  4514. @item ra
  4515. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4516. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4517. @item gr
  4518. @item gg
  4519. @item gb
  4520. @item ga
  4521. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4522. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4523. @item br
  4524. @item bg
  4525. @item bb
  4526. @item ba
  4527. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4528. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4529. @item ar
  4530. @item ag
  4531. @item ab
  4532. @item aa
  4533. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4534. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4535. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4536. @end table
  4537. @subsection Examples
  4538. @itemize
  4539. @item
  4540. Convert source to grayscale:
  4541. @example
  4542. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4543. @end example
  4544. @item
  4545. Simulate sepia tones:
  4546. @example
  4547. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4548. @end example
  4549. @end itemize
  4550. @section colormatrix
  4551. Convert color matrix.
  4552. The filter accepts the following options:
  4553. @table @option
  4554. @item src
  4555. @item dst
  4556. Specify the source and destination color matrix. Both values must be
  4557. specified.
  4558. The accepted values are:
  4559. @table @samp
  4560. @item bt709
  4561. BT.709
  4562. @item fcc
  4563. FCC
  4564. @item bt601
  4565. BT.601
  4566. @item bt470
  4567. BT.470
  4568. @item bt470bg
  4569. BT.470BG
  4570. @item smpte170m
  4571. SMPTE-170M
  4572. @item smpte240m
  4573. SMPTE-240M
  4574. @item bt2020
  4575. BT.2020
  4576. @end table
  4577. @end table
  4578. For example to convert from BT.601 to SMPTE-240M, use the command:
  4579. @example
  4580. colormatrix=bt601:smpte240m
  4581. @end example
  4582. @section colorspace
  4583. Convert colorspace, transfer characteristics or color primaries.
  4584. Input video needs to have an even size.
  4585. The filter accepts the following options:
  4586. @table @option
  4587. @anchor{all}
  4588. @item all
  4589. Specify all color properties at once.
  4590. The accepted values are:
  4591. @table @samp
  4592. @item bt470m
  4593. BT.470M
  4594. @item bt470bg
  4595. BT.470BG
  4596. @item bt601-6-525
  4597. BT.601-6 525
  4598. @item bt601-6-625
  4599. BT.601-6 625
  4600. @item bt709
  4601. BT.709
  4602. @item smpte170m
  4603. SMPTE-170M
  4604. @item smpte240m
  4605. SMPTE-240M
  4606. @item bt2020
  4607. BT.2020
  4608. @end table
  4609. @anchor{space}
  4610. @item space
  4611. Specify output colorspace.
  4612. The accepted values are:
  4613. @table @samp
  4614. @item bt709
  4615. BT.709
  4616. @item fcc
  4617. FCC
  4618. @item bt470bg
  4619. BT.470BG or BT.601-6 625
  4620. @item smpte170m
  4621. SMPTE-170M or BT.601-6 525
  4622. @item smpte240m
  4623. SMPTE-240M
  4624. @item ycgco
  4625. YCgCo
  4626. @item bt2020ncl
  4627. BT.2020 with non-constant luminance
  4628. @end table
  4629. @anchor{trc}
  4630. @item trc
  4631. Specify output transfer characteristics.
  4632. The accepted values are:
  4633. @table @samp
  4634. @item bt709
  4635. BT.709
  4636. @item bt470m
  4637. BT.470M
  4638. @item bt470bg
  4639. BT.470BG
  4640. @item gamma22
  4641. Constant gamma of 2.2
  4642. @item gamma28
  4643. Constant gamma of 2.8
  4644. @item smpte170m
  4645. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4646. @item smpte240m
  4647. SMPTE-240M
  4648. @item srgb
  4649. SRGB
  4650. @item iec61966-2-1
  4651. iec61966-2-1
  4652. @item iec61966-2-4
  4653. iec61966-2-4
  4654. @item xvycc
  4655. xvycc
  4656. @item bt2020-10
  4657. BT.2020 for 10-bits content
  4658. @item bt2020-12
  4659. BT.2020 for 12-bits content
  4660. @end table
  4661. @anchor{primaries}
  4662. @item primaries
  4663. Specify output color primaries.
  4664. The accepted values are:
  4665. @table @samp
  4666. @item bt709
  4667. BT.709
  4668. @item bt470m
  4669. BT.470M
  4670. @item bt470bg
  4671. BT.470BG or BT.601-6 625
  4672. @item smpte170m
  4673. SMPTE-170M or BT.601-6 525
  4674. @item smpte240m
  4675. SMPTE-240M
  4676. @item film
  4677. film
  4678. @item smpte431
  4679. SMPTE-431
  4680. @item smpte432
  4681. SMPTE-432
  4682. @item bt2020
  4683. BT.2020
  4684. @item jedec-p22
  4685. JEDEC P22 phosphors
  4686. @end table
  4687. @anchor{range}
  4688. @item range
  4689. Specify output color range.
  4690. The accepted values are:
  4691. @table @samp
  4692. @item tv
  4693. TV (restricted) range
  4694. @item mpeg
  4695. MPEG (restricted) range
  4696. @item pc
  4697. PC (full) range
  4698. @item jpeg
  4699. JPEG (full) range
  4700. @end table
  4701. @item format
  4702. Specify output color format.
  4703. The accepted values are:
  4704. @table @samp
  4705. @item yuv420p
  4706. YUV 4:2:0 planar 8-bits
  4707. @item yuv420p10
  4708. YUV 4:2:0 planar 10-bits
  4709. @item yuv420p12
  4710. YUV 4:2:0 planar 12-bits
  4711. @item yuv422p
  4712. YUV 4:2:2 planar 8-bits
  4713. @item yuv422p10
  4714. YUV 4:2:2 planar 10-bits
  4715. @item yuv422p12
  4716. YUV 4:2:2 planar 12-bits
  4717. @item yuv444p
  4718. YUV 4:4:4 planar 8-bits
  4719. @item yuv444p10
  4720. YUV 4:4:4 planar 10-bits
  4721. @item yuv444p12
  4722. YUV 4:4:4 planar 12-bits
  4723. @end table
  4724. @item fast
  4725. Do a fast conversion, which skips gamma/primary correction. This will take
  4726. significantly less CPU, but will be mathematically incorrect. To get output
  4727. compatible with that produced by the colormatrix filter, use fast=1.
  4728. @item dither
  4729. Specify dithering mode.
  4730. The accepted values are:
  4731. @table @samp
  4732. @item none
  4733. No dithering
  4734. @item fsb
  4735. Floyd-Steinberg dithering
  4736. @end table
  4737. @item wpadapt
  4738. Whitepoint adaptation mode.
  4739. The accepted values are:
  4740. @table @samp
  4741. @item bradford
  4742. Bradford whitepoint adaptation
  4743. @item vonkries
  4744. von Kries whitepoint adaptation
  4745. @item identity
  4746. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4747. @end table
  4748. @item iall
  4749. Override all input properties at once. Same accepted values as @ref{all}.
  4750. @item ispace
  4751. Override input colorspace. Same accepted values as @ref{space}.
  4752. @item iprimaries
  4753. Override input color primaries. Same accepted values as @ref{primaries}.
  4754. @item itrc
  4755. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4756. @item irange
  4757. Override input color range. Same accepted values as @ref{range}.
  4758. @end table
  4759. The filter converts the transfer characteristics, color space and color
  4760. primaries to the specified user values. The output value, if not specified,
  4761. is set to a default value based on the "all" property. If that property is
  4762. also not specified, the filter will log an error. The output color range and
  4763. format default to the same value as the input color range and format. The
  4764. input transfer characteristics, color space, color primaries and color range
  4765. should be set on the input data. If any of these are missing, the filter will
  4766. log an error and no conversion will take place.
  4767. For example to convert the input to SMPTE-240M, use the command:
  4768. @example
  4769. colorspace=smpte240m
  4770. @end example
  4771. @section convolution
  4772. Apply convolution 3x3, 5x5 or 7x7 filter.
  4773. The filter accepts the following options:
  4774. @table @option
  4775. @item 0m
  4776. @item 1m
  4777. @item 2m
  4778. @item 3m
  4779. Set matrix for each plane.
  4780. Matrix is sequence of 9, 25 or 49 signed integers.
  4781. @item 0rdiv
  4782. @item 1rdiv
  4783. @item 2rdiv
  4784. @item 3rdiv
  4785. Set multiplier for calculated value for each plane.
  4786. @item 0bias
  4787. @item 1bias
  4788. @item 2bias
  4789. @item 3bias
  4790. Set bias for each plane. This value is added to the result of the multiplication.
  4791. Useful for making the overall image brighter or darker. Default is 0.0.
  4792. @end table
  4793. @subsection Examples
  4794. @itemize
  4795. @item
  4796. Apply sharpen:
  4797. @example
  4798. 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"
  4799. @end example
  4800. @item
  4801. Apply blur:
  4802. @example
  4803. 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"
  4804. @end example
  4805. @item
  4806. Apply edge enhance:
  4807. @example
  4808. 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"
  4809. @end example
  4810. @item
  4811. Apply edge detect:
  4812. @example
  4813. 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"
  4814. @end example
  4815. @item
  4816. Apply laplacian edge detector which includes diagonals:
  4817. @example
  4818. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4819. @end example
  4820. @item
  4821. Apply emboss:
  4822. @example
  4823. 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"
  4824. @end example
  4825. @end itemize
  4826. @section convolve
  4827. Apply 2D convolution of video stream in frequency domain using second stream
  4828. as impulse.
  4829. The filter accepts the following options:
  4830. @table @option
  4831. @item planes
  4832. Set which planes to process.
  4833. @item impulse
  4834. Set which impulse video frames will be processed, can be @var{first}
  4835. or @var{all}. Default is @var{all}.
  4836. @end table
  4837. The @code{convolve} filter also supports the @ref{framesync} options.
  4838. @section copy
  4839. Copy the input video source unchanged to the output. This is mainly useful for
  4840. testing purposes.
  4841. @anchor{coreimage}
  4842. @section coreimage
  4843. Video filtering on GPU using Apple's CoreImage API on OSX.
  4844. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4845. processed by video hardware. However, software-based OpenGL implementations
  4846. exist which means there is no guarantee for hardware processing. It depends on
  4847. the respective OSX.
  4848. There are many filters and image generators provided by Apple that come with a
  4849. large variety of options. The filter has to be referenced by its name along
  4850. with its options.
  4851. The coreimage filter accepts the following options:
  4852. @table @option
  4853. @item list_filters
  4854. List all available filters and generators along with all their respective
  4855. options as well as possible minimum and maximum values along with the default
  4856. values.
  4857. @example
  4858. list_filters=true
  4859. @end example
  4860. @item filter
  4861. Specify all filters by their respective name and options.
  4862. Use @var{list_filters} to determine all valid filter names and options.
  4863. Numerical options are specified by a float value and are automatically clamped
  4864. to their respective value range. Vector and color options have to be specified
  4865. by a list of space separated float values. Character escaping has to be done.
  4866. A special option name @code{default} is available to use default options for a
  4867. filter.
  4868. It is required to specify either @code{default} or at least one of the filter options.
  4869. All omitted options are used with their default values.
  4870. The syntax of the filter string is as follows:
  4871. @example
  4872. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4873. @end example
  4874. @item output_rect
  4875. Specify a rectangle where the output of the filter chain is copied into the
  4876. input image. It is given by a list of space separated float values:
  4877. @example
  4878. output_rect=x\ y\ width\ height
  4879. @end example
  4880. If not given, the output rectangle equals the dimensions of the input image.
  4881. The output rectangle is automatically cropped at the borders of the input
  4882. image. Negative values are valid for each component.
  4883. @example
  4884. output_rect=25\ 25\ 100\ 100
  4885. @end example
  4886. @end table
  4887. Several filters can be chained for successive processing without GPU-HOST
  4888. transfers allowing for fast processing of complex filter chains.
  4889. Currently, only filters with zero (generators) or exactly one (filters) input
  4890. image and one output image are supported. Also, transition filters are not yet
  4891. usable as intended.
  4892. Some filters generate output images with additional padding depending on the
  4893. respective filter kernel. The padding is automatically removed to ensure the
  4894. filter output has the same size as the input image.
  4895. For image generators, the size of the output image is determined by the
  4896. previous output image of the filter chain or the input image of the whole
  4897. filterchain, respectively. The generators do not use the pixel information of
  4898. this image to generate their output. However, the generated output is
  4899. blended onto this image, resulting in partial or complete coverage of the
  4900. output image.
  4901. The @ref{coreimagesrc} video source can be used for generating input images
  4902. which are directly fed into the filter chain. By using it, providing input
  4903. images by another video source or an input video is not required.
  4904. @subsection Examples
  4905. @itemize
  4906. @item
  4907. List all filters available:
  4908. @example
  4909. coreimage=list_filters=true
  4910. @end example
  4911. @item
  4912. Use the CIBoxBlur filter with default options to blur an image:
  4913. @example
  4914. coreimage=filter=CIBoxBlur@@default
  4915. @end example
  4916. @item
  4917. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4918. its center at 100x100 and a radius of 50 pixels:
  4919. @example
  4920. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4921. @end example
  4922. @item
  4923. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4924. given as complete and escaped command-line for Apple's standard bash shell:
  4925. @example
  4926. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4927. @end example
  4928. @end itemize
  4929. @section crop
  4930. Crop the input video to given dimensions.
  4931. It accepts the following parameters:
  4932. @table @option
  4933. @item w, out_w
  4934. The width of the output video. It defaults to @code{iw}.
  4935. This expression is evaluated only once during the filter
  4936. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4937. @item h, out_h
  4938. The height of the output video. It defaults to @code{ih}.
  4939. This expression is evaluated only once during the filter
  4940. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4941. @item x
  4942. The horizontal position, in the input video, of the left edge of the output
  4943. video. It defaults to @code{(in_w-out_w)/2}.
  4944. This expression is evaluated per-frame.
  4945. @item y
  4946. The vertical position, in the input video, of the top edge of the output video.
  4947. It defaults to @code{(in_h-out_h)/2}.
  4948. This expression is evaluated per-frame.
  4949. @item keep_aspect
  4950. If set to 1 will force the output display aspect ratio
  4951. to be the same of the input, by changing the output sample aspect
  4952. ratio. It defaults to 0.
  4953. @item exact
  4954. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4955. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4956. It defaults to 0.
  4957. @end table
  4958. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4959. expressions containing the following constants:
  4960. @table @option
  4961. @item x
  4962. @item y
  4963. The computed values for @var{x} and @var{y}. They are evaluated for
  4964. each new frame.
  4965. @item in_w
  4966. @item in_h
  4967. The input width and height.
  4968. @item iw
  4969. @item ih
  4970. These are the same as @var{in_w} and @var{in_h}.
  4971. @item out_w
  4972. @item out_h
  4973. The output (cropped) width and height.
  4974. @item ow
  4975. @item oh
  4976. These are the same as @var{out_w} and @var{out_h}.
  4977. @item a
  4978. same as @var{iw} / @var{ih}
  4979. @item sar
  4980. input sample aspect ratio
  4981. @item dar
  4982. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4983. @item hsub
  4984. @item vsub
  4985. horizontal and vertical chroma subsample values. For example for the
  4986. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4987. @item n
  4988. The number of the input frame, starting from 0.
  4989. @item pos
  4990. the position in the file of the input frame, NAN if unknown
  4991. @item t
  4992. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4993. @end table
  4994. The expression for @var{out_w} may depend on the value of @var{out_h},
  4995. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4996. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4997. evaluated after @var{out_w} and @var{out_h}.
  4998. The @var{x} and @var{y} parameters specify the expressions for the
  4999. position of the top-left corner of the output (non-cropped) area. They
  5000. are evaluated for each frame. If the evaluated value is not valid, it
  5001. is approximated to the nearest valid value.
  5002. The expression for @var{x} may depend on @var{y}, and the expression
  5003. for @var{y} may depend on @var{x}.
  5004. @subsection Examples
  5005. @itemize
  5006. @item
  5007. Crop area with size 100x100 at position (12,34).
  5008. @example
  5009. crop=100:100:12:34
  5010. @end example
  5011. Using named options, the example above becomes:
  5012. @example
  5013. crop=w=100:h=100:x=12:y=34
  5014. @end example
  5015. @item
  5016. Crop the central input area with size 100x100:
  5017. @example
  5018. crop=100:100
  5019. @end example
  5020. @item
  5021. Crop the central input area with size 2/3 of the input video:
  5022. @example
  5023. crop=2/3*in_w:2/3*in_h
  5024. @end example
  5025. @item
  5026. Crop the input video central square:
  5027. @example
  5028. crop=out_w=in_h
  5029. crop=in_h
  5030. @end example
  5031. @item
  5032. Delimit the rectangle with the top-left corner placed at position
  5033. 100:100 and the right-bottom corner corresponding to the right-bottom
  5034. corner of the input image.
  5035. @example
  5036. crop=in_w-100:in_h-100:100:100
  5037. @end example
  5038. @item
  5039. Crop 10 pixels from the left and right borders, and 20 pixels from
  5040. the top and bottom borders
  5041. @example
  5042. crop=in_w-2*10:in_h-2*20
  5043. @end example
  5044. @item
  5045. Keep only the bottom right quarter of the input image:
  5046. @example
  5047. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5048. @end example
  5049. @item
  5050. Crop height for getting Greek harmony:
  5051. @example
  5052. crop=in_w:1/PHI*in_w
  5053. @end example
  5054. @item
  5055. Apply trembling effect:
  5056. @example
  5057. 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)
  5058. @end example
  5059. @item
  5060. Apply erratic camera effect depending on timestamp:
  5061. @example
  5062. 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)"
  5063. @end example
  5064. @item
  5065. Set x depending on the value of y:
  5066. @example
  5067. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5068. @end example
  5069. @end itemize
  5070. @subsection Commands
  5071. This filter supports the following commands:
  5072. @table @option
  5073. @item w, out_w
  5074. @item h, out_h
  5075. @item x
  5076. @item y
  5077. Set width/height of the output video and the horizontal/vertical position
  5078. in the input video.
  5079. The command accepts the same syntax of the corresponding option.
  5080. If the specified expression is not valid, it is kept at its current
  5081. value.
  5082. @end table
  5083. @section cropdetect
  5084. Auto-detect the crop size.
  5085. It calculates the necessary cropping parameters and prints the
  5086. recommended parameters via the logging system. The detected dimensions
  5087. correspond to the non-black area of the input video.
  5088. It accepts the following parameters:
  5089. @table @option
  5090. @item limit
  5091. Set higher black value threshold, which can be optionally specified
  5092. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5093. value greater to the set value is considered non-black. It defaults to 24.
  5094. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5095. on the bitdepth of the pixel format.
  5096. @item round
  5097. The value which the width/height should be divisible by. It defaults to
  5098. 16. The offset is automatically adjusted to center the video. Use 2 to
  5099. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5100. encoding to most video codecs.
  5101. @item reset_count, reset
  5102. Set the counter that determines after how many frames cropdetect will
  5103. reset the previously detected largest video area and start over to
  5104. detect the current optimal crop area. Default value is 0.
  5105. This can be useful when channel logos distort the video area. 0
  5106. indicates 'never reset', and returns the largest area encountered during
  5107. playback.
  5108. @end table
  5109. @anchor{curves}
  5110. @section curves
  5111. Apply color adjustments using curves.
  5112. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5113. component (red, green and blue) has its values defined by @var{N} key points
  5114. tied from each other using a smooth curve. The x-axis represents the pixel
  5115. values from the input frame, and the y-axis the new pixel values to be set for
  5116. the output frame.
  5117. By default, a component curve is defined by the two points @var{(0;0)} and
  5118. @var{(1;1)}. This creates a straight line where each original pixel value is
  5119. "adjusted" to its own value, which means no change to the image.
  5120. The filter allows you to redefine these two points and add some more. A new
  5121. curve (using a natural cubic spline interpolation) will be define to pass
  5122. smoothly through all these new coordinates. The new defined points needs to be
  5123. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5124. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5125. the vector spaces, the values will be clipped accordingly.
  5126. The filter accepts the following options:
  5127. @table @option
  5128. @item preset
  5129. Select one of the available color presets. This option can be used in addition
  5130. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5131. options takes priority on the preset values.
  5132. Available presets are:
  5133. @table @samp
  5134. @item none
  5135. @item color_negative
  5136. @item cross_process
  5137. @item darker
  5138. @item increase_contrast
  5139. @item lighter
  5140. @item linear_contrast
  5141. @item medium_contrast
  5142. @item negative
  5143. @item strong_contrast
  5144. @item vintage
  5145. @end table
  5146. Default is @code{none}.
  5147. @item master, m
  5148. Set the master key points. These points will define a second pass mapping. It
  5149. is sometimes called a "luminance" or "value" mapping. It can be used with
  5150. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5151. post-processing LUT.
  5152. @item red, r
  5153. Set the key points for the red component.
  5154. @item green, g
  5155. Set the key points for the green component.
  5156. @item blue, b
  5157. Set the key points for the blue component.
  5158. @item all
  5159. Set the key points for all components (not including master).
  5160. Can be used in addition to the other key points component
  5161. options. In this case, the unset component(s) will fallback on this
  5162. @option{all} setting.
  5163. @item psfile
  5164. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5165. @item plot
  5166. Save Gnuplot script of the curves in specified file.
  5167. @end table
  5168. To avoid some filtergraph syntax conflicts, each key points list need to be
  5169. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5170. @subsection Examples
  5171. @itemize
  5172. @item
  5173. Increase slightly the middle level of blue:
  5174. @example
  5175. curves=blue='0/0 0.5/0.58 1/1'
  5176. @end example
  5177. @item
  5178. Vintage effect:
  5179. @example
  5180. 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'
  5181. @end example
  5182. Here we obtain the following coordinates for each components:
  5183. @table @var
  5184. @item red
  5185. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5186. @item green
  5187. @code{(0;0) (0.50;0.48) (1;1)}
  5188. @item blue
  5189. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5190. @end table
  5191. @item
  5192. The previous example can also be achieved with the associated built-in preset:
  5193. @example
  5194. curves=preset=vintage
  5195. @end example
  5196. @item
  5197. Or simply:
  5198. @example
  5199. curves=vintage
  5200. @end example
  5201. @item
  5202. Use a Photoshop preset and redefine the points of the green component:
  5203. @example
  5204. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5205. @end example
  5206. @item
  5207. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5208. and @command{gnuplot}:
  5209. @example
  5210. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5211. gnuplot -p /tmp/curves.plt
  5212. @end example
  5213. @end itemize
  5214. @section datascope
  5215. Video data analysis filter.
  5216. This filter shows hexadecimal pixel values of part of video.
  5217. The filter accepts the following options:
  5218. @table @option
  5219. @item size, s
  5220. Set output video size.
  5221. @item x
  5222. Set x offset from where to pick pixels.
  5223. @item y
  5224. Set y offset from where to pick pixels.
  5225. @item mode
  5226. Set scope mode, can be one of the following:
  5227. @table @samp
  5228. @item mono
  5229. Draw hexadecimal pixel values with white color on black background.
  5230. @item color
  5231. Draw hexadecimal pixel values with input video pixel color on black
  5232. background.
  5233. @item color2
  5234. Draw hexadecimal pixel values on color background picked from input video,
  5235. the text color is picked in such way so its always visible.
  5236. @end table
  5237. @item axis
  5238. Draw rows and columns numbers on left and top of video.
  5239. @item opacity
  5240. Set background opacity.
  5241. @end table
  5242. @section dctdnoiz
  5243. Denoise frames using 2D DCT (frequency domain filtering).
  5244. This filter is not designed for real time.
  5245. The filter accepts the following options:
  5246. @table @option
  5247. @item sigma, s
  5248. Set the noise sigma constant.
  5249. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5250. coefficient (absolute value) below this threshold with be dropped.
  5251. If you need a more advanced filtering, see @option{expr}.
  5252. Default is @code{0}.
  5253. @item overlap
  5254. Set number overlapping pixels for each block. Since the filter can be slow, you
  5255. may want to reduce this value, at the cost of a less effective filter and the
  5256. risk of various artefacts.
  5257. If the overlapping value doesn't permit processing the whole input width or
  5258. height, a warning will be displayed and according borders won't be denoised.
  5259. Default value is @var{blocksize}-1, which is the best possible setting.
  5260. @item expr, e
  5261. Set the coefficient factor expression.
  5262. For each coefficient of a DCT block, this expression will be evaluated as a
  5263. multiplier value for the coefficient.
  5264. If this is option is set, the @option{sigma} option will be ignored.
  5265. The absolute value of the coefficient can be accessed through the @var{c}
  5266. variable.
  5267. @item n
  5268. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5269. @var{blocksize}, which is the width and height of the processed blocks.
  5270. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5271. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5272. on the speed processing. Also, a larger block size does not necessarily means a
  5273. better de-noising.
  5274. @end table
  5275. @subsection Examples
  5276. Apply a denoise with a @option{sigma} of @code{4.5}:
  5277. @example
  5278. dctdnoiz=4.5
  5279. @end example
  5280. The same operation can be achieved using the expression system:
  5281. @example
  5282. dctdnoiz=e='gte(c, 4.5*3)'
  5283. @end example
  5284. Violent denoise using a block size of @code{16x16}:
  5285. @example
  5286. dctdnoiz=15:n=4
  5287. @end example
  5288. @section deband
  5289. Remove banding artifacts from input video.
  5290. It works by replacing banded pixels with average value of referenced pixels.
  5291. The filter accepts the following options:
  5292. @table @option
  5293. @item 1thr
  5294. @item 2thr
  5295. @item 3thr
  5296. @item 4thr
  5297. Set banding detection threshold for each plane. Default is 0.02.
  5298. Valid range is 0.00003 to 0.5.
  5299. If difference between current pixel and reference pixel is less than threshold,
  5300. it will be considered as banded.
  5301. @item range, r
  5302. Banding detection range in pixels. Default is 16. If positive, random number
  5303. in range 0 to set value will be used. If negative, exact absolute value
  5304. will be used.
  5305. The range defines square of four pixels around current pixel.
  5306. @item direction, d
  5307. Set direction in radians from which four pixel will be compared. If positive,
  5308. random direction from 0 to set direction will be picked. If negative, exact of
  5309. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5310. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5311. column.
  5312. @item blur, b
  5313. If enabled, current pixel is compared with average value of all four
  5314. surrounding pixels. The default is enabled. If disabled current pixel is
  5315. compared with all four surrounding pixels. The pixel is considered banded
  5316. if only all four differences with surrounding pixels are less than threshold.
  5317. @item coupling, c
  5318. If enabled, current pixel is changed if and only if all pixel components are banded,
  5319. e.g. banding detection threshold is triggered for all color components.
  5320. The default is disabled.
  5321. @end table
  5322. @anchor{decimate}
  5323. @section decimate
  5324. Drop duplicated frames at regular intervals.
  5325. The filter accepts the following options:
  5326. @table @option
  5327. @item cycle
  5328. Set the number of frames from which one will be dropped. Setting this to
  5329. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5330. Default is @code{5}.
  5331. @item dupthresh
  5332. Set the threshold for duplicate detection. If the difference metric for a frame
  5333. is less than or equal to this value, then it is declared as duplicate. Default
  5334. is @code{1.1}
  5335. @item scthresh
  5336. Set scene change threshold. Default is @code{15}.
  5337. @item blockx
  5338. @item blocky
  5339. Set the size of the x and y-axis blocks used during metric calculations.
  5340. Larger blocks give better noise suppression, but also give worse detection of
  5341. small movements. Must be a power of two. Default is @code{32}.
  5342. @item ppsrc
  5343. Mark main input as a pre-processed input and activate clean source input
  5344. stream. This allows the input to be pre-processed with various filters to help
  5345. the metrics calculation while keeping the frame selection lossless. When set to
  5346. @code{1}, the first stream is for the pre-processed input, and the second
  5347. stream is the clean source from where the kept frames are chosen. Default is
  5348. @code{0}.
  5349. @item chroma
  5350. Set whether or not chroma is considered in the metric calculations. Default is
  5351. @code{1}.
  5352. @end table
  5353. @section deflate
  5354. Apply deflate effect to the video.
  5355. This filter replaces the pixel by the local(3x3) average by taking into account
  5356. only values lower than the pixel.
  5357. It accepts the following options:
  5358. @table @option
  5359. @item threshold0
  5360. @item threshold1
  5361. @item threshold2
  5362. @item threshold3
  5363. Limit the maximum change for each plane, default is 65535.
  5364. If 0, plane will remain unchanged.
  5365. @end table
  5366. @section deflicker
  5367. Remove temporal frame luminance variations.
  5368. It accepts the following options:
  5369. @table @option
  5370. @item size, s
  5371. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5372. @item mode, m
  5373. Set averaging mode to smooth temporal luminance variations.
  5374. Available values are:
  5375. @table @samp
  5376. @item am
  5377. Arithmetic mean
  5378. @item gm
  5379. Geometric mean
  5380. @item hm
  5381. Harmonic mean
  5382. @item qm
  5383. Quadratic mean
  5384. @item cm
  5385. Cubic mean
  5386. @item pm
  5387. Power mean
  5388. @item median
  5389. Median
  5390. @end table
  5391. @item bypass
  5392. Do not actually modify frame. Useful when one only wants metadata.
  5393. @end table
  5394. @section dejudder
  5395. Remove judder produced by partially interlaced telecined content.
  5396. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5397. source was partially telecined content then the output of @code{pullup,dejudder}
  5398. will have a variable frame rate. May change the recorded frame rate of the
  5399. container. Aside from that change, this filter will not affect constant frame
  5400. rate video.
  5401. The option available in this filter is:
  5402. @table @option
  5403. @item cycle
  5404. Specify the length of the window over which the judder repeats.
  5405. Accepts any integer greater than 1. Useful values are:
  5406. @table @samp
  5407. @item 4
  5408. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5409. @item 5
  5410. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5411. @item 20
  5412. If a mixture of the two.
  5413. @end table
  5414. The default is @samp{4}.
  5415. @end table
  5416. @section delogo
  5417. Suppress a TV station logo by a simple interpolation of the surrounding
  5418. pixels. Just set a rectangle covering the logo and watch it disappear
  5419. (and sometimes something even uglier appear - your mileage may vary).
  5420. It accepts the following parameters:
  5421. @table @option
  5422. @item x
  5423. @item y
  5424. Specify the top left corner coordinates of the logo. They must be
  5425. specified.
  5426. @item w
  5427. @item h
  5428. Specify the width and height of the logo to clear. They must be
  5429. specified.
  5430. @item band, t
  5431. Specify the thickness of the fuzzy edge of the rectangle (added to
  5432. @var{w} and @var{h}). The default value is 1. This option is
  5433. deprecated, setting higher values should no longer be necessary and
  5434. is not recommended.
  5435. @item show
  5436. When set to 1, a green rectangle is drawn on the screen to simplify
  5437. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5438. The default value is 0.
  5439. The rectangle is drawn on the outermost pixels which will be (partly)
  5440. replaced with interpolated values. The values of the next pixels
  5441. immediately outside this rectangle in each direction will be used to
  5442. compute the interpolated pixel values inside the rectangle.
  5443. @end table
  5444. @subsection Examples
  5445. @itemize
  5446. @item
  5447. Set a rectangle covering the area with top left corner coordinates 0,0
  5448. and size 100x77, and a band of size 10:
  5449. @example
  5450. delogo=x=0:y=0:w=100:h=77:band=10
  5451. @end example
  5452. @end itemize
  5453. @section deshake
  5454. Attempt to fix small changes in horizontal and/or vertical shift. This
  5455. filter helps remove camera shake from hand-holding a camera, bumping a
  5456. tripod, moving on a vehicle, etc.
  5457. The filter accepts the following options:
  5458. @table @option
  5459. @item x
  5460. @item y
  5461. @item w
  5462. @item h
  5463. Specify a rectangular area where to limit the search for motion
  5464. vectors.
  5465. If desired the search for motion vectors can be limited to a
  5466. rectangular area of the frame defined by its top left corner, width
  5467. and height. These parameters have the same meaning as the drawbox
  5468. filter which can be used to visualise the position of the bounding
  5469. box.
  5470. This is useful when simultaneous movement of subjects within the frame
  5471. might be confused for camera motion by the motion vector search.
  5472. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5473. then the full frame is used. This allows later options to be set
  5474. without specifying the bounding box for the motion vector search.
  5475. Default - search the whole frame.
  5476. @item rx
  5477. @item ry
  5478. Specify the maximum extent of movement in x and y directions in the
  5479. range 0-64 pixels. Default 16.
  5480. @item edge
  5481. Specify how to generate pixels to fill blanks at the edge of the
  5482. frame. Available values are:
  5483. @table @samp
  5484. @item blank, 0
  5485. Fill zeroes at blank locations
  5486. @item original, 1
  5487. Original image at blank locations
  5488. @item clamp, 2
  5489. Extruded edge value at blank locations
  5490. @item mirror, 3
  5491. Mirrored edge at blank locations
  5492. @end table
  5493. Default value is @samp{mirror}.
  5494. @item blocksize
  5495. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5496. default 8.
  5497. @item contrast
  5498. Specify the contrast threshold for blocks. Only blocks with more than
  5499. the specified contrast (difference between darkest and lightest
  5500. pixels) will be considered. Range 1-255, default 125.
  5501. @item search
  5502. Specify the search strategy. Available values are:
  5503. @table @samp
  5504. @item exhaustive, 0
  5505. Set exhaustive search
  5506. @item less, 1
  5507. Set less exhaustive search.
  5508. @end table
  5509. Default value is @samp{exhaustive}.
  5510. @item filename
  5511. If set then a detailed log of the motion search is written to the
  5512. specified file.
  5513. @end table
  5514. @section despill
  5515. Remove unwanted contamination of foreground colors, caused by reflected color of
  5516. greenscreen or bluescreen.
  5517. This filter accepts the following options:
  5518. @table @option
  5519. @item type
  5520. Set what type of despill to use.
  5521. @item mix
  5522. Set how spillmap will be generated.
  5523. @item expand
  5524. Set how much to get rid of still remaining spill.
  5525. @item red
  5526. Controls amount of red in spill area.
  5527. @item green
  5528. Controls amount of green in spill area.
  5529. Should be -1 for greenscreen.
  5530. @item blue
  5531. Controls amount of blue in spill area.
  5532. Should be -1 for bluescreen.
  5533. @item brightness
  5534. Controls brightness of spill area, preserving colors.
  5535. @item alpha
  5536. Modify alpha from generated spillmap.
  5537. @end table
  5538. @section detelecine
  5539. Apply an exact inverse of the telecine operation. It requires a predefined
  5540. pattern specified using the pattern option which must be the same as that passed
  5541. to the telecine filter.
  5542. This filter accepts the following options:
  5543. @table @option
  5544. @item first_field
  5545. @table @samp
  5546. @item top, t
  5547. top field first
  5548. @item bottom, b
  5549. bottom field first
  5550. The default value is @code{top}.
  5551. @end table
  5552. @item pattern
  5553. A string of numbers representing the pulldown pattern you wish to apply.
  5554. The default value is @code{23}.
  5555. @item start_frame
  5556. A number representing position of the first frame with respect to the telecine
  5557. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5558. @end table
  5559. @section dilation
  5560. Apply dilation effect to the video.
  5561. This filter replaces the pixel by the local(3x3) maximum.
  5562. It accepts the following options:
  5563. @table @option
  5564. @item threshold0
  5565. @item threshold1
  5566. @item threshold2
  5567. @item threshold3
  5568. Limit the maximum change for each plane, default is 65535.
  5569. If 0, plane will remain unchanged.
  5570. @item coordinates
  5571. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5572. pixels are used.
  5573. Flags to local 3x3 coordinates maps like this:
  5574. 1 2 3
  5575. 4 5
  5576. 6 7 8
  5577. @end table
  5578. @section displace
  5579. Displace pixels as indicated by second and third input stream.
  5580. It takes three input streams and outputs one stream, the first input is the
  5581. source, and second and third input are displacement maps.
  5582. The second input specifies how much to displace pixels along the
  5583. x-axis, while the third input specifies how much to displace pixels
  5584. along the y-axis.
  5585. If one of displacement map streams terminates, last frame from that
  5586. displacement map will be used.
  5587. Note that once generated, displacements maps can be reused over and over again.
  5588. A description of the accepted options follows.
  5589. @table @option
  5590. @item edge
  5591. Set displace behavior for pixels that are out of range.
  5592. Available values are:
  5593. @table @samp
  5594. @item blank
  5595. Missing pixels are replaced by black pixels.
  5596. @item smear
  5597. Adjacent pixels will spread out to replace missing pixels.
  5598. @item wrap
  5599. Out of range pixels are wrapped so they point to pixels of other side.
  5600. @item mirror
  5601. Out of range pixels will be replaced with mirrored pixels.
  5602. @end table
  5603. Default is @samp{smear}.
  5604. @end table
  5605. @subsection Examples
  5606. @itemize
  5607. @item
  5608. Add ripple effect to rgb input of video size hd720:
  5609. @example
  5610. 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
  5611. @end example
  5612. @item
  5613. Add wave effect to rgb input of video size hd720:
  5614. @example
  5615. 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
  5616. @end example
  5617. @end itemize
  5618. @section drawbox
  5619. Draw a colored box on the input image.
  5620. It accepts the following parameters:
  5621. @table @option
  5622. @item x
  5623. @item y
  5624. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5625. @item width, w
  5626. @item height, h
  5627. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5628. the input width and height. It defaults to 0.
  5629. @item color, c
  5630. Specify the color of the box to write. For the general syntax of this option,
  5631. check the "Color" section in the ffmpeg-utils manual. If the special
  5632. value @code{invert} is used, the box edge color is the same as the
  5633. video with inverted luma.
  5634. @item thickness, t
  5635. The expression which sets the thickness of the box edge.
  5636. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5637. See below for the list of accepted constants.
  5638. @item replace
  5639. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5640. will overwrite the video's color and alpha pixels.
  5641. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5642. @end table
  5643. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5644. following constants:
  5645. @table @option
  5646. @item dar
  5647. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5648. @item hsub
  5649. @item vsub
  5650. horizontal and vertical chroma subsample values. For example for the
  5651. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5652. @item in_h, ih
  5653. @item in_w, iw
  5654. The input width and height.
  5655. @item sar
  5656. The input sample aspect ratio.
  5657. @item x
  5658. @item y
  5659. The x and y offset coordinates where the box is drawn.
  5660. @item w
  5661. @item h
  5662. The width and height of the drawn box.
  5663. @item t
  5664. The thickness of the drawn box.
  5665. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5666. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5667. @end table
  5668. @subsection Examples
  5669. @itemize
  5670. @item
  5671. Draw a black box around the edge of the input image:
  5672. @example
  5673. drawbox
  5674. @end example
  5675. @item
  5676. Draw a box with color red and an opacity of 50%:
  5677. @example
  5678. drawbox=10:20:200:60:red@@0.5
  5679. @end example
  5680. The previous example can be specified as:
  5681. @example
  5682. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5683. @end example
  5684. @item
  5685. Fill the box with pink color:
  5686. @example
  5687. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5688. @end example
  5689. @item
  5690. Draw a 2-pixel red 2.40:1 mask:
  5691. @example
  5692. 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
  5693. @end example
  5694. @end itemize
  5695. @section drawgrid
  5696. Draw a grid on the input image.
  5697. It accepts the following parameters:
  5698. @table @option
  5699. @item x
  5700. @item y
  5701. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5702. @item width, w
  5703. @item height, h
  5704. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5705. input width and height, respectively, minus @code{thickness}, so image gets
  5706. framed. Default to 0.
  5707. @item color, c
  5708. Specify the color of the grid. For the general syntax of this option,
  5709. check the "Color" section in the ffmpeg-utils manual. If the special
  5710. value @code{invert} is used, the grid color is the same as the
  5711. video with inverted luma.
  5712. @item thickness, t
  5713. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5714. See below for the list of accepted constants.
  5715. @item replace
  5716. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5717. will overwrite the video's color and alpha pixels.
  5718. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5719. @end table
  5720. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5721. following constants:
  5722. @table @option
  5723. @item dar
  5724. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5725. @item hsub
  5726. @item vsub
  5727. horizontal and vertical chroma subsample values. For example for the
  5728. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5729. @item in_h, ih
  5730. @item in_w, iw
  5731. The input grid cell width and height.
  5732. @item sar
  5733. The input sample aspect ratio.
  5734. @item x
  5735. @item y
  5736. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5737. @item w
  5738. @item h
  5739. The width and height of the drawn cell.
  5740. @item t
  5741. The thickness of the drawn cell.
  5742. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5743. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5744. @end table
  5745. @subsection Examples
  5746. @itemize
  5747. @item
  5748. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5749. @example
  5750. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5751. @end example
  5752. @item
  5753. Draw a white 3x3 grid with an opacity of 50%:
  5754. @example
  5755. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5756. @end example
  5757. @end itemize
  5758. @anchor{drawtext}
  5759. @section drawtext
  5760. Draw a text string or text from a specified file on top of a video, using the
  5761. libfreetype library.
  5762. To enable compilation of this filter, you need to configure FFmpeg with
  5763. @code{--enable-libfreetype}.
  5764. To enable default font fallback and the @var{font} option you need to
  5765. configure FFmpeg with @code{--enable-libfontconfig}.
  5766. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5767. @code{--enable-libfribidi}.
  5768. @subsection Syntax
  5769. It accepts the following parameters:
  5770. @table @option
  5771. @item box
  5772. Used to draw a box around text using the background color.
  5773. The value must be either 1 (enable) or 0 (disable).
  5774. The default value of @var{box} is 0.
  5775. @item boxborderw
  5776. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5777. The default value of @var{boxborderw} is 0.
  5778. @item boxcolor
  5779. The color to be used for drawing box around text. For the syntax of this
  5780. option, check the "Color" section in the ffmpeg-utils manual.
  5781. The default value of @var{boxcolor} is "white".
  5782. @item line_spacing
  5783. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5784. The default value of @var{line_spacing} is 0.
  5785. @item borderw
  5786. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5787. The default value of @var{borderw} is 0.
  5788. @item bordercolor
  5789. Set the color to be used for drawing border around text. For the syntax of this
  5790. option, check the "Color" section in the ffmpeg-utils manual.
  5791. The default value of @var{bordercolor} is "black".
  5792. @item expansion
  5793. Select how the @var{text} is expanded. Can be either @code{none},
  5794. @code{strftime} (deprecated) or
  5795. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5796. below for details.
  5797. @item basetime
  5798. Set a start time for the count. Value is in microseconds. Only applied
  5799. in the deprecated strftime expansion mode. To emulate in normal expansion
  5800. mode use the @code{pts} function, supplying the start time (in seconds)
  5801. as the second argument.
  5802. @item fix_bounds
  5803. If true, check and fix text coords to avoid clipping.
  5804. @item fontcolor
  5805. The color to be used for drawing fonts. For the syntax of this option, check
  5806. the "Color" section in the ffmpeg-utils manual.
  5807. The default value of @var{fontcolor} is "black".
  5808. @item fontcolor_expr
  5809. String which is expanded the same way as @var{text} to obtain dynamic
  5810. @var{fontcolor} value. By default this option has empty value and is not
  5811. processed. When this option is set, it overrides @var{fontcolor} option.
  5812. @item font
  5813. The font family to be used for drawing text. By default Sans.
  5814. @item fontfile
  5815. The font file to be used for drawing text. The path must be included.
  5816. This parameter is mandatory if the fontconfig support is disabled.
  5817. @item alpha
  5818. Draw the text applying alpha blending. The value can
  5819. be a number between 0.0 and 1.0.
  5820. The expression accepts the same variables @var{x, y} as well.
  5821. The default value is 1.
  5822. Please see @var{fontcolor_expr}.
  5823. @item fontsize
  5824. The font size to be used for drawing text.
  5825. The default value of @var{fontsize} is 16.
  5826. @item text_shaping
  5827. If set to 1, attempt to shape the text (for example, reverse the order of
  5828. right-to-left text and join Arabic characters) before drawing it.
  5829. Otherwise, just draw the text exactly as given.
  5830. By default 1 (if supported).
  5831. @item ft_load_flags
  5832. The flags to be used for loading the fonts.
  5833. The flags map the corresponding flags supported by libfreetype, and are
  5834. a combination of the following values:
  5835. @table @var
  5836. @item default
  5837. @item no_scale
  5838. @item no_hinting
  5839. @item render
  5840. @item no_bitmap
  5841. @item vertical_layout
  5842. @item force_autohint
  5843. @item crop_bitmap
  5844. @item pedantic
  5845. @item ignore_global_advance_width
  5846. @item no_recurse
  5847. @item ignore_transform
  5848. @item monochrome
  5849. @item linear_design
  5850. @item no_autohint
  5851. @end table
  5852. Default value is "default".
  5853. For more information consult the documentation for the FT_LOAD_*
  5854. libfreetype flags.
  5855. @item shadowcolor
  5856. The color to be used for drawing a shadow behind the drawn text. For the
  5857. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5858. The default value of @var{shadowcolor} is "black".
  5859. @item shadowx
  5860. @item shadowy
  5861. The x and y offsets for the text shadow position with respect to the
  5862. position of the text. They can be either positive or negative
  5863. values. The default value for both is "0".
  5864. @item start_number
  5865. The starting frame number for the n/frame_num variable. The default value
  5866. is "0".
  5867. @item tabsize
  5868. The size in number of spaces to use for rendering the tab.
  5869. Default value is 4.
  5870. @item timecode
  5871. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5872. format. It can be used with or without text parameter. @var{timecode_rate}
  5873. option must be specified.
  5874. @item timecode_rate, rate, r
  5875. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5876. integer. Minimum value is "1".
  5877. Drop-frame timecode is supported for frame rates 30 & 60.
  5878. @item tc24hmax
  5879. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5880. Default is 0 (disabled).
  5881. @item text
  5882. The text string to be drawn. The text must be a sequence of UTF-8
  5883. encoded characters.
  5884. This parameter is mandatory if no file is specified with the parameter
  5885. @var{textfile}.
  5886. @item textfile
  5887. A text file containing text to be drawn. The text must be a sequence
  5888. of UTF-8 encoded characters.
  5889. This parameter is mandatory if no text string is specified with the
  5890. parameter @var{text}.
  5891. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5892. @item reload
  5893. If set to 1, the @var{textfile} will be reloaded before each frame.
  5894. Be sure to update it atomically, or it may be read partially, or even fail.
  5895. @item x
  5896. @item y
  5897. The expressions which specify the offsets where text will be drawn
  5898. within the video frame. They are relative to the top/left border of the
  5899. output image.
  5900. The default value of @var{x} and @var{y} is "0".
  5901. See below for the list of accepted constants and functions.
  5902. @end table
  5903. The parameters for @var{x} and @var{y} are expressions containing the
  5904. following constants and functions:
  5905. @table @option
  5906. @item dar
  5907. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5908. @item hsub
  5909. @item vsub
  5910. horizontal and vertical chroma subsample values. For example for the
  5911. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5912. @item line_h, lh
  5913. the height of each text line
  5914. @item main_h, h, H
  5915. the input height
  5916. @item main_w, w, W
  5917. the input width
  5918. @item max_glyph_a, ascent
  5919. the maximum distance from the baseline to the highest/upper grid
  5920. coordinate used to place a glyph outline point, for all the rendered
  5921. glyphs.
  5922. It is a positive value, due to the grid's orientation with the Y axis
  5923. upwards.
  5924. @item max_glyph_d, descent
  5925. the maximum distance from the baseline to the lowest grid coordinate
  5926. used to place a glyph outline point, for all the rendered glyphs.
  5927. This is a negative value, due to the grid's orientation, with the Y axis
  5928. upwards.
  5929. @item max_glyph_h
  5930. maximum glyph height, that is the maximum height for all the glyphs
  5931. contained in the rendered text, it is equivalent to @var{ascent} -
  5932. @var{descent}.
  5933. @item max_glyph_w
  5934. maximum glyph width, that is the maximum width for all the glyphs
  5935. contained in the rendered text
  5936. @item n
  5937. the number of input frame, starting from 0
  5938. @item rand(min, max)
  5939. return a random number included between @var{min} and @var{max}
  5940. @item sar
  5941. The input sample aspect ratio.
  5942. @item t
  5943. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5944. @item text_h, th
  5945. the height of the rendered text
  5946. @item text_w, tw
  5947. the width of the rendered text
  5948. @item x
  5949. @item y
  5950. the x and y offset coordinates where the text is drawn.
  5951. These parameters allow the @var{x} and @var{y} expressions to refer
  5952. each other, so you can for example specify @code{y=x/dar}.
  5953. @end table
  5954. @anchor{drawtext_expansion}
  5955. @subsection Text expansion
  5956. If @option{expansion} is set to @code{strftime},
  5957. the filter recognizes strftime() sequences in the provided text and
  5958. expands them accordingly. Check the documentation of strftime(). This
  5959. feature is deprecated.
  5960. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5961. If @option{expansion} is set to @code{normal} (which is the default),
  5962. the following expansion mechanism is used.
  5963. The backslash character @samp{\}, followed by any character, always expands to
  5964. the second character.
  5965. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5966. braces is a function name, possibly followed by arguments separated by ':'.
  5967. If the arguments contain special characters or delimiters (':' or '@}'),
  5968. they should be escaped.
  5969. Note that they probably must also be escaped as the value for the
  5970. @option{text} option in the filter argument string and as the filter
  5971. argument in the filtergraph description, and possibly also for the shell,
  5972. that makes up to four levels of escaping; using a text file avoids these
  5973. problems.
  5974. The following functions are available:
  5975. @table @command
  5976. @item expr, e
  5977. The expression evaluation result.
  5978. It must take one argument specifying the expression to be evaluated,
  5979. which accepts the same constants and functions as the @var{x} and
  5980. @var{y} values. Note that not all constants should be used, for
  5981. example the text size is not known when evaluating the expression, so
  5982. the constants @var{text_w} and @var{text_h} will have an undefined
  5983. value.
  5984. @item expr_int_format, eif
  5985. Evaluate the expression's value and output as formatted integer.
  5986. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5987. The second argument specifies the output format. Allowed values are @samp{x},
  5988. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5989. @code{printf} function.
  5990. The third parameter is optional and sets the number of positions taken by the output.
  5991. It can be used to add padding with zeros from the left.
  5992. @item gmtime
  5993. The time at which the filter is running, expressed in UTC.
  5994. It can accept an argument: a strftime() format string.
  5995. @item localtime
  5996. The time at which the filter is running, expressed in the local time zone.
  5997. It can accept an argument: a strftime() format string.
  5998. @item metadata
  5999. Frame metadata. Takes one or two arguments.
  6000. The first argument is mandatory and specifies the metadata key.
  6001. The second argument is optional and specifies a default value, used when the
  6002. metadata key is not found or empty.
  6003. @item n, frame_num
  6004. The frame number, starting from 0.
  6005. @item pict_type
  6006. A 1 character description of the current picture type.
  6007. @item pts
  6008. The timestamp of the current frame.
  6009. It can take up to three arguments.
  6010. The first argument is the format of the timestamp; it defaults to @code{flt}
  6011. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6012. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6013. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6014. @code{localtime} stands for the timestamp of the frame formatted as
  6015. local time zone time.
  6016. The second argument is an offset added to the timestamp.
  6017. If the format is set to @code{localtime} or @code{gmtime},
  6018. a third argument may be supplied: a strftime() format string.
  6019. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6020. @end table
  6021. @subsection Examples
  6022. @itemize
  6023. @item
  6024. Draw "Test Text" with font FreeSerif, using the default values for the
  6025. optional parameters.
  6026. @example
  6027. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6028. @end example
  6029. @item
  6030. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6031. and y=50 (counting from the top-left corner of the screen), text is
  6032. yellow with a red box around it. Both the text and the box have an
  6033. opacity of 20%.
  6034. @example
  6035. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6036. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6037. @end example
  6038. Note that the double quotes are not necessary if spaces are not used
  6039. within the parameter list.
  6040. @item
  6041. Show the text at the center of the video frame:
  6042. @example
  6043. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6044. @end example
  6045. @item
  6046. Show the text at a random position, switching to a new position every 30 seconds:
  6047. @example
  6048. 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)"
  6049. @end example
  6050. @item
  6051. Show a text line sliding from right to left in the last row of the video
  6052. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6053. with no newlines.
  6054. @example
  6055. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6056. @end example
  6057. @item
  6058. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6059. @example
  6060. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6061. @end example
  6062. @item
  6063. Draw a single green letter "g", at the center of the input video.
  6064. The glyph baseline is placed at half screen height.
  6065. @example
  6066. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6067. @end example
  6068. @item
  6069. Show text for 1 second every 3 seconds:
  6070. @example
  6071. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6072. @end example
  6073. @item
  6074. Use fontconfig to set the font. Note that the colons need to be escaped.
  6075. @example
  6076. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6077. @end example
  6078. @item
  6079. Print the date of a real-time encoding (see strftime(3)):
  6080. @example
  6081. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6082. @end example
  6083. @item
  6084. Show text fading in and out (appearing/disappearing):
  6085. @example
  6086. #!/bin/sh
  6087. DS=1.0 # display start
  6088. DE=10.0 # display end
  6089. FID=1.5 # fade in duration
  6090. FOD=5 # fade out duration
  6091. 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 @}"
  6092. @end example
  6093. @item
  6094. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6095. and the @option{fontsize} value are included in the @option{y} offset.
  6096. @example
  6097. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6098. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6099. @end example
  6100. @end itemize
  6101. For more information about libfreetype, check:
  6102. @url{http://www.freetype.org/}.
  6103. For more information about fontconfig, check:
  6104. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6105. For more information about libfribidi, check:
  6106. @url{http://fribidi.org/}.
  6107. @section edgedetect
  6108. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6109. The filter accepts the following options:
  6110. @table @option
  6111. @item low
  6112. @item high
  6113. Set low and high threshold values used by the Canny thresholding
  6114. algorithm.
  6115. The high threshold selects the "strong" edge pixels, which are then
  6116. connected through 8-connectivity with the "weak" edge pixels selected
  6117. by the low threshold.
  6118. @var{low} and @var{high} threshold values must be chosen in the range
  6119. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6120. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6121. is @code{50/255}.
  6122. @item mode
  6123. Define the drawing mode.
  6124. @table @samp
  6125. @item wires
  6126. Draw white/gray wires on black background.
  6127. @item colormix
  6128. Mix the colors to create a paint/cartoon effect.
  6129. @end table
  6130. Default value is @var{wires}.
  6131. @end table
  6132. @subsection Examples
  6133. @itemize
  6134. @item
  6135. Standard edge detection with custom values for the hysteresis thresholding:
  6136. @example
  6137. edgedetect=low=0.1:high=0.4
  6138. @end example
  6139. @item
  6140. Painting effect without thresholding:
  6141. @example
  6142. edgedetect=mode=colormix:high=0
  6143. @end example
  6144. @end itemize
  6145. @section eq
  6146. Set brightness, contrast, saturation and approximate gamma adjustment.
  6147. The filter accepts the following options:
  6148. @table @option
  6149. @item contrast
  6150. Set the contrast expression. The value must be a float value in range
  6151. @code{-2.0} to @code{2.0}. The default value is "1".
  6152. @item brightness
  6153. Set the brightness expression. The value must be a float value in
  6154. range @code{-1.0} to @code{1.0}. The default value is "0".
  6155. @item saturation
  6156. Set the saturation expression. The value must be a float in
  6157. range @code{0.0} to @code{3.0}. The default value is "1".
  6158. @item gamma
  6159. Set the gamma expression. The value must be a float in range
  6160. @code{0.1} to @code{10.0}. The default value is "1".
  6161. @item gamma_r
  6162. Set the gamma expression for red. The value must be a float in
  6163. range @code{0.1} to @code{10.0}. The default value is "1".
  6164. @item gamma_g
  6165. Set the gamma expression for green. The value must be a float in range
  6166. @code{0.1} to @code{10.0}. The default value is "1".
  6167. @item gamma_b
  6168. Set the gamma expression for blue. The value must be a float in range
  6169. @code{0.1} to @code{10.0}. The default value is "1".
  6170. @item gamma_weight
  6171. Set the gamma weight expression. It can be used to reduce the effect
  6172. of a high gamma value on bright image areas, e.g. keep them from
  6173. getting overamplified and just plain white. The value must be a float
  6174. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6175. gamma correction all the way down while @code{1.0} leaves it at its
  6176. full strength. Default is "1".
  6177. @item eval
  6178. Set when the expressions for brightness, contrast, saturation and
  6179. gamma expressions are evaluated.
  6180. It accepts the following values:
  6181. @table @samp
  6182. @item init
  6183. only evaluate expressions once during the filter initialization or
  6184. when a command is processed
  6185. @item frame
  6186. evaluate expressions for each incoming frame
  6187. @end table
  6188. Default value is @samp{init}.
  6189. @end table
  6190. The expressions accept the following parameters:
  6191. @table @option
  6192. @item n
  6193. frame count of the input frame starting from 0
  6194. @item pos
  6195. byte position of the corresponding packet in the input file, NAN if
  6196. unspecified
  6197. @item r
  6198. frame rate of the input video, NAN if the input frame rate is unknown
  6199. @item t
  6200. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6201. @end table
  6202. @subsection Commands
  6203. The filter supports the following commands:
  6204. @table @option
  6205. @item contrast
  6206. Set the contrast expression.
  6207. @item brightness
  6208. Set the brightness expression.
  6209. @item saturation
  6210. Set the saturation expression.
  6211. @item gamma
  6212. Set the gamma expression.
  6213. @item gamma_r
  6214. Set the gamma_r expression.
  6215. @item gamma_g
  6216. Set gamma_g expression.
  6217. @item gamma_b
  6218. Set gamma_b expression.
  6219. @item gamma_weight
  6220. Set gamma_weight expression.
  6221. The command accepts the same syntax of the corresponding option.
  6222. If the specified expression is not valid, it is kept at its current
  6223. value.
  6224. @end table
  6225. @section erosion
  6226. Apply erosion effect to the video.
  6227. This filter replaces the pixel by the local(3x3) minimum.
  6228. It accepts the following options:
  6229. @table @option
  6230. @item threshold0
  6231. @item threshold1
  6232. @item threshold2
  6233. @item threshold3
  6234. Limit the maximum change for each plane, default is 65535.
  6235. If 0, plane will remain unchanged.
  6236. @item coordinates
  6237. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6238. pixels are used.
  6239. Flags to local 3x3 coordinates maps like this:
  6240. 1 2 3
  6241. 4 5
  6242. 6 7 8
  6243. @end table
  6244. @section extractplanes
  6245. Extract color channel components from input video stream into
  6246. separate grayscale video streams.
  6247. The filter accepts the following option:
  6248. @table @option
  6249. @item planes
  6250. Set plane(s) to extract.
  6251. Available values for planes are:
  6252. @table @samp
  6253. @item y
  6254. @item u
  6255. @item v
  6256. @item a
  6257. @item r
  6258. @item g
  6259. @item b
  6260. @end table
  6261. Choosing planes not available in the input will result in an error.
  6262. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6263. with @code{y}, @code{u}, @code{v} planes at same time.
  6264. @end table
  6265. @subsection Examples
  6266. @itemize
  6267. @item
  6268. Extract luma, u and v color channel component from input video frame
  6269. into 3 grayscale outputs:
  6270. @example
  6271. 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
  6272. @end example
  6273. @end itemize
  6274. @section elbg
  6275. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6276. For each input image, the filter will compute the optimal mapping from
  6277. the input to the output given the codebook length, that is the number
  6278. of distinct output colors.
  6279. This filter accepts the following options.
  6280. @table @option
  6281. @item codebook_length, l
  6282. Set codebook length. The value must be a positive integer, and
  6283. represents the number of distinct output colors. Default value is 256.
  6284. @item nb_steps, n
  6285. Set the maximum number of iterations to apply for computing the optimal
  6286. mapping. The higher the value the better the result and the higher the
  6287. computation time. Default value is 1.
  6288. @item seed, s
  6289. Set a random seed, must be an integer included between 0 and
  6290. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6291. will try to use a good random seed on a best effort basis.
  6292. @item pal8
  6293. Set pal8 output pixel format. This option does not work with codebook
  6294. length greater than 256.
  6295. @end table
  6296. @section fade
  6297. Apply a fade-in/out effect to the input video.
  6298. It accepts the following parameters:
  6299. @table @option
  6300. @item type, t
  6301. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6302. effect.
  6303. Default is @code{in}.
  6304. @item start_frame, s
  6305. Specify the number of the frame to start applying the fade
  6306. effect at. Default is 0.
  6307. @item nb_frames, n
  6308. The number of frames that the fade effect lasts. At the end of the
  6309. fade-in effect, the output video will have the same intensity as the input video.
  6310. At the end of the fade-out transition, the output video will be filled with the
  6311. selected @option{color}.
  6312. Default is 25.
  6313. @item alpha
  6314. If set to 1, fade only alpha channel, if one exists on the input.
  6315. Default value is 0.
  6316. @item start_time, st
  6317. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6318. effect. If both start_frame and start_time are specified, the fade will start at
  6319. whichever comes last. Default is 0.
  6320. @item duration, d
  6321. The number of seconds for which the fade effect has to last. At the end of the
  6322. fade-in effect the output video will have the same intensity as the input video,
  6323. at the end of the fade-out transition the output video will be filled with the
  6324. selected @option{color}.
  6325. If both duration and nb_frames are specified, duration is used. Default is 0
  6326. (nb_frames is used by default).
  6327. @item color, c
  6328. Specify the color of the fade. Default is "black".
  6329. @end table
  6330. @subsection Examples
  6331. @itemize
  6332. @item
  6333. Fade in the first 30 frames of video:
  6334. @example
  6335. fade=in:0:30
  6336. @end example
  6337. The command above is equivalent to:
  6338. @example
  6339. fade=t=in:s=0:n=30
  6340. @end example
  6341. @item
  6342. Fade out the last 45 frames of a 200-frame video:
  6343. @example
  6344. fade=out:155:45
  6345. fade=type=out:start_frame=155:nb_frames=45
  6346. @end example
  6347. @item
  6348. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6349. @example
  6350. fade=in:0:25, fade=out:975:25
  6351. @end example
  6352. @item
  6353. Make the first 5 frames yellow, then fade in from frame 5-24:
  6354. @example
  6355. fade=in:5:20:color=yellow
  6356. @end example
  6357. @item
  6358. Fade in alpha over first 25 frames of video:
  6359. @example
  6360. fade=in:0:25:alpha=1
  6361. @end example
  6362. @item
  6363. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6364. @example
  6365. fade=t=in:st=5.5:d=0.5
  6366. @end example
  6367. @end itemize
  6368. @section fftfilt
  6369. Apply arbitrary expressions to samples in frequency domain
  6370. @table @option
  6371. @item dc_Y
  6372. Adjust the dc value (gain) of the luma plane of the image. The filter
  6373. accepts an integer value in range @code{0} to @code{1000}. The default
  6374. value is set to @code{0}.
  6375. @item dc_U
  6376. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6377. filter accepts an integer value in range @code{0} to @code{1000}. The
  6378. default value is set to @code{0}.
  6379. @item dc_V
  6380. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6381. filter accepts an integer value in range @code{0} to @code{1000}. The
  6382. default value is set to @code{0}.
  6383. @item weight_Y
  6384. Set the frequency domain weight expression for the luma plane.
  6385. @item weight_U
  6386. Set the frequency domain weight expression for the 1st chroma plane.
  6387. @item weight_V
  6388. Set the frequency domain weight expression for the 2nd chroma plane.
  6389. @item eval
  6390. Set when the expressions are evaluated.
  6391. It accepts the following values:
  6392. @table @samp
  6393. @item init
  6394. Only evaluate expressions once during the filter initialization.
  6395. @item frame
  6396. Evaluate expressions for each incoming frame.
  6397. @end table
  6398. Default value is @samp{init}.
  6399. The filter accepts the following variables:
  6400. @item X
  6401. @item Y
  6402. The coordinates of the current sample.
  6403. @item W
  6404. @item H
  6405. The width and height of the image.
  6406. @item N
  6407. The number of input frame, starting from 0.
  6408. @end table
  6409. @subsection Examples
  6410. @itemize
  6411. @item
  6412. High-pass:
  6413. @example
  6414. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6415. @end example
  6416. @item
  6417. Low-pass:
  6418. @example
  6419. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6420. @end example
  6421. @item
  6422. Sharpen:
  6423. @example
  6424. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6425. @end example
  6426. @item
  6427. Blur:
  6428. @example
  6429. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6430. @end example
  6431. @end itemize
  6432. @section field
  6433. Extract a single field from an interlaced image using stride
  6434. arithmetic to avoid wasting CPU time. The output frames are marked as
  6435. non-interlaced.
  6436. The filter accepts the following options:
  6437. @table @option
  6438. @item type
  6439. Specify whether to extract the top (if the value is @code{0} or
  6440. @code{top}) or the bottom field (if the value is @code{1} or
  6441. @code{bottom}).
  6442. @end table
  6443. @section fieldhint
  6444. Create new frames by copying the top and bottom fields from surrounding frames
  6445. supplied as numbers by the hint file.
  6446. @table @option
  6447. @item hint
  6448. Set file containing hints: absolute/relative frame numbers.
  6449. There must be one line for each frame in a clip. Each line must contain two
  6450. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6451. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6452. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6453. for @code{relative} mode. First number tells from which frame to pick up top
  6454. field and second number tells from which frame to pick up bottom field.
  6455. If optionally followed by @code{+} output frame will be marked as interlaced,
  6456. else if followed by @code{-} output frame will be marked as progressive, else
  6457. it will be marked same as input frame.
  6458. If line starts with @code{#} or @code{;} that line is skipped.
  6459. @item mode
  6460. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6461. @end table
  6462. Example of first several lines of @code{hint} file for @code{relative} mode:
  6463. @example
  6464. 0,0 - # first frame
  6465. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6466. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6467. 1,0 -
  6468. 0,0 -
  6469. 0,0 -
  6470. 1,0 -
  6471. 1,0 -
  6472. 1,0 -
  6473. 0,0 -
  6474. 0,0 -
  6475. 1,0 -
  6476. 1,0 -
  6477. 1,0 -
  6478. 0,0 -
  6479. @end example
  6480. @section fieldmatch
  6481. Field matching filter for inverse telecine. It is meant to reconstruct the
  6482. progressive frames from a telecined stream. The filter does not drop duplicated
  6483. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6484. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6485. The separation of the field matching and the decimation is notably motivated by
  6486. the possibility of inserting a de-interlacing filter fallback between the two.
  6487. If the source has mixed telecined and real interlaced content,
  6488. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6489. But these remaining combed frames will be marked as interlaced, and thus can be
  6490. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6491. In addition to the various configuration options, @code{fieldmatch} can take an
  6492. optional second stream, activated through the @option{ppsrc} option. If
  6493. enabled, the frames reconstruction will be based on the fields and frames from
  6494. this second stream. This allows the first input to be pre-processed in order to
  6495. help the various algorithms of the filter, while keeping the output lossless
  6496. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6497. or brightness/contrast adjustments can help.
  6498. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6499. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6500. which @code{fieldmatch} is based on. While the semantic and usage are very
  6501. close, some behaviour and options names can differ.
  6502. The @ref{decimate} filter currently only works for constant frame rate input.
  6503. If your input has mixed telecined (30fps) and progressive content with a lower
  6504. framerate like 24fps use the following filterchain to produce the necessary cfr
  6505. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6506. The filter accepts the following options:
  6507. @table @option
  6508. @item order
  6509. Specify the assumed field order of the input stream. Available values are:
  6510. @table @samp
  6511. @item auto
  6512. Auto detect parity (use FFmpeg's internal parity value).
  6513. @item bff
  6514. Assume bottom field first.
  6515. @item tff
  6516. Assume top field first.
  6517. @end table
  6518. Note that it is sometimes recommended not to trust the parity announced by the
  6519. stream.
  6520. Default value is @var{auto}.
  6521. @item mode
  6522. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6523. sense that it won't risk creating jerkiness due to duplicate frames when
  6524. possible, but if there are bad edits or blended fields it will end up
  6525. outputting combed frames when a good match might actually exist. On the other
  6526. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6527. but will almost always find a good frame if there is one. The other values are
  6528. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6529. jerkiness and creating duplicate frames versus finding good matches in sections
  6530. with bad edits, orphaned fields, blended fields, etc.
  6531. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6532. Available values are:
  6533. @table @samp
  6534. @item pc
  6535. 2-way matching (p/c)
  6536. @item pc_n
  6537. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6538. @item pc_u
  6539. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6540. @item pc_n_ub
  6541. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6542. still combed (p/c + n + u/b)
  6543. @item pcn
  6544. 3-way matching (p/c/n)
  6545. @item pcn_ub
  6546. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6547. detected as combed (p/c/n + u/b)
  6548. @end table
  6549. The parenthesis at the end indicate the matches that would be used for that
  6550. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6551. @var{top}).
  6552. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6553. the slowest.
  6554. Default value is @var{pc_n}.
  6555. @item ppsrc
  6556. Mark the main input stream as a pre-processed input, and enable the secondary
  6557. input stream as the clean source to pick the fields from. See the filter
  6558. introduction for more details. It is similar to the @option{clip2} feature from
  6559. VFM/TFM.
  6560. Default value is @code{0} (disabled).
  6561. @item field
  6562. Set the field to match from. It is recommended to set this to the same value as
  6563. @option{order} unless you experience matching failures with that setting. In
  6564. certain circumstances changing the field that is used to match from can have a
  6565. large impact on matching performance. Available values are:
  6566. @table @samp
  6567. @item auto
  6568. Automatic (same value as @option{order}).
  6569. @item bottom
  6570. Match from the bottom field.
  6571. @item top
  6572. Match from the top field.
  6573. @end table
  6574. Default value is @var{auto}.
  6575. @item mchroma
  6576. Set whether or not chroma is included during the match comparisons. In most
  6577. cases it is recommended to leave this enabled. You should set this to @code{0}
  6578. only if your clip has bad chroma problems such as heavy rainbowing or other
  6579. artifacts. Setting this to @code{0} could also be used to speed things up at
  6580. the cost of some accuracy.
  6581. Default value is @code{1}.
  6582. @item y0
  6583. @item y1
  6584. These define an exclusion band which excludes the lines between @option{y0} and
  6585. @option{y1} from being included in the field matching decision. An exclusion
  6586. band can be used to ignore subtitles, a logo, or other things that may
  6587. interfere with the matching. @option{y0} sets the starting scan line and
  6588. @option{y1} sets the ending line; all lines in between @option{y0} and
  6589. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6590. @option{y0} and @option{y1} to the same value will disable the feature.
  6591. @option{y0} and @option{y1} defaults to @code{0}.
  6592. @item scthresh
  6593. Set the scene change detection threshold as a percentage of maximum change on
  6594. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6595. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6596. @option{scthresh} is @code{[0.0, 100.0]}.
  6597. Default value is @code{12.0}.
  6598. @item combmatch
  6599. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6600. account the combed scores of matches when deciding what match to use as the
  6601. final match. Available values are:
  6602. @table @samp
  6603. @item none
  6604. No final matching based on combed scores.
  6605. @item sc
  6606. Combed scores are only used when a scene change is detected.
  6607. @item full
  6608. Use combed scores all the time.
  6609. @end table
  6610. Default is @var{sc}.
  6611. @item combdbg
  6612. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6613. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6614. Available values are:
  6615. @table @samp
  6616. @item none
  6617. No forced calculation.
  6618. @item pcn
  6619. Force p/c/n calculations.
  6620. @item pcnub
  6621. Force p/c/n/u/b calculations.
  6622. @end table
  6623. Default value is @var{none}.
  6624. @item cthresh
  6625. This is the area combing threshold used for combed frame detection. This
  6626. essentially controls how "strong" or "visible" combing must be to be detected.
  6627. Larger values mean combing must be more visible and smaller values mean combing
  6628. can be less visible or strong and still be detected. Valid settings are from
  6629. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6630. be detected as combed). This is basically a pixel difference value. A good
  6631. range is @code{[8, 12]}.
  6632. Default value is @code{9}.
  6633. @item chroma
  6634. Sets whether or not chroma is considered in the combed frame decision. Only
  6635. disable this if your source has chroma problems (rainbowing, etc.) that are
  6636. causing problems for the combed frame detection with chroma enabled. Actually,
  6637. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6638. where there is chroma only combing in the source.
  6639. Default value is @code{0}.
  6640. @item blockx
  6641. @item blocky
  6642. Respectively set the x-axis and y-axis size of the window used during combed
  6643. frame detection. This has to do with the size of the area in which
  6644. @option{combpel} pixels are required to be detected as combed for a frame to be
  6645. declared combed. See the @option{combpel} parameter description for more info.
  6646. Possible values are any number that is a power of 2 starting at 4 and going up
  6647. to 512.
  6648. Default value is @code{16}.
  6649. @item combpel
  6650. The number of combed pixels inside any of the @option{blocky} by
  6651. @option{blockx} size blocks on the frame for the frame to be detected as
  6652. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6653. setting controls "how much" combing there must be in any localized area (a
  6654. window defined by the @option{blockx} and @option{blocky} settings) on the
  6655. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6656. which point no frames will ever be detected as combed). This setting is known
  6657. as @option{MI} in TFM/VFM vocabulary.
  6658. Default value is @code{80}.
  6659. @end table
  6660. @anchor{p/c/n/u/b meaning}
  6661. @subsection p/c/n/u/b meaning
  6662. @subsubsection p/c/n
  6663. We assume the following telecined stream:
  6664. @example
  6665. Top fields: 1 2 2 3 4
  6666. Bottom fields: 1 2 3 4 4
  6667. @end example
  6668. The numbers correspond to the progressive frame the fields relate to. Here, the
  6669. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6670. When @code{fieldmatch} is configured to run a matching from bottom
  6671. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6672. @example
  6673. Input stream:
  6674. T 1 2 2 3 4
  6675. B 1 2 3 4 4 <-- matching reference
  6676. Matches: c c n n c
  6677. Output stream:
  6678. T 1 2 3 4 4
  6679. B 1 2 3 4 4
  6680. @end example
  6681. As a result of the field matching, we can see that some frames get duplicated.
  6682. To perform a complete inverse telecine, you need to rely on a decimation filter
  6683. after this operation. See for instance the @ref{decimate} filter.
  6684. The same operation now matching from top fields (@option{field}=@var{top})
  6685. looks like this:
  6686. @example
  6687. Input stream:
  6688. T 1 2 2 3 4 <-- matching reference
  6689. B 1 2 3 4 4
  6690. Matches: c c p p c
  6691. Output stream:
  6692. T 1 2 2 3 4
  6693. B 1 2 2 3 4
  6694. @end example
  6695. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6696. basically, they refer to the frame and field of the opposite parity:
  6697. @itemize
  6698. @item @var{p} matches the field of the opposite parity in the previous frame
  6699. @item @var{c} matches the field of the opposite parity in the current frame
  6700. @item @var{n} matches the field of the opposite parity in the next frame
  6701. @end itemize
  6702. @subsubsection u/b
  6703. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6704. from the opposite parity flag. In the following examples, we assume that we are
  6705. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6706. 'x' is placed above and below each matched fields.
  6707. With bottom matching (@option{field}=@var{bottom}):
  6708. @example
  6709. Match: c p n b u
  6710. x x x x x
  6711. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6712. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6713. x x x x x
  6714. Output frames:
  6715. 2 1 2 2 2
  6716. 2 2 2 1 3
  6717. @end example
  6718. With top matching (@option{field}=@var{top}):
  6719. @example
  6720. Match: c p n b u
  6721. x x x x x
  6722. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6723. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6724. x x x x x
  6725. Output frames:
  6726. 2 2 2 1 2
  6727. 2 1 3 2 2
  6728. @end example
  6729. @subsection Examples
  6730. Simple IVTC of a top field first telecined stream:
  6731. @example
  6732. fieldmatch=order=tff:combmatch=none, decimate
  6733. @end example
  6734. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6735. @example
  6736. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6737. @end example
  6738. @section fieldorder
  6739. Transform the field order of the input video.
  6740. It accepts the following parameters:
  6741. @table @option
  6742. @item order
  6743. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6744. for bottom field first.
  6745. @end table
  6746. The default value is @samp{tff}.
  6747. The transformation is done by shifting the picture content up or down
  6748. by one line, and filling the remaining line with appropriate picture content.
  6749. This method is consistent with most broadcast field order converters.
  6750. If the input video is not flagged as being interlaced, or it is already
  6751. flagged as being of the required output field order, then this filter does
  6752. not alter the incoming video.
  6753. It is very useful when converting to or from PAL DV material,
  6754. which is bottom field first.
  6755. For example:
  6756. @example
  6757. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6758. @end example
  6759. @section fifo, afifo
  6760. Buffer input images and send them when they are requested.
  6761. It is mainly useful when auto-inserted by the libavfilter
  6762. framework.
  6763. It does not take parameters.
  6764. @section fillborders
  6765. Fill borders of the input video, without changing video stream dimensions.
  6766. Sometimes video can have garbage at the four edges and you may not want to
  6767. crop video input to keep size multiple of some number.
  6768. This filter accepts the following options:
  6769. @table @option
  6770. @item left
  6771. Number of pixels to fill from left border.
  6772. @item right
  6773. Number of pixels to fill from right border.
  6774. @item top
  6775. Number of pixels to fill from top border.
  6776. @item bottom
  6777. Number of pixels to fill from bottom border.
  6778. @item mode
  6779. Set fill mode.
  6780. It accepts the following values:
  6781. @table @samp
  6782. @item smear
  6783. fill pixels using outermost pixels
  6784. @item mirror
  6785. fill pixels using mirroring
  6786. @item fixed
  6787. fill pixels with constant value
  6788. @end table
  6789. Default is @var{smear}.
  6790. @item color
  6791. Set color for pixels in fixed mode. Default is @var{black}.
  6792. @end table
  6793. @section find_rect
  6794. Find a rectangular object
  6795. It accepts the following options:
  6796. @table @option
  6797. @item object
  6798. Filepath of the object image, needs to be in gray8.
  6799. @item threshold
  6800. Detection threshold, default is 0.5.
  6801. @item mipmaps
  6802. Number of mipmaps, default is 3.
  6803. @item xmin, ymin, xmax, ymax
  6804. Specifies the rectangle in which to search.
  6805. @end table
  6806. @subsection Examples
  6807. @itemize
  6808. @item
  6809. Generate a representative palette of a given video using @command{ffmpeg}:
  6810. @example
  6811. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6812. @end example
  6813. @end itemize
  6814. @section cover_rect
  6815. Cover a rectangular object
  6816. It accepts the following options:
  6817. @table @option
  6818. @item cover
  6819. Filepath of the optional cover image, needs to be in yuv420.
  6820. @item mode
  6821. Set covering mode.
  6822. It accepts the following values:
  6823. @table @samp
  6824. @item cover
  6825. cover it by the supplied image
  6826. @item blur
  6827. cover it by interpolating the surrounding pixels
  6828. @end table
  6829. Default value is @var{blur}.
  6830. @end table
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Generate a representative palette of a given video using @command{ffmpeg}:
  6835. @example
  6836. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6837. @end example
  6838. @end itemize
  6839. @section floodfill
  6840. Flood area with values of same pixel components with another values.
  6841. It accepts the following options:
  6842. @table @option
  6843. @item x
  6844. Set pixel x coordinate.
  6845. @item y
  6846. Set pixel y coordinate.
  6847. @item s0
  6848. Set source #0 component value.
  6849. @item s1
  6850. Set source #1 component value.
  6851. @item s2
  6852. Set source #2 component value.
  6853. @item s3
  6854. Set source #3 component value.
  6855. @item d0
  6856. Set destination #0 component value.
  6857. @item d1
  6858. Set destination #1 component value.
  6859. @item d2
  6860. Set destination #2 component value.
  6861. @item d3
  6862. Set destination #3 component value.
  6863. @end table
  6864. @anchor{format}
  6865. @section format
  6866. Convert the input video to one of the specified pixel formats.
  6867. Libavfilter will try to pick one that is suitable as input to
  6868. the next filter.
  6869. It accepts the following parameters:
  6870. @table @option
  6871. @item pix_fmts
  6872. A '|'-separated list of pixel format names, such as
  6873. "pix_fmts=yuv420p|monow|rgb24".
  6874. @end table
  6875. @subsection Examples
  6876. @itemize
  6877. @item
  6878. Convert the input video to the @var{yuv420p} format
  6879. @example
  6880. format=pix_fmts=yuv420p
  6881. @end example
  6882. Convert the input video to any of the formats in the list
  6883. @example
  6884. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6885. @end example
  6886. @end itemize
  6887. @anchor{fps}
  6888. @section fps
  6889. Convert the video to specified constant frame rate by duplicating or dropping
  6890. frames as necessary.
  6891. It accepts the following parameters:
  6892. @table @option
  6893. @item fps
  6894. The desired output frame rate. The default is @code{25}.
  6895. @item start_time
  6896. Assume the first PTS should be the given value, in seconds. This allows for
  6897. padding/trimming at the start of stream. By default, no assumption is made
  6898. about the first frame's expected PTS, so no padding or trimming is done.
  6899. For example, this could be set to 0 to pad the beginning with duplicates of
  6900. the first frame if a video stream starts after the audio stream or to trim any
  6901. frames with a negative PTS.
  6902. @item round
  6903. Timestamp (PTS) rounding method.
  6904. Possible values are:
  6905. @table @option
  6906. @item zero
  6907. round towards 0
  6908. @item inf
  6909. round away from 0
  6910. @item down
  6911. round towards -infinity
  6912. @item up
  6913. round towards +infinity
  6914. @item near
  6915. round to nearest
  6916. @end table
  6917. The default is @code{near}.
  6918. @item eof_action
  6919. Action performed when reading the last frame.
  6920. Possible values are:
  6921. @table @option
  6922. @item round
  6923. Use same timestamp rounding method as used for other frames.
  6924. @item pass
  6925. Pass through last frame if input duration has not been reached yet.
  6926. @end table
  6927. The default is @code{round}.
  6928. @end table
  6929. Alternatively, the options can be specified as a flat string:
  6930. @var{fps}[:@var{start_time}[:@var{round}]].
  6931. See also the @ref{setpts} filter.
  6932. @subsection Examples
  6933. @itemize
  6934. @item
  6935. A typical usage in order to set the fps to 25:
  6936. @example
  6937. fps=fps=25
  6938. @end example
  6939. @item
  6940. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6941. @example
  6942. fps=fps=film:round=near
  6943. @end example
  6944. @end itemize
  6945. @section framepack
  6946. Pack two different video streams into a stereoscopic video, setting proper
  6947. metadata on supported codecs. The two views should have the same size and
  6948. framerate and processing will stop when the shorter video ends. Please note
  6949. that you may conveniently adjust view properties with the @ref{scale} and
  6950. @ref{fps} filters.
  6951. It accepts the following parameters:
  6952. @table @option
  6953. @item format
  6954. The desired packing format. Supported values are:
  6955. @table @option
  6956. @item sbs
  6957. The views are next to each other (default).
  6958. @item tab
  6959. The views are on top of each other.
  6960. @item lines
  6961. The views are packed by line.
  6962. @item columns
  6963. The views are packed by column.
  6964. @item frameseq
  6965. The views are temporally interleaved.
  6966. @end table
  6967. @end table
  6968. Some examples:
  6969. @example
  6970. # Convert left and right views into a frame-sequential video
  6971. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6972. # Convert views into a side-by-side video with the same output resolution as the input
  6973. 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
  6974. @end example
  6975. @section framerate
  6976. Change the frame rate by interpolating new video output frames from the source
  6977. frames.
  6978. This filter is not designed to function correctly with interlaced media. If
  6979. you wish to change the frame rate of interlaced media then you are required
  6980. to deinterlace before this filter and re-interlace after this filter.
  6981. A description of the accepted options follows.
  6982. @table @option
  6983. @item fps
  6984. Specify the output frames per second. This option can also be specified
  6985. as a value alone. The default is @code{50}.
  6986. @item interp_start
  6987. Specify the start of a range where the output frame will be created as a
  6988. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6989. the default is @code{15}.
  6990. @item interp_end
  6991. Specify the end of a range where the output frame will be created as a
  6992. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6993. the default is @code{240}.
  6994. @item scene
  6995. Specify the level at which a scene change is detected as a value between
  6996. 0 and 100 to indicate a new scene; a low value reflects a low
  6997. probability for the current frame to introduce a new scene, while a higher
  6998. value means the current frame is more likely to be one.
  6999. The default is @code{7}.
  7000. @item flags
  7001. Specify flags influencing the filter process.
  7002. Available value for @var{flags} is:
  7003. @table @option
  7004. @item scene_change_detect, scd
  7005. Enable scene change detection using the value of the option @var{scene}.
  7006. This flag is enabled by default.
  7007. @end table
  7008. @end table
  7009. @section framestep
  7010. Select one frame every N-th frame.
  7011. This filter accepts the following option:
  7012. @table @option
  7013. @item step
  7014. Select frame after every @code{step} frames.
  7015. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7016. @end table
  7017. @anchor{frei0r}
  7018. @section frei0r
  7019. Apply a frei0r effect to the input video.
  7020. To enable the compilation of this filter, you need to install the frei0r
  7021. header and configure FFmpeg with @code{--enable-frei0r}.
  7022. It accepts the following parameters:
  7023. @table @option
  7024. @item filter_name
  7025. The name of the frei0r effect to load. If the environment variable
  7026. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7027. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7028. Otherwise, the standard frei0r paths are searched, in this order:
  7029. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7030. @file{/usr/lib/frei0r-1/}.
  7031. @item filter_params
  7032. A '|'-separated list of parameters to pass to the frei0r effect.
  7033. @end table
  7034. A frei0r effect parameter can be a boolean (its value is either
  7035. "y" or "n"), a double, a color (specified as
  7036. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7037. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  7038. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  7039. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7040. The number and types of parameters depend on the loaded effect. If an
  7041. effect parameter is not specified, the default value is set.
  7042. @subsection Examples
  7043. @itemize
  7044. @item
  7045. Apply the distort0r effect, setting the first two double parameters:
  7046. @example
  7047. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7048. @end example
  7049. @item
  7050. Apply the colordistance effect, taking a color as the first parameter:
  7051. @example
  7052. frei0r=colordistance:0.2/0.3/0.4
  7053. frei0r=colordistance:violet
  7054. frei0r=colordistance:0x112233
  7055. @end example
  7056. @item
  7057. Apply the perspective effect, specifying the top left and top right image
  7058. positions:
  7059. @example
  7060. frei0r=perspective:0.2/0.2|0.8/0.2
  7061. @end example
  7062. @end itemize
  7063. For more information, see
  7064. @url{http://frei0r.dyne.org}
  7065. @section fspp
  7066. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7067. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7068. processing filter, one of them is performed once per block, not per pixel.
  7069. This allows for much higher speed.
  7070. The filter accepts the following options:
  7071. @table @option
  7072. @item quality
  7073. Set quality. This option defines the number of levels for averaging. It accepts
  7074. an integer in the range 4-5. Default value is @code{4}.
  7075. @item qp
  7076. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7077. If not set, the filter will use the QP from the video stream (if available).
  7078. @item strength
  7079. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7080. more details but also more artifacts, while higher values make the image smoother
  7081. but also blurrier. Default value is @code{0} − PSNR optimal.
  7082. @item use_bframe_qp
  7083. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7084. option may cause flicker since the B-Frames have often larger QP. Default is
  7085. @code{0} (not enabled).
  7086. @end table
  7087. @section gblur
  7088. Apply Gaussian blur filter.
  7089. The filter accepts the following options:
  7090. @table @option
  7091. @item sigma
  7092. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7093. @item steps
  7094. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7095. @item planes
  7096. Set which planes to filter. By default all planes are filtered.
  7097. @item sigmaV
  7098. Set vertical sigma, if negative it will be same as @code{sigma}.
  7099. Default is @code{-1}.
  7100. @end table
  7101. @section geq
  7102. The filter accepts the following options:
  7103. @table @option
  7104. @item lum_expr, lum
  7105. Set the luminance expression.
  7106. @item cb_expr, cb
  7107. Set the chrominance blue expression.
  7108. @item cr_expr, cr
  7109. Set the chrominance red expression.
  7110. @item alpha_expr, a
  7111. Set the alpha expression.
  7112. @item red_expr, r
  7113. Set the red expression.
  7114. @item green_expr, g
  7115. Set the green expression.
  7116. @item blue_expr, b
  7117. Set the blue expression.
  7118. @end table
  7119. The colorspace is selected according to the specified options. If one
  7120. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7121. options is specified, the filter will automatically select a YCbCr
  7122. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7123. @option{blue_expr} options is specified, it will select an RGB
  7124. colorspace.
  7125. If one of the chrominance expression is not defined, it falls back on the other
  7126. one. If no alpha expression is specified it will evaluate to opaque value.
  7127. If none of chrominance expressions are specified, they will evaluate
  7128. to the luminance expression.
  7129. The expressions can use the following variables and functions:
  7130. @table @option
  7131. @item N
  7132. The sequential number of the filtered frame, starting from @code{0}.
  7133. @item X
  7134. @item Y
  7135. The coordinates of the current sample.
  7136. @item W
  7137. @item H
  7138. The width and height of the image.
  7139. @item SW
  7140. @item SH
  7141. Width and height scale depending on the currently filtered plane. It is the
  7142. ratio between the corresponding luma plane number of pixels and the current
  7143. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7144. @code{0.5,0.5} for chroma planes.
  7145. @item T
  7146. Time of the current frame, expressed in seconds.
  7147. @item p(x, y)
  7148. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7149. plane.
  7150. @item lum(x, y)
  7151. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7152. plane.
  7153. @item cb(x, y)
  7154. Return the value of the pixel at location (@var{x},@var{y}) of the
  7155. blue-difference chroma plane. Return 0 if there is no such plane.
  7156. @item cr(x, y)
  7157. Return the value of the pixel at location (@var{x},@var{y}) of the
  7158. red-difference chroma plane. Return 0 if there is no such plane.
  7159. @item r(x, y)
  7160. @item g(x, y)
  7161. @item b(x, y)
  7162. Return the value of the pixel at location (@var{x},@var{y}) of the
  7163. red/green/blue component. Return 0 if there is no such component.
  7164. @item alpha(x, y)
  7165. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7166. plane. Return 0 if there is no such plane.
  7167. @end table
  7168. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7169. automatically clipped to the closer edge.
  7170. @subsection Examples
  7171. @itemize
  7172. @item
  7173. Flip the image horizontally:
  7174. @example
  7175. geq=p(W-X\,Y)
  7176. @end example
  7177. @item
  7178. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7179. wavelength of 100 pixels:
  7180. @example
  7181. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7182. @end example
  7183. @item
  7184. Generate a fancy enigmatic moving light:
  7185. @example
  7186. 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
  7187. @end example
  7188. @item
  7189. Generate a quick emboss effect:
  7190. @example
  7191. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7192. @end example
  7193. @item
  7194. Modify RGB components depending on pixel position:
  7195. @example
  7196. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7197. @end example
  7198. @item
  7199. Create a radial gradient that is the same size as the input (also see
  7200. the @ref{vignette} filter):
  7201. @example
  7202. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7203. @end example
  7204. @end itemize
  7205. @section gradfun
  7206. Fix the banding artifacts that are sometimes introduced into nearly flat
  7207. regions by truncation to 8-bit color depth.
  7208. Interpolate the gradients that should go where the bands are, and
  7209. dither them.
  7210. It is designed for playback only. Do not use it prior to
  7211. lossy compression, because compression tends to lose the dither and
  7212. bring back the bands.
  7213. It accepts the following parameters:
  7214. @table @option
  7215. @item strength
  7216. The maximum amount by which the filter will change any one pixel. This is also
  7217. the threshold for detecting nearly flat regions. Acceptable values range from
  7218. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7219. valid range.
  7220. @item radius
  7221. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7222. gradients, but also prevents the filter from modifying the pixels near detailed
  7223. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7224. values will be clipped to the valid range.
  7225. @end table
  7226. Alternatively, the options can be specified as a flat string:
  7227. @var{strength}[:@var{radius}]
  7228. @subsection Examples
  7229. @itemize
  7230. @item
  7231. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7232. @example
  7233. gradfun=3.5:8
  7234. @end example
  7235. @item
  7236. Specify radius, omitting the strength (which will fall-back to the default
  7237. value):
  7238. @example
  7239. gradfun=radius=8
  7240. @end example
  7241. @end itemize
  7242. @anchor{haldclut}
  7243. @section haldclut
  7244. Apply a Hald CLUT to a video stream.
  7245. First input is the video stream to process, and second one is the Hald CLUT.
  7246. The Hald CLUT input can be a simple picture or a complete video stream.
  7247. The filter accepts the following options:
  7248. @table @option
  7249. @item shortest
  7250. Force termination when the shortest input terminates. Default is @code{0}.
  7251. @item repeatlast
  7252. Continue applying the last CLUT after the end of the stream. A value of
  7253. @code{0} disable the filter after the last frame of the CLUT is reached.
  7254. Default is @code{1}.
  7255. @end table
  7256. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7257. filters share the same internals).
  7258. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7259. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7260. @subsection Workflow examples
  7261. @subsubsection Hald CLUT video stream
  7262. Generate an identity Hald CLUT stream altered with various effects:
  7263. @example
  7264. 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
  7265. @end example
  7266. Note: make sure you use a lossless codec.
  7267. Then use it with @code{haldclut} to apply it on some random stream:
  7268. @example
  7269. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7270. @end example
  7271. The Hald CLUT will be applied to the 10 first seconds (duration of
  7272. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7273. to the remaining frames of the @code{mandelbrot} stream.
  7274. @subsubsection Hald CLUT with preview
  7275. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7276. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7277. biggest possible square starting at the top left of the picture. The remaining
  7278. padding pixels (bottom or right) will be ignored. This area can be used to add
  7279. a preview of the Hald CLUT.
  7280. Typically, the following generated Hald CLUT will be supported by the
  7281. @code{haldclut} filter:
  7282. @example
  7283. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7284. pad=iw+320 [padded_clut];
  7285. smptebars=s=320x256, split [a][b];
  7286. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7287. [main][b] overlay=W-320" -frames:v 1 clut.png
  7288. @end example
  7289. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7290. bars are displayed on the right-top, and below the same color bars processed by
  7291. the color changes.
  7292. Then, the effect of this Hald CLUT can be visualized with:
  7293. @example
  7294. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7295. @end example
  7296. @section hflip
  7297. Flip the input video horizontally.
  7298. For example, to horizontally flip the input video with @command{ffmpeg}:
  7299. @example
  7300. ffmpeg -i in.avi -vf "hflip" out.avi
  7301. @end example
  7302. @section histeq
  7303. This filter applies a global color histogram equalization on a
  7304. per-frame basis.
  7305. It can be used to correct video that has a compressed range of pixel
  7306. intensities. The filter redistributes the pixel intensities to
  7307. equalize their distribution across the intensity range. It may be
  7308. viewed as an "automatically adjusting contrast filter". This filter is
  7309. useful only for correcting degraded or poorly captured source
  7310. video.
  7311. The filter accepts the following options:
  7312. @table @option
  7313. @item strength
  7314. Determine the amount of equalization to be applied. As the strength
  7315. is reduced, the distribution of pixel intensities more-and-more
  7316. approaches that of the input frame. The value must be a float number
  7317. in the range [0,1] and defaults to 0.200.
  7318. @item intensity
  7319. Set the maximum intensity that can generated and scale the output
  7320. values appropriately. The strength should be set as desired and then
  7321. the intensity can be limited if needed to avoid washing-out. The value
  7322. must be a float number in the range [0,1] and defaults to 0.210.
  7323. @item antibanding
  7324. Set the antibanding level. If enabled the filter will randomly vary
  7325. the luminance of output pixels by a small amount to avoid banding of
  7326. the histogram. Possible values are @code{none}, @code{weak} or
  7327. @code{strong}. It defaults to @code{none}.
  7328. @end table
  7329. @section histogram
  7330. Compute and draw a color distribution histogram for the input video.
  7331. The computed histogram is a representation of the color component
  7332. distribution in an image.
  7333. Standard histogram displays the color components distribution in an image.
  7334. Displays color graph for each color component. Shows distribution of
  7335. the Y, U, V, A or R, G, B components, depending on input format, in the
  7336. current frame. Below each graph a color component scale meter is shown.
  7337. The filter accepts the following options:
  7338. @table @option
  7339. @item level_height
  7340. Set height of level. Default value is @code{200}.
  7341. Allowed range is [50, 2048].
  7342. @item scale_height
  7343. Set height of color scale. Default value is @code{12}.
  7344. Allowed range is [0, 40].
  7345. @item display_mode
  7346. Set display mode.
  7347. It accepts the following values:
  7348. @table @samp
  7349. @item stack
  7350. Per color component graphs are placed below each other.
  7351. @item parade
  7352. Per color component graphs are placed side by side.
  7353. @item overlay
  7354. Presents information identical to that in the @code{parade}, except
  7355. that the graphs representing color components are superimposed directly
  7356. over one another.
  7357. @end table
  7358. Default is @code{stack}.
  7359. @item levels_mode
  7360. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7361. Default is @code{linear}.
  7362. @item components
  7363. Set what color components to display.
  7364. Default is @code{7}.
  7365. @item fgopacity
  7366. Set foreground opacity. Default is @code{0.7}.
  7367. @item bgopacity
  7368. Set background opacity. Default is @code{0.5}.
  7369. @end table
  7370. @subsection Examples
  7371. @itemize
  7372. @item
  7373. Calculate and draw histogram:
  7374. @example
  7375. ffplay -i input -vf histogram
  7376. @end example
  7377. @end itemize
  7378. @anchor{hqdn3d}
  7379. @section hqdn3d
  7380. This is a high precision/quality 3d denoise filter. It aims to reduce
  7381. image noise, producing smooth images and making still images really
  7382. still. It should enhance compressibility.
  7383. It accepts the following optional parameters:
  7384. @table @option
  7385. @item luma_spatial
  7386. A non-negative floating point number which specifies spatial luma strength.
  7387. It defaults to 4.0.
  7388. @item chroma_spatial
  7389. A non-negative floating point number which specifies spatial chroma strength.
  7390. It defaults to 3.0*@var{luma_spatial}/4.0.
  7391. @item luma_tmp
  7392. A floating point number which specifies luma temporal strength. It defaults to
  7393. 6.0*@var{luma_spatial}/4.0.
  7394. @item chroma_tmp
  7395. A floating point number which specifies chroma temporal strength. It defaults to
  7396. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7397. @end table
  7398. @section hwdownload
  7399. Download hardware frames to system memory.
  7400. The input must be in hardware frames, and the output a non-hardware format.
  7401. Not all formats will be supported on the output - it may be necessary to insert
  7402. an additional @option{format} filter immediately following in the graph to get
  7403. the output in a supported format.
  7404. @section hwmap
  7405. Map hardware frames to system memory or to another device.
  7406. This filter has several different modes of operation; which one is used depends
  7407. on the input and output formats:
  7408. @itemize
  7409. @item
  7410. Hardware frame input, normal frame output
  7411. Map the input frames to system memory and pass them to the output. If the
  7412. original hardware frame is later required (for example, after overlaying
  7413. something else on part of it), the @option{hwmap} filter can be used again
  7414. in the next mode to retrieve it.
  7415. @item
  7416. Normal frame input, hardware frame output
  7417. If the input is actually a software-mapped hardware frame, then unmap it -
  7418. that is, return the original hardware frame.
  7419. Otherwise, a device must be provided. Create new hardware surfaces on that
  7420. device for the output, then map them back to the software format at the input
  7421. and give those frames to the preceding filter. This will then act like the
  7422. @option{hwupload} filter, but may be able to avoid an additional copy when
  7423. the input is already in a compatible format.
  7424. @item
  7425. Hardware frame input and output
  7426. A device must be supplied for the output, either directly or with the
  7427. @option{derive_device} option. The input and output devices must be of
  7428. different types and compatible - the exact meaning of this is
  7429. system-dependent, but typically it means that they must refer to the same
  7430. underlying hardware context (for example, refer to the same graphics card).
  7431. If the input frames were originally created on the output device, then unmap
  7432. to retrieve the original frames.
  7433. Otherwise, map the frames to the output device - create new hardware frames
  7434. on the output corresponding to the frames on the input.
  7435. @end itemize
  7436. The following additional parameters are accepted:
  7437. @table @option
  7438. @item mode
  7439. Set the frame mapping mode. Some combination of:
  7440. @table @var
  7441. @item read
  7442. The mapped frame should be readable.
  7443. @item write
  7444. The mapped frame should be writeable.
  7445. @item overwrite
  7446. The mapping will always overwrite the entire frame.
  7447. This may improve performance in some cases, as the original contents of the
  7448. frame need not be loaded.
  7449. @item direct
  7450. The mapping must not involve any copying.
  7451. Indirect mappings to copies of frames are created in some cases where either
  7452. direct mapping is not possible or it would have unexpected properties.
  7453. Setting this flag ensures that the mapping is direct and will fail if that is
  7454. not possible.
  7455. @end table
  7456. Defaults to @var{read+write} if not specified.
  7457. @item derive_device @var{type}
  7458. Rather than using the device supplied at initialisation, instead derive a new
  7459. device of type @var{type} from the device the input frames exist on.
  7460. @item reverse
  7461. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7462. and map them back to the source. This may be necessary in some cases where
  7463. a mapping in one direction is required but only the opposite direction is
  7464. supported by the devices being used.
  7465. This option is dangerous - it may break the preceding filter in undefined
  7466. ways if there are any additional constraints on that filter's output.
  7467. Do not use it without fully understanding the implications of its use.
  7468. @end table
  7469. @section hwupload
  7470. Upload system memory frames to hardware surfaces.
  7471. The device to upload to must be supplied when the filter is initialised. If
  7472. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7473. option.
  7474. @anchor{hwupload_cuda}
  7475. @section hwupload_cuda
  7476. Upload system memory frames to a CUDA device.
  7477. It accepts the following optional parameters:
  7478. @table @option
  7479. @item device
  7480. The number of the CUDA device to use
  7481. @end table
  7482. @section hqx
  7483. Apply a high-quality magnification filter designed for pixel art. This filter
  7484. was originally created by Maxim Stepin.
  7485. It accepts the following option:
  7486. @table @option
  7487. @item n
  7488. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7489. @code{hq3x} and @code{4} for @code{hq4x}.
  7490. Default is @code{3}.
  7491. @end table
  7492. @section hstack
  7493. Stack input videos horizontally.
  7494. All streams must be of same pixel format and of same height.
  7495. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7496. to create same output.
  7497. The filter accept the following option:
  7498. @table @option
  7499. @item inputs
  7500. Set number of input streams. Default is 2.
  7501. @item shortest
  7502. If set to 1, force the output to terminate when the shortest input
  7503. terminates. Default value is 0.
  7504. @end table
  7505. @section hue
  7506. Modify the hue and/or the saturation of the input.
  7507. It accepts the following parameters:
  7508. @table @option
  7509. @item h
  7510. Specify the hue angle as a number of degrees. It accepts an expression,
  7511. and defaults to "0".
  7512. @item s
  7513. Specify the saturation in the [-10,10] range. It accepts an expression and
  7514. defaults to "1".
  7515. @item H
  7516. Specify the hue angle as a number of radians. It accepts an
  7517. expression, and defaults to "0".
  7518. @item b
  7519. Specify the brightness in the [-10,10] range. It accepts an expression and
  7520. defaults to "0".
  7521. @end table
  7522. @option{h} and @option{H} are mutually exclusive, and can't be
  7523. specified at the same time.
  7524. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7525. expressions containing the following constants:
  7526. @table @option
  7527. @item n
  7528. frame count of the input frame starting from 0
  7529. @item pts
  7530. presentation timestamp of the input frame expressed in time base units
  7531. @item r
  7532. frame rate of the input video, NAN if the input frame rate is unknown
  7533. @item t
  7534. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7535. @item tb
  7536. time base of the input video
  7537. @end table
  7538. @subsection Examples
  7539. @itemize
  7540. @item
  7541. Set the hue to 90 degrees and the saturation to 1.0:
  7542. @example
  7543. hue=h=90:s=1
  7544. @end example
  7545. @item
  7546. Same command but expressing the hue in radians:
  7547. @example
  7548. hue=H=PI/2:s=1
  7549. @end example
  7550. @item
  7551. Rotate hue and make the saturation swing between 0
  7552. and 2 over a period of 1 second:
  7553. @example
  7554. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7555. @end example
  7556. @item
  7557. Apply a 3 seconds saturation fade-in effect starting at 0:
  7558. @example
  7559. hue="s=min(t/3\,1)"
  7560. @end example
  7561. The general fade-in expression can be written as:
  7562. @example
  7563. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7564. @end example
  7565. @item
  7566. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7567. @example
  7568. hue="s=max(0\, min(1\, (8-t)/3))"
  7569. @end example
  7570. The general fade-out expression can be written as:
  7571. @example
  7572. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7573. @end example
  7574. @end itemize
  7575. @subsection Commands
  7576. This filter supports the following commands:
  7577. @table @option
  7578. @item b
  7579. @item s
  7580. @item h
  7581. @item H
  7582. Modify the hue and/or the saturation and/or brightness of the input video.
  7583. The command accepts the same syntax of the corresponding option.
  7584. If the specified expression is not valid, it is kept at its current
  7585. value.
  7586. @end table
  7587. @section hysteresis
  7588. Grow first stream into second stream by connecting components.
  7589. This makes it possible to build more robust edge masks.
  7590. This filter accepts the following options:
  7591. @table @option
  7592. @item planes
  7593. Set which planes will be processed as bitmap, unprocessed planes will be
  7594. copied from first stream.
  7595. By default value 0xf, all planes will be processed.
  7596. @item threshold
  7597. Set threshold which is used in filtering. If pixel component value is higher than
  7598. this value filter algorithm for connecting components is activated.
  7599. By default value is 0.
  7600. @end table
  7601. @section idet
  7602. Detect video interlacing type.
  7603. This filter tries to detect if the input frames are interlaced, progressive,
  7604. top or bottom field first. It will also try to detect fields that are
  7605. repeated between adjacent frames (a sign of telecine).
  7606. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7607. Multiple frame detection incorporates the classification history of previous frames.
  7608. The filter will log these metadata values:
  7609. @table @option
  7610. @item single.current_frame
  7611. Detected type of current frame using single-frame detection. One of:
  7612. ``tff'' (top field first), ``bff'' (bottom field first),
  7613. ``progressive'', or ``undetermined''
  7614. @item single.tff
  7615. Cumulative number of frames detected as top field first using single-frame detection.
  7616. @item multiple.tff
  7617. Cumulative number of frames detected as top field first using multiple-frame detection.
  7618. @item single.bff
  7619. Cumulative number of frames detected as bottom field first using single-frame detection.
  7620. @item multiple.current_frame
  7621. Detected type of current frame using multiple-frame detection. One of:
  7622. ``tff'' (top field first), ``bff'' (bottom field first),
  7623. ``progressive'', or ``undetermined''
  7624. @item multiple.bff
  7625. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7626. @item single.progressive
  7627. Cumulative number of frames detected as progressive using single-frame detection.
  7628. @item multiple.progressive
  7629. Cumulative number of frames detected as progressive using multiple-frame detection.
  7630. @item single.undetermined
  7631. Cumulative number of frames that could not be classified using single-frame detection.
  7632. @item multiple.undetermined
  7633. Cumulative number of frames that could not be classified using multiple-frame detection.
  7634. @item repeated.current_frame
  7635. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7636. @item repeated.neither
  7637. Cumulative number of frames with no repeated field.
  7638. @item repeated.top
  7639. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7640. @item repeated.bottom
  7641. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7642. @end table
  7643. The filter accepts the following options:
  7644. @table @option
  7645. @item intl_thres
  7646. Set interlacing threshold.
  7647. @item prog_thres
  7648. Set progressive threshold.
  7649. @item rep_thres
  7650. Threshold for repeated field detection.
  7651. @item half_life
  7652. Number of frames after which a given frame's contribution to the
  7653. statistics is halved (i.e., it contributes only 0.5 to its
  7654. classification). The default of 0 means that all frames seen are given
  7655. full weight of 1.0 forever.
  7656. @item analyze_interlaced_flag
  7657. When this is not 0 then idet will use the specified number of frames to determine
  7658. if the interlaced flag is accurate, it will not count undetermined frames.
  7659. If the flag is found to be accurate it will be used without any further
  7660. computations, if it is found to be inaccurate it will be cleared without any
  7661. further computations. This allows inserting the idet filter as a low computational
  7662. method to clean up the interlaced flag
  7663. @end table
  7664. @section il
  7665. Deinterleave or interleave fields.
  7666. This filter allows one to process interlaced images fields without
  7667. deinterlacing them. Deinterleaving splits the input frame into 2
  7668. fields (so called half pictures). Odd lines are moved to the top
  7669. half of the output image, even lines to the bottom half.
  7670. You can process (filter) them independently and then re-interleave them.
  7671. The filter accepts the following options:
  7672. @table @option
  7673. @item luma_mode, l
  7674. @item chroma_mode, c
  7675. @item alpha_mode, a
  7676. Available values for @var{luma_mode}, @var{chroma_mode} and
  7677. @var{alpha_mode} are:
  7678. @table @samp
  7679. @item none
  7680. Do nothing.
  7681. @item deinterleave, d
  7682. Deinterleave fields, placing one above the other.
  7683. @item interleave, i
  7684. Interleave fields. Reverse the effect of deinterleaving.
  7685. @end table
  7686. Default value is @code{none}.
  7687. @item luma_swap, ls
  7688. @item chroma_swap, cs
  7689. @item alpha_swap, as
  7690. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7691. @end table
  7692. @section inflate
  7693. Apply inflate effect to the video.
  7694. This filter replaces the pixel by the local(3x3) average by taking into account
  7695. only values higher than the pixel.
  7696. It accepts the following options:
  7697. @table @option
  7698. @item threshold0
  7699. @item threshold1
  7700. @item threshold2
  7701. @item threshold3
  7702. Limit the maximum change for each plane, default is 65535.
  7703. If 0, plane will remain unchanged.
  7704. @end table
  7705. @section interlace
  7706. Simple interlacing filter from progressive contents. This interleaves upper (or
  7707. lower) lines from odd frames with lower (or upper) lines from even frames,
  7708. halving the frame rate and preserving image height.
  7709. @example
  7710. Original Original New Frame
  7711. Frame 'j' Frame 'j+1' (tff)
  7712. ========== =========== ==================
  7713. Line 0 --------------------> Frame 'j' Line 0
  7714. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7715. Line 2 ---------------------> Frame 'j' Line 2
  7716. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7717. ... ... ...
  7718. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7719. @end example
  7720. It accepts the following optional parameters:
  7721. @table @option
  7722. @item scan
  7723. This determines whether the interlaced frame is taken from the even
  7724. (tff - default) or odd (bff) lines of the progressive frame.
  7725. @item lowpass
  7726. Vertical lowpass filter to avoid twitter interlacing and
  7727. reduce moire patterns.
  7728. @table @samp
  7729. @item 0, off
  7730. Disable vertical lowpass filter
  7731. @item 1, linear
  7732. Enable linear filter (default)
  7733. @item 2, complex
  7734. Enable complex filter. This will slightly less reduce twitter and moire
  7735. but better retain detail and subjective sharpness impression.
  7736. @end table
  7737. @end table
  7738. @section kerndeint
  7739. Deinterlace input video by applying Donald Graft's adaptive kernel
  7740. deinterling. Work on interlaced parts of a video to produce
  7741. progressive frames.
  7742. The description of the accepted parameters follows.
  7743. @table @option
  7744. @item thresh
  7745. Set the threshold which affects the filter's tolerance when
  7746. determining if a pixel line must be processed. It must be an integer
  7747. in the range [0,255] and defaults to 10. A value of 0 will result in
  7748. applying the process on every pixels.
  7749. @item map
  7750. Paint pixels exceeding the threshold value to white if set to 1.
  7751. Default is 0.
  7752. @item order
  7753. Set the fields order. Swap fields if set to 1, leave fields alone if
  7754. 0. Default is 0.
  7755. @item sharp
  7756. Enable additional sharpening if set to 1. Default is 0.
  7757. @item twoway
  7758. Enable twoway sharpening if set to 1. Default is 0.
  7759. @end table
  7760. @subsection Examples
  7761. @itemize
  7762. @item
  7763. Apply default values:
  7764. @example
  7765. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7766. @end example
  7767. @item
  7768. Enable additional sharpening:
  7769. @example
  7770. kerndeint=sharp=1
  7771. @end example
  7772. @item
  7773. Paint processed pixels in white:
  7774. @example
  7775. kerndeint=map=1
  7776. @end example
  7777. @end itemize
  7778. @section lenscorrection
  7779. Correct radial lens distortion
  7780. This filter can be used to correct for radial distortion as can result from the use
  7781. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7782. one can use tools available for example as part of opencv or simply trial-and-error.
  7783. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7784. and extract the k1 and k2 coefficients from the resulting matrix.
  7785. Note that effectively the same filter is available in the open-source tools Krita and
  7786. Digikam from the KDE project.
  7787. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7788. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7789. brightness distribution, so you may want to use both filters together in certain
  7790. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7791. be applied before or after lens correction.
  7792. @subsection Options
  7793. The filter accepts the following options:
  7794. @table @option
  7795. @item cx
  7796. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7797. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7798. width.
  7799. @item cy
  7800. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7801. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7802. height.
  7803. @item k1
  7804. Coefficient of the quadratic correction term. 0.5 means no correction.
  7805. @item k2
  7806. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7807. @end table
  7808. The formula that generates the correction is:
  7809. @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)
  7810. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7811. distances from the focal point in the source and target images, respectively.
  7812. @section libvmaf
  7813. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7814. score between two input videos.
  7815. The obtained VMAF score is printed through the logging system.
  7816. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7817. After installing the library it can be enabled using:
  7818. @code{./configure --enable-libvmaf}.
  7819. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7820. The filter has following options:
  7821. @table @option
  7822. @item model_path
  7823. Set the model path which is to be used for SVM.
  7824. Default value: @code{"vmaf_v0.6.1.pkl"}
  7825. @item log_path
  7826. Set the file path to be used to store logs.
  7827. @item log_fmt
  7828. Set the format of the log file (xml or json).
  7829. @item enable_transform
  7830. Enables transform for computing vmaf.
  7831. @item phone_model
  7832. Invokes the phone model which will generate VMAF scores higher than in the
  7833. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7834. @item psnr
  7835. Enables computing psnr along with vmaf.
  7836. @item ssim
  7837. Enables computing ssim along with vmaf.
  7838. @item ms_ssim
  7839. Enables computing ms_ssim along with vmaf.
  7840. @item pool
  7841. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7842. @end table
  7843. This filter also supports the @ref{framesync} options.
  7844. On the below examples the input file @file{main.mpg} being processed is
  7845. compared with the reference file @file{ref.mpg}.
  7846. @example
  7847. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7848. @end example
  7849. Example with options:
  7850. @example
  7851. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7852. @end example
  7853. @section limiter
  7854. Limits the pixel components values to the specified range [min, max].
  7855. The filter accepts the following options:
  7856. @table @option
  7857. @item min
  7858. Lower bound. Defaults to the lowest allowed value for the input.
  7859. @item max
  7860. Upper bound. Defaults to the highest allowed value for the input.
  7861. @item planes
  7862. Specify which planes will be processed. Defaults to all available.
  7863. @end table
  7864. @section loop
  7865. Loop video frames.
  7866. The filter accepts the following options:
  7867. @table @option
  7868. @item loop
  7869. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7870. Default is 0.
  7871. @item size
  7872. Set maximal size in number of frames. Default is 0.
  7873. @item start
  7874. Set first frame of loop. Default is 0.
  7875. @end table
  7876. @anchor{lut3d}
  7877. @section lut3d
  7878. Apply a 3D LUT to an input video.
  7879. The filter accepts the following options:
  7880. @table @option
  7881. @item file
  7882. Set the 3D LUT file name.
  7883. Currently supported formats:
  7884. @table @samp
  7885. @item 3dl
  7886. AfterEffects
  7887. @item cube
  7888. Iridas
  7889. @item dat
  7890. DaVinci
  7891. @item m3d
  7892. Pandora
  7893. @end table
  7894. @item interp
  7895. Select interpolation mode.
  7896. Available values are:
  7897. @table @samp
  7898. @item nearest
  7899. Use values from the nearest defined point.
  7900. @item trilinear
  7901. Interpolate values using the 8 points defining a cube.
  7902. @item tetrahedral
  7903. Interpolate values using a tetrahedron.
  7904. @end table
  7905. @end table
  7906. This filter also supports the @ref{framesync} options.
  7907. @section lumakey
  7908. Turn certain luma values into transparency.
  7909. The filter accepts the following options:
  7910. @table @option
  7911. @item threshold
  7912. Set the luma which will be used as base for transparency.
  7913. Default value is @code{0}.
  7914. @item tolerance
  7915. Set the range of luma values to be keyed out.
  7916. Default value is @code{0}.
  7917. @item softness
  7918. Set the range of softness. Default value is @code{0}.
  7919. Use this to control gradual transition from zero to full transparency.
  7920. @end table
  7921. @section lut, lutrgb, lutyuv
  7922. Compute a look-up table for binding each pixel component input value
  7923. to an output value, and apply it to the input video.
  7924. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7925. to an RGB input video.
  7926. These filters accept the following parameters:
  7927. @table @option
  7928. @item c0
  7929. set first pixel component expression
  7930. @item c1
  7931. set second pixel component expression
  7932. @item c2
  7933. set third pixel component expression
  7934. @item c3
  7935. set fourth pixel component expression, corresponds to the alpha component
  7936. @item r
  7937. set red component expression
  7938. @item g
  7939. set green component expression
  7940. @item b
  7941. set blue component expression
  7942. @item a
  7943. alpha component expression
  7944. @item y
  7945. set Y/luminance component expression
  7946. @item u
  7947. set U/Cb component expression
  7948. @item v
  7949. set V/Cr component expression
  7950. @end table
  7951. Each of them specifies the expression to use for computing the lookup table for
  7952. the corresponding pixel component values.
  7953. The exact component associated to each of the @var{c*} options depends on the
  7954. format in input.
  7955. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7956. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7957. The expressions can contain the following constants and functions:
  7958. @table @option
  7959. @item w
  7960. @item h
  7961. The input width and height.
  7962. @item val
  7963. The input value for the pixel component.
  7964. @item clipval
  7965. The input value, clipped to the @var{minval}-@var{maxval} range.
  7966. @item maxval
  7967. The maximum value for the pixel component.
  7968. @item minval
  7969. The minimum value for the pixel component.
  7970. @item negval
  7971. The negated value for the pixel component value, clipped to the
  7972. @var{minval}-@var{maxval} range; it corresponds to the expression
  7973. "maxval-clipval+minval".
  7974. @item clip(val)
  7975. The computed value in @var{val}, clipped to the
  7976. @var{minval}-@var{maxval} range.
  7977. @item gammaval(gamma)
  7978. The computed gamma correction value of the pixel component value,
  7979. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7980. expression
  7981. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7982. @end table
  7983. All expressions default to "val".
  7984. @subsection Examples
  7985. @itemize
  7986. @item
  7987. Negate input video:
  7988. @example
  7989. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7990. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7991. @end example
  7992. The above is the same as:
  7993. @example
  7994. lutrgb="r=negval:g=negval:b=negval"
  7995. lutyuv="y=negval:u=negval:v=negval"
  7996. @end example
  7997. @item
  7998. Negate luminance:
  7999. @example
  8000. lutyuv=y=negval
  8001. @end example
  8002. @item
  8003. Remove chroma components, turning the video into a graytone image:
  8004. @example
  8005. lutyuv="u=128:v=128"
  8006. @end example
  8007. @item
  8008. Apply a luma burning effect:
  8009. @example
  8010. lutyuv="y=2*val"
  8011. @end example
  8012. @item
  8013. Remove green and blue components:
  8014. @example
  8015. lutrgb="g=0:b=0"
  8016. @end example
  8017. @item
  8018. Set a constant alpha channel value on input:
  8019. @example
  8020. format=rgba,lutrgb=a="maxval-minval/2"
  8021. @end example
  8022. @item
  8023. Correct luminance gamma by a factor of 0.5:
  8024. @example
  8025. lutyuv=y=gammaval(0.5)
  8026. @end example
  8027. @item
  8028. Discard least significant bits of luma:
  8029. @example
  8030. lutyuv=y='bitand(val, 128+64+32)'
  8031. @end example
  8032. @item
  8033. Technicolor like effect:
  8034. @example
  8035. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8036. @end example
  8037. @end itemize
  8038. @section lut2, tlut2
  8039. The @code{lut2} filter takes two input streams and outputs one
  8040. stream.
  8041. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8042. from one single stream.
  8043. This filter accepts the following parameters:
  8044. @table @option
  8045. @item c0
  8046. set first pixel component expression
  8047. @item c1
  8048. set second pixel component expression
  8049. @item c2
  8050. set third pixel component expression
  8051. @item c3
  8052. set fourth pixel component expression, corresponds to the alpha component
  8053. @end table
  8054. Each of them specifies the expression to use for computing the lookup table for
  8055. the corresponding pixel component values.
  8056. The exact component associated to each of the @var{c*} options depends on the
  8057. format in inputs.
  8058. The expressions can contain the following constants:
  8059. @table @option
  8060. @item w
  8061. @item h
  8062. The input width and height.
  8063. @item x
  8064. The first input value for the pixel component.
  8065. @item y
  8066. The second input value for the pixel component.
  8067. @item bdx
  8068. The first input video bit depth.
  8069. @item bdy
  8070. The second input video bit depth.
  8071. @end table
  8072. All expressions default to "x".
  8073. @subsection Examples
  8074. @itemize
  8075. @item
  8076. Highlight differences between two RGB video streams:
  8077. @example
  8078. 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)'
  8079. @end example
  8080. @item
  8081. Highlight differences between two YUV video streams:
  8082. @example
  8083. 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)'
  8084. @end example
  8085. @item
  8086. Show max difference between two video streams:
  8087. @example
  8088. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  8089. @end example
  8090. @end itemize
  8091. @section maskedclamp
  8092. Clamp the first input stream with the second input and third input stream.
  8093. Returns the value of first stream to be between second input
  8094. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8095. This filter accepts the following options:
  8096. @table @option
  8097. @item undershoot
  8098. Default value is @code{0}.
  8099. @item overshoot
  8100. Default value is @code{0}.
  8101. @item planes
  8102. Set which planes will be processed as bitmap, unprocessed planes will be
  8103. copied from first stream.
  8104. By default value 0xf, all planes will be processed.
  8105. @end table
  8106. @section maskedmerge
  8107. Merge the first input stream with the second input stream using per pixel
  8108. weights in the third input stream.
  8109. A value of 0 in the third stream pixel component means that pixel component
  8110. from first stream is returned unchanged, while maximum value (eg. 255 for
  8111. 8-bit videos) means that pixel component from second stream is returned
  8112. unchanged. Intermediate values define the amount of merging between both
  8113. input stream's pixel components.
  8114. This filter accepts the following options:
  8115. @table @option
  8116. @item planes
  8117. Set which planes will be processed as bitmap, unprocessed planes will be
  8118. copied from first stream.
  8119. By default value 0xf, all planes will be processed.
  8120. @end table
  8121. @section mcdeint
  8122. Apply motion-compensation deinterlacing.
  8123. It needs one field per frame as input and must thus be used together
  8124. with yadif=1/3 or equivalent.
  8125. This filter accepts the following options:
  8126. @table @option
  8127. @item mode
  8128. Set the deinterlacing mode.
  8129. It accepts one of the following values:
  8130. @table @samp
  8131. @item fast
  8132. @item medium
  8133. @item slow
  8134. use iterative motion estimation
  8135. @item extra_slow
  8136. like @samp{slow}, but use multiple reference frames.
  8137. @end table
  8138. Default value is @samp{fast}.
  8139. @item parity
  8140. Set the picture field parity assumed for the input video. It must be
  8141. one of the following values:
  8142. @table @samp
  8143. @item 0, tff
  8144. assume top field first
  8145. @item 1, bff
  8146. assume bottom field first
  8147. @end table
  8148. Default value is @samp{bff}.
  8149. @item qp
  8150. Set per-block quantization parameter (QP) used by the internal
  8151. encoder.
  8152. Higher values should result in a smoother motion vector field but less
  8153. optimal individual vectors. Default value is 1.
  8154. @end table
  8155. @section mergeplanes
  8156. Merge color channel components from several video streams.
  8157. The filter accepts up to 4 input streams, and merge selected input
  8158. planes to the output video.
  8159. This filter accepts the following options:
  8160. @table @option
  8161. @item mapping
  8162. Set input to output plane mapping. Default is @code{0}.
  8163. The mappings is specified as a bitmap. It should be specified as a
  8164. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8165. mapping for the first plane of the output stream. 'A' sets the number of
  8166. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8167. corresponding input to use (from 0 to 3). The rest of the mappings is
  8168. similar, 'Bb' describes the mapping for the output stream second
  8169. plane, 'Cc' describes the mapping for the output stream third plane and
  8170. 'Dd' describes the mapping for the output stream fourth plane.
  8171. @item format
  8172. Set output pixel format. Default is @code{yuva444p}.
  8173. @end table
  8174. @subsection Examples
  8175. @itemize
  8176. @item
  8177. Merge three gray video streams of same width and height into single video stream:
  8178. @example
  8179. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8180. @end example
  8181. @item
  8182. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8183. @example
  8184. [a0][a1]mergeplanes=0x00010210:yuva444p
  8185. @end example
  8186. @item
  8187. Swap Y and A plane in yuva444p stream:
  8188. @example
  8189. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8190. @end example
  8191. @item
  8192. Swap U and V plane in yuv420p stream:
  8193. @example
  8194. format=yuv420p,mergeplanes=0x000201:yuv420p
  8195. @end example
  8196. @item
  8197. Cast a rgb24 clip to yuv444p:
  8198. @example
  8199. format=rgb24,mergeplanes=0x000102:yuv444p
  8200. @end example
  8201. @end itemize
  8202. @section mestimate
  8203. Estimate and export motion vectors using block matching algorithms.
  8204. Motion vectors are stored in frame side data to be used by other filters.
  8205. This filter accepts the following options:
  8206. @table @option
  8207. @item method
  8208. Specify the motion estimation method. Accepts one of the following values:
  8209. @table @samp
  8210. @item esa
  8211. Exhaustive search algorithm.
  8212. @item tss
  8213. Three step search algorithm.
  8214. @item tdls
  8215. Two dimensional logarithmic search algorithm.
  8216. @item ntss
  8217. New three step search algorithm.
  8218. @item fss
  8219. Four step search algorithm.
  8220. @item ds
  8221. Diamond search algorithm.
  8222. @item hexbs
  8223. Hexagon-based search algorithm.
  8224. @item epzs
  8225. Enhanced predictive zonal search algorithm.
  8226. @item umh
  8227. Uneven multi-hexagon search algorithm.
  8228. @end table
  8229. Default value is @samp{esa}.
  8230. @item mb_size
  8231. Macroblock size. Default @code{16}.
  8232. @item search_param
  8233. Search parameter. Default @code{7}.
  8234. @end table
  8235. @section midequalizer
  8236. Apply Midway Image Equalization effect using two video streams.
  8237. Midway Image Equalization adjusts a pair of images to have the same
  8238. histogram, while maintaining their dynamics as much as possible. It's
  8239. useful for e.g. matching exposures from a pair of stereo cameras.
  8240. This filter has two inputs and one output, which must be of same pixel format, but
  8241. may be of different sizes. The output of filter is first input adjusted with
  8242. midway histogram of both inputs.
  8243. This filter accepts the following option:
  8244. @table @option
  8245. @item planes
  8246. Set which planes to process. Default is @code{15}, which is all available planes.
  8247. @end table
  8248. @section minterpolate
  8249. Convert the video to specified frame rate using motion interpolation.
  8250. This filter accepts the following options:
  8251. @table @option
  8252. @item fps
  8253. 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}.
  8254. @item mi_mode
  8255. Motion interpolation mode. Following values are accepted:
  8256. @table @samp
  8257. @item dup
  8258. Duplicate previous or next frame for interpolating new ones.
  8259. @item blend
  8260. Blend source frames. Interpolated frame is mean of previous and next frames.
  8261. @item mci
  8262. Motion compensated interpolation. Following options are effective when this mode is selected:
  8263. @table @samp
  8264. @item mc_mode
  8265. Motion compensation mode. Following values are accepted:
  8266. @table @samp
  8267. @item obmc
  8268. Overlapped block motion compensation.
  8269. @item aobmc
  8270. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8271. @end table
  8272. Default mode is @samp{obmc}.
  8273. @item me_mode
  8274. Motion estimation mode. Following values are accepted:
  8275. @table @samp
  8276. @item bidir
  8277. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8278. @item bilat
  8279. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8280. @end table
  8281. Default mode is @samp{bilat}.
  8282. @item me
  8283. The algorithm to be used for motion estimation. Following values are accepted:
  8284. @table @samp
  8285. @item esa
  8286. Exhaustive search algorithm.
  8287. @item tss
  8288. Three step search algorithm.
  8289. @item tdls
  8290. Two dimensional logarithmic search algorithm.
  8291. @item ntss
  8292. New three step search algorithm.
  8293. @item fss
  8294. Four step search algorithm.
  8295. @item ds
  8296. Diamond search algorithm.
  8297. @item hexbs
  8298. Hexagon-based search algorithm.
  8299. @item epzs
  8300. Enhanced predictive zonal search algorithm.
  8301. @item umh
  8302. Uneven multi-hexagon search algorithm.
  8303. @end table
  8304. Default algorithm is @samp{epzs}.
  8305. @item mb_size
  8306. Macroblock size. Default @code{16}.
  8307. @item search_param
  8308. Motion estimation search parameter. Default @code{32}.
  8309. @item vsbmc
  8310. 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).
  8311. @end table
  8312. @end table
  8313. @item scd
  8314. 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:
  8315. @table @samp
  8316. @item none
  8317. Disable scene change detection.
  8318. @item fdiff
  8319. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8320. @end table
  8321. Default method is @samp{fdiff}.
  8322. @item scd_threshold
  8323. Scene change detection threshold. Default is @code{5.0}.
  8324. @end table
  8325. @section mix
  8326. Mix several video input streams into one video stream.
  8327. A description of the accepted options follows.
  8328. @table @option
  8329. @item nb_inputs
  8330. The number of inputs. If unspecified, it defaults to 2.
  8331. @item weights
  8332. Specify weight of each input video stream as sequence.
  8333. Each weight is separated by space.
  8334. @item duration
  8335. Specify how end of stream is determined.
  8336. @table @samp
  8337. @item longest
  8338. The duration of the longest input. (default)
  8339. @item shortest
  8340. The duration of the shortest input.
  8341. @item first
  8342. The duration of the first input.
  8343. @end table
  8344. @end table
  8345. @section mpdecimate
  8346. Drop frames that do not differ greatly from the previous frame in
  8347. order to reduce frame rate.
  8348. The main use of this filter is for very-low-bitrate encoding
  8349. (e.g. streaming over dialup modem), but it could in theory be used for
  8350. fixing movies that were inverse-telecined incorrectly.
  8351. A description of the accepted options follows.
  8352. @table @option
  8353. @item max
  8354. Set the maximum number of consecutive frames which can be dropped (if
  8355. positive), or the minimum interval between dropped frames (if
  8356. negative). If the value is 0, the frame is dropped disregarding the
  8357. number of previous sequentially dropped frames.
  8358. Default value is 0.
  8359. @item hi
  8360. @item lo
  8361. @item frac
  8362. Set the dropping threshold values.
  8363. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8364. represent actual pixel value differences, so a threshold of 64
  8365. corresponds to 1 unit of difference for each pixel, or the same spread
  8366. out differently over the block.
  8367. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8368. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8369. meaning the whole image) differ by more than a threshold of @option{lo}.
  8370. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8371. 64*5, and default value for @option{frac} is 0.33.
  8372. @end table
  8373. @section negate
  8374. Negate input video.
  8375. It accepts an integer in input; if non-zero it negates the
  8376. alpha component (if available). The default value in input is 0.
  8377. @section nlmeans
  8378. Denoise frames using Non-Local Means algorithm.
  8379. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8380. context similarity is defined by comparing their surrounding patches of size
  8381. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8382. around the pixel.
  8383. Note that the research area defines centers for patches, which means some
  8384. patches will be made of pixels outside that research area.
  8385. The filter accepts the following options.
  8386. @table @option
  8387. @item s
  8388. Set denoising strength.
  8389. @item p
  8390. Set patch size.
  8391. @item pc
  8392. Same as @option{p} but for chroma planes.
  8393. The default value is @var{0} and means automatic.
  8394. @item r
  8395. Set research size.
  8396. @item rc
  8397. Same as @option{r} but for chroma planes.
  8398. The default value is @var{0} and means automatic.
  8399. @end table
  8400. @section nnedi
  8401. Deinterlace video using neural network edge directed interpolation.
  8402. This filter accepts the following options:
  8403. @table @option
  8404. @item weights
  8405. Mandatory option, without binary file filter can not work.
  8406. Currently file can be found here:
  8407. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8408. @item deint
  8409. Set which frames to deinterlace, by default it is @code{all}.
  8410. Can be @code{all} or @code{interlaced}.
  8411. @item field
  8412. Set mode of operation.
  8413. Can be one of the following:
  8414. @table @samp
  8415. @item af
  8416. Use frame flags, both fields.
  8417. @item a
  8418. Use frame flags, single field.
  8419. @item t
  8420. Use top field only.
  8421. @item b
  8422. Use bottom field only.
  8423. @item tf
  8424. Use both fields, top first.
  8425. @item bf
  8426. Use both fields, bottom first.
  8427. @end table
  8428. @item planes
  8429. Set which planes to process, by default filter process all frames.
  8430. @item nsize
  8431. Set size of local neighborhood around each pixel, used by the predictor neural
  8432. network.
  8433. Can be one of the following:
  8434. @table @samp
  8435. @item s8x6
  8436. @item s16x6
  8437. @item s32x6
  8438. @item s48x6
  8439. @item s8x4
  8440. @item s16x4
  8441. @item s32x4
  8442. @end table
  8443. @item nns
  8444. Set the number of neurons in predictor neural network.
  8445. Can be one of the following:
  8446. @table @samp
  8447. @item n16
  8448. @item n32
  8449. @item n64
  8450. @item n128
  8451. @item n256
  8452. @end table
  8453. @item qual
  8454. Controls the number of different neural network predictions that are blended
  8455. together to compute the final output value. Can be @code{fast}, default or
  8456. @code{slow}.
  8457. @item etype
  8458. Set which set of weights to use in the predictor.
  8459. Can be one of the following:
  8460. @table @samp
  8461. @item a
  8462. weights trained to minimize absolute error
  8463. @item s
  8464. weights trained to minimize squared error
  8465. @end table
  8466. @item pscrn
  8467. Controls whether or not the prescreener neural network is used to decide
  8468. which pixels should be processed by the predictor neural network and which
  8469. can be handled by simple cubic interpolation.
  8470. The prescreener is trained to know whether cubic interpolation will be
  8471. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8472. The computational complexity of the prescreener nn is much less than that of
  8473. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8474. using the prescreener generally results in much faster processing.
  8475. The prescreener is pretty accurate, so the difference between using it and not
  8476. using it is almost always unnoticeable.
  8477. Can be one of the following:
  8478. @table @samp
  8479. @item none
  8480. @item original
  8481. @item new
  8482. @end table
  8483. Default is @code{new}.
  8484. @item fapprox
  8485. Set various debugging flags.
  8486. @end table
  8487. @section noformat
  8488. Force libavfilter not to use any of the specified pixel formats for the
  8489. input to the next filter.
  8490. It accepts the following parameters:
  8491. @table @option
  8492. @item pix_fmts
  8493. A '|'-separated list of pixel format names, such as
  8494. pix_fmts=yuv420p|monow|rgb24".
  8495. @end table
  8496. @subsection Examples
  8497. @itemize
  8498. @item
  8499. Force libavfilter to use a format different from @var{yuv420p} for the
  8500. input to the vflip filter:
  8501. @example
  8502. noformat=pix_fmts=yuv420p,vflip
  8503. @end example
  8504. @item
  8505. Convert the input video to any of the formats not contained in the list:
  8506. @example
  8507. noformat=yuv420p|yuv444p|yuv410p
  8508. @end example
  8509. @end itemize
  8510. @section noise
  8511. Add noise on video input frame.
  8512. The filter accepts the following options:
  8513. @table @option
  8514. @item all_seed
  8515. @item c0_seed
  8516. @item c1_seed
  8517. @item c2_seed
  8518. @item c3_seed
  8519. Set noise seed for specific pixel component or all pixel components in case
  8520. of @var{all_seed}. Default value is @code{123457}.
  8521. @item all_strength, alls
  8522. @item c0_strength, c0s
  8523. @item c1_strength, c1s
  8524. @item c2_strength, c2s
  8525. @item c3_strength, c3s
  8526. Set noise strength for specific pixel component or all pixel components in case
  8527. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8528. @item all_flags, allf
  8529. @item c0_flags, c0f
  8530. @item c1_flags, c1f
  8531. @item c2_flags, c2f
  8532. @item c3_flags, c3f
  8533. Set pixel component flags or set flags for all components if @var{all_flags}.
  8534. Available values for component flags are:
  8535. @table @samp
  8536. @item a
  8537. averaged temporal noise (smoother)
  8538. @item p
  8539. mix random noise with a (semi)regular pattern
  8540. @item t
  8541. temporal noise (noise pattern changes between frames)
  8542. @item u
  8543. uniform noise (gaussian otherwise)
  8544. @end table
  8545. @end table
  8546. @subsection Examples
  8547. Add temporal and uniform noise to input video:
  8548. @example
  8549. noise=alls=20:allf=t+u
  8550. @end example
  8551. @section normalize
  8552. Normalize RGB video (aka histogram stretching, contrast stretching).
  8553. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8554. For each channel of each frame, the filter computes the input range and maps
  8555. it linearly to the user-specified output range. The output range defaults
  8556. to the full dynamic range from pure black to pure white.
  8557. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8558. changes in brightness) caused when small dark or bright objects enter or leave
  8559. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8560. video camera, and, like a video camera, it may cause a period of over- or
  8561. under-exposure of the video.
  8562. The R,G,B channels can be normalized independently, which may cause some
  8563. color shifting, or linked together as a single channel, which prevents
  8564. color shifting. Linked normalization preserves hue. Independent normalization
  8565. does not, so it can be used to remove some color casts. Independent and linked
  8566. normalization can be combined in any ratio.
  8567. The normalize filter accepts the following options:
  8568. @table @option
  8569. @item blackpt
  8570. @item whitept
  8571. Colors which define the output range. The minimum input value is mapped to
  8572. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8573. The defaults are black and white respectively. Specifying white for
  8574. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8575. normalized video. Shades of grey can be used to reduce the dynamic range
  8576. (contrast). Specifying saturated colors here can create some interesting
  8577. effects.
  8578. @item smoothing
  8579. The number of previous frames to use for temporal smoothing. The input range
  8580. of each channel is smoothed using a rolling average over the current frame
  8581. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8582. smoothing).
  8583. @item independence
  8584. Controls the ratio of independent (color shifting) channel normalization to
  8585. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8586. independent. Defaults to 1.0 (fully independent).
  8587. @item strength
  8588. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8589. expensive no-op. Defaults to 1.0 (full strength).
  8590. @end table
  8591. @subsection Examples
  8592. Stretch video contrast to use the full dynamic range, with no temporal
  8593. smoothing; may flicker depending on the source content:
  8594. @example
  8595. normalize=blackpt=black:whitept=white:smoothing=0
  8596. @end example
  8597. As above, but with 50 frames of temporal smoothing; flicker should be
  8598. reduced, depending on the source content:
  8599. @example
  8600. normalize=blackpt=black:whitept=white:smoothing=50
  8601. @end example
  8602. As above, but with hue-preserving linked channel normalization:
  8603. @example
  8604. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8605. @end example
  8606. As above, but with half strength:
  8607. @example
  8608. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8609. @end example
  8610. Map the darkest input color to red, the brightest input color to cyan:
  8611. @example
  8612. normalize=blackpt=red:whitept=cyan
  8613. @end example
  8614. @section null
  8615. Pass the video source unchanged to the output.
  8616. @section ocr
  8617. Optical Character Recognition
  8618. This filter uses Tesseract for optical character recognition.
  8619. It accepts the following options:
  8620. @table @option
  8621. @item datapath
  8622. Set datapath to tesseract data. Default is to use whatever was
  8623. set at installation.
  8624. @item language
  8625. Set language, default is "eng".
  8626. @item whitelist
  8627. Set character whitelist.
  8628. @item blacklist
  8629. Set character blacklist.
  8630. @end table
  8631. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8632. @section ocv
  8633. Apply a video transform using libopencv.
  8634. To enable this filter, install the libopencv library and headers and
  8635. configure FFmpeg with @code{--enable-libopencv}.
  8636. It accepts the following parameters:
  8637. @table @option
  8638. @item filter_name
  8639. The name of the libopencv filter to apply.
  8640. @item filter_params
  8641. The parameters to pass to the libopencv filter. If not specified, the default
  8642. values are assumed.
  8643. @end table
  8644. Refer to the official libopencv documentation for more precise
  8645. information:
  8646. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8647. Several libopencv filters are supported; see the following subsections.
  8648. @anchor{dilate}
  8649. @subsection dilate
  8650. Dilate an image by using a specific structuring element.
  8651. It corresponds to the libopencv function @code{cvDilate}.
  8652. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8653. @var{struct_el} represents a structuring element, and has the syntax:
  8654. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8655. @var{cols} and @var{rows} represent the number of columns and rows of
  8656. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8657. point, and @var{shape} the shape for the structuring element. @var{shape}
  8658. must be "rect", "cross", "ellipse", or "custom".
  8659. If the value for @var{shape} is "custom", it must be followed by a
  8660. string of the form "=@var{filename}". The file with name
  8661. @var{filename} is assumed to represent a binary image, with each
  8662. printable character corresponding to a bright pixel. When a custom
  8663. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8664. or columns and rows of the read file are assumed instead.
  8665. The default value for @var{struct_el} is "3x3+0x0/rect".
  8666. @var{nb_iterations} specifies the number of times the transform is
  8667. applied to the image, and defaults to 1.
  8668. Some examples:
  8669. @example
  8670. # Use the default values
  8671. ocv=dilate
  8672. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8673. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8674. # Read the shape from the file diamond.shape, iterating two times.
  8675. # The file diamond.shape may contain a pattern of characters like this
  8676. # *
  8677. # ***
  8678. # *****
  8679. # ***
  8680. # *
  8681. # The specified columns and rows are ignored
  8682. # but the anchor point coordinates are not
  8683. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8684. @end example
  8685. @subsection erode
  8686. Erode an image by using a specific structuring element.
  8687. It corresponds to the libopencv function @code{cvErode}.
  8688. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8689. with the same syntax and semantics as the @ref{dilate} filter.
  8690. @subsection smooth
  8691. Smooth the input video.
  8692. The filter takes the following parameters:
  8693. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8694. @var{type} is the type of smooth filter to apply, and must be one of
  8695. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8696. or "bilateral". The default value is "gaussian".
  8697. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8698. depend on the smooth type. @var{param1} and
  8699. @var{param2} accept integer positive values or 0. @var{param3} and
  8700. @var{param4} accept floating point values.
  8701. The default value for @var{param1} is 3. The default value for the
  8702. other parameters is 0.
  8703. These parameters correspond to the parameters assigned to the
  8704. libopencv function @code{cvSmooth}.
  8705. @section oscilloscope
  8706. 2D Video Oscilloscope.
  8707. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8708. It accepts the following parameters:
  8709. @table @option
  8710. @item x
  8711. Set scope center x position.
  8712. @item y
  8713. Set scope center y position.
  8714. @item s
  8715. Set scope size, relative to frame diagonal.
  8716. @item t
  8717. Set scope tilt/rotation.
  8718. @item o
  8719. Set trace opacity.
  8720. @item tx
  8721. Set trace center x position.
  8722. @item ty
  8723. Set trace center y position.
  8724. @item tw
  8725. Set trace width, relative to width of frame.
  8726. @item th
  8727. Set trace height, relative to height of frame.
  8728. @item c
  8729. Set which components to trace. By default it traces first three components.
  8730. @item g
  8731. Draw trace grid. By default is enabled.
  8732. @item st
  8733. Draw some statistics. By default is enabled.
  8734. @item sc
  8735. Draw scope. By default is enabled.
  8736. @end table
  8737. @subsection Examples
  8738. @itemize
  8739. @item
  8740. Inspect full first row of video frame.
  8741. @example
  8742. oscilloscope=x=0.5:y=0:s=1
  8743. @end example
  8744. @item
  8745. Inspect full last row of video frame.
  8746. @example
  8747. oscilloscope=x=0.5:y=1:s=1
  8748. @end example
  8749. @item
  8750. Inspect full 5th line of video frame of height 1080.
  8751. @example
  8752. oscilloscope=x=0.5:y=5/1080:s=1
  8753. @end example
  8754. @item
  8755. Inspect full last column of video frame.
  8756. @example
  8757. oscilloscope=x=1:y=0.5:s=1:t=1
  8758. @end example
  8759. @end itemize
  8760. @anchor{overlay}
  8761. @section overlay
  8762. Overlay one video on top of another.
  8763. It takes two inputs and has one output. The first input is the "main"
  8764. video on which the second input is overlaid.
  8765. It accepts the following parameters:
  8766. A description of the accepted options follows.
  8767. @table @option
  8768. @item x
  8769. @item y
  8770. Set the expression for the x and y coordinates of the overlaid video
  8771. on the main video. Default value is "0" for both expressions. In case
  8772. the expression is invalid, it is set to a huge value (meaning that the
  8773. overlay will not be displayed within the output visible area).
  8774. @item eof_action
  8775. See @ref{framesync}.
  8776. @item eval
  8777. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8778. It accepts the following values:
  8779. @table @samp
  8780. @item init
  8781. only evaluate expressions once during the filter initialization or
  8782. when a command is processed
  8783. @item frame
  8784. evaluate expressions for each incoming frame
  8785. @end table
  8786. Default value is @samp{frame}.
  8787. @item shortest
  8788. See @ref{framesync}.
  8789. @item format
  8790. Set the format for the output video.
  8791. It accepts the following values:
  8792. @table @samp
  8793. @item yuv420
  8794. force YUV420 output
  8795. @item yuv422
  8796. force YUV422 output
  8797. @item yuv444
  8798. force YUV444 output
  8799. @item rgb
  8800. force packed RGB output
  8801. @item gbrp
  8802. force planar RGB output
  8803. @item auto
  8804. automatically pick format
  8805. @end table
  8806. Default value is @samp{yuv420}.
  8807. @item repeatlast
  8808. See @ref{framesync}.
  8809. @item alpha
  8810. Set format of alpha of the overlaid video, it can be @var{straight} or
  8811. @var{premultiplied}. Default is @var{straight}.
  8812. @end table
  8813. The @option{x}, and @option{y} expressions can contain the following
  8814. parameters.
  8815. @table @option
  8816. @item main_w, W
  8817. @item main_h, H
  8818. The main input width and height.
  8819. @item overlay_w, w
  8820. @item overlay_h, h
  8821. The overlay input width and height.
  8822. @item x
  8823. @item y
  8824. The computed values for @var{x} and @var{y}. They are evaluated for
  8825. each new frame.
  8826. @item hsub
  8827. @item vsub
  8828. horizontal and vertical chroma subsample values of the output
  8829. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8830. @var{vsub} is 1.
  8831. @item n
  8832. the number of input frame, starting from 0
  8833. @item pos
  8834. the position in the file of the input frame, NAN if unknown
  8835. @item t
  8836. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8837. @end table
  8838. This filter also supports the @ref{framesync} options.
  8839. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8840. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8841. when @option{eval} is set to @samp{init}.
  8842. Be aware that frames are taken from each input video in timestamp
  8843. order, hence, if their initial timestamps differ, it is a good idea
  8844. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8845. have them begin in the same zero timestamp, as the example for
  8846. the @var{movie} filter does.
  8847. You can chain together more overlays but you should test the
  8848. efficiency of such approach.
  8849. @subsection Commands
  8850. This filter supports the following commands:
  8851. @table @option
  8852. @item x
  8853. @item y
  8854. Modify the x and y of the overlay input.
  8855. The command accepts the same syntax of the corresponding option.
  8856. If the specified expression is not valid, it is kept at its current
  8857. value.
  8858. @end table
  8859. @subsection Examples
  8860. @itemize
  8861. @item
  8862. Draw the overlay at 10 pixels from the bottom right corner of the main
  8863. video:
  8864. @example
  8865. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8866. @end example
  8867. Using named options the example above becomes:
  8868. @example
  8869. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8870. @end example
  8871. @item
  8872. Insert a transparent PNG logo in the bottom left corner of the input,
  8873. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8874. @example
  8875. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8876. @end example
  8877. @item
  8878. Insert 2 different transparent PNG logos (second logo on bottom
  8879. right corner) using the @command{ffmpeg} tool:
  8880. @example
  8881. 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
  8882. @end example
  8883. @item
  8884. Add a transparent color layer on top of the main video; @code{WxH}
  8885. must specify the size of the main input to the overlay filter:
  8886. @example
  8887. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8888. @end example
  8889. @item
  8890. Play an original video and a filtered version (here with the deshake
  8891. filter) side by side using the @command{ffplay} tool:
  8892. @example
  8893. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8894. @end example
  8895. The above command is the same as:
  8896. @example
  8897. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8898. @end example
  8899. @item
  8900. Make a sliding overlay appearing from the left to the right top part of the
  8901. screen starting since time 2:
  8902. @example
  8903. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8904. @end example
  8905. @item
  8906. Compose output by putting two input videos side to side:
  8907. @example
  8908. ffmpeg -i left.avi -i right.avi -filter_complex "
  8909. nullsrc=size=200x100 [background];
  8910. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8911. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8912. [background][left] overlay=shortest=1 [background+left];
  8913. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8914. "
  8915. @end example
  8916. @item
  8917. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8918. @example
  8919. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8920. -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]'
  8921. masked.avi
  8922. @end example
  8923. @item
  8924. Chain several overlays in cascade:
  8925. @example
  8926. nullsrc=s=200x200 [bg];
  8927. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8928. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8929. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8930. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8931. [in3] null, [mid2] overlay=100:100 [out0]
  8932. @end example
  8933. @end itemize
  8934. @section owdenoise
  8935. Apply Overcomplete Wavelet denoiser.
  8936. The filter accepts the following options:
  8937. @table @option
  8938. @item depth
  8939. Set depth.
  8940. Larger depth values will denoise lower frequency components more, but
  8941. slow down filtering.
  8942. Must be an int in the range 8-16, default is @code{8}.
  8943. @item luma_strength, ls
  8944. Set luma strength.
  8945. Must be a double value in the range 0-1000, default is @code{1.0}.
  8946. @item chroma_strength, cs
  8947. Set chroma strength.
  8948. Must be a double value in the range 0-1000, default is @code{1.0}.
  8949. @end table
  8950. @anchor{pad}
  8951. @section pad
  8952. Add paddings to the input image, and place the original input at the
  8953. provided @var{x}, @var{y} coordinates.
  8954. It accepts the following parameters:
  8955. @table @option
  8956. @item width, w
  8957. @item height, h
  8958. Specify an expression for the size of the output image with the
  8959. paddings added. If the value for @var{width} or @var{height} is 0, the
  8960. corresponding input size is used for the output.
  8961. The @var{width} expression can reference the value set by the
  8962. @var{height} expression, and vice versa.
  8963. The default value of @var{width} and @var{height} is 0.
  8964. @item x
  8965. @item y
  8966. Specify the offsets to place the input image at within the padded area,
  8967. with respect to the top/left border of the output image.
  8968. The @var{x} expression can reference the value set by the @var{y}
  8969. expression, and vice versa.
  8970. The default value of @var{x} and @var{y} is 0.
  8971. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8972. so the input image is centered on the padded area.
  8973. @item color
  8974. Specify the color of the padded area. For the syntax of this option,
  8975. check the "Color" section in the ffmpeg-utils manual.
  8976. The default value of @var{color} is "black".
  8977. @item eval
  8978. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8979. It accepts the following values:
  8980. @table @samp
  8981. @item init
  8982. Only evaluate expressions once during the filter initialization or when
  8983. a command is processed.
  8984. @item frame
  8985. Evaluate expressions for each incoming frame.
  8986. @end table
  8987. Default value is @samp{init}.
  8988. @item aspect
  8989. Pad to aspect instead to a resolution.
  8990. @end table
  8991. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8992. options are expressions containing the following constants:
  8993. @table @option
  8994. @item in_w
  8995. @item in_h
  8996. The input video width and height.
  8997. @item iw
  8998. @item ih
  8999. These are the same as @var{in_w} and @var{in_h}.
  9000. @item out_w
  9001. @item out_h
  9002. The output width and height (the size of the padded area), as
  9003. specified by the @var{width} and @var{height} expressions.
  9004. @item ow
  9005. @item oh
  9006. These are the same as @var{out_w} and @var{out_h}.
  9007. @item x
  9008. @item y
  9009. The x and y offsets as specified by the @var{x} and @var{y}
  9010. expressions, or NAN if not yet specified.
  9011. @item a
  9012. same as @var{iw} / @var{ih}
  9013. @item sar
  9014. input sample aspect ratio
  9015. @item dar
  9016. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9017. @item hsub
  9018. @item vsub
  9019. The horizontal and vertical chroma subsample values. For example for the
  9020. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9021. @end table
  9022. @subsection Examples
  9023. @itemize
  9024. @item
  9025. Add paddings with the color "violet" to the input video. The output video
  9026. size is 640x480, and the top-left corner of the input video is placed at
  9027. column 0, row 40
  9028. @example
  9029. pad=640:480:0:40:violet
  9030. @end example
  9031. The example above is equivalent to the following command:
  9032. @example
  9033. pad=width=640:height=480:x=0:y=40:color=violet
  9034. @end example
  9035. @item
  9036. Pad the input to get an output with dimensions increased by 3/2,
  9037. and put the input video at the center of the padded area:
  9038. @example
  9039. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9040. @end example
  9041. @item
  9042. Pad the input to get a squared output with size equal to the maximum
  9043. value between the input width and height, and put the input video at
  9044. the center of the padded area:
  9045. @example
  9046. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9047. @end example
  9048. @item
  9049. Pad the input to get a final w/h ratio of 16:9:
  9050. @example
  9051. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9052. @end example
  9053. @item
  9054. In case of anamorphic video, in order to set the output display aspect
  9055. correctly, it is necessary to use @var{sar} in the expression,
  9056. according to the relation:
  9057. @example
  9058. (ih * X / ih) * sar = output_dar
  9059. X = output_dar / sar
  9060. @end example
  9061. Thus the previous example needs to be modified to:
  9062. @example
  9063. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9064. @end example
  9065. @item
  9066. Double the output size and put the input video in the bottom-right
  9067. corner of the output padded area:
  9068. @example
  9069. pad="2*iw:2*ih:ow-iw:oh-ih"
  9070. @end example
  9071. @end itemize
  9072. @anchor{palettegen}
  9073. @section palettegen
  9074. Generate one palette for a whole video stream.
  9075. It accepts the following options:
  9076. @table @option
  9077. @item max_colors
  9078. Set the maximum number of colors to quantize in the palette.
  9079. Note: the palette will still contain 256 colors; the unused palette entries
  9080. will be black.
  9081. @item reserve_transparent
  9082. Create a palette of 255 colors maximum and reserve the last one for
  9083. transparency. Reserving the transparency color is useful for GIF optimization.
  9084. If not set, the maximum of colors in the palette will be 256. You probably want
  9085. to disable this option for a standalone image.
  9086. Set by default.
  9087. @item transparency_color
  9088. Set the color that will be used as background for transparency.
  9089. @item stats_mode
  9090. Set statistics mode.
  9091. It accepts the following values:
  9092. @table @samp
  9093. @item full
  9094. Compute full frame histograms.
  9095. @item diff
  9096. Compute histograms only for the part that differs from previous frame. This
  9097. might be relevant to give more importance to the moving part of your input if
  9098. the background is static.
  9099. @item single
  9100. Compute new histogram for each frame.
  9101. @end table
  9102. Default value is @var{full}.
  9103. @end table
  9104. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9105. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9106. color quantization of the palette. This information is also visible at
  9107. @var{info} logging level.
  9108. @subsection Examples
  9109. @itemize
  9110. @item
  9111. Generate a representative palette of a given video using @command{ffmpeg}:
  9112. @example
  9113. ffmpeg -i input.mkv -vf palettegen palette.png
  9114. @end example
  9115. @end itemize
  9116. @section paletteuse
  9117. Use a palette to downsample an input video stream.
  9118. The filter takes two inputs: one video stream and a palette. The palette must
  9119. be a 256 pixels image.
  9120. It accepts the following options:
  9121. @table @option
  9122. @item dither
  9123. Select dithering mode. Available algorithms are:
  9124. @table @samp
  9125. @item bayer
  9126. Ordered 8x8 bayer dithering (deterministic)
  9127. @item heckbert
  9128. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9129. Note: this dithering is sometimes considered "wrong" and is included as a
  9130. reference.
  9131. @item floyd_steinberg
  9132. Floyd and Steingberg dithering (error diffusion)
  9133. @item sierra2
  9134. Frankie Sierra dithering v2 (error diffusion)
  9135. @item sierra2_4a
  9136. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9137. @end table
  9138. Default is @var{sierra2_4a}.
  9139. @item bayer_scale
  9140. When @var{bayer} dithering is selected, this option defines the scale of the
  9141. pattern (how much the crosshatch pattern is visible). A low value means more
  9142. visible pattern for less banding, and higher value means less visible pattern
  9143. at the cost of more banding.
  9144. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9145. @item diff_mode
  9146. If set, define the zone to process
  9147. @table @samp
  9148. @item rectangle
  9149. Only the changing rectangle will be reprocessed. This is similar to GIF
  9150. cropping/offsetting compression mechanism. This option can be useful for speed
  9151. if only a part of the image is changing, and has use cases such as limiting the
  9152. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9153. moving scene (it leads to more deterministic output if the scene doesn't change
  9154. much, and as a result less moving noise and better GIF compression).
  9155. @end table
  9156. Default is @var{none}.
  9157. @item new
  9158. Take new palette for each output frame.
  9159. @item alpha_threshold
  9160. Sets the alpha threshold for transparency. Alpha values above this threshold
  9161. will be treated as completely opaque, and values below this threshold will be
  9162. treated as completely transparent.
  9163. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9164. @end table
  9165. @subsection Examples
  9166. @itemize
  9167. @item
  9168. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9169. using @command{ffmpeg}:
  9170. @example
  9171. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9172. @end example
  9173. @end itemize
  9174. @section perspective
  9175. Correct perspective of video not recorded perpendicular to the screen.
  9176. A description of the accepted parameters follows.
  9177. @table @option
  9178. @item x0
  9179. @item y0
  9180. @item x1
  9181. @item y1
  9182. @item x2
  9183. @item y2
  9184. @item x3
  9185. @item y3
  9186. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9187. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9188. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9189. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9190. then the corners of the source will be sent to the specified coordinates.
  9191. The expressions can use the following variables:
  9192. @table @option
  9193. @item W
  9194. @item H
  9195. the width and height of video frame.
  9196. @item in
  9197. Input frame count.
  9198. @item on
  9199. Output frame count.
  9200. @end table
  9201. @item interpolation
  9202. Set interpolation for perspective correction.
  9203. It accepts the following values:
  9204. @table @samp
  9205. @item linear
  9206. @item cubic
  9207. @end table
  9208. Default value is @samp{linear}.
  9209. @item sense
  9210. Set interpretation of coordinate options.
  9211. It accepts the following values:
  9212. @table @samp
  9213. @item 0, source
  9214. Send point in the source specified by the given coordinates to
  9215. the corners of the destination.
  9216. @item 1, destination
  9217. Send the corners of the source to the point in the destination specified
  9218. by the given coordinates.
  9219. Default value is @samp{source}.
  9220. @end table
  9221. @item eval
  9222. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9223. It accepts the following values:
  9224. @table @samp
  9225. @item init
  9226. only evaluate expressions once during the filter initialization or
  9227. when a command is processed
  9228. @item frame
  9229. evaluate expressions for each incoming frame
  9230. @end table
  9231. Default value is @samp{init}.
  9232. @end table
  9233. @section phase
  9234. Delay interlaced video by one field time so that the field order changes.
  9235. The intended use is to fix PAL movies that have been captured with the
  9236. opposite field order to the film-to-video transfer.
  9237. A description of the accepted parameters follows.
  9238. @table @option
  9239. @item mode
  9240. Set phase mode.
  9241. It accepts the following values:
  9242. @table @samp
  9243. @item t
  9244. Capture field order top-first, transfer bottom-first.
  9245. Filter will delay the bottom field.
  9246. @item b
  9247. Capture field order bottom-first, transfer top-first.
  9248. Filter will delay the top field.
  9249. @item p
  9250. Capture and transfer with the same field order. This mode only exists
  9251. for the documentation of the other options to refer to, but if you
  9252. actually select it, the filter will faithfully do nothing.
  9253. @item a
  9254. Capture field order determined automatically by field flags, transfer
  9255. opposite.
  9256. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9257. basis using field flags. If no field information is available,
  9258. then this works just like @samp{u}.
  9259. @item u
  9260. Capture unknown or varying, transfer opposite.
  9261. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9262. analyzing the images and selecting the alternative that produces best
  9263. match between the fields.
  9264. @item T
  9265. Capture top-first, transfer unknown or varying.
  9266. Filter selects among @samp{t} and @samp{p} using image analysis.
  9267. @item B
  9268. Capture bottom-first, transfer unknown or varying.
  9269. Filter selects among @samp{b} and @samp{p} using image analysis.
  9270. @item A
  9271. Capture determined by field flags, transfer unknown or varying.
  9272. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9273. image analysis. If no field information is available, then this works just
  9274. like @samp{U}. This is the default mode.
  9275. @item U
  9276. Both capture and transfer unknown or varying.
  9277. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9278. @end table
  9279. @end table
  9280. @section pixdesctest
  9281. Pixel format descriptor test filter, mainly useful for internal
  9282. testing. The output video should be equal to the input video.
  9283. For example:
  9284. @example
  9285. format=monow, pixdesctest
  9286. @end example
  9287. can be used to test the monowhite pixel format descriptor definition.
  9288. @section pixscope
  9289. Display sample values of color channels. Mainly useful for checking color
  9290. and levels. Minimum supported resolution is 640x480.
  9291. The filters accept the following options:
  9292. @table @option
  9293. @item x
  9294. Set scope X position, relative offset on X axis.
  9295. @item y
  9296. Set scope Y position, relative offset on Y axis.
  9297. @item w
  9298. Set scope width.
  9299. @item h
  9300. Set scope height.
  9301. @item o
  9302. Set window opacity. This window also holds statistics about pixel area.
  9303. @item wx
  9304. Set window X position, relative offset on X axis.
  9305. @item wy
  9306. Set window Y position, relative offset on Y axis.
  9307. @end table
  9308. @section pp
  9309. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9310. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9311. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9312. Each subfilter and some options have a short and a long name that can be used
  9313. interchangeably, i.e. dr/dering are the same.
  9314. The filters accept the following options:
  9315. @table @option
  9316. @item subfilters
  9317. Set postprocessing subfilters string.
  9318. @end table
  9319. All subfilters share common options to determine their scope:
  9320. @table @option
  9321. @item a/autoq
  9322. Honor the quality commands for this subfilter.
  9323. @item c/chrom
  9324. Do chrominance filtering, too (default).
  9325. @item y/nochrom
  9326. Do luminance filtering only (no chrominance).
  9327. @item n/noluma
  9328. Do chrominance filtering only (no luminance).
  9329. @end table
  9330. These options can be appended after the subfilter name, separated by a '|'.
  9331. Available subfilters are:
  9332. @table @option
  9333. @item hb/hdeblock[|difference[|flatness]]
  9334. Horizontal deblocking filter
  9335. @table @option
  9336. @item difference
  9337. Difference factor where higher values mean more deblocking (default: @code{32}).
  9338. @item flatness
  9339. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9340. @end table
  9341. @item vb/vdeblock[|difference[|flatness]]
  9342. Vertical deblocking filter
  9343. @table @option
  9344. @item difference
  9345. Difference factor where higher values mean more deblocking (default: @code{32}).
  9346. @item flatness
  9347. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9348. @end table
  9349. @item ha/hadeblock[|difference[|flatness]]
  9350. Accurate horizontal deblocking filter
  9351. @table @option
  9352. @item difference
  9353. Difference factor where higher values mean more deblocking (default: @code{32}).
  9354. @item flatness
  9355. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9356. @end table
  9357. @item va/vadeblock[|difference[|flatness]]
  9358. Accurate vertical deblocking filter
  9359. @table @option
  9360. @item difference
  9361. Difference factor where higher values mean more deblocking (default: @code{32}).
  9362. @item flatness
  9363. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9364. @end table
  9365. @end table
  9366. The horizontal and vertical deblocking filters share the difference and
  9367. flatness values so you cannot set different horizontal and vertical
  9368. thresholds.
  9369. @table @option
  9370. @item h1/x1hdeblock
  9371. Experimental horizontal deblocking filter
  9372. @item v1/x1vdeblock
  9373. Experimental vertical deblocking filter
  9374. @item dr/dering
  9375. Deringing filter
  9376. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9377. @table @option
  9378. @item threshold1
  9379. larger -> stronger filtering
  9380. @item threshold2
  9381. larger -> stronger filtering
  9382. @item threshold3
  9383. larger -> stronger filtering
  9384. @end table
  9385. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9386. @table @option
  9387. @item f/fullyrange
  9388. Stretch luminance to @code{0-255}.
  9389. @end table
  9390. @item lb/linblenddeint
  9391. Linear blend deinterlacing filter that deinterlaces the given block by
  9392. filtering all lines with a @code{(1 2 1)} filter.
  9393. @item li/linipoldeint
  9394. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9395. linearly interpolating every second line.
  9396. @item ci/cubicipoldeint
  9397. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9398. cubically interpolating every second line.
  9399. @item md/mediandeint
  9400. Median deinterlacing filter that deinterlaces the given block by applying a
  9401. median filter to every second line.
  9402. @item fd/ffmpegdeint
  9403. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9404. second line with a @code{(-1 4 2 4 -1)} filter.
  9405. @item l5/lowpass5
  9406. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9407. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9408. @item fq/forceQuant[|quantizer]
  9409. Overrides the quantizer table from the input with the constant quantizer you
  9410. specify.
  9411. @table @option
  9412. @item quantizer
  9413. Quantizer to use
  9414. @end table
  9415. @item de/default
  9416. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9417. @item fa/fast
  9418. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9419. @item ac
  9420. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9421. @end table
  9422. @subsection Examples
  9423. @itemize
  9424. @item
  9425. Apply horizontal and vertical deblocking, deringing and automatic
  9426. brightness/contrast:
  9427. @example
  9428. pp=hb/vb/dr/al
  9429. @end example
  9430. @item
  9431. Apply default filters without brightness/contrast correction:
  9432. @example
  9433. pp=de/-al
  9434. @end example
  9435. @item
  9436. Apply default filters and temporal denoiser:
  9437. @example
  9438. pp=default/tmpnoise|1|2|3
  9439. @end example
  9440. @item
  9441. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9442. automatically depending on available CPU time:
  9443. @example
  9444. pp=hb|y/vb|a
  9445. @end example
  9446. @end itemize
  9447. @section pp7
  9448. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9449. similar to spp = 6 with 7 point DCT, where only the center sample is
  9450. used after IDCT.
  9451. The filter accepts the following options:
  9452. @table @option
  9453. @item qp
  9454. Force a constant quantization parameter. It accepts an integer in range
  9455. 0 to 63. If not set, the filter will use the QP from the video stream
  9456. (if available).
  9457. @item mode
  9458. Set thresholding mode. Available modes are:
  9459. @table @samp
  9460. @item hard
  9461. Set hard thresholding.
  9462. @item soft
  9463. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9464. @item medium
  9465. Set medium thresholding (good results, default).
  9466. @end table
  9467. @end table
  9468. @section premultiply
  9469. Apply alpha premultiply effect to input video stream using first plane
  9470. of second stream as alpha.
  9471. Both streams must have same dimensions and same pixel format.
  9472. The filter accepts the following option:
  9473. @table @option
  9474. @item planes
  9475. Set which planes will be processed, unprocessed planes will be copied.
  9476. By default value 0xf, all planes will be processed.
  9477. @item inplace
  9478. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9479. @end table
  9480. @section prewitt
  9481. Apply prewitt operator to input video stream.
  9482. The filter accepts the following option:
  9483. @table @option
  9484. @item planes
  9485. Set which planes will be processed, unprocessed planes will be copied.
  9486. By default value 0xf, all planes will be processed.
  9487. @item scale
  9488. Set value which will be multiplied with filtered result.
  9489. @item delta
  9490. Set value which will be added to filtered result.
  9491. @end table
  9492. @section pseudocolor
  9493. Alter frame colors in video with pseudocolors.
  9494. This filter accept the following options:
  9495. @table @option
  9496. @item c0
  9497. set pixel first component expression
  9498. @item c1
  9499. set pixel second component expression
  9500. @item c2
  9501. set pixel third component expression
  9502. @item c3
  9503. set pixel fourth component expression, corresponds to the alpha component
  9504. @item i
  9505. set component to use as base for altering colors
  9506. @end table
  9507. Each of them specifies the expression to use for computing the lookup table for
  9508. the corresponding pixel component values.
  9509. The expressions can contain the following constants and functions:
  9510. @table @option
  9511. @item w
  9512. @item h
  9513. The input width and height.
  9514. @item val
  9515. The input value for the pixel component.
  9516. @item ymin, umin, vmin, amin
  9517. The minimum allowed component value.
  9518. @item ymax, umax, vmax, amax
  9519. The maximum allowed component value.
  9520. @end table
  9521. All expressions default to "val".
  9522. @subsection Examples
  9523. @itemize
  9524. @item
  9525. Change too high luma values to gradient:
  9526. @example
  9527. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  9528. @end example
  9529. @end itemize
  9530. @section psnr
  9531. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9532. Ratio) between two input videos.
  9533. This filter takes in input two input videos, the first input is
  9534. considered the "main" source and is passed unchanged to the
  9535. output. The second input is used as a "reference" video for computing
  9536. the PSNR.
  9537. Both video inputs must have the same resolution and pixel format for
  9538. this filter to work correctly. Also it assumes that both inputs
  9539. have the same number of frames, which are compared one by one.
  9540. The obtained average PSNR is printed through the logging system.
  9541. The filter stores the accumulated MSE (mean squared error) of each
  9542. frame, and at the end of the processing it is averaged across all frames
  9543. equally, and the following formula is applied to obtain the PSNR:
  9544. @example
  9545. PSNR = 10*log10(MAX^2/MSE)
  9546. @end example
  9547. Where MAX is the average of the maximum values of each component of the
  9548. image.
  9549. The description of the accepted parameters follows.
  9550. @table @option
  9551. @item stats_file, f
  9552. If specified the filter will use the named file to save the PSNR of
  9553. each individual frame. When filename equals "-" the data is sent to
  9554. standard output.
  9555. @item stats_version
  9556. Specifies which version of the stats file format to use. Details of
  9557. each format are written below.
  9558. Default value is 1.
  9559. @item stats_add_max
  9560. Determines whether the max value is output to the stats log.
  9561. Default value is 0.
  9562. Requires stats_version >= 2. If this is set and stats_version < 2,
  9563. the filter will return an error.
  9564. @end table
  9565. This filter also supports the @ref{framesync} options.
  9566. The file printed if @var{stats_file} is selected, contains a sequence of
  9567. key/value pairs of the form @var{key}:@var{value} for each compared
  9568. couple of frames.
  9569. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9570. the list of per-frame-pair stats, with key value pairs following the frame
  9571. format with the following parameters:
  9572. @table @option
  9573. @item psnr_log_version
  9574. The version of the log file format. Will match @var{stats_version}.
  9575. @item fields
  9576. A comma separated list of the per-frame-pair parameters included in
  9577. the log.
  9578. @end table
  9579. A description of each shown per-frame-pair parameter follows:
  9580. @table @option
  9581. @item n
  9582. sequential number of the input frame, starting from 1
  9583. @item mse_avg
  9584. Mean Square Error pixel-by-pixel average difference of the compared
  9585. frames, averaged over all the image components.
  9586. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9587. Mean Square Error pixel-by-pixel average difference of the compared
  9588. frames for the component specified by the suffix.
  9589. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9590. Peak Signal to Noise ratio of the compared frames for the component
  9591. specified by the suffix.
  9592. @item max_avg, max_y, max_u, max_v
  9593. Maximum allowed value for each channel, and average over all
  9594. channels.
  9595. @end table
  9596. For example:
  9597. @example
  9598. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9599. [main][ref] psnr="stats_file=stats.log" [out]
  9600. @end example
  9601. On this example the input file being processed is compared with the
  9602. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9603. is stored in @file{stats.log}.
  9604. @anchor{pullup}
  9605. @section pullup
  9606. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9607. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9608. content.
  9609. The pullup filter is designed to take advantage of future context in making
  9610. its decisions. This filter is stateless in the sense that it does not lock
  9611. onto a pattern to follow, but it instead looks forward to the following
  9612. fields in order to identify matches and rebuild progressive frames.
  9613. To produce content with an even framerate, insert the fps filter after
  9614. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9615. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9616. The filter accepts the following options:
  9617. @table @option
  9618. @item jl
  9619. @item jr
  9620. @item jt
  9621. @item jb
  9622. These options set the amount of "junk" to ignore at the left, right, top, and
  9623. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9624. while top and bottom are in units of 2 lines.
  9625. The default is 8 pixels on each side.
  9626. @item sb
  9627. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9628. filter generating an occasional mismatched frame, but it may also cause an
  9629. excessive number of frames to be dropped during high motion sequences.
  9630. Conversely, setting it to -1 will make filter match fields more easily.
  9631. This may help processing of video where there is slight blurring between
  9632. the fields, but may also cause there to be interlaced frames in the output.
  9633. Default value is @code{0}.
  9634. @item mp
  9635. Set the metric plane to use. It accepts the following values:
  9636. @table @samp
  9637. @item l
  9638. Use luma plane.
  9639. @item u
  9640. Use chroma blue plane.
  9641. @item v
  9642. Use chroma red plane.
  9643. @end table
  9644. This option may be set to use chroma plane instead of the default luma plane
  9645. for doing filter's computations. This may improve accuracy on very clean
  9646. source material, but more likely will decrease accuracy, especially if there
  9647. is chroma noise (rainbow effect) or any grayscale video.
  9648. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9649. load and make pullup usable in realtime on slow machines.
  9650. @end table
  9651. For best results (without duplicated frames in the output file) it is
  9652. necessary to change the output frame rate. For example, to inverse
  9653. telecine NTSC input:
  9654. @example
  9655. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9656. @end example
  9657. @section qp
  9658. Change video quantization parameters (QP).
  9659. The filter accepts the following option:
  9660. @table @option
  9661. @item qp
  9662. Set expression for quantization parameter.
  9663. @end table
  9664. The expression is evaluated through the eval API and can contain, among others,
  9665. the following constants:
  9666. @table @var
  9667. @item known
  9668. 1 if index is not 129, 0 otherwise.
  9669. @item qp
  9670. Sequential index starting from -129 to 128.
  9671. @end table
  9672. @subsection Examples
  9673. @itemize
  9674. @item
  9675. Some equation like:
  9676. @example
  9677. qp=2+2*sin(PI*qp)
  9678. @end example
  9679. @end itemize
  9680. @section random
  9681. Flush video frames from internal cache of frames into a random order.
  9682. No frame is discarded.
  9683. Inspired by @ref{frei0r} nervous filter.
  9684. @table @option
  9685. @item frames
  9686. Set size in number of frames of internal cache, in range from @code{2} to
  9687. @code{512}. Default is @code{30}.
  9688. @item seed
  9689. Set seed for random number generator, must be an integer included between
  9690. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9691. less than @code{0}, the filter will try to use a good random seed on a
  9692. best effort basis.
  9693. @end table
  9694. @section readeia608
  9695. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9696. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9697. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9698. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9699. @table @option
  9700. @item lavfi.readeia608.X.cc
  9701. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9702. @item lavfi.readeia608.X.line
  9703. The number of the line on which the EIA-608 data was identified and read.
  9704. @end table
  9705. This filter accepts the following options:
  9706. @table @option
  9707. @item scan_min
  9708. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9709. @item scan_max
  9710. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9711. @item mac
  9712. Set minimal acceptable amplitude change for sync codes detection.
  9713. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9714. @item spw
  9715. Set the ratio of width reserved for sync code detection.
  9716. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9717. @item mhd
  9718. Set the max peaks height difference for sync code detection.
  9719. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9720. @item mpd
  9721. Set max peaks period difference for sync code detection.
  9722. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9723. @item msd
  9724. Set the first two max start code bits differences.
  9725. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9726. @item bhd
  9727. Set the minimum ratio of bits height compared to 3rd start code bit.
  9728. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9729. @item th_w
  9730. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9731. @item th_b
  9732. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9733. @item chp
  9734. Enable checking the parity bit. In the event of a parity error, the filter will output
  9735. @code{0x00} for that character. Default is false.
  9736. @end table
  9737. @subsection Examples
  9738. @itemize
  9739. @item
  9740. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9741. @example
  9742. 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
  9743. @end example
  9744. @end itemize
  9745. @section readvitc
  9746. Read vertical interval timecode (VITC) information from the top lines of a
  9747. video frame.
  9748. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9749. timecode value, if a valid timecode has been detected. Further metadata key
  9750. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9751. timecode data has been found or not.
  9752. This filter accepts the following options:
  9753. @table @option
  9754. @item scan_max
  9755. Set the maximum number of lines to scan for VITC data. If the value is set to
  9756. @code{-1} the full video frame is scanned. Default is @code{45}.
  9757. @item thr_b
  9758. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9759. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9760. @item thr_w
  9761. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9762. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9763. @end table
  9764. @subsection Examples
  9765. @itemize
  9766. @item
  9767. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9768. draw @code{--:--:--:--} as a placeholder:
  9769. @example
  9770. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9771. @end example
  9772. @end itemize
  9773. @section remap
  9774. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9775. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9776. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9777. value for pixel will be used for destination pixel.
  9778. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9779. will have Xmap/Ymap video stream dimensions.
  9780. Xmap and Ymap input video streams are 16bit depth, single channel.
  9781. @section removegrain
  9782. The removegrain filter is a spatial denoiser for progressive video.
  9783. @table @option
  9784. @item m0
  9785. Set mode for the first plane.
  9786. @item m1
  9787. Set mode for the second plane.
  9788. @item m2
  9789. Set mode for the third plane.
  9790. @item m3
  9791. Set mode for the fourth plane.
  9792. @end table
  9793. Range of mode is from 0 to 24. Description of each mode follows:
  9794. @table @var
  9795. @item 0
  9796. Leave input plane unchanged. Default.
  9797. @item 1
  9798. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9799. @item 2
  9800. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9801. @item 3
  9802. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9803. @item 4
  9804. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9805. This is equivalent to a median filter.
  9806. @item 5
  9807. Line-sensitive clipping giving the minimal change.
  9808. @item 6
  9809. Line-sensitive clipping, intermediate.
  9810. @item 7
  9811. Line-sensitive clipping, intermediate.
  9812. @item 8
  9813. Line-sensitive clipping, intermediate.
  9814. @item 9
  9815. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9816. @item 10
  9817. Replaces the target pixel with the closest neighbour.
  9818. @item 11
  9819. [1 2 1] horizontal and vertical kernel blur.
  9820. @item 12
  9821. Same as mode 11.
  9822. @item 13
  9823. Bob mode, interpolates top field from the line where the neighbours
  9824. pixels are the closest.
  9825. @item 14
  9826. Bob mode, interpolates bottom field from the line where the neighbours
  9827. pixels are the closest.
  9828. @item 15
  9829. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9830. interpolation formula.
  9831. @item 16
  9832. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9833. interpolation formula.
  9834. @item 17
  9835. Clips the pixel with the minimum and maximum of respectively the maximum and
  9836. minimum of each pair of opposite neighbour pixels.
  9837. @item 18
  9838. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9839. the current pixel is minimal.
  9840. @item 19
  9841. Replaces the pixel with the average of its 8 neighbours.
  9842. @item 20
  9843. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9844. @item 21
  9845. Clips pixels using the averages of opposite neighbour.
  9846. @item 22
  9847. Same as mode 21 but simpler and faster.
  9848. @item 23
  9849. Small edge and halo removal, but reputed useless.
  9850. @item 24
  9851. Similar as 23.
  9852. @end table
  9853. @section removelogo
  9854. Suppress a TV station logo, using an image file to determine which
  9855. pixels comprise the logo. It works by filling in the pixels that
  9856. comprise the logo with neighboring pixels.
  9857. The filter accepts the following options:
  9858. @table @option
  9859. @item filename, f
  9860. Set the filter bitmap file, which can be any image format supported by
  9861. libavformat. The width and height of the image file must match those of the
  9862. video stream being processed.
  9863. @end table
  9864. Pixels in the provided bitmap image with a value of zero are not
  9865. considered part of the logo, non-zero pixels are considered part of
  9866. the logo. If you use white (255) for the logo and black (0) for the
  9867. rest, you will be safe. For making the filter bitmap, it is
  9868. recommended to take a screen capture of a black frame with the logo
  9869. visible, and then using a threshold filter followed by the erode
  9870. filter once or twice.
  9871. If needed, little splotches can be fixed manually. Remember that if
  9872. logo pixels are not covered, the filter quality will be much
  9873. reduced. Marking too many pixels as part of the logo does not hurt as
  9874. much, but it will increase the amount of blurring needed to cover over
  9875. the image and will destroy more information than necessary, and extra
  9876. pixels will slow things down on a large logo.
  9877. @section repeatfields
  9878. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9879. fields based on its value.
  9880. @section reverse
  9881. Reverse a video clip.
  9882. Warning: This filter requires memory to buffer the entire clip, so trimming
  9883. is suggested.
  9884. @subsection Examples
  9885. @itemize
  9886. @item
  9887. Take the first 5 seconds of a clip, and reverse it.
  9888. @example
  9889. trim=end=5,reverse
  9890. @end example
  9891. @end itemize
  9892. @section roberts
  9893. Apply roberts cross operator to input video stream.
  9894. The filter accepts the following option:
  9895. @table @option
  9896. @item planes
  9897. Set which planes will be processed, unprocessed planes will be copied.
  9898. By default value 0xf, all planes will be processed.
  9899. @item scale
  9900. Set value which will be multiplied with filtered result.
  9901. @item delta
  9902. Set value which will be added to filtered result.
  9903. @end table
  9904. @section rotate
  9905. Rotate video by an arbitrary angle expressed in radians.
  9906. The filter accepts the following options:
  9907. A description of the optional parameters follows.
  9908. @table @option
  9909. @item angle, a
  9910. Set an expression for the angle by which to rotate the input video
  9911. clockwise, expressed as a number of radians. A negative value will
  9912. result in a counter-clockwise rotation. By default it is set to "0".
  9913. This expression is evaluated for each frame.
  9914. @item out_w, ow
  9915. Set the output width expression, default value is "iw".
  9916. This expression is evaluated just once during configuration.
  9917. @item out_h, oh
  9918. Set the output height expression, default value is "ih".
  9919. This expression is evaluated just once during configuration.
  9920. @item bilinear
  9921. Enable bilinear interpolation if set to 1, a value of 0 disables
  9922. it. Default value is 1.
  9923. @item fillcolor, c
  9924. Set the color used to fill the output area not covered by the rotated
  9925. image. For the general syntax of this option, check the "Color" section in the
  9926. ffmpeg-utils manual. If the special value "none" is selected then no
  9927. background is printed (useful for example if the background is never shown).
  9928. Default value is "black".
  9929. @end table
  9930. The expressions for the angle and the output size can contain the
  9931. following constants and functions:
  9932. @table @option
  9933. @item n
  9934. sequential number of the input frame, starting from 0. It is always NAN
  9935. before the first frame is filtered.
  9936. @item t
  9937. time in seconds of the input frame, it is set to 0 when the filter is
  9938. configured. It is always NAN before the first frame is filtered.
  9939. @item hsub
  9940. @item vsub
  9941. horizontal and vertical chroma subsample values. For example for the
  9942. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9943. @item in_w, iw
  9944. @item in_h, ih
  9945. the input video width and height
  9946. @item out_w, ow
  9947. @item out_h, oh
  9948. the output width and height, that is the size of the padded area as
  9949. specified by the @var{width} and @var{height} expressions
  9950. @item rotw(a)
  9951. @item roth(a)
  9952. the minimal width/height required for completely containing the input
  9953. video rotated by @var{a} radians.
  9954. These are only available when computing the @option{out_w} and
  9955. @option{out_h} expressions.
  9956. @end table
  9957. @subsection Examples
  9958. @itemize
  9959. @item
  9960. Rotate the input by PI/6 radians clockwise:
  9961. @example
  9962. rotate=PI/6
  9963. @end example
  9964. @item
  9965. Rotate the input by PI/6 radians counter-clockwise:
  9966. @example
  9967. rotate=-PI/6
  9968. @end example
  9969. @item
  9970. Rotate the input by 45 degrees clockwise:
  9971. @example
  9972. rotate=45*PI/180
  9973. @end example
  9974. @item
  9975. Apply a constant rotation with period T, starting from an angle of PI/3:
  9976. @example
  9977. rotate=PI/3+2*PI*t/T
  9978. @end example
  9979. @item
  9980. Make the input video rotation oscillating with a period of T
  9981. seconds and an amplitude of A radians:
  9982. @example
  9983. rotate=A*sin(2*PI/T*t)
  9984. @end example
  9985. @item
  9986. Rotate the video, output size is chosen so that the whole rotating
  9987. input video is always completely contained in the output:
  9988. @example
  9989. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9990. @end example
  9991. @item
  9992. Rotate the video, reduce the output size so that no background is ever
  9993. shown:
  9994. @example
  9995. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9996. @end example
  9997. @end itemize
  9998. @subsection Commands
  9999. The filter supports the following commands:
  10000. @table @option
  10001. @item a, angle
  10002. Set the angle expression.
  10003. The command accepts the same syntax of the corresponding option.
  10004. If the specified expression is not valid, it is kept at its current
  10005. value.
  10006. @end table
  10007. @section sab
  10008. Apply Shape Adaptive Blur.
  10009. The filter accepts the following options:
  10010. @table @option
  10011. @item luma_radius, lr
  10012. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10013. value is 1.0. A greater value will result in a more blurred image, and
  10014. in slower processing.
  10015. @item luma_pre_filter_radius, lpfr
  10016. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10017. value is 1.0.
  10018. @item luma_strength, ls
  10019. Set luma maximum difference between pixels to still be considered, must
  10020. be a value in the 0.1-100.0 range, default value is 1.0.
  10021. @item chroma_radius, cr
  10022. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10023. greater value will result in a more blurred image, and in slower
  10024. processing.
  10025. @item chroma_pre_filter_radius, cpfr
  10026. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10027. @item chroma_strength, cs
  10028. Set chroma maximum difference between pixels to still be considered,
  10029. must be a value in the -0.9-100.0 range.
  10030. @end table
  10031. Each chroma option value, if not explicitly specified, is set to the
  10032. corresponding luma option value.
  10033. @anchor{scale}
  10034. @section scale
  10035. Scale (resize) the input video, using the libswscale library.
  10036. The scale filter forces the output display aspect ratio to be the same
  10037. of the input, by changing the output sample aspect ratio.
  10038. If the input image format is different from the format requested by
  10039. the next filter, the scale filter will convert the input to the
  10040. requested format.
  10041. @subsection Options
  10042. The filter accepts the following options, or any of the options
  10043. supported by the libswscale scaler.
  10044. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10045. the complete list of scaler options.
  10046. @table @option
  10047. @item width, w
  10048. @item height, h
  10049. Set the output video dimension expression. Default value is the input
  10050. dimension.
  10051. If the @var{width} or @var{w} value is 0, the input width is used for
  10052. the output. If the @var{height} or @var{h} value is 0, the input height
  10053. is used for the output.
  10054. If one and only one of the values is -n with n >= 1, the scale filter
  10055. will use a value that maintains the aspect ratio of the input image,
  10056. calculated from the other specified dimension. After that it will,
  10057. however, make sure that the calculated dimension is divisible by n and
  10058. adjust the value if necessary.
  10059. If both values are -n with n >= 1, the behavior will be identical to
  10060. both values being set to 0 as previously detailed.
  10061. See below for the list of accepted constants for use in the dimension
  10062. expression.
  10063. @item eval
  10064. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10065. @table @samp
  10066. @item init
  10067. Only evaluate expressions once during the filter initialization or when a command is processed.
  10068. @item frame
  10069. Evaluate expressions for each incoming frame.
  10070. @end table
  10071. Default value is @samp{init}.
  10072. @item interl
  10073. Set the interlacing mode. It accepts the following values:
  10074. @table @samp
  10075. @item 1
  10076. Force interlaced aware scaling.
  10077. @item 0
  10078. Do not apply interlaced scaling.
  10079. @item -1
  10080. Select interlaced aware scaling depending on whether the source frames
  10081. are flagged as interlaced or not.
  10082. @end table
  10083. Default value is @samp{0}.
  10084. @item flags
  10085. Set libswscale scaling flags. See
  10086. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10087. complete list of values. If not explicitly specified the filter applies
  10088. the default flags.
  10089. @item param0, param1
  10090. Set libswscale input parameters for scaling algorithms that need them. See
  10091. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10092. complete documentation. If not explicitly specified the filter applies
  10093. empty parameters.
  10094. @item size, s
  10095. Set the video size. For the syntax of this option, check the
  10096. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10097. @item in_color_matrix
  10098. @item out_color_matrix
  10099. Set in/output YCbCr color space type.
  10100. This allows the autodetected value to be overridden as well as allows forcing
  10101. a specific value used for the output and encoder.
  10102. If not specified, the color space type depends on the pixel format.
  10103. Possible values:
  10104. @table @samp
  10105. @item auto
  10106. Choose automatically.
  10107. @item bt709
  10108. Format conforming to International Telecommunication Union (ITU)
  10109. Recommendation BT.709.
  10110. @item fcc
  10111. Set color space conforming to the United States Federal Communications
  10112. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10113. @item bt601
  10114. Set color space conforming to:
  10115. @itemize
  10116. @item
  10117. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10118. @item
  10119. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10120. @item
  10121. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10122. @end itemize
  10123. @item smpte240m
  10124. Set color space conforming to SMPTE ST 240:1999.
  10125. @end table
  10126. @item in_range
  10127. @item out_range
  10128. Set in/output YCbCr sample range.
  10129. This allows the autodetected value to be overridden as well as allows forcing
  10130. a specific value used for the output and encoder. If not specified, the
  10131. range depends on the pixel format. Possible values:
  10132. @table @samp
  10133. @item auto/unknown
  10134. Choose automatically.
  10135. @item jpeg/full/pc
  10136. Set full range (0-255 in case of 8-bit luma).
  10137. @item mpeg/limited/tv
  10138. Set "MPEG" range (16-235 in case of 8-bit luma).
  10139. @end table
  10140. @item force_original_aspect_ratio
  10141. Enable decreasing or increasing output video width or height if necessary to
  10142. keep the original aspect ratio. Possible values:
  10143. @table @samp
  10144. @item disable
  10145. Scale the video as specified and disable this feature.
  10146. @item decrease
  10147. The output video dimensions will automatically be decreased if needed.
  10148. @item increase
  10149. The output video dimensions will automatically be increased if needed.
  10150. @end table
  10151. One useful instance of this option is that when you know a specific device's
  10152. maximum allowed resolution, you can use this to limit the output video to
  10153. that, while retaining the aspect ratio. For example, device A allows
  10154. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10155. decrease) and specifying 1280x720 to the command line makes the output
  10156. 1280x533.
  10157. Please note that this is a different thing than specifying -1 for @option{w}
  10158. or @option{h}, you still need to specify the output resolution for this option
  10159. to work.
  10160. @end table
  10161. The values of the @option{w} and @option{h} options are expressions
  10162. containing the following constants:
  10163. @table @var
  10164. @item in_w
  10165. @item in_h
  10166. The input width and height
  10167. @item iw
  10168. @item ih
  10169. These are the same as @var{in_w} and @var{in_h}.
  10170. @item out_w
  10171. @item out_h
  10172. The output (scaled) width and height
  10173. @item ow
  10174. @item oh
  10175. These are the same as @var{out_w} and @var{out_h}
  10176. @item a
  10177. The same as @var{iw} / @var{ih}
  10178. @item sar
  10179. input sample aspect ratio
  10180. @item dar
  10181. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10182. @item hsub
  10183. @item vsub
  10184. horizontal and vertical input chroma subsample values. For example for the
  10185. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10186. @item ohsub
  10187. @item ovsub
  10188. horizontal and vertical output chroma subsample values. For example for the
  10189. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10190. @end table
  10191. @subsection Examples
  10192. @itemize
  10193. @item
  10194. Scale the input video to a size of 200x100
  10195. @example
  10196. scale=w=200:h=100
  10197. @end example
  10198. This is equivalent to:
  10199. @example
  10200. scale=200:100
  10201. @end example
  10202. or:
  10203. @example
  10204. scale=200x100
  10205. @end example
  10206. @item
  10207. Specify a size abbreviation for the output size:
  10208. @example
  10209. scale=qcif
  10210. @end example
  10211. which can also be written as:
  10212. @example
  10213. scale=size=qcif
  10214. @end example
  10215. @item
  10216. Scale the input to 2x:
  10217. @example
  10218. scale=w=2*iw:h=2*ih
  10219. @end example
  10220. @item
  10221. The above is the same as:
  10222. @example
  10223. scale=2*in_w:2*in_h
  10224. @end example
  10225. @item
  10226. Scale the input to 2x with forced interlaced scaling:
  10227. @example
  10228. scale=2*iw:2*ih:interl=1
  10229. @end example
  10230. @item
  10231. Scale the input to half size:
  10232. @example
  10233. scale=w=iw/2:h=ih/2
  10234. @end example
  10235. @item
  10236. Increase the width, and set the height to the same size:
  10237. @example
  10238. scale=3/2*iw:ow
  10239. @end example
  10240. @item
  10241. Seek Greek harmony:
  10242. @example
  10243. scale=iw:1/PHI*iw
  10244. scale=ih*PHI:ih
  10245. @end example
  10246. @item
  10247. Increase the height, and set the width to 3/2 of the height:
  10248. @example
  10249. scale=w=3/2*oh:h=3/5*ih
  10250. @end example
  10251. @item
  10252. Increase the size, making the size a multiple of the chroma
  10253. subsample values:
  10254. @example
  10255. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10256. @end example
  10257. @item
  10258. Increase the width to a maximum of 500 pixels,
  10259. keeping the same aspect ratio as the input:
  10260. @example
  10261. scale=w='min(500\, iw*3/2):h=-1'
  10262. @end example
  10263. @end itemize
  10264. @subsection Commands
  10265. This filter supports the following commands:
  10266. @table @option
  10267. @item width, w
  10268. @item height, h
  10269. Set the output video dimension expression.
  10270. The command accepts the same syntax of the corresponding option.
  10271. If the specified expression is not valid, it is kept at its current
  10272. value.
  10273. @end table
  10274. @section scale_npp
  10275. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10276. format conversion on CUDA video frames. Setting the output width and height
  10277. works in the same way as for the @var{scale} filter.
  10278. The following additional options are accepted:
  10279. @table @option
  10280. @item format
  10281. The pixel format of the output CUDA frames. If set to the string "same" (the
  10282. default), the input format will be kept. Note that automatic format negotiation
  10283. and conversion is not yet supported for hardware frames
  10284. @item interp_algo
  10285. The interpolation algorithm used for resizing. One of the following:
  10286. @table @option
  10287. @item nn
  10288. Nearest neighbour.
  10289. @item linear
  10290. @item cubic
  10291. @item cubic2p_bspline
  10292. 2-parameter cubic (B=1, C=0)
  10293. @item cubic2p_catmullrom
  10294. 2-parameter cubic (B=0, C=1/2)
  10295. @item cubic2p_b05c03
  10296. 2-parameter cubic (B=1/2, C=3/10)
  10297. @item super
  10298. Supersampling
  10299. @item lanczos
  10300. @end table
  10301. @end table
  10302. @section scale2ref
  10303. Scale (resize) the input video, based on a reference video.
  10304. See the scale filter for available options, scale2ref supports the same but
  10305. uses the reference video instead of the main input as basis. scale2ref also
  10306. supports the following additional constants for the @option{w} and
  10307. @option{h} options:
  10308. @table @var
  10309. @item main_w
  10310. @item main_h
  10311. The main input video's width and height
  10312. @item main_a
  10313. The same as @var{main_w} / @var{main_h}
  10314. @item main_sar
  10315. The main input video's sample aspect ratio
  10316. @item main_dar, mdar
  10317. The main input video's display aspect ratio. Calculated from
  10318. @code{(main_w / main_h) * main_sar}.
  10319. @item main_hsub
  10320. @item main_vsub
  10321. The main input video's horizontal and vertical chroma subsample values.
  10322. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10323. is 1.
  10324. @end table
  10325. @subsection Examples
  10326. @itemize
  10327. @item
  10328. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10329. @example
  10330. 'scale2ref[b][a];[a][b]overlay'
  10331. @end example
  10332. @end itemize
  10333. @anchor{selectivecolor}
  10334. @section selectivecolor
  10335. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10336. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10337. by the "purity" of the color (that is, how saturated it already is).
  10338. This filter is similar to the Adobe Photoshop Selective Color tool.
  10339. The filter accepts the following options:
  10340. @table @option
  10341. @item correction_method
  10342. Select color correction method.
  10343. Available values are:
  10344. @table @samp
  10345. @item absolute
  10346. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10347. component value).
  10348. @item relative
  10349. Specified adjustments are relative to the original component value.
  10350. @end table
  10351. Default is @code{absolute}.
  10352. @item reds
  10353. Adjustments for red pixels (pixels where the red component is the maximum)
  10354. @item yellows
  10355. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10356. @item greens
  10357. Adjustments for green pixels (pixels where the green component is the maximum)
  10358. @item cyans
  10359. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10360. @item blues
  10361. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10362. @item magentas
  10363. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10364. @item whites
  10365. Adjustments for white pixels (pixels where all components are greater than 128)
  10366. @item neutrals
  10367. Adjustments for all pixels except pure black and pure white
  10368. @item blacks
  10369. Adjustments for black pixels (pixels where all components are lesser than 128)
  10370. @item psfile
  10371. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10372. @end table
  10373. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10374. 4 space separated floating point adjustment values in the [-1,1] range,
  10375. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10376. pixels of its range.
  10377. @subsection Examples
  10378. @itemize
  10379. @item
  10380. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10381. increase magenta by 27% in blue areas:
  10382. @example
  10383. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10384. @end example
  10385. @item
  10386. Use a Photoshop selective color preset:
  10387. @example
  10388. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10389. @end example
  10390. @end itemize
  10391. @anchor{separatefields}
  10392. @section separatefields
  10393. The @code{separatefields} takes a frame-based video input and splits
  10394. each frame into its components fields, producing a new half height clip
  10395. with twice the frame rate and twice the frame count.
  10396. This filter use field-dominance information in frame to decide which
  10397. of each pair of fields to place first in the output.
  10398. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10399. @section setdar, setsar
  10400. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10401. output video.
  10402. This is done by changing the specified Sample (aka Pixel) Aspect
  10403. Ratio, according to the following equation:
  10404. @example
  10405. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10406. @end example
  10407. Keep in mind that the @code{setdar} filter does not modify the pixel
  10408. dimensions of the video frame. Also, the display aspect ratio set by
  10409. this filter may be changed by later filters in the filterchain,
  10410. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10411. applied.
  10412. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10413. the filter output video.
  10414. Note that as a consequence of the application of this filter, the
  10415. output display aspect ratio will change according to the equation
  10416. above.
  10417. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10418. filter may be changed by later filters in the filterchain, e.g. if
  10419. another "setsar" or a "setdar" filter is applied.
  10420. It accepts the following parameters:
  10421. @table @option
  10422. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10423. Set the aspect ratio used by the filter.
  10424. The parameter can be a floating point number string, an expression, or
  10425. a string of the form @var{num}:@var{den}, where @var{num} and
  10426. @var{den} are the numerator and denominator of the aspect ratio. If
  10427. the parameter is not specified, it is assumed the value "0".
  10428. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10429. should be escaped.
  10430. @item max
  10431. Set the maximum integer value to use for expressing numerator and
  10432. denominator when reducing the expressed aspect ratio to a rational.
  10433. Default value is @code{100}.
  10434. @end table
  10435. The parameter @var{sar} is an expression containing
  10436. the following constants:
  10437. @table @option
  10438. @item E, PI, PHI
  10439. These are approximated values for the mathematical constants e
  10440. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10441. @item w, h
  10442. The input width and height.
  10443. @item a
  10444. These are the same as @var{w} / @var{h}.
  10445. @item sar
  10446. The input sample aspect ratio.
  10447. @item dar
  10448. The input display aspect ratio. It is the same as
  10449. (@var{w} / @var{h}) * @var{sar}.
  10450. @item hsub, vsub
  10451. Horizontal and vertical chroma subsample values. For example, for the
  10452. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10453. @end table
  10454. @subsection Examples
  10455. @itemize
  10456. @item
  10457. To change the display aspect ratio to 16:9, specify one of the following:
  10458. @example
  10459. setdar=dar=1.77777
  10460. setdar=dar=16/9
  10461. @end example
  10462. @item
  10463. To change the sample aspect ratio to 10:11, specify:
  10464. @example
  10465. setsar=sar=10/11
  10466. @end example
  10467. @item
  10468. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10469. 1000 in the aspect ratio reduction, use the command:
  10470. @example
  10471. setdar=ratio=16/9:max=1000
  10472. @end example
  10473. @end itemize
  10474. @anchor{setfield}
  10475. @section setfield
  10476. Force field for the output video frame.
  10477. The @code{setfield} filter marks the interlace type field for the
  10478. output frames. It does not change the input frame, but only sets the
  10479. corresponding property, which affects how the frame is treated by
  10480. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10481. The filter accepts the following options:
  10482. @table @option
  10483. @item mode
  10484. Available values are:
  10485. @table @samp
  10486. @item auto
  10487. Keep the same field property.
  10488. @item bff
  10489. Mark the frame as bottom-field-first.
  10490. @item tff
  10491. Mark the frame as top-field-first.
  10492. @item prog
  10493. Mark the frame as progressive.
  10494. @end table
  10495. @end table
  10496. @section showinfo
  10497. Show a line containing various information for each input video frame.
  10498. The input video is not modified.
  10499. The shown line contains a sequence of key/value pairs of the form
  10500. @var{key}:@var{value}.
  10501. The following values are shown in the output:
  10502. @table @option
  10503. @item n
  10504. The (sequential) number of the input frame, starting from 0.
  10505. @item pts
  10506. The Presentation TimeStamp of the input frame, expressed as a number of
  10507. time base units. The time base unit depends on the filter input pad.
  10508. @item pts_time
  10509. The Presentation TimeStamp of the input frame, expressed as a number of
  10510. seconds.
  10511. @item pos
  10512. The position of the frame in the input stream, or -1 if this information is
  10513. unavailable and/or meaningless (for example in case of synthetic video).
  10514. @item fmt
  10515. The pixel format name.
  10516. @item sar
  10517. The sample aspect ratio of the input frame, expressed in the form
  10518. @var{num}/@var{den}.
  10519. @item s
  10520. The size of the input frame. For the syntax of this option, check the
  10521. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10522. @item i
  10523. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10524. for bottom field first).
  10525. @item iskey
  10526. This is 1 if the frame is a key frame, 0 otherwise.
  10527. @item type
  10528. The picture type of the input frame ("I" for an I-frame, "P" for a
  10529. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10530. Also refer to the documentation of the @code{AVPictureType} enum and of
  10531. the @code{av_get_picture_type_char} function defined in
  10532. @file{libavutil/avutil.h}.
  10533. @item checksum
  10534. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10535. @item plane_checksum
  10536. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10537. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10538. @end table
  10539. @section showpalette
  10540. Displays the 256 colors palette of each frame. This filter is only relevant for
  10541. @var{pal8} pixel format frames.
  10542. It accepts the following option:
  10543. @table @option
  10544. @item s
  10545. Set the size of the box used to represent one palette color entry. Default is
  10546. @code{30} (for a @code{30x30} pixel box).
  10547. @end table
  10548. @section shuffleframes
  10549. Reorder and/or duplicate and/or drop video frames.
  10550. It accepts the following parameters:
  10551. @table @option
  10552. @item mapping
  10553. Set the destination indexes of input frames.
  10554. This is space or '|' separated list of indexes that maps input frames to output
  10555. frames. Number of indexes also sets maximal value that each index may have.
  10556. '-1' index have special meaning and that is to drop frame.
  10557. @end table
  10558. The first frame has the index 0. The default is to keep the input unchanged.
  10559. @subsection Examples
  10560. @itemize
  10561. @item
  10562. Swap second and third frame of every three frames of the input:
  10563. @example
  10564. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10565. @end example
  10566. @item
  10567. Swap 10th and 1st frame of every ten frames of the input:
  10568. @example
  10569. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10570. @end example
  10571. @end itemize
  10572. @section shuffleplanes
  10573. Reorder and/or duplicate video planes.
  10574. It accepts the following parameters:
  10575. @table @option
  10576. @item map0
  10577. The index of the input plane to be used as the first output plane.
  10578. @item map1
  10579. The index of the input plane to be used as the second output plane.
  10580. @item map2
  10581. The index of the input plane to be used as the third output plane.
  10582. @item map3
  10583. The index of the input plane to be used as the fourth output plane.
  10584. @end table
  10585. The first plane has the index 0. The default is to keep the input unchanged.
  10586. @subsection Examples
  10587. @itemize
  10588. @item
  10589. Swap the second and third planes of the input:
  10590. @example
  10591. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10592. @end example
  10593. @end itemize
  10594. @anchor{signalstats}
  10595. @section signalstats
  10596. Evaluate various visual metrics that assist in determining issues associated
  10597. with the digitization of analog video media.
  10598. By default the filter will log these metadata values:
  10599. @table @option
  10600. @item YMIN
  10601. Display the minimal Y value contained within the input frame. Expressed in
  10602. range of [0-255].
  10603. @item YLOW
  10604. Display the Y value at the 10% percentile within the input frame. Expressed in
  10605. range of [0-255].
  10606. @item YAVG
  10607. Display the average Y value within the input frame. Expressed in range of
  10608. [0-255].
  10609. @item YHIGH
  10610. Display the Y value at the 90% percentile within the input frame. Expressed in
  10611. range of [0-255].
  10612. @item YMAX
  10613. Display the maximum Y value contained within the input frame. Expressed in
  10614. range of [0-255].
  10615. @item UMIN
  10616. Display the minimal U value contained within the input frame. Expressed in
  10617. range of [0-255].
  10618. @item ULOW
  10619. Display the U value at the 10% percentile within the input frame. Expressed in
  10620. range of [0-255].
  10621. @item UAVG
  10622. Display the average U value within the input frame. Expressed in range of
  10623. [0-255].
  10624. @item UHIGH
  10625. Display the U value at the 90% percentile within the input frame. Expressed in
  10626. range of [0-255].
  10627. @item UMAX
  10628. Display the maximum U value contained within the input frame. Expressed in
  10629. range of [0-255].
  10630. @item VMIN
  10631. Display the minimal V value contained within the input frame. Expressed in
  10632. range of [0-255].
  10633. @item VLOW
  10634. Display the V value at the 10% percentile within the input frame. Expressed in
  10635. range of [0-255].
  10636. @item VAVG
  10637. Display the average V value within the input frame. Expressed in range of
  10638. [0-255].
  10639. @item VHIGH
  10640. Display the V value at the 90% percentile within the input frame. Expressed in
  10641. range of [0-255].
  10642. @item VMAX
  10643. Display the maximum V value contained within the input frame. Expressed in
  10644. range of [0-255].
  10645. @item SATMIN
  10646. Display the minimal saturation value contained within the input frame.
  10647. Expressed in range of [0-~181.02].
  10648. @item SATLOW
  10649. Display the saturation value at the 10% percentile within the input frame.
  10650. Expressed in range of [0-~181.02].
  10651. @item SATAVG
  10652. Display the average saturation value within the input frame. Expressed in range
  10653. of [0-~181.02].
  10654. @item SATHIGH
  10655. Display the saturation value at the 90% percentile within the input frame.
  10656. Expressed in range of [0-~181.02].
  10657. @item SATMAX
  10658. Display the maximum saturation value contained within the input frame.
  10659. Expressed in range of [0-~181.02].
  10660. @item HUEMED
  10661. Display the median value for hue within the input frame. Expressed in range of
  10662. [0-360].
  10663. @item HUEAVG
  10664. Display the average value for hue within the input frame. Expressed in range of
  10665. [0-360].
  10666. @item YDIF
  10667. Display the average of sample value difference between all values of the Y
  10668. plane in the current frame and corresponding values of the previous input frame.
  10669. Expressed in range of [0-255].
  10670. @item UDIF
  10671. Display the average of sample value difference between all values of the U
  10672. plane in the current frame and corresponding values of the previous input frame.
  10673. Expressed in range of [0-255].
  10674. @item VDIF
  10675. Display the average of sample value difference between all values of the V
  10676. plane in the current frame and corresponding values of the previous input frame.
  10677. Expressed in range of [0-255].
  10678. @item YBITDEPTH
  10679. Display bit depth of Y plane in current frame.
  10680. Expressed in range of [0-16].
  10681. @item UBITDEPTH
  10682. Display bit depth of U plane in current frame.
  10683. Expressed in range of [0-16].
  10684. @item VBITDEPTH
  10685. Display bit depth of V plane in current frame.
  10686. Expressed in range of [0-16].
  10687. @end table
  10688. The filter accepts the following options:
  10689. @table @option
  10690. @item stat
  10691. @item out
  10692. @option{stat} specify an additional form of image analysis.
  10693. @option{out} output video with the specified type of pixel highlighted.
  10694. Both options accept the following values:
  10695. @table @samp
  10696. @item tout
  10697. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10698. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10699. include the results of video dropouts, head clogs, or tape tracking issues.
  10700. @item vrep
  10701. Identify @var{vertical line repetition}. Vertical line repetition includes
  10702. similar rows of pixels within a frame. In born-digital video vertical line
  10703. repetition is common, but this pattern is uncommon in video digitized from an
  10704. analog source. When it occurs in video that results from the digitization of an
  10705. analog source it can indicate concealment from a dropout compensator.
  10706. @item brng
  10707. Identify pixels that fall outside of legal broadcast range.
  10708. @end table
  10709. @item color, c
  10710. Set the highlight color for the @option{out} option. The default color is
  10711. yellow.
  10712. @end table
  10713. @subsection Examples
  10714. @itemize
  10715. @item
  10716. Output data of various video metrics:
  10717. @example
  10718. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10719. @end example
  10720. @item
  10721. Output specific data about the minimum and maximum values of the Y plane per frame:
  10722. @example
  10723. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10724. @end example
  10725. @item
  10726. Playback video while highlighting pixels that are outside of broadcast range in red.
  10727. @example
  10728. ffplay example.mov -vf signalstats="out=brng:color=red"
  10729. @end example
  10730. @item
  10731. Playback video with signalstats metadata drawn over the frame.
  10732. @example
  10733. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10734. @end example
  10735. The contents of signalstat_drawtext.txt used in the command are:
  10736. @example
  10737. time %@{pts:hms@}
  10738. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10739. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10740. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10741. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10742. @end example
  10743. @end itemize
  10744. @anchor{signature}
  10745. @section signature
  10746. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10747. input. In this case the matching between the inputs can be calculated additionally.
  10748. The filter always passes through the first input. The signature of each stream can
  10749. be written into a file.
  10750. It accepts the following options:
  10751. @table @option
  10752. @item detectmode
  10753. Enable or disable the matching process.
  10754. Available values are:
  10755. @table @samp
  10756. @item off
  10757. Disable the calculation of a matching (default).
  10758. @item full
  10759. Calculate the matching for the whole video and output whether the whole video
  10760. matches or only parts.
  10761. @item fast
  10762. Calculate only until a matching is found or the video ends. Should be faster in
  10763. some cases.
  10764. @end table
  10765. @item nb_inputs
  10766. Set the number of inputs. The option value must be a non negative integer.
  10767. Default value is 1.
  10768. @item filename
  10769. Set the path to which the output is written. If there is more than one input,
  10770. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10771. integer), that will be replaced with the input number. If no filename is
  10772. specified, no output will be written. This is the default.
  10773. @item format
  10774. Choose the output format.
  10775. Available values are:
  10776. @table @samp
  10777. @item binary
  10778. Use the specified binary representation (default).
  10779. @item xml
  10780. Use the specified xml representation.
  10781. @end table
  10782. @item th_d
  10783. Set threshold to detect one word as similar. The option value must be an integer
  10784. greater than zero. The default value is 9000.
  10785. @item th_dc
  10786. Set threshold to detect all words as similar. The option value must be an integer
  10787. greater than zero. The default value is 60000.
  10788. @item th_xh
  10789. Set threshold to detect frames as similar. The option value must be an integer
  10790. greater than zero. The default value is 116.
  10791. @item th_di
  10792. Set the minimum length of a sequence in frames to recognize it as matching
  10793. sequence. The option value must be a non negative integer value.
  10794. The default value is 0.
  10795. @item th_it
  10796. Set the minimum relation, that matching frames to all frames must have.
  10797. The option value must be a double value between 0 and 1. The default value is 0.5.
  10798. @end table
  10799. @subsection Examples
  10800. @itemize
  10801. @item
  10802. To calculate the signature of an input video and store it in signature.bin:
  10803. @example
  10804. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10805. @end example
  10806. @item
  10807. To detect whether two videos match and store the signatures in XML format in
  10808. signature0.xml and signature1.xml:
  10809. @example
  10810. 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 -
  10811. @end example
  10812. @end itemize
  10813. @anchor{smartblur}
  10814. @section smartblur
  10815. Blur the input video without impacting the outlines.
  10816. It accepts the following options:
  10817. @table @option
  10818. @item luma_radius, lr
  10819. Set the luma radius. The option value must be a float number in
  10820. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10821. used to blur the image (slower if larger). Default value is 1.0.
  10822. @item luma_strength, ls
  10823. Set the luma strength. The option value must be a float number
  10824. in the range [-1.0,1.0] that configures the blurring. A value included
  10825. in [0.0,1.0] will blur the image whereas a value included in
  10826. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10827. @item luma_threshold, lt
  10828. Set the luma threshold used as a coefficient to determine
  10829. whether a pixel should be blurred or not. The option value must be an
  10830. integer in the range [-30,30]. A value of 0 will filter all the image,
  10831. a value included in [0,30] will filter flat areas and a value included
  10832. in [-30,0] will filter edges. Default value is 0.
  10833. @item chroma_radius, cr
  10834. Set the chroma radius. The option value must be a float number in
  10835. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10836. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10837. @item chroma_strength, cs
  10838. Set the chroma strength. The option value must be a float number
  10839. in the range [-1.0,1.0] that configures the blurring. A value included
  10840. in [0.0,1.0] will blur the image whereas a value included in
  10841. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10842. @item chroma_threshold, ct
  10843. Set the chroma threshold used as a coefficient to determine
  10844. whether a pixel should be blurred or not. The option value must be an
  10845. integer in the range [-30,30]. A value of 0 will filter all the image,
  10846. a value included in [0,30] will filter flat areas and a value included
  10847. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10848. @end table
  10849. If a chroma option is not explicitly set, the corresponding luma value
  10850. is set.
  10851. @section ssim
  10852. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10853. This filter takes in input two input videos, the first input is
  10854. considered the "main" source and is passed unchanged to the
  10855. output. The second input is used as a "reference" video for computing
  10856. the SSIM.
  10857. Both video inputs must have the same resolution and pixel format for
  10858. this filter to work correctly. Also it assumes that both inputs
  10859. have the same number of frames, which are compared one by one.
  10860. The filter stores the calculated SSIM of each frame.
  10861. The description of the accepted parameters follows.
  10862. @table @option
  10863. @item stats_file, f
  10864. If specified the filter will use the named file to save the SSIM of
  10865. each individual frame. When filename equals "-" the data is sent to
  10866. standard output.
  10867. @end table
  10868. The file printed if @var{stats_file} is selected, contains a sequence of
  10869. key/value pairs of the form @var{key}:@var{value} for each compared
  10870. couple of frames.
  10871. A description of each shown parameter follows:
  10872. @table @option
  10873. @item n
  10874. sequential number of the input frame, starting from 1
  10875. @item Y, U, V, R, G, B
  10876. SSIM of the compared frames for the component specified by the suffix.
  10877. @item All
  10878. SSIM of the compared frames for the whole frame.
  10879. @item dB
  10880. Same as above but in dB representation.
  10881. @end table
  10882. This filter also supports the @ref{framesync} options.
  10883. For example:
  10884. @example
  10885. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10886. [main][ref] ssim="stats_file=stats.log" [out]
  10887. @end example
  10888. On this example the input file being processed is compared with the
  10889. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10890. is stored in @file{stats.log}.
  10891. Another example with both psnr and ssim at same time:
  10892. @example
  10893. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10894. @end example
  10895. @section stereo3d
  10896. Convert between different stereoscopic image formats.
  10897. The filters accept the following options:
  10898. @table @option
  10899. @item in
  10900. Set stereoscopic image format of input.
  10901. Available values for input image formats are:
  10902. @table @samp
  10903. @item sbsl
  10904. side by side parallel (left eye left, right eye right)
  10905. @item sbsr
  10906. side by side crosseye (right eye left, left eye right)
  10907. @item sbs2l
  10908. side by side parallel with half width resolution
  10909. (left eye left, right eye right)
  10910. @item sbs2r
  10911. side by side crosseye with half width resolution
  10912. (right eye left, left eye right)
  10913. @item abl
  10914. above-below (left eye above, right eye below)
  10915. @item abr
  10916. above-below (right eye above, left eye below)
  10917. @item ab2l
  10918. above-below with half height resolution
  10919. (left eye above, right eye below)
  10920. @item ab2r
  10921. above-below with half height resolution
  10922. (right eye above, left eye below)
  10923. @item al
  10924. alternating frames (left eye first, right eye second)
  10925. @item ar
  10926. alternating frames (right eye first, left eye second)
  10927. @item irl
  10928. interleaved rows (left eye has top row, right eye starts on next row)
  10929. @item irr
  10930. interleaved rows (right eye has top row, left eye starts on next row)
  10931. @item icl
  10932. interleaved columns, left eye first
  10933. @item icr
  10934. interleaved columns, right eye first
  10935. Default value is @samp{sbsl}.
  10936. @end table
  10937. @item out
  10938. Set stereoscopic image format of output.
  10939. @table @samp
  10940. @item sbsl
  10941. side by side parallel (left eye left, right eye right)
  10942. @item sbsr
  10943. side by side crosseye (right eye left, left eye right)
  10944. @item sbs2l
  10945. side by side parallel with half width resolution
  10946. (left eye left, right eye right)
  10947. @item sbs2r
  10948. side by side crosseye with half width resolution
  10949. (right eye left, left eye right)
  10950. @item abl
  10951. above-below (left eye above, right eye below)
  10952. @item abr
  10953. above-below (right eye above, left eye below)
  10954. @item ab2l
  10955. above-below with half height resolution
  10956. (left eye above, right eye below)
  10957. @item ab2r
  10958. above-below with half height resolution
  10959. (right eye above, left eye below)
  10960. @item al
  10961. alternating frames (left eye first, right eye second)
  10962. @item ar
  10963. alternating frames (right eye first, left eye second)
  10964. @item irl
  10965. interleaved rows (left eye has top row, right eye starts on next row)
  10966. @item irr
  10967. interleaved rows (right eye has top row, left eye starts on next row)
  10968. @item arbg
  10969. anaglyph red/blue gray
  10970. (red filter on left eye, blue filter on right eye)
  10971. @item argg
  10972. anaglyph red/green gray
  10973. (red filter on left eye, green filter on right eye)
  10974. @item arcg
  10975. anaglyph red/cyan gray
  10976. (red filter on left eye, cyan filter on right eye)
  10977. @item arch
  10978. anaglyph red/cyan half colored
  10979. (red filter on left eye, cyan filter on right eye)
  10980. @item arcc
  10981. anaglyph red/cyan color
  10982. (red filter on left eye, cyan filter on right eye)
  10983. @item arcd
  10984. anaglyph red/cyan color optimized with the least squares projection of dubois
  10985. (red filter on left eye, cyan filter on right eye)
  10986. @item agmg
  10987. anaglyph green/magenta gray
  10988. (green filter on left eye, magenta filter on right eye)
  10989. @item agmh
  10990. anaglyph green/magenta half colored
  10991. (green filter on left eye, magenta filter on right eye)
  10992. @item agmc
  10993. anaglyph green/magenta colored
  10994. (green filter on left eye, magenta filter on right eye)
  10995. @item agmd
  10996. anaglyph green/magenta color optimized with the least squares projection of dubois
  10997. (green filter on left eye, magenta filter on right eye)
  10998. @item aybg
  10999. anaglyph yellow/blue gray
  11000. (yellow filter on left eye, blue filter on right eye)
  11001. @item aybh
  11002. anaglyph yellow/blue half colored
  11003. (yellow filter on left eye, blue filter on right eye)
  11004. @item aybc
  11005. anaglyph yellow/blue colored
  11006. (yellow filter on left eye, blue filter on right eye)
  11007. @item aybd
  11008. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11009. (yellow filter on left eye, blue filter on right eye)
  11010. @item ml
  11011. mono output (left eye only)
  11012. @item mr
  11013. mono output (right eye only)
  11014. @item chl
  11015. checkerboard, left eye first
  11016. @item chr
  11017. checkerboard, right eye first
  11018. @item icl
  11019. interleaved columns, left eye first
  11020. @item icr
  11021. interleaved columns, right eye first
  11022. @item hdmi
  11023. HDMI frame pack
  11024. @end table
  11025. Default value is @samp{arcd}.
  11026. @end table
  11027. @subsection Examples
  11028. @itemize
  11029. @item
  11030. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11031. @example
  11032. stereo3d=sbsl:aybd
  11033. @end example
  11034. @item
  11035. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11036. @example
  11037. stereo3d=abl:sbsr
  11038. @end example
  11039. @end itemize
  11040. @section streamselect, astreamselect
  11041. Select video or audio streams.
  11042. The filter accepts the following options:
  11043. @table @option
  11044. @item inputs
  11045. Set number of inputs. Default is 2.
  11046. @item map
  11047. Set input indexes to remap to outputs.
  11048. @end table
  11049. @subsection Commands
  11050. The @code{streamselect} and @code{astreamselect} filter supports the following
  11051. commands:
  11052. @table @option
  11053. @item map
  11054. Set input indexes to remap to outputs.
  11055. @end table
  11056. @subsection Examples
  11057. @itemize
  11058. @item
  11059. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11060. @example
  11061. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11062. @end example
  11063. @item
  11064. Same as above, but for audio:
  11065. @example
  11066. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11067. @end example
  11068. @end itemize
  11069. @section sobel
  11070. Apply sobel operator to input video stream.
  11071. The filter accepts the following option:
  11072. @table @option
  11073. @item planes
  11074. Set which planes will be processed, unprocessed planes will be copied.
  11075. By default value 0xf, all planes will be processed.
  11076. @item scale
  11077. Set value which will be multiplied with filtered result.
  11078. @item delta
  11079. Set value which will be added to filtered result.
  11080. @end table
  11081. @anchor{spp}
  11082. @section spp
  11083. Apply a simple postprocessing filter that compresses and decompresses the image
  11084. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11085. and average the results.
  11086. The filter accepts the following options:
  11087. @table @option
  11088. @item quality
  11089. Set quality. This option defines the number of levels for averaging. It accepts
  11090. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11091. effect. A value of @code{6} means the higher quality. For each increment of
  11092. that value the speed drops by a factor of approximately 2. Default value is
  11093. @code{3}.
  11094. @item qp
  11095. Force a constant quantization parameter. If not set, the filter will use the QP
  11096. from the video stream (if available).
  11097. @item mode
  11098. Set thresholding mode. Available modes are:
  11099. @table @samp
  11100. @item hard
  11101. Set hard thresholding (default).
  11102. @item soft
  11103. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11104. @end table
  11105. @item use_bframe_qp
  11106. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11107. option may cause flicker since the B-Frames have often larger QP. Default is
  11108. @code{0} (not enabled).
  11109. @end table
  11110. @anchor{subtitles}
  11111. @section subtitles
  11112. Draw subtitles on top of input video using the libass library.
  11113. To enable compilation of this filter you need to configure FFmpeg with
  11114. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11115. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11116. Alpha) subtitles format.
  11117. The filter accepts the following options:
  11118. @table @option
  11119. @item filename, f
  11120. Set the filename of the subtitle file to read. It must be specified.
  11121. @item original_size
  11122. Specify the size of the original video, the video for which the ASS file
  11123. was composed. For the syntax of this option, check the
  11124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11125. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11126. correctly scale the fonts if the aspect ratio has been changed.
  11127. @item fontsdir
  11128. Set a directory path containing fonts that can be used by the filter.
  11129. These fonts will be used in addition to whatever the font provider uses.
  11130. @item alpha
  11131. Process alpha channel, by default alpha channel is untouched.
  11132. @item charenc
  11133. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11134. useful if not UTF-8.
  11135. @item stream_index, si
  11136. Set subtitles stream index. @code{subtitles} filter only.
  11137. @item force_style
  11138. Override default style or script info parameters of the subtitles. It accepts a
  11139. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11140. @end table
  11141. If the first key is not specified, it is assumed that the first value
  11142. specifies the @option{filename}.
  11143. For example, to render the file @file{sub.srt} on top of the input
  11144. video, use the command:
  11145. @example
  11146. subtitles=sub.srt
  11147. @end example
  11148. which is equivalent to:
  11149. @example
  11150. subtitles=filename=sub.srt
  11151. @end example
  11152. To render the default subtitles stream from file @file{video.mkv}, use:
  11153. @example
  11154. subtitles=video.mkv
  11155. @end example
  11156. To render the second subtitles stream from that file, use:
  11157. @example
  11158. subtitles=video.mkv:si=1
  11159. @end example
  11160. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11161. @code{DejaVu Serif}, use:
  11162. @example
  11163. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11164. @end example
  11165. @section super2xsai
  11166. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11167. Interpolate) pixel art scaling algorithm.
  11168. Useful for enlarging pixel art images without reducing sharpness.
  11169. @section swaprect
  11170. Swap two rectangular objects in video.
  11171. This filter accepts the following options:
  11172. @table @option
  11173. @item w
  11174. Set object width.
  11175. @item h
  11176. Set object height.
  11177. @item x1
  11178. Set 1st rect x coordinate.
  11179. @item y1
  11180. Set 1st rect y coordinate.
  11181. @item x2
  11182. Set 2nd rect x coordinate.
  11183. @item y2
  11184. Set 2nd rect y coordinate.
  11185. All expressions are evaluated once for each frame.
  11186. @end table
  11187. The all options are expressions containing the following constants:
  11188. @table @option
  11189. @item w
  11190. @item h
  11191. The input width and height.
  11192. @item a
  11193. same as @var{w} / @var{h}
  11194. @item sar
  11195. input sample aspect ratio
  11196. @item dar
  11197. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11198. @item n
  11199. The number of the input frame, starting from 0.
  11200. @item t
  11201. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11202. @item pos
  11203. the position in the file of the input frame, NAN if unknown
  11204. @end table
  11205. @section swapuv
  11206. Swap U & V plane.
  11207. @section telecine
  11208. Apply telecine process to the video.
  11209. This filter accepts the following options:
  11210. @table @option
  11211. @item first_field
  11212. @table @samp
  11213. @item top, t
  11214. top field first
  11215. @item bottom, b
  11216. bottom field first
  11217. The default value is @code{top}.
  11218. @end table
  11219. @item pattern
  11220. A string of numbers representing the pulldown pattern you wish to apply.
  11221. The default value is @code{23}.
  11222. @end table
  11223. @example
  11224. Some typical patterns:
  11225. NTSC output (30i):
  11226. 27.5p: 32222
  11227. 24p: 23 (classic)
  11228. 24p: 2332 (preferred)
  11229. 20p: 33
  11230. 18p: 334
  11231. 16p: 3444
  11232. PAL output (25i):
  11233. 27.5p: 12222
  11234. 24p: 222222222223 ("Euro pulldown")
  11235. 16.67p: 33
  11236. 16p: 33333334
  11237. @end example
  11238. @section threshold
  11239. Apply threshold effect to video stream.
  11240. This filter needs four video streams to perform thresholding.
  11241. First stream is stream we are filtering.
  11242. Second stream is holding threshold values, third stream is holding min values,
  11243. and last, fourth stream is holding max values.
  11244. The filter accepts the following option:
  11245. @table @option
  11246. @item planes
  11247. Set which planes will be processed, unprocessed planes will be copied.
  11248. By default value 0xf, all planes will be processed.
  11249. @end table
  11250. For example if first stream pixel's component value is less then threshold value
  11251. of pixel component from 2nd threshold stream, third stream value will picked,
  11252. otherwise fourth stream pixel component value will be picked.
  11253. Using color source filter one can perform various types of thresholding:
  11254. @subsection Examples
  11255. @itemize
  11256. @item
  11257. Binary threshold, using gray color as threshold:
  11258. @example
  11259. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11260. @end example
  11261. @item
  11262. Inverted binary threshold, using gray color as threshold:
  11263. @example
  11264. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11265. @end example
  11266. @item
  11267. Truncate binary threshold, using gray color as threshold:
  11268. @example
  11269. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11270. @end example
  11271. @item
  11272. Threshold to zero, using gray color as threshold:
  11273. @example
  11274. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11275. @end example
  11276. @item
  11277. Inverted threshold to zero, using gray color as threshold:
  11278. @example
  11279. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11280. @end example
  11281. @end itemize
  11282. @section thumbnail
  11283. Select the most representative frame in a given sequence of consecutive frames.
  11284. The filter accepts the following options:
  11285. @table @option
  11286. @item n
  11287. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11288. will pick one of them, and then handle the next batch of @var{n} frames until
  11289. the end. Default is @code{100}.
  11290. @end table
  11291. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11292. value will result in a higher memory usage, so a high value is not recommended.
  11293. @subsection Examples
  11294. @itemize
  11295. @item
  11296. Extract one picture each 50 frames:
  11297. @example
  11298. thumbnail=50
  11299. @end example
  11300. @item
  11301. Complete example of a thumbnail creation with @command{ffmpeg}:
  11302. @example
  11303. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11304. @end example
  11305. @end itemize
  11306. @section tile
  11307. Tile several successive frames together.
  11308. The filter accepts the following options:
  11309. @table @option
  11310. @item layout
  11311. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11312. this option, check the
  11313. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11314. @item nb_frames
  11315. Set the maximum number of frames to render in the given area. It must be less
  11316. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11317. the area will be used.
  11318. @item margin
  11319. Set the outer border margin in pixels.
  11320. @item padding
  11321. Set the inner border thickness (i.e. the number of pixels between frames). For
  11322. more advanced padding options (such as having different values for the edges),
  11323. refer to the pad video filter.
  11324. @item color
  11325. Specify the color of the unused area. For the syntax of this option, check the
  11326. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11327. is "black".
  11328. @item overlap
  11329. Set the number of frames to overlap when tiling several successive frames together.
  11330. The value must be between @code{0} and @var{nb_frames - 1}.
  11331. @item init_padding
  11332. Set the number of frames to initially be empty before displaying first output frame.
  11333. This controls how soon will one get first output frame.
  11334. The value must be between @code{0} and @var{nb_frames - 1}.
  11335. @end table
  11336. @subsection Examples
  11337. @itemize
  11338. @item
  11339. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11340. @example
  11341. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11342. @end example
  11343. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11344. duplicating each output frame to accommodate the originally detected frame
  11345. rate.
  11346. @item
  11347. Display @code{5} pictures in an area of @code{3x2} frames,
  11348. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11349. mixed flat and named options:
  11350. @example
  11351. tile=3x2:nb_frames=5:padding=7:margin=2
  11352. @end example
  11353. @end itemize
  11354. @section tinterlace
  11355. Perform various types of temporal field interlacing.
  11356. Frames are counted starting from 1, so the first input frame is
  11357. considered odd.
  11358. The filter accepts the following options:
  11359. @table @option
  11360. @item mode
  11361. Specify the mode of the interlacing. This option can also be specified
  11362. as a value alone. See below for a list of values for this option.
  11363. Available values are:
  11364. @table @samp
  11365. @item merge, 0
  11366. Move odd frames into the upper field, even into the lower field,
  11367. generating a double height frame at half frame rate.
  11368. @example
  11369. ------> time
  11370. Input:
  11371. Frame 1 Frame 2 Frame 3 Frame 4
  11372. 11111 22222 33333 44444
  11373. 11111 22222 33333 44444
  11374. 11111 22222 33333 44444
  11375. 11111 22222 33333 44444
  11376. Output:
  11377. 11111 33333
  11378. 22222 44444
  11379. 11111 33333
  11380. 22222 44444
  11381. 11111 33333
  11382. 22222 44444
  11383. 11111 33333
  11384. 22222 44444
  11385. @end example
  11386. @item drop_even, 1
  11387. Only output odd frames, even frames are dropped, generating a frame with
  11388. unchanged height at half frame rate.
  11389. @example
  11390. ------> time
  11391. Input:
  11392. Frame 1 Frame 2 Frame 3 Frame 4
  11393. 11111 22222 33333 44444
  11394. 11111 22222 33333 44444
  11395. 11111 22222 33333 44444
  11396. 11111 22222 33333 44444
  11397. Output:
  11398. 11111 33333
  11399. 11111 33333
  11400. 11111 33333
  11401. 11111 33333
  11402. @end example
  11403. @item drop_odd, 2
  11404. Only output even frames, odd frames are dropped, generating a frame with
  11405. unchanged height at half frame rate.
  11406. @example
  11407. ------> time
  11408. Input:
  11409. Frame 1 Frame 2 Frame 3 Frame 4
  11410. 11111 22222 33333 44444
  11411. 11111 22222 33333 44444
  11412. 11111 22222 33333 44444
  11413. 11111 22222 33333 44444
  11414. Output:
  11415. 22222 44444
  11416. 22222 44444
  11417. 22222 44444
  11418. 22222 44444
  11419. @end example
  11420. @item pad, 3
  11421. Expand each frame to full height, but pad alternate lines with black,
  11422. generating a frame with double height at the same input frame rate.
  11423. @example
  11424. ------> time
  11425. Input:
  11426. Frame 1 Frame 2 Frame 3 Frame 4
  11427. 11111 22222 33333 44444
  11428. 11111 22222 33333 44444
  11429. 11111 22222 33333 44444
  11430. 11111 22222 33333 44444
  11431. Output:
  11432. 11111 ..... 33333 .....
  11433. ..... 22222 ..... 44444
  11434. 11111 ..... 33333 .....
  11435. ..... 22222 ..... 44444
  11436. 11111 ..... 33333 .....
  11437. ..... 22222 ..... 44444
  11438. 11111 ..... 33333 .....
  11439. ..... 22222 ..... 44444
  11440. @end example
  11441. @item interleave_top, 4
  11442. Interleave the upper field from odd frames with the lower field from
  11443. even frames, generating a frame with unchanged height at half frame rate.
  11444. @example
  11445. ------> time
  11446. Input:
  11447. Frame 1 Frame 2 Frame 3 Frame 4
  11448. 11111<- 22222 33333<- 44444
  11449. 11111 22222<- 33333 44444<-
  11450. 11111<- 22222 33333<- 44444
  11451. 11111 22222<- 33333 44444<-
  11452. Output:
  11453. 11111 33333
  11454. 22222 44444
  11455. 11111 33333
  11456. 22222 44444
  11457. @end example
  11458. @item interleave_bottom, 5
  11459. Interleave the lower field from odd frames with the upper field from
  11460. even frames, generating a frame with unchanged height at half frame rate.
  11461. @example
  11462. ------> time
  11463. Input:
  11464. Frame 1 Frame 2 Frame 3 Frame 4
  11465. 11111 22222<- 33333 44444<-
  11466. 11111<- 22222 33333<- 44444
  11467. 11111 22222<- 33333 44444<-
  11468. 11111<- 22222 33333<- 44444
  11469. Output:
  11470. 22222 44444
  11471. 11111 33333
  11472. 22222 44444
  11473. 11111 33333
  11474. @end example
  11475. @item interlacex2, 6
  11476. Double frame rate with unchanged height. Frames are inserted each
  11477. containing the second temporal field from the previous input frame and
  11478. the first temporal field from the next input frame. This mode relies on
  11479. the top_field_first flag. Useful for interlaced video displays with no
  11480. field synchronisation.
  11481. @example
  11482. ------> time
  11483. Input:
  11484. Frame 1 Frame 2 Frame 3 Frame 4
  11485. 11111 22222 33333 44444
  11486. 11111 22222 33333 44444
  11487. 11111 22222 33333 44444
  11488. 11111 22222 33333 44444
  11489. Output:
  11490. 11111 22222 22222 33333 33333 44444 44444
  11491. 11111 11111 22222 22222 33333 33333 44444
  11492. 11111 22222 22222 33333 33333 44444 44444
  11493. 11111 11111 22222 22222 33333 33333 44444
  11494. @end example
  11495. @item mergex2, 7
  11496. Move odd frames into the upper field, even into the lower field,
  11497. generating a double height frame at same frame rate.
  11498. @example
  11499. ------> time
  11500. Input:
  11501. Frame 1 Frame 2 Frame 3 Frame 4
  11502. 11111 22222 33333 44444
  11503. 11111 22222 33333 44444
  11504. 11111 22222 33333 44444
  11505. 11111 22222 33333 44444
  11506. Output:
  11507. 11111 33333 33333 55555
  11508. 22222 22222 44444 44444
  11509. 11111 33333 33333 55555
  11510. 22222 22222 44444 44444
  11511. 11111 33333 33333 55555
  11512. 22222 22222 44444 44444
  11513. 11111 33333 33333 55555
  11514. 22222 22222 44444 44444
  11515. @end example
  11516. @end table
  11517. Numeric values are deprecated but are accepted for backward
  11518. compatibility reasons.
  11519. Default mode is @code{merge}.
  11520. @item flags
  11521. Specify flags influencing the filter process.
  11522. Available value for @var{flags} is:
  11523. @table @option
  11524. @item low_pass_filter, vlfp
  11525. Enable linear vertical low-pass filtering in the filter.
  11526. Vertical low-pass filtering is required when creating an interlaced
  11527. destination from a progressive source which contains high-frequency
  11528. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11529. patterning.
  11530. @item complex_filter, cvlfp
  11531. Enable complex vertical low-pass filtering.
  11532. This will slightly less reduce interlace 'twitter' and Moire
  11533. patterning but better retain detail and subjective sharpness impression.
  11534. @end table
  11535. Vertical low-pass filtering can only be enabled for @option{mode}
  11536. @var{interleave_top} and @var{interleave_bottom}.
  11537. @end table
  11538. @section tonemap
  11539. Tone map colors from different dynamic ranges.
  11540. This filter expects data in single precision floating point, as it needs to
  11541. operate on (and can output) out-of-range values. Another filter, such as
  11542. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11543. The tonemapping algorithms implemented only work on linear light, so input
  11544. data should be linearized beforehand (and possibly correctly tagged).
  11545. @example
  11546. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11547. @end example
  11548. @subsection Options
  11549. The filter accepts the following options.
  11550. @table @option
  11551. @item tonemap
  11552. Set the tone map algorithm to use.
  11553. Possible values are:
  11554. @table @var
  11555. @item none
  11556. Do not apply any tone map, only desaturate overbright pixels.
  11557. @item clip
  11558. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11559. in-range values, while distorting out-of-range values.
  11560. @item linear
  11561. Stretch the entire reference gamut to a linear multiple of the display.
  11562. @item gamma
  11563. Fit a logarithmic transfer between the tone curves.
  11564. @item reinhard
  11565. Preserve overall image brightness with a simple curve, using nonlinear
  11566. contrast, which results in flattening details and degrading color accuracy.
  11567. @item hable
  11568. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11569. of slightly darkening everything. Use it when detail preservation is more
  11570. important than color and brightness accuracy.
  11571. @item mobius
  11572. Smoothly map out-of-range values, while retaining contrast and colors for
  11573. in-range material as much as possible. Use it when color accuracy is more
  11574. important than detail preservation.
  11575. @end table
  11576. Default is none.
  11577. @item param
  11578. Tune the tone mapping algorithm.
  11579. This affects the following algorithms:
  11580. @table @var
  11581. @item none
  11582. Ignored.
  11583. @item linear
  11584. Specifies the scale factor to use while stretching.
  11585. Default to 1.0.
  11586. @item gamma
  11587. Specifies the exponent of the function.
  11588. Default to 1.8.
  11589. @item clip
  11590. Specify an extra linear coefficient to multiply into the signal before clipping.
  11591. Default to 1.0.
  11592. @item reinhard
  11593. Specify the local contrast coefficient at the display peak.
  11594. Default to 0.5, which means that in-gamut values will be about half as bright
  11595. as when clipping.
  11596. @item hable
  11597. Ignored.
  11598. @item mobius
  11599. Specify the transition point from linear to mobius transform. Every value
  11600. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11601. more accurate the result will be, at the cost of losing bright details.
  11602. Default to 0.3, which due to the steep initial slope still preserves in-range
  11603. colors fairly accurately.
  11604. @end table
  11605. @item desat
  11606. Apply desaturation for highlights that exceed this level of brightness. The
  11607. higher the parameter, the more color information will be preserved. This
  11608. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11609. (smoothly) turning into white instead. This makes images feel more natural,
  11610. at the cost of reducing information about out-of-range colors.
  11611. The default of 2.0 is somewhat conservative and will mostly just apply to
  11612. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11613. This option works only if the input frame has a supported color tag.
  11614. @item peak
  11615. Override signal/nominal/reference peak with this value. Useful when the
  11616. embedded peak information in display metadata is not reliable or when tone
  11617. mapping from a lower range to a higher range.
  11618. @end table
  11619. @section transpose
  11620. Transpose rows with columns in the input video and optionally flip it.
  11621. It accepts the following parameters:
  11622. @table @option
  11623. @item dir
  11624. Specify the transposition direction.
  11625. Can assume the following values:
  11626. @table @samp
  11627. @item 0, 4, cclock_flip
  11628. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11629. @example
  11630. L.R L.l
  11631. . . -> . .
  11632. l.r R.r
  11633. @end example
  11634. @item 1, 5, clock
  11635. Rotate by 90 degrees clockwise, that is:
  11636. @example
  11637. L.R l.L
  11638. . . -> . .
  11639. l.r r.R
  11640. @end example
  11641. @item 2, 6, cclock
  11642. Rotate by 90 degrees counterclockwise, that is:
  11643. @example
  11644. L.R R.r
  11645. . . -> . .
  11646. l.r L.l
  11647. @end example
  11648. @item 3, 7, clock_flip
  11649. Rotate by 90 degrees clockwise and vertically flip, that is:
  11650. @example
  11651. L.R r.R
  11652. . . -> . .
  11653. l.r l.L
  11654. @end example
  11655. @end table
  11656. For values between 4-7, the transposition is only done if the input
  11657. video geometry is portrait and not landscape. These values are
  11658. deprecated, the @code{passthrough} option should be used instead.
  11659. Numerical values are deprecated, and should be dropped in favor of
  11660. symbolic constants.
  11661. @item passthrough
  11662. Do not apply the transposition if the input geometry matches the one
  11663. specified by the specified value. It accepts the following values:
  11664. @table @samp
  11665. @item none
  11666. Always apply transposition.
  11667. @item portrait
  11668. Preserve portrait geometry (when @var{height} >= @var{width}).
  11669. @item landscape
  11670. Preserve landscape geometry (when @var{width} >= @var{height}).
  11671. @end table
  11672. Default value is @code{none}.
  11673. @end table
  11674. For example to rotate by 90 degrees clockwise and preserve portrait
  11675. layout:
  11676. @example
  11677. transpose=dir=1:passthrough=portrait
  11678. @end example
  11679. The command above can also be specified as:
  11680. @example
  11681. transpose=1:portrait
  11682. @end example
  11683. @section trim
  11684. Trim the input so that the output contains one continuous subpart of the input.
  11685. It accepts the following parameters:
  11686. @table @option
  11687. @item start
  11688. Specify the time of the start of the kept section, i.e. the frame with the
  11689. timestamp @var{start} will be the first frame in the output.
  11690. @item end
  11691. Specify the time of the first frame that will be dropped, i.e. the frame
  11692. immediately preceding the one with the timestamp @var{end} will be the last
  11693. frame in the output.
  11694. @item start_pts
  11695. This is the same as @var{start}, except this option sets the start timestamp
  11696. in timebase units instead of seconds.
  11697. @item end_pts
  11698. This is the same as @var{end}, except this option sets the end timestamp
  11699. in timebase units instead of seconds.
  11700. @item duration
  11701. The maximum duration of the output in seconds.
  11702. @item start_frame
  11703. The number of the first frame that should be passed to the output.
  11704. @item end_frame
  11705. The number of the first frame that should be dropped.
  11706. @end table
  11707. @option{start}, @option{end}, and @option{duration} are expressed as time
  11708. duration specifications; see
  11709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11710. for the accepted syntax.
  11711. Note that the first two sets of the start/end options and the @option{duration}
  11712. option look at the frame timestamp, while the _frame variants simply count the
  11713. frames that pass through the filter. Also note that this filter does not modify
  11714. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11715. setpts filter after the trim filter.
  11716. If multiple start or end options are set, this filter tries to be greedy and
  11717. keep all the frames that match at least one of the specified constraints. To keep
  11718. only the part that matches all the constraints at once, chain multiple trim
  11719. filters.
  11720. The defaults are such that all the input is kept. So it is possible to set e.g.
  11721. just the end values to keep everything before the specified time.
  11722. Examples:
  11723. @itemize
  11724. @item
  11725. Drop everything except the second minute of input:
  11726. @example
  11727. ffmpeg -i INPUT -vf trim=60:120
  11728. @end example
  11729. @item
  11730. Keep only the first second:
  11731. @example
  11732. ffmpeg -i INPUT -vf trim=duration=1
  11733. @end example
  11734. @end itemize
  11735. @section unpremultiply
  11736. Apply alpha unpremultiply effect to input video stream using first plane
  11737. of second stream as alpha.
  11738. Both streams must have same dimensions and same pixel format.
  11739. The filter accepts the following option:
  11740. @table @option
  11741. @item planes
  11742. Set which planes will be processed, unprocessed planes will be copied.
  11743. By default value 0xf, all planes will be processed.
  11744. If the format has 1 or 2 components, then luma is bit 0.
  11745. If the format has 3 or 4 components:
  11746. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11747. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11748. If present, the alpha channel is always the last bit.
  11749. @item inplace
  11750. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11751. @end table
  11752. @anchor{unsharp}
  11753. @section unsharp
  11754. Sharpen or blur the input video.
  11755. It accepts the following parameters:
  11756. @table @option
  11757. @item luma_msize_x, lx
  11758. Set the luma matrix horizontal size. It must be an odd integer between
  11759. 3 and 23. The default value is 5.
  11760. @item luma_msize_y, ly
  11761. Set the luma matrix vertical size. It must be an odd integer between 3
  11762. and 23. The default value is 5.
  11763. @item luma_amount, la
  11764. Set the luma effect strength. It must be a floating point number, reasonable
  11765. values lay between -1.5 and 1.5.
  11766. Negative values will blur the input video, while positive values will
  11767. sharpen it, a value of zero will disable the effect.
  11768. Default value is 1.0.
  11769. @item chroma_msize_x, cx
  11770. Set the chroma matrix horizontal size. It must be an odd integer
  11771. between 3 and 23. The default value is 5.
  11772. @item chroma_msize_y, cy
  11773. Set the chroma matrix vertical size. It must be an odd integer
  11774. between 3 and 23. The default value is 5.
  11775. @item chroma_amount, ca
  11776. Set the chroma effect strength. It must be a floating point number, reasonable
  11777. values lay between -1.5 and 1.5.
  11778. Negative values will blur the input video, while positive values will
  11779. sharpen it, a value of zero will disable the effect.
  11780. Default value is 0.0.
  11781. @end table
  11782. All parameters are optional and default to the equivalent of the
  11783. string '5:5:1.0:5:5:0.0'.
  11784. @subsection Examples
  11785. @itemize
  11786. @item
  11787. Apply strong luma sharpen effect:
  11788. @example
  11789. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11790. @end example
  11791. @item
  11792. Apply a strong blur of both luma and chroma parameters:
  11793. @example
  11794. unsharp=7:7:-2:7:7:-2
  11795. @end example
  11796. @end itemize
  11797. @section uspp
  11798. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11799. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11800. shifts and average the results.
  11801. The way this differs from the behavior of spp is that uspp actually encodes &
  11802. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11803. DCT similar to MJPEG.
  11804. The filter accepts the following options:
  11805. @table @option
  11806. @item quality
  11807. Set quality. This option defines the number of levels for averaging. It accepts
  11808. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11809. effect. A value of @code{8} means the higher quality. For each increment of
  11810. that value the speed drops by a factor of approximately 2. Default value is
  11811. @code{3}.
  11812. @item qp
  11813. Force a constant quantization parameter. If not set, the filter will use the QP
  11814. from the video stream (if available).
  11815. @end table
  11816. @section vaguedenoiser
  11817. Apply a wavelet based denoiser.
  11818. It transforms each frame from the video input into the wavelet domain,
  11819. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11820. the obtained coefficients. It does an inverse wavelet transform after.
  11821. Due to wavelet properties, it should give a nice smoothed result, and
  11822. reduced noise, without blurring picture features.
  11823. This filter accepts the following options:
  11824. @table @option
  11825. @item threshold
  11826. The filtering strength. The higher, the more filtered the video will be.
  11827. Hard thresholding can use a higher threshold than soft thresholding
  11828. before the video looks overfiltered. Default value is 2.
  11829. @item method
  11830. The filtering method the filter will use.
  11831. It accepts the following values:
  11832. @table @samp
  11833. @item hard
  11834. All values under the threshold will be zeroed.
  11835. @item soft
  11836. All values under the threshold will be zeroed. All values above will be
  11837. reduced by the threshold.
  11838. @item garrote
  11839. Scales or nullifies coefficients - intermediary between (more) soft and
  11840. (less) hard thresholding.
  11841. @end table
  11842. Default is garrote.
  11843. @item nsteps
  11844. Number of times, the wavelet will decompose the picture. Picture can't
  11845. be decomposed beyond a particular point (typically, 8 for a 640x480
  11846. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11847. @item percent
  11848. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11849. @item planes
  11850. A list of the planes to process. By default all planes are processed.
  11851. @end table
  11852. @section vectorscope
  11853. Display 2 color component values in the two dimensional graph (which is called
  11854. a vectorscope).
  11855. This filter accepts the following options:
  11856. @table @option
  11857. @item mode, m
  11858. Set vectorscope mode.
  11859. It accepts the following values:
  11860. @table @samp
  11861. @item gray
  11862. Gray values are displayed on graph, higher brightness means more pixels have
  11863. same component color value on location in graph. This is the default mode.
  11864. @item color
  11865. Gray values are displayed on graph. Surrounding pixels values which are not
  11866. present in video frame are drawn in gradient of 2 color components which are
  11867. set by option @code{x} and @code{y}. The 3rd color component is static.
  11868. @item color2
  11869. Actual color components values present in video frame are displayed on graph.
  11870. @item color3
  11871. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11872. on graph increases value of another color component, which is luminance by
  11873. default values of @code{x} and @code{y}.
  11874. @item color4
  11875. Actual colors present in video frame are displayed on graph. If two different
  11876. colors map to same position on graph then color with higher value of component
  11877. not present in graph is picked.
  11878. @item color5
  11879. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11880. component picked from radial gradient.
  11881. @end table
  11882. @item x
  11883. Set which color component will be represented on X-axis. Default is @code{1}.
  11884. @item y
  11885. Set which color component will be represented on Y-axis. Default is @code{2}.
  11886. @item intensity, i
  11887. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11888. of color component which represents frequency of (X, Y) location in graph.
  11889. @item envelope, e
  11890. @table @samp
  11891. @item none
  11892. No envelope, this is default.
  11893. @item instant
  11894. Instant envelope, even darkest single pixel will be clearly highlighted.
  11895. @item peak
  11896. Hold maximum and minimum values presented in graph over time. This way you
  11897. can still spot out of range values without constantly looking at vectorscope.
  11898. @item peak+instant
  11899. Peak and instant envelope combined together.
  11900. @end table
  11901. @item graticule, g
  11902. Set what kind of graticule to draw.
  11903. @table @samp
  11904. @item none
  11905. @item green
  11906. @item color
  11907. @end table
  11908. @item opacity, o
  11909. Set graticule opacity.
  11910. @item flags, f
  11911. Set graticule flags.
  11912. @table @samp
  11913. @item white
  11914. Draw graticule for white point.
  11915. @item black
  11916. Draw graticule for black point.
  11917. @item name
  11918. Draw color points short names.
  11919. @end table
  11920. @item bgopacity, b
  11921. Set background opacity.
  11922. @item lthreshold, l
  11923. Set low threshold for color component not represented on X or Y axis.
  11924. Values lower than this value will be ignored. Default is 0.
  11925. Note this value is multiplied with actual max possible value one pixel component
  11926. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11927. is 0.1 * 255 = 25.
  11928. @item hthreshold, h
  11929. Set high threshold for color component not represented on X or Y axis.
  11930. Values higher than this value will be ignored. Default is 1.
  11931. Note this value is multiplied with actual max possible value one pixel component
  11932. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11933. is 0.9 * 255 = 230.
  11934. @item colorspace, c
  11935. Set what kind of colorspace to use when drawing graticule.
  11936. @table @samp
  11937. @item auto
  11938. @item 601
  11939. @item 709
  11940. @end table
  11941. Default is auto.
  11942. @end table
  11943. @anchor{vidstabdetect}
  11944. @section vidstabdetect
  11945. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11946. @ref{vidstabtransform} for pass 2.
  11947. This filter generates a file with relative translation and rotation
  11948. transform information about subsequent frames, which is then used by
  11949. the @ref{vidstabtransform} filter.
  11950. To enable compilation of this filter you need to configure FFmpeg with
  11951. @code{--enable-libvidstab}.
  11952. This filter accepts the following options:
  11953. @table @option
  11954. @item result
  11955. Set the path to the file used to write the transforms information.
  11956. Default value is @file{transforms.trf}.
  11957. @item shakiness
  11958. Set how shaky the video is and how quick the camera is. It accepts an
  11959. integer in the range 1-10, a value of 1 means little shakiness, a
  11960. value of 10 means strong shakiness. Default value is 5.
  11961. @item accuracy
  11962. Set the accuracy of the detection process. It must be a value in the
  11963. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11964. accuracy. Default value is 15.
  11965. @item stepsize
  11966. Set stepsize of the search process. The region around minimum is
  11967. scanned with 1 pixel resolution. Default value is 6.
  11968. @item mincontrast
  11969. Set minimum contrast. Below this value a local measurement field is
  11970. discarded. Must be a floating point value in the range 0-1. Default
  11971. value is 0.3.
  11972. @item tripod
  11973. Set reference frame number for tripod mode.
  11974. If enabled, the motion of the frames is compared to a reference frame
  11975. in the filtered stream, identified by the specified number. The idea
  11976. is to compensate all movements in a more-or-less static scene and keep
  11977. the camera view absolutely still.
  11978. If set to 0, it is disabled. The frames are counted starting from 1.
  11979. @item show
  11980. Show fields and transforms in the resulting frames. It accepts an
  11981. integer in the range 0-2. Default value is 0, which disables any
  11982. visualization.
  11983. @end table
  11984. @subsection Examples
  11985. @itemize
  11986. @item
  11987. Use default values:
  11988. @example
  11989. vidstabdetect
  11990. @end example
  11991. @item
  11992. Analyze strongly shaky movie and put the results in file
  11993. @file{mytransforms.trf}:
  11994. @example
  11995. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11996. @end example
  11997. @item
  11998. Visualize the result of internal transformations in the resulting
  11999. video:
  12000. @example
  12001. vidstabdetect=show=1
  12002. @end example
  12003. @item
  12004. Analyze a video with medium shakiness using @command{ffmpeg}:
  12005. @example
  12006. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12007. @end example
  12008. @end itemize
  12009. @anchor{vidstabtransform}
  12010. @section vidstabtransform
  12011. Video stabilization/deshaking: pass 2 of 2,
  12012. see @ref{vidstabdetect} for pass 1.
  12013. Read a file with transform information for each frame and
  12014. apply/compensate them. Together with the @ref{vidstabdetect}
  12015. filter this can be used to deshake videos. See also
  12016. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12017. the @ref{unsharp} filter, see below.
  12018. To enable compilation of this filter you need to configure FFmpeg with
  12019. @code{--enable-libvidstab}.
  12020. @subsection Options
  12021. @table @option
  12022. @item input
  12023. Set path to the file used to read the transforms. Default value is
  12024. @file{transforms.trf}.
  12025. @item smoothing
  12026. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12027. camera movements. Default value is 10.
  12028. For example a number of 10 means that 21 frames are used (10 in the
  12029. past and 10 in the future) to smoothen the motion in the video. A
  12030. larger value leads to a smoother video, but limits the acceleration of
  12031. the camera (pan/tilt movements). 0 is a special case where a static
  12032. camera is simulated.
  12033. @item optalgo
  12034. Set the camera path optimization algorithm.
  12035. Accepted values are:
  12036. @table @samp
  12037. @item gauss
  12038. gaussian kernel low-pass filter on camera motion (default)
  12039. @item avg
  12040. averaging on transformations
  12041. @end table
  12042. @item maxshift
  12043. Set maximal number of pixels to translate frames. Default value is -1,
  12044. meaning no limit.
  12045. @item maxangle
  12046. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12047. value is -1, meaning no limit.
  12048. @item crop
  12049. Specify how to deal with borders that may be visible due to movement
  12050. compensation.
  12051. Available values are:
  12052. @table @samp
  12053. @item keep
  12054. keep image information from previous frame (default)
  12055. @item black
  12056. fill the border black
  12057. @end table
  12058. @item invert
  12059. Invert transforms if set to 1. Default value is 0.
  12060. @item relative
  12061. Consider transforms as relative to previous frame if set to 1,
  12062. absolute if set to 0. Default value is 0.
  12063. @item zoom
  12064. Set percentage to zoom. A positive value will result in a zoom-in
  12065. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12066. zoom).
  12067. @item optzoom
  12068. Set optimal zooming to avoid borders.
  12069. Accepted values are:
  12070. @table @samp
  12071. @item 0
  12072. disabled
  12073. @item 1
  12074. optimal static zoom value is determined (only very strong movements
  12075. will lead to visible borders) (default)
  12076. @item 2
  12077. optimal adaptive zoom value is determined (no borders will be
  12078. visible), see @option{zoomspeed}
  12079. @end table
  12080. Note that the value given at zoom is added to the one calculated here.
  12081. @item zoomspeed
  12082. Set percent to zoom maximally each frame (enabled when
  12083. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12084. 0.25.
  12085. @item interpol
  12086. Specify type of interpolation.
  12087. Available values are:
  12088. @table @samp
  12089. @item no
  12090. no interpolation
  12091. @item linear
  12092. linear only horizontal
  12093. @item bilinear
  12094. linear in both directions (default)
  12095. @item bicubic
  12096. cubic in both directions (slow)
  12097. @end table
  12098. @item tripod
  12099. Enable virtual tripod mode if set to 1, which is equivalent to
  12100. @code{relative=0:smoothing=0}. Default value is 0.
  12101. Use also @code{tripod} option of @ref{vidstabdetect}.
  12102. @item debug
  12103. Increase log verbosity if set to 1. Also the detected global motions
  12104. are written to the temporary file @file{global_motions.trf}. Default
  12105. value is 0.
  12106. @end table
  12107. @subsection Examples
  12108. @itemize
  12109. @item
  12110. Use @command{ffmpeg} for a typical stabilization with default values:
  12111. @example
  12112. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12113. @end example
  12114. Note the use of the @ref{unsharp} filter which is always recommended.
  12115. @item
  12116. Zoom in a bit more and load transform data from a given file:
  12117. @example
  12118. vidstabtransform=zoom=5:input="mytransforms.trf"
  12119. @end example
  12120. @item
  12121. Smoothen the video even more:
  12122. @example
  12123. vidstabtransform=smoothing=30
  12124. @end example
  12125. @end itemize
  12126. @section vflip
  12127. Flip the input video vertically.
  12128. For example, to vertically flip a video with @command{ffmpeg}:
  12129. @example
  12130. ffmpeg -i in.avi -vf "vflip" out.avi
  12131. @end example
  12132. @anchor{vignette}
  12133. @section vignette
  12134. Make or reverse a natural vignetting effect.
  12135. The filter accepts the following options:
  12136. @table @option
  12137. @item angle, a
  12138. Set lens angle expression as a number of radians.
  12139. The value is clipped in the @code{[0,PI/2]} range.
  12140. Default value: @code{"PI/5"}
  12141. @item x0
  12142. @item y0
  12143. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12144. by default.
  12145. @item mode
  12146. Set forward/backward mode.
  12147. Available modes are:
  12148. @table @samp
  12149. @item forward
  12150. The larger the distance from the central point, the darker the image becomes.
  12151. @item backward
  12152. The larger the distance from the central point, the brighter the image becomes.
  12153. This can be used to reverse a vignette effect, though there is no automatic
  12154. detection to extract the lens @option{angle} and other settings (yet). It can
  12155. also be used to create a burning effect.
  12156. @end table
  12157. Default value is @samp{forward}.
  12158. @item eval
  12159. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12160. It accepts the following values:
  12161. @table @samp
  12162. @item init
  12163. Evaluate expressions only once during the filter initialization.
  12164. @item frame
  12165. Evaluate expressions for each incoming frame. This is way slower than the
  12166. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12167. allows advanced dynamic expressions.
  12168. @end table
  12169. Default value is @samp{init}.
  12170. @item dither
  12171. Set dithering to reduce the circular banding effects. Default is @code{1}
  12172. (enabled).
  12173. @item aspect
  12174. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12175. Setting this value to the SAR of the input will make a rectangular vignetting
  12176. following the dimensions of the video.
  12177. Default is @code{1/1}.
  12178. @end table
  12179. @subsection Expressions
  12180. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12181. following parameters.
  12182. @table @option
  12183. @item w
  12184. @item h
  12185. input width and height
  12186. @item n
  12187. the number of input frame, starting from 0
  12188. @item pts
  12189. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12190. @var{TB} units, NAN if undefined
  12191. @item r
  12192. frame rate of the input video, NAN if the input frame rate is unknown
  12193. @item t
  12194. the PTS (Presentation TimeStamp) of the filtered video frame,
  12195. expressed in seconds, NAN if undefined
  12196. @item tb
  12197. time base of the input video
  12198. @end table
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. Apply simple strong vignetting effect:
  12203. @example
  12204. vignette=PI/4
  12205. @end example
  12206. @item
  12207. Make a flickering vignetting:
  12208. @example
  12209. vignette='PI/4+random(1)*PI/50':eval=frame
  12210. @end example
  12211. @end itemize
  12212. @section vmafmotion
  12213. Obtain the average vmaf motion score of a video.
  12214. It is one of the component filters of VMAF.
  12215. The obtained average motion score is printed through the logging system.
  12216. In the below example the input file @file{ref.mpg} is being processed and score
  12217. is computed.
  12218. @example
  12219. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12220. @end example
  12221. @section vstack
  12222. Stack input videos vertically.
  12223. All streams must be of same pixel format and of same width.
  12224. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12225. to create same output.
  12226. The filter accept the following option:
  12227. @table @option
  12228. @item inputs
  12229. Set number of input streams. Default is 2.
  12230. @item shortest
  12231. If set to 1, force the output to terminate when the shortest input
  12232. terminates. Default value is 0.
  12233. @end table
  12234. @section w3fdif
  12235. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12236. Deinterlacing Filter").
  12237. Based on the process described by Martin Weston for BBC R&D, and
  12238. implemented based on the de-interlace algorithm written by Jim
  12239. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12240. uses filter coefficients calculated by BBC R&D.
  12241. There are two sets of filter coefficients, so called "simple":
  12242. and "complex". Which set of filter coefficients is used can
  12243. be set by passing an optional parameter:
  12244. @table @option
  12245. @item filter
  12246. Set the interlacing filter coefficients. Accepts one of the following values:
  12247. @table @samp
  12248. @item simple
  12249. Simple filter coefficient set.
  12250. @item complex
  12251. More-complex filter coefficient set.
  12252. @end table
  12253. Default value is @samp{complex}.
  12254. @item deint
  12255. Specify which frames to deinterlace. Accept one of the following values:
  12256. @table @samp
  12257. @item all
  12258. Deinterlace all frames,
  12259. @item interlaced
  12260. Only deinterlace frames marked as interlaced.
  12261. @end table
  12262. Default value is @samp{all}.
  12263. @end table
  12264. @section waveform
  12265. Video waveform monitor.
  12266. The waveform monitor plots color component intensity. By default luminance
  12267. only. Each column of the waveform corresponds to a column of pixels in the
  12268. source video.
  12269. It accepts the following options:
  12270. @table @option
  12271. @item mode, m
  12272. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12273. In row mode, the graph on the left side represents color component value 0 and
  12274. the right side represents value = 255. In column mode, the top side represents
  12275. color component value = 0 and bottom side represents value = 255.
  12276. @item intensity, i
  12277. Set intensity. Smaller values are useful to find out how many values of the same
  12278. luminance are distributed across input rows/columns.
  12279. Default value is @code{0.04}. Allowed range is [0, 1].
  12280. @item mirror, r
  12281. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12282. In mirrored mode, higher values will be represented on the left
  12283. side for @code{row} mode and at the top for @code{column} mode. Default is
  12284. @code{1} (mirrored).
  12285. @item display, d
  12286. Set display mode.
  12287. It accepts the following values:
  12288. @table @samp
  12289. @item overlay
  12290. Presents information identical to that in the @code{parade}, except
  12291. that the graphs representing color components are superimposed directly
  12292. over one another.
  12293. This display mode makes it easier to spot relative differences or similarities
  12294. in overlapping areas of the color components that are supposed to be identical,
  12295. such as neutral whites, grays, or blacks.
  12296. @item stack
  12297. Display separate graph for the color components side by side in
  12298. @code{row} mode or one below the other in @code{column} mode.
  12299. @item parade
  12300. Display separate graph for the color components side by side in
  12301. @code{column} mode or one below the other in @code{row} mode.
  12302. Using this display mode makes it easy to spot color casts in the highlights
  12303. and shadows of an image, by comparing the contours of the top and the bottom
  12304. graphs of each waveform. Since whites, grays, and blacks are characterized
  12305. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12306. should display three waveforms of roughly equal width/height. If not, the
  12307. correction is easy to perform by making level adjustments the three waveforms.
  12308. @end table
  12309. Default is @code{stack}.
  12310. @item components, c
  12311. Set which color components to display. Default is 1, which means only luminance
  12312. or red color component if input is in RGB colorspace. If is set for example to
  12313. 7 it will display all 3 (if) available color components.
  12314. @item envelope, e
  12315. @table @samp
  12316. @item none
  12317. No envelope, this is default.
  12318. @item instant
  12319. Instant envelope, minimum and maximum values presented in graph will be easily
  12320. visible even with small @code{step} value.
  12321. @item peak
  12322. Hold minimum and maximum values presented in graph across time. This way you
  12323. can still spot out of range values without constantly looking at waveforms.
  12324. @item peak+instant
  12325. Peak and instant envelope combined together.
  12326. @end table
  12327. @item filter, f
  12328. @table @samp
  12329. @item lowpass
  12330. No filtering, this is default.
  12331. @item flat
  12332. Luma and chroma combined together.
  12333. @item aflat
  12334. Similar as above, but shows difference between blue and red chroma.
  12335. @item chroma
  12336. Displays only chroma.
  12337. @item color
  12338. Displays actual color value on waveform.
  12339. @item acolor
  12340. Similar as above, but with luma showing frequency of chroma values.
  12341. @end table
  12342. @item graticule, g
  12343. Set which graticule to display.
  12344. @table @samp
  12345. @item none
  12346. Do not display graticule.
  12347. @item green
  12348. Display green graticule showing legal broadcast ranges.
  12349. @end table
  12350. @item opacity, o
  12351. Set graticule opacity.
  12352. @item flags, fl
  12353. Set graticule flags.
  12354. @table @samp
  12355. @item numbers
  12356. Draw numbers above lines. By default enabled.
  12357. @item dots
  12358. Draw dots instead of lines.
  12359. @end table
  12360. @item scale, s
  12361. Set scale used for displaying graticule.
  12362. @table @samp
  12363. @item digital
  12364. @item millivolts
  12365. @item ire
  12366. @end table
  12367. Default is digital.
  12368. @item bgopacity, b
  12369. Set background opacity.
  12370. @end table
  12371. @section weave, doubleweave
  12372. The @code{weave} takes a field-based video input and join
  12373. each two sequential fields into single frame, producing a new double
  12374. height clip with half the frame rate and half the frame count.
  12375. The @code{doubleweave} works same as @code{weave} but without
  12376. halving frame rate and frame count.
  12377. It accepts the following option:
  12378. @table @option
  12379. @item first_field
  12380. Set first field. Available values are:
  12381. @table @samp
  12382. @item top, t
  12383. Set the frame as top-field-first.
  12384. @item bottom, b
  12385. Set the frame as bottom-field-first.
  12386. @end table
  12387. @end table
  12388. @subsection Examples
  12389. @itemize
  12390. @item
  12391. Interlace video using @ref{select} and @ref{separatefields} filter:
  12392. @example
  12393. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12394. @end example
  12395. @end itemize
  12396. @section xbr
  12397. Apply the xBR high-quality magnification filter which is designed for pixel
  12398. art. It follows a set of edge-detection rules, see
  12399. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12400. It accepts the following option:
  12401. @table @option
  12402. @item n
  12403. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12404. @code{3xBR} and @code{4} for @code{4xBR}.
  12405. Default is @code{3}.
  12406. @end table
  12407. @anchor{yadif}
  12408. @section yadif
  12409. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12410. filter").
  12411. It accepts the following parameters:
  12412. @table @option
  12413. @item mode
  12414. The interlacing mode to adopt. It accepts one of the following values:
  12415. @table @option
  12416. @item 0, send_frame
  12417. Output one frame for each frame.
  12418. @item 1, send_field
  12419. Output one frame for each field.
  12420. @item 2, send_frame_nospatial
  12421. Like @code{send_frame}, but it skips the spatial interlacing check.
  12422. @item 3, send_field_nospatial
  12423. Like @code{send_field}, but it skips the spatial interlacing check.
  12424. @end table
  12425. The default value is @code{send_frame}.
  12426. @item parity
  12427. The picture field parity assumed for the input interlaced video. It accepts one
  12428. of the following values:
  12429. @table @option
  12430. @item 0, tff
  12431. Assume the top field is first.
  12432. @item 1, bff
  12433. Assume the bottom field is first.
  12434. @item -1, auto
  12435. Enable automatic detection of field parity.
  12436. @end table
  12437. The default value is @code{auto}.
  12438. If the interlacing is unknown or the decoder does not export this information,
  12439. top field first will be assumed.
  12440. @item deint
  12441. Specify which frames to deinterlace. Accept one of the following
  12442. values:
  12443. @table @option
  12444. @item 0, all
  12445. Deinterlace all frames.
  12446. @item 1, interlaced
  12447. Only deinterlace frames marked as interlaced.
  12448. @end table
  12449. The default value is @code{all}.
  12450. @end table
  12451. @section zoompan
  12452. Apply Zoom & Pan effect.
  12453. This filter accepts the following options:
  12454. @table @option
  12455. @item zoom, z
  12456. Set the zoom expression. Default is 1.
  12457. @item x
  12458. @item y
  12459. Set the x and y expression. Default is 0.
  12460. @item d
  12461. Set the duration expression in number of frames.
  12462. This sets for how many number of frames effect will last for
  12463. single input image.
  12464. @item s
  12465. Set the output image size, default is 'hd720'.
  12466. @item fps
  12467. Set the output frame rate, default is '25'.
  12468. @end table
  12469. Each expression can contain the following constants:
  12470. @table @option
  12471. @item in_w, iw
  12472. Input width.
  12473. @item in_h, ih
  12474. Input height.
  12475. @item out_w, ow
  12476. Output width.
  12477. @item out_h, oh
  12478. Output height.
  12479. @item in
  12480. Input frame count.
  12481. @item on
  12482. Output frame count.
  12483. @item x
  12484. @item y
  12485. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12486. for current input frame.
  12487. @item px
  12488. @item py
  12489. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12490. not yet such frame (first input frame).
  12491. @item zoom
  12492. Last calculated zoom from 'z' expression for current input frame.
  12493. @item pzoom
  12494. Last calculated zoom of last output frame of previous input frame.
  12495. @item duration
  12496. Number of output frames for current input frame. Calculated from 'd' expression
  12497. for each input frame.
  12498. @item pduration
  12499. number of output frames created for previous input frame
  12500. @item a
  12501. Rational number: input width / input height
  12502. @item sar
  12503. sample aspect ratio
  12504. @item dar
  12505. display aspect ratio
  12506. @end table
  12507. @subsection Examples
  12508. @itemize
  12509. @item
  12510. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12511. @example
  12512. 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
  12513. @end example
  12514. @item
  12515. Zoom-in up to 1.5 and pan always at center of picture:
  12516. @example
  12517. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12518. @end example
  12519. @item
  12520. Same as above but without pausing:
  12521. @example
  12522. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12523. @end example
  12524. @end itemize
  12525. @anchor{zscale}
  12526. @section zscale
  12527. Scale (resize) the input video, using the z.lib library:
  12528. https://github.com/sekrit-twc/zimg.
  12529. The zscale filter forces the output display aspect ratio to be the same
  12530. as the input, by changing the output sample aspect ratio.
  12531. If the input image format is different from the format requested by
  12532. the next filter, the zscale filter will convert the input to the
  12533. requested format.
  12534. @subsection Options
  12535. The filter accepts the following options.
  12536. @table @option
  12537. @item width, w
  12538. @item height, h
  12539. Set the output video dimension expression. Default value is the input
  12540. dimension.
  12541. If the @var{width} or @var{w} value is 0, the input width is used for
  12542. the output. If the @var{height} or @var{h} value is 0, the input height
  12543. is used for the output.
  12544. If one and only one of the values is -n with n >= 1, the zscale filter
  12545. will use a value that maintains the aspect ratio of the input image,
  12546. calculated from the other specified dimension. After that it will,
  12547. however, make sure that the calculated dimension is divisible by n and
  12548. adjust the value if necessary.
  12549. If both values are -n with n >= 1, the behavior will be identical to
  12550. both values being set to 0 as previously detailed.
  12551. See below for the list of accepted constants for use in the dimension
  12552. expression.
  12553. @item size, s
  12554. Set the video size. For the syntax of this option, check the
  12555. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12556. @item dither, d
  12557. Set the dither type.
  12558. Possible values are:
  12559. @table @var
  12560. @item none
  12561. @item ordered
  12562. @item random
  12563. @item error_diffusion
  12564. @end table
  12565. Default is none.
  12566. @item filter, f
  12567. Set the resize filter type.
  12568. Possible values are:
  12569. @table @var
  12570. @item point
  12571. @item bilinear
  12572. @item bicubic
  12573. @item spline16
  12574. @item spline36
  12575. @item lanczos
  12576. @end table
  12577. Default is bilinear.
  12578. @item range, r
  12579. Set the color range.
  12580. Possible values are:
  12581. @table @var
  12582. @item input
  12583. @item limited
  12584. @item full
  12585. @end table
  12586. Default is same as input.
  12587. @item primaries, p
  12588. Set the color primaries.
  12589. Possible values are:
  12590. @table @var
  12591. @item input
  12592. @item 709
  12593. @item unspecified
  12594. @item 170m
  12595. @item 240m
  12596. @item 2020
  12597. @end table
  12598. Default is same as input.
  12599. @item transfer, t
  12600. Set the transfer characteristics.
  12601. Possible values are:
  12602. @table @var
  12603. @item input
  12604. @item 709
  12605. @item unspecified
  12606. @item 601
  12607. @item linear
  12608. @item 2020_10
  12609. @item 2020_12
  12610. @item smpte2084
  12611. @item iec61966-2-1
  12612. @item arib-std-b67
  12613. @end table
  12614. Default is same as input.
  12615. @item matrix, m
  12616. Set the colorspace matrix.
  12617. Possible value are:
  12618. @table @var
  12619. @item input
  12620. @item 709
  12621. @item unspecified
  12622. @item 470bg
  12623. @item 170m
  12624. @item 2020_ncl
  12625. @item 2020_cl
  12626. @end table
  12627. Default is same as input.
  12628. @item rangein, rin
  12629. Set the input color range.
  12630. Possible values are:
  12631. @table @var
  12632. @item input
  12633. @item limited
  12634. @item full
  12635. @end table
  12636. Default is same as input.
  12637. @item primariesin, pin
  12638. Set the input color primaries.
  12639. Possible values are:
  12640. @table @var
  12641. @item input
  12642. @item 709
  12643. @item unspecified
  12644. @item 170m
  12645. @item 240m
  12646. @item 2020
  12647. @end table
  12648. Default is same as input.
  12649. @item transferin, tin
  12650. Set the input transfer characteristics.
  12651. Possible values are:
  12652. @table @var
  12653. @item input
  12654. @item 709
  12655. @item unspecified
  12656. @item 601
  12657. @item linear
  12658. @item 2020_10
  12659. @item 2020_12
  12660. @end table
  12661. Default is same as input.
  12662. @item matrixin, min
  12663. Set the input colorspace matrix.
  12664. Possible value are:
  12665. @table @var
  12666. @item input
  12667. @item 709
  12668. @item unspecified
  12669. @item 470bg
  12670. @item 170m
  12671. @item 2020_ncl
  12672. @item 2020_cl
  12673. @end table
  12674. @item chromal, c
  12675. Set the output chroma location.
  12676. Possible values are:
  12677. @table @var
  12678. @item input
  12679. @item left
  12680. @item center
  12681. @item topleft
  12682. @item top
  12683. @item bottomleft
  12684. @item bottom
  12685. @end table
  12686. @item chromalin, cin
  12687. Set the input chroma location.
  12688. Possible values are:
  12689. @table @var
  12690. @item input
  12691. @item left
  12692. @item center
  12693. @item topleft
  12694. @item top
  12695. @item bottomleft
  12696. @item bottom
  12697. @end table
  12698. @item npl
  12699. Set the nominal peak luminance.
  12700. @end table
  12701. The values of the @option{w} and @option{h} options are expressions
  12702. containing the following constants:
  12703. @table @var
  12704. @item in_w
  12705. @item in_h
  12706. The input width and height
  12707. @item iw
  12708. @item ih
  12709. These are the same as @var{in_w} and @var{in_h}.
  12710. @item out_w
  12711. @item out_h
  12712. The output (scaled) width and height
  12713. @item ow
  12714. @item oh
  12715. These are the same as @var{out_w} and @var{out_h}
  12716. @item a
  12717. The same as @var{iw} / @var{ih}
  12718. @item sar
  12719. input sample aspect ratio
  12720. @item dar
  12721. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12722. @item hsub
  12723. @item vsub
  12724. horizontal and vertical input chroma subsample values. For example for the
  12725. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12726. @item ohsub
  12727. @item ovsub
  12728. horizontal and vertical output chroma subsample values. For example for the
  12729. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12730. @end table
  12731. @table @option
  12732. @end table
  12733. @c man end VIDEO FILTERS
  12734. @chapter Video Sources
  12735. @c man begin VIDEO SOURCES
  12736. Below is a description of the currently available video sources.
  12737. @section buffer
  12738. Buffer video frames, and make them available to the filter chain.
  12739. This source is mainly intended for a programmatic use, in particular
  12740. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12741. It accepts the following parameters:
  12742. @table @option
  12743. @item video_size
  12744. Specify the size (width and height) of the buffered video frames. For the
  12745. syntax of this option, check the
  12746. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12747. @item width
  12748. The input video width.
  12749. @item height
  12750. The input video height.
  12751. @item pix_fmt
  12752. A string representing the pixel format of the buffered video frames.
  12753. It may be a number corresponding to a pixel format, or a pixel format
  12754. name.
  12755. @item time_base
  12756. Specify the timebase assumed by the timestamps of the buffered frames.
  12757. @item frame_rate
  12758. Specify the frame rate expected for the video stream.
  12759. @item pixel_aspect, sar
  12760. The sample (pixel) aspect ratio of the input video.
  12761. @item sws_param
  12762. Specify the optional parameters to be used for the scale filter which
  12763. is automatically inserted when an input change is detected in the
  12764. input size or format.
  12765. @item hw_frames_ctx
  12766. When using a hardware pixel format, this should be a reference to an
  12767. AVHWFramesContext describing input frames.
  12768. @end table
  12769. For example:
  12770. @example
  12771. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12772. @end example
  12773. will instruct the source to accept video frames with size 320x240 and
  12774. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12775. square pixels (1:1 sample aspect ratio).
  12776. Since the pixel format with name "yuv410p" corresponds to the number 6
  12777. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12778. this example corresponds to:
  12779. @example
  12780. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12781. @end example
  12782. Alternatively, the options can be specified as a flat string, but this
  12783. syntax is deprecated:
  12784. @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}]
  12785. @section cellauto
  12786. Create a pattern generated by an elementary cellular automaton.
  12787. The initial state of the cellular automaton can be defined through the
  12788. @option{filename} and @option{pattern} options. If such options are
  12789. not specified an initial state is created randomly.
  12790. At each new frame a new row in the video is filled with the result of
  12791. the cellular automaton next generation. The behavior when the whole
  12792. frame is filled is defined by the @option{scroll} option.
  12793. This source accepts the following options:
  12794. @table @option
  12795. @item filename, f
  12796. Read the initial cellular automaton state, i.e. the starting row, from
  12797. the specified file.
  12798. In the file, each non-whitespace character is considered an alive
  12799. cell, a newline will terminate the row, and further characters in the
  12800. file will be ignored.
  12801. @item pattern, p
  12802. Read the initial cellular automaton state, i.e. the starting row, from
  12803. the specified string.
  12804. Each non-whitespace character in the string is considered an alive
  12805. cell, a newline will terminate the row, and further characters in the
  12806. string will be ignored.
  12807. @item rate, r
  12808. Set the video rate, that is the number of frames generated per second.
  12809. Default is 25.
  12810. @item random_fill_ratio, ratio
  12811. Set the random fill ratio for the initial cellular automaton row. It
  12812. is a floating point number value ranging from 0 to 1, defaults to
  12813. 1/PHI.
  12814. This option is ignored when a file or a pattern is specified.
  12815. @item random_seed, seed
  12816. Set the seed for filling randomly the initial row, must be an integer
  12817. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12818. set to -1, the filter will try to use a good random seed on a best
  12819. effort basis.
  12820. @item rule
  12821. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12822. Default value is 110.
  12823. @item size, s
  12824. Set the size of the output video. For the syntax of this option, check the
  12825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12826. If @option{filename} or @option{pattern} is specified, the size is set
  12827. by default to the width of the specified initial state row, and the
  12828. height is set to @var{width} * PHI.
  12829. If @option{size} is set, it must contain the width of the specified
  12830. pattern string, and the specified pattern will be centered in the
  12831. larger row.
  12832. If a filename or a pattern string is not specified, the size value
  12833. defaults to "320x518" (used for a randomly generated initial state).
  12834. @item scroll
  12835. If set to 1, scroll the output upward when all the rows in the output
  12836. have been already filled. If set to 0, the new generated row will be
  12837. written over the top row just after the bottom row is filled.
  12838. Defaults to 1.
  12839. @item start_full, full
  12840. If set to 1, completely fill the output with generated rows before
  12841. outputting the first frame.
  12842. This is the default behavior, for disabling set the value to 0.
  12843. @item stitch
  12844. If set to 1, stitch the left and right row edges together.
  12845. This is the default behavior, for disabling set the value to 0.
  12846. @end table
  12847. @subsection Examples
  12848. @itemize
  12849. @item
  12850. Read the initial state from @file{pattern}, and specify an output of
  12851. size 200x400.
  12852. @example
  12853. cellauto=f=pattern:s=200x400
  12854. @end example
  12855. @item
  12856. Generate a random initial row with a width of 200 cells, with a fill
  12857. ratio of 2/3:
  12858. @example
  12859. cellauto=ratio=2/3:s=200x200
  12860. @end example
  12861. @item
  12862. Create a pattern generated by rule 18 starting by a single alive cell
  12863. centered on an initial row with width 100:
  12864. @example
  12865. cellauto=p=@@:s=100x400:full=0:rule=18
  12866. @end example
  12867. @item
  12868. Specify a more elaborated initial pattern:
  12869. @example
  12870. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12871. @end example
  12872. @end itemize
  12873. @anchor{coreimagesrc}
  12874. @section coreimagesrc
  12875. Video source generated on GPU using Apple's CoreImage API on OSX.
  12876. This video source is a specialized version of the @ref{coreimage} video filter.
  12877. Use a core image generator at the beginning of the applied filterchain to
  12878. generate the content.
  12879. The coreimagesrc video source accepts the following options:
  12880. @table @option
  12881. @item list_generators
  12882. List all available generators along with all their respective options as well as
  12883. possible minimum and maximum values along with the default values.
  12884. @example
  12885. list_generators=true
  12886. @end example
  12887. @item size, s
  12888. Specify the size of the sourced video. For the syntax of this option, check the
  12889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12890. The default value is @code{320x240}.
  12891. @item rate, r
  12892. Specify the frame rate of the sourced video, as the number of frames
  12893. generated per second. It has to be a string in the format
  12894. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12895. number or a valid video frame rate abbreviation. The default value is
  12896. "25".
  12897. @item sar
  12898. Set the sample aspect ratio of the sourced video.
  12899. @item duration, d
  12900. Set the duration of the sourced video. See
  12901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12902. for the accepted syntax.
  12903. If not specified, or the expressed duration is negative, the video is
  12904. supposed to be generated forever.
  12905. @end table
  12906. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12907. A complete filterchain can be used for further processing of the
  12908. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12909. and examples for details.
  12910. @subsection Examples
  12911. @itemize
  12912. @item
  12913. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12914. given as complete and escaped command-line for Apple's standard bash shell:
  12915. @example
  12916. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12917. @end example
  12918. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12919. need for a nullsrc video source.
  12920. @end itemize
  12921. @section mandelbrot
  12922. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12923. point specified with @var{start_x} and @var{start_y}.
  12924. This source accepts the following options:
  12925. @table @option
  12926. @item end_pts
  12927. Set the terminal pts value. Default value is 400.
  12928. @item end_scale
  12929. Set the terminal scale value.
  12930. Must be a floating point value. Default value is 0.3.
  12931. @item inner
  12932. Set the inner coloring mode, that is the algorithm used to draw the
  12933. Mandelbrot fractal internal region.
  12934. It shall assume one of the following values:
  12935. @table @option
  12936. @item black
  12937. Set black mode.
  12938. @item convergence
  12939. Show time until convergence.
  12940. @item mincol
  12941. Set color based on point closest to the origin of the iterations.
  12942. @item period
  12943. Set period mode.
  12944. @end table
  12945. Default value is @var{mincol}.
  12946. @item bailout
  12947. Set the bailout value. Default value is 10.0.
  12948. @item maxiter
  12949. Set the maximum of iterations performed by the rendering
  12950. algorithm. Default value is 7189.
  12951. @item outer
  12952. Set outer coloring mode.
  12953. It shall assume one of following values:
  12954. @table @option
  12955. @item iteration_count
  12956. Set iteration cound mode.
  12957. @item normalized_iteration_count
  12958. set normalized iteration count mode.
  12959. @end table
  12960. Default value is @var{normalized_iteration_count}.
  12961. @item rate, r
  12962. Set frame rate, expressed as number of frames per second. Default
  12963. value is "25".
  12964. @item size, s
  12965. Set frame size. For the syntax of this option, check the "Video
  12966. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12967. @item start_scale
  12968. Set the initial scale value. Default value is 3.0.
  12969. @item start_x
  12970. Set the initial x position. Must be a floating point value between
  12971. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12972. @item start_y
  12973. Set the initial y position. Must be a floating point value between
  12974. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12975. @end table
  12976. @section mptestsrc
  12977. Generate various test patterns, as generated by the MPlayer test filter.
  12978. The size of the generated video is fixed, and is 256x256.
  12979. This source is useful in particular for testing encoding features.
  12980. This source accepts the following options:
  12981. @table @option
  12982. @item rate, r
  12983. Specify the frame rate of the sourced video, as the number of frames
  12984. generated per second. It has to be a string in the format
  12985. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12986. number or a valid video frame rate abbreviation. The default value is
  12987. "25".
  12988. @item duration, d
  12989. Set the duration of the sourced video. See
  12990. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12991. for the accepted syntax.
  12992. If not specified, or the expressed duration is negative, the video is
  12993. supposed to be generated forever.
  12994. @item test, t
  12995. Set the number or the name of the test to perform. Supported tests are:
  12996. @table @option
  12997. @item dc_luma
  12998. @item dc_chroma
  12999. @item freq_luma
  13000. @item freq_chroma
  13001. @item amp_luma
  13002. @item amp_chroma
  13003. @item cbp
  13004. @item mv
  13005. @item ring1
  13006. @item ring2
  13007. @item all
  13008. @end table
  13009. Default value is "all", which will cycle through the list of all tests.
  13010. @end table
  13011. Some examples:
  13012. @example
  13013. mptestsrc=t=dc_luma
  13014. @end example
  13015. will generate a "dc_luma" test pattern.
  13016. @section frei0r_src
  13017. Provide a frei0r source.
  13018. To enable compilation of this filter you need to install the frei0r
  13019. header and configure FFmpeg with @code{--enable-frei0r}.
  13020. This source accepts the following parameters:
  13021. @table @option
  13022. @item size
  13023. The size of the video to generate. For the syntax of this option, check the
  13024. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13025. @item framerate
  13026. The framerate of the generated video. It may be a string of the form
  13027. @var{num}/@var{den} or a frame rate abbreviation.
  13028. @item filter_name
  13029. The name to the frei0r source to load. For more information regarding frei0r and
  13030. how to set the parameters, read the @ref{frei0r} section in the video filters
  13031. documentation.
  13032. @item filter_params
  13033. A '|'-separated list of parameters to pass to the frei0r source.
  13034. @end table
  13035. For example, to generate a frei0r partik0l source with size 200x200
  13036. and frame rate 10 which is overlaid on the overlay filter main input:
  13037. @example
  13038. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13039. @end example
  13040. @section life
  13041. Generate a life pattern.
  13042. This source is based on a generalization of John Conway's life game.
  13043. The sourced input represents a life grid, each pixel represents a cell
  13044. which can be in one of two possible states, alive or dead. Every cell
  13045. interacts with its eight neighbours, which are the cells that are
  13046. horizontally, vertically, or diagonally adjacent.
  13047. At each interaction the grid evolves according to the adopted rule,
  13048. which specifies the number of neighbor alive cells which will make a
  13049. cell stay alive or born. The @option{rule} option allows one to specify
  13050. the rule to adopt.
  13051. This source accepts the following options:
  13052. @table @option
  13053. @item filename, f
  13054. Set the file from which to read the initial grid state. In the file,
  13055. each non-whitespace character is considered an alive cell, and newline
  13056. is used to delimit the end of each row.
  13057. If this option is not specified, the initial grid is generated
  13058. randomly.
  13059. @item rate, r
  13060. Set the video rate, that is the number of frames generated per second.
  13061. Default is 25.
  13062. @item random_fill_ratio, ratio
  13063. Set the random fill ratio for the initial random grid. It is a
  13064. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13065. It is ignored when a file is specified.
  13066. @item random_seed, seed
  13067. Set the seed for filling the initial random grid, must be an integer
  13068. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13069. set to -1, the filter will try to use a good random seed on a best
  13070. effort basis.
  13071. @item rule
  13072. Set the life rule.
  13073. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13074. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13075. @var{NS} specifies the number of alive neighbor cells which make a
  13076. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13077. which make a dead cell to become alive (i.e. to "born").
  13078. "s" and "b" can be used in place of "S" and "B", respectively.
  13079. Alternatively a rule can be specified by an 18-bits integer. The 9
  13080. high order bits are used to encode the next cell state if it is alive
  13081. for each number of neighbor alive cells, the low order bits specify
  13082. the rule for "borning" new cells. Higher order bits encode for an
  13083. higher number of neighbor cells.
  13084. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13085. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13086. Default value is "S23/B3", which is the original Conway's game of life
  13087. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13088. cells, and will born a new cell if there are three alive cells around
  13089. a dead cell.
  13090. @item size, s
  13091. Set the size of the output video. For the syntax of this option, check the
  13092. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13093. If @option{filename} is specified, the size is set by default to the
  13094. same size of the input file. If @option{size} is set, it must contain
  13095. the size specified in the input file, and the initial grid defined in
  13096. that file is centered in the larger resulting area.
  13097. If a filename is not specified, the size value defaults to "320x240"
  13098. (used for a randomly generated initial grid).
  13099. @item stitch
  13100. If set to 1, stitch the left and right grid edges together, and the
  13101. top and bottom edges also. Defaults to 1.
  13102. @item mold
  13103. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13104. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13105. value from 0 to 255.
  13106. @item life_color
  13107. Set the color of living (or new born) cells.
  13108. @item death_color
  13109. Set the color of dead cells. If @option{mold} is set, this is the first color
  13110. used to represent a dead cell.
  13111. @item mold_color
  13112. Set mold color, for definitely dead and moldy cells.
  13113. For the syntax of these 3 color options, check the "Color" section in the
  13114. ffmpeg-utils manual.
  13115. @end table
  13116. @subsection Examples
  13117. @itemize
  13118. @item
  13119. Read a grid from @file{pattern}, and center it on a grid of size
  13120. 300x300 pixels:
  13121. @example
  13122. life=f=pattern:s=300x300
  13123. @end example
  13124. @item
  13125. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13126. @example
  13127. life=ratio=2/3:s=200x200
  13128. @end example
  13129. @item
  13130. Specify a custom rule for evolving a randomly generated grid:
  13131. @example
  13132. life=rule=S14/B34
  13133. @end example
  13134. @item
  13135. Full example with slow death effect (mold) using @command{ffplay}:
  13136. @example
  13137. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13138. @end example
  13139. @end itemize
  13140. @anchor{allrgb}
  13141. @anchor{allyuv}
  13142. @anchor{color}
  13143. @anchor{haldclutsrc}
  13144. @anchor{nullsrc}
  13145. @anchor{rgbtestsrc}
  13146. @anchor{smptebars}
  13147. @anchor{smptehdbars}
  13148. @anchor{testsrc}
  13149. @anchor{testsrc2}
  13150. @anchor{yuvtestsrc}
  13151. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13152. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13153. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13154. The @code{color} source provides an uniformly colored input.
  13155. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13156. @ref{haldclut} filter.
  13157. The @code{nullsrc} source returns unprocessed video frames. It is
  13158. mainly useful to be employed in analysis / debugging tools, or as the
  13159. source for filters which ignore the input data.
  13160. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13161. detecting RGB vs BGR issues. You should see a red, green and blue
  13162. stripe from top to bottom.
  13163. The @code{smptebars} source generates a color bars pattern, based on
  13164. the SMPTE Engineering Guideline EG 1-1990.
  13165. The @code{smptehdbars} source generates a color bars pattern, based on
  13166. the SMPTE RP 219-2002.
  13167. The @code{testsrc} source generates a test video pattern, showing a
  13168. color pattern, a scrolling gradient and a timestamp. This is mainly
  13169. intended for testing purposes.
  13170. The @code{testsrc2} source is similar to testsrc, but supports more
  13171. pixel formats instead of just @code{rgb24}. This allows using it as an
  13172. input for other tests without requiring a format conversion.
  13173. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13174. see a y, cb and cr stripe from top to bottom.
  13175. The sources accept the following parameters:
  13176. @table @option
  13177. @item level
  13178. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13179. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13180. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13181. coded on a @code{1/(N*N)} scale.
  13182. @item color, c
  13183. Specify the color of the source, only available in the @code{color}
  13184. source. For the syntax of this option, check the "Color" section in the
  13185. ffmpeg-utils manual.
  13186. @item size, s
  13187. Specify the size of the sourced video. For the syntax of this option, check the
  13188. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13189. The default value is @code{320x240}.
  13190. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13191. @code{haldclutsrc} filters.
  13192. @item rate, r
  13193. Specify the frame rate of the sourced video, as the number of frames
  13194. generated per second. It has to be a string in the format
  13195. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13196. number or a valid video frame rate abbreviation. The default value is
  13197. "25".
  13198. @item duration, d
  13199. Set the duration of the sourced video. See
  13200. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13201. for the accepted syntax.
  13202. If not specified, or the expressed duration is negative, the video is
  13203. supposed to be generated forever.
  13204. @item sar
  13205. Set the sample aspect ratio of the sourced video.
  13206. @item alpha
  13207. Specify the alpha (opacity) of the background, only available in the
  13208. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13209. 255 (fully opaque, the default).
  13210. @item decimals, n
  13211. Set the number of decimals to show in the timestamp, only available in the
  13212. @code{testsrc} source.
  13213. The displayed timestamp value will correspond to the original
  13214. timestamp value multiplied by the power of 10 of the specified
  13215. value. Default value is 0.
  13216. @end table
  13217. @subsection Examples
  13218. @itemize
  13219. @item
  13220. Generate a video with a duration of 5.3 seconds, with size
  13221. 176x144 and a frame rate of 10 frames per second:
  13222. @example
  13223. testsrc=duration=5.3:size=qcif:rate=10
  13224. @end example
  13225. @item
  13226. The following graph description will generate a red source
  13227. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13228. frames per second:
  13229. @example
  13230. color=c=red@@0.2:s=qcif:r=10
  13231. @end example
  13232. @item
  13233. If the input content is to be ignored, @code{nullsrc} can be used. The
  13234. following command generates noise in the luminance plane by employing
  13235. the @code{geq} filter:
  13236. @example
  13237. nullsrc=s=256x256, geq=random(1)*255:128:128
  13238. @end example
  13239. @end itemize
  13240. @subsection Commands
  13241. The @code{color} source supports the following commands:
  13242. @table @option
  13243. @item c, color
  13244. Set the color of the created image. Accepts the same syntax of the
  13245. corresponding @option{color} option.
  13246. @end table
  13247. @c man end VIDEO SOURCES
  13248. @chapter Video Sinks
  13249. @c man begin VIDEO SINKS
  13250. Below is a description of the currently available video sinks.
  13251. @section buffersink
  13252. Buffer video frames, and make them available to the end of the filter
  13253. graph.
  13254. This sink is mainly intended for programmatic use, in particular
  13255. through the interface defined in @file{libavfilter/buffersink.h}
  13256. or the options system.
  13257. It accepts a pointer to an AVBufferSinkContext structure, which
  13258. defines the incoming buffers' formats, to be passed as the opaque
  13259. parameter to @code{avfilter_init_filter} for initialization.
  13260. @section nullsink
  13261. Null video sink: do absolutely nothing with the input video. It is
  13262. mainly useful as a template and for use in analysis / debugging
  13263. tools.
  13264. @c man end VIDEO SINKS
  13265. @chapter Multimedia Filters
  13266. @c man begin MULTIMEDIA FILTERS
  13267. Below is a description of the currently available multimedia filters.
  13268. @section abitscope
  13269. Convert input audio to a video output, displaying the audio bit scope.
  13270. The filter accepts the following options:
  13271. @table @option
  13272. @item rate, r
  13273. Set frame rate, expressed as number of frames per second. Default
  13274. value is "25".
  13275. @item size, s
  13276. Specify the video size for the output. For the syntax of this option, check the
  13277. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13278. Default value is @code{1024x256}.
  13279. @item colors
  13280. Specify list of colors separated by space or by '|' which will be used to
  13281. draw channels. Unrecognized or missing colors will be replaced
  13282. by white color.
  13283. @end table
  13284. @section ahistogram
  13285. Convert input audio to a video output, displaying the volume histogram.
  13286. The filter accepts the following options:
  13287. @table @option
  13288. @item dmode
  13289. Specify how histogram is calculated.
  13290. It accepts the following values:
  13291. @table @samp
  13292. @item single
  13293. Use single histogram for all channels.
  13294. @item separate
  13295. Use separate histogram for each channel.
  13296. @end table
  13297. Default is @code{single}.
  13298. @item rate, r
  13299. Set frame rate, expressed as number of frames per second. Default
  13300. value is "25".
  13301. @item size, s
  13302. Specify the video size for the output. For the syntax of this option, check the
  13303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13304. Default value is @code{hd720}.
  13305. @item scale
  13306. Set display scale.
  13307. It accepts the following values:
  13308. @table @samp
  13309. @item log
  13310. logarithmic
  13311. @item sqrt
  13312. square root
  13313. @item cbrt
  13314. cubic root
  13315. @item lin
  13316. linear
  13317. @item rlog
  13318. reverse logarithmic
  13319. @end table
  13320. Default is @code{log}.
  13321. @item ascale
  13322. Set amplitude scale.
  13323. It accepts the following values:
  13324. @table @samp
  13325. @item log
  13326. logarithmic
  13327. @item lin
  13328. linear
  13329. @end table
  13330. Default is @code{log}.
  13331. @item acount
  13332. Set how much frames to accumulate in histogram.
  13333. Defauls is 1. Setting this to -1 accumulates all frames.
  13334. @item rheight
  13335. Set histogram ratio of window height.
  13336. @item slide
  13337. Set sonogram sliding.
  13338. It accepts the following values:
  13339. @table @samp
  13340. @item replace
  13341. replace old rows with new ones.
  13342. @item scroll
  13343. scroll from top to bottom.
  13344. @end table
  13345. Default is @code{replace}.
  13346. @end table
  13347. @section aphasemeter
  13348. Convert input audio to a video output, displaying the audio phase.
  13349. The filter accepts the following options:
  13350. @table @option
  13351. @item rate, r
  13352. Set the output frame rate. Default value is @code{25}.
  13353. @item size, s
  13354. Set the video size for the output. For the syntax of this option, check the
  13355. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13356. Default value is @code{800x400}.
  13357. @item rc
  13358. @item gc
  13359. @item bc
  13360. Specify the red, green, blue contrast. Default values are @code{2},
  13361. @code{7} and @code{1}.
  13362. Allowed range is @code{[0, 255]}.
  13363. @item mpc
  13364. Set color which will be used for drawing median phase. If color is
  13365. @code{none} which is default, no median phase value will be drawn.
  13366. @item video
  13367. Enable video output. Default is enabled.
  13368. @end table
  13369. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13370. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13371. The @code{-1} means left and right channels are completely out of phase and
  13372. @code{1} means channels are in phase.
  13373. @section avectorscope
  13374. Convert input audio to a video output, representing the audio vector
  13375. scope.
  13376. The filter is used to measure the difference between channels of stereo
  13377. audio stream. A monoaural signal, consisting of identical left and right
  13378. signal, results in straight vertical line. Any stereo separation is visible
  13379. as a deviation from this line, creating a Lissajous figure.
  13380. If the straight (or deviation from it) but horizontal line appears this
  13381. indicates that the left and right channels are out of phase.
  13382. The filter accepts the following options:
  13383. @table @option
  13384. @item mode, m
  13385. Set the vectorscope mode.
  13386. Available values are:
  13387. @table @samp
  13388. @item lissajous
  13389. Lissajous rotated by 45 degrees.
  13390. @item lissajous_xy
  13391. Same as above but not rotated.
  13392. @item polar
  13393. Shape resembling half of circle.
  13394. @end table
  13395. Default value is @samp{lissajous}.
  13396. @item size, s
  13397. Set the video size for the output. For the syntax of this option, check the
  13398. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13399. Default value is @code{400x400}.
  13400. @item rate, r
  13401. Set the output frame rate. Default value is @code{25}.
  13402. @item rc
  13403. @item gc
  13404. @item bc
  13405. @item ac
  13406. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13407. @code{160}, @code{80} and @code{255}.
  13408. Allowed range is @code{[0, 255]}.
  13409. @item rf
  13410. @item gf
  13411. @item bf
  13412. @item af
  13413. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13414. @code{10}, @code{5} and @code{5}.
  13415. Allowed range is @code{[0, 255]}.
  13416. @item zoom
  13417. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13418. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13419. @item draw
  13420. Set the vectorscope drawing mode.
  13421. Available values are:
  13422. @table @samp
  13423. @item dot
  13424. Draw dot for each sample.
  13425. @item line
  13426. Draw line between previous and current sample.
  13427. @end table
  13428. Default value is @samp{dot}.
  13429. @item scale
  13430. Specify amplitude scale of audio samples.
  13431. Available values are:
  13432. @table @samp
  13433. @item lin
  13434. Linear.
  13435. @item sqrt
  13436. Square root.
  13437. @item cbrt
  13438. Cubic root.
  13439. @item log
  13440. Logarithmic.
  13441. @end table
  13442. @item swap
  13443. Swap left channel axis with right channel axis.
  13444. @item mirror
  13445. Mirror axis.
  13446. @table @samp
  13447. @item none
  13448. No mirror.
  13449. @item x
  13450. Mirror only x axis.
  13451. @item y
  13452. Mirror only y axis.
  13453. @item xy
  13454. Mirror both axis.
  13455. @end table
  13456. @end table
  13457. @subsection Examples
  13458. @itemize
  13459. @item
  13460. Complete example using @command{ffplay}:
  13461. @example
  13462. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13463. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13464. @end example
  13465. @end itemize
  13466. @section bench, abench
  13467. Benchmark part of a filtergraph.
  13468. The filter accepts the following options:
  13469. @table @option
  13470. @item action
  13471. Start or stop a timer.
  13472. Available values are:
  13473. @table @samp
  13474. @item start
  13475. Get the current time, set it as frame metadata (using the key
  13476. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13477. @item stop
  13478. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13479. the input frame metadata to get the time difference. Time difference, average,
  13480. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13481. @code{min}) are then printed. The timestamps are expressed in seconds.
  13482. @end table
  13483. @end table
  13484. @subsection Examples
  13485. @itemize
  13486. @item
  13487. Benchmark @ref{selectivecolor} filter:
  13488. @example
  13489. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13490. @end example
  13491. @end itemize
  13492. @section concat
  13493. Concatenate audio and video streams, joining them together one after the
  13494. other.
  13495. The filter works on segments of synchronized video and audio streams. All
  13496. segments must have the same number of streams of each type, and that will
  13497. also be the number of streams at output.
  13498. The filter accepts the following options:
  13499. @table @option
  13500. @item n
  13501. Set the number of segments. Default is 2.
  13502. @item v
  13503. Set the number of output video streams, that is also the number of video
  13504. streams in each segment. Default is 1.
  13505. @item a
  13506. Set the number of output audio streams, that is also the number of audio
  13507. streams in each segment. Default is 0.
  13508. @item unsafe
  13509. Activate unsafe mode: do not fail if segments have a different format.
  13510. @end table
  13511. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13512. @var{a} audio outputs.
  13513. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13514. segment, in the same order as the outputs, then the inputs for the second
  13515. segment, etc.
  13516. Related streams do not always have exactly the same duration, for various
  13517. reasons including codec frame size or sloppy authoring. For that reason,
  13518. related synchronized streams (e.g. a video and its audio track) should be
  13519. concatenated at once. The concat filter will use the duration of the longest
  13520. stream in each segment (except the last one), and if necessary pad shorter
  13521. audio streams with silence.
  13522. For this filter to work correctly, all segments must start at timestamp 0.
  13523. All corresponding streams must have the same parameters in all segments; the
  13524. filtering system will automatically select a common pixel format for video
  13525. streams, and a common sample format, sample rate and channel layout for
  13526. audio streams, but other settings, such as resolution, must be converted
  13527. explicitly by the user.
  13528. Different frame rates are acceptable but will result in variable frame rate
  13529. at output; be sure to configure the output file to handle it.
  13530. @subsection Examples
  13531. @itemize
  13532. @item
  13533. Concatenate an opening, an episode and an ending, all in bilingual version
  13534. (video in stream 0, audio in streams 1 and 2):
  13535. @example
  13536. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13537. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13538. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13539. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13540. @end example
  13541. @item
  13542. Concatenate two parts, handling audio and video separately, using the
  13543. (a)movie sources, and adjusting the resolution:
  13544. @example
  13545. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13546. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13547. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13548. @end example
  13549. Note that a desync will happen at the stitch if the audio and video streams
  13550. do not have exactly the same duration in the first file.
  13551. @end itemize
  13552. @section drawgraph, adrawgraph
  13553. Draw a graph using input video or audio metadata.
  13554. It accepts the following parameters:
  13555. @table @option
  13556. @item m1
  13557. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13558. @item fg1
  13559. Set 1st foreground color expression.
  13560. @item m2
  13561. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13562. @item fg2
  13563. Set 2nd foreground color expression.
  13564. @item m3
  13565. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13566. @item fg3
  13567. Set 3rd foreground color expression.
  13568. @item m4
  13569. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13570. @item fg4
  13571. Set 4th foreground color expression.
  13572. @item min
  13573. Set minimal value of metadata value.
  13574. @item max
  13575. Set maximal value of metadata value.
  13576. @item bg
  13577. Set graph background color. Default is white.
  13578. @item mode
  13579. Set graph mode.
  13580. Available values for mode is:
  13581. @table @samp
  13582. @item bar
  13583. @item dot
  13584. @item line
  13585. @end table
  13586. Default is @code{line}.
  13587. @item slide
  13588. Set slide mode.
  13589. Available values for slide is:
  13590. @table @samp
  13591. @item frame
  13592. Draw new frame when right border is reached.
  13593. @item replace
  13594. Replace old columns with new ones.
  13595. @item scroll
  13596. Scroll from right to left.
  13597. @item rscroll
  13598. Scroll from left to right.
  13599. @item picture
  13600. Draw single picture.
  13601. @end table
  13602. Default is @code{frame}.
  13603. @item size
  13604. Set size of graph video. For the syntax of this option, check the
  13605. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13606. The default value is @code{900x256}.
  13607. The foreground color expressions can use the following variables:
  13608. @table @option
  13609. @item MIN
  13610. Minimal value of metadata value.
  13611. @item MAX
  13612. Maximal value of metadata value.
  13613. @item VAL
  13614. Current metadata key value.
  13615. @end table
  13616. The color is defined as 0xAABBGGRR.
  13617. @end table
  13618. Example using metadata from @ref{signalstats} filter:
  13619. @example
  13620. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13621. @end example
  13622. Example using metadata from @ref{ebur128} filter:
  13623. @example
  13624. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13625. @end example
  13626. @anchor{ebur128}
  13627. @section ebur128
  13628. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13629. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13630. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13631. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13632. The filter also has a video output (see the @var{video} option) with a real
  13633. time graph to observe the loudness evolution. The graphic contains the logged
  13634. message mentioned above, so it is not printed anymore when this option is set,
  13635. unless the verbose logging is set. The main graphing area contains the
  13636. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13637. the momentary loudness (400 milliseconds).
  13638. More information about the Loudness Recommendation EBU R128 on
  13639. @url{http://tech.ebu.ch/loudness}.
  13640. The filter accepts the following options:
  13641. @table @option
  13642. @item video
  13643. Activate the video output. The audio stream is passed unchanged whether this
  13644. option is set or no. The video stream will be the first output stream if
  13645. activated. Default is @code{0}.
  13646. @item size
  13647. Set the video size. This option is for video only. For the syntax of this
  13648. option, check the
  13649. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13650. Default and minimum resolution is @code{640x480}.
  13651. @item meter
  13652. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13653. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13654. other integer value between this range is allowed.
  13655. @item metadata
  13656. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13657. into 100ms output frames, each of them containing various loudness information
  13658. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13659. Default is @code{0}.
  13660. @item framelog
  13661. Force the frame logging level.
  13662. Available values are:
  13663. @table @samp
  13664. @item info
  13665. information logging level
  13666. @item verbose
  13667. verbose logging level
  13668. @end table
  13669. By default, the logging level is set to @var{info}. If the @option{video} or
  13670. the @option{metadata} options are set, it switches to @var{verbose}.
  13671. @item peak
  13672. Set peak mode(s).
  13673. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13674. values are:
  13675. @table @samp
  13676. @item none
  13677. Disable any peak mode (default).
  13678. @item sample
  13679. Enable sample-peak mode.
  13680. Simple peak mode looking for the higher sample value. It logs a message
  13681. for sample-peak (identified by @code{SPK}).
  13682. @item true
  13683. Enable true-peak mode.
  13684. If enabled, the peak lookup is done on an over-sampled version of the input
  13685. stream for better peak accuracy. It logs a message for true-peak.
  13686. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13687. This mode requires a build with @code{libswresample}.
  13688. @end table
  13689. @item dualmono
  13690. Treat mono input files as "dual mono". If a mono file is intended for playback
  13691. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13692. If set to @code{true}, this option will compensate for this effect.
  13693. Multi-channel input files are not affected by this option.
  13694. @item panlaw
  13695. Set a specific pan law to be used for the measurement of dual mono files.
  13696. This parameter is optional, and has a default value of -3.01dB.
  13697. @end table
  13698. @subsection Examples
  13699. @itemize
  13700. @item
  13701. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13702. @example
  13703. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13704. @end example
  13705. @item
  13706. Run an analysis with @command{ffmpeg}:
  13707. @example
  13708. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13709. @end example
  13710. @end itemize
  13711. @section interleave, ainterleave
  13712. Temporally interleave frames from several inputs.
  13713. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13714. These filters read frames from several inputs and send the oldest
  13715. queued frame to the output.
  13716. Input streams must have well defined, monotonically increasing frame
  13717. timestamp values.
  13718. In order to submit one frame to output, these filters need to enqueue
  13719. at least one frame for each input, so they cannot work in case one
  13720. input is not yet terminated and will not receive incoming frames.
  13721. For example consider the case when one input is a @code{select} filter
  13722. which always drops input frames. The @code{interleave} filter will keep
  13723. reading from that input, but it will never be able to send new frames
  13724. to output until the input sends an end-of-stream signal.
  13725. Also, depending on inputs synchronization, the filters will drop
  13726. frames in case one input receives more frames than the other ones, and
  13727. the queue is already filled.
  13728. These filters accept the following options:
  13729. @table @option
  13730. @item nb_inputs, n
  13731. Set the number of different inputs, it is 2 by default.
  13732. @end table
  13733. @subsection Examples
  13734. @itemize
  13735. @item
  13736. Interleave frames belonging to different streams using @command{ffmpeg}:
  13737. @example
  13738. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13739. @end example
  13740. @item
  13741. Add flickering blur effect:
  13742. @example
  13743. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13744. @end example
  13745. @end itemize
  13746. @section metadata, ametadata
  13747. Manipulate frame metadata.
  13748. This filter accepts the following options:
  13749. @table @option
  13750. @item mode
  13751. Set mode of operation of the filter.
  13752. Can be one of the following:
  13753. @table @samp
  13754. @item select
  13755. If both @code{value} and @code{key} is set, select frames
  13756. which have such metadata. If only @code{key} is set, select
  13757. every frame that has such key in metadata.
  13758. @item add
  13759. Add new metadata @code{key} and @code{value}. If key is already available
  13760. do nothing.
  13761. @item modify
  13762. Modify value of already present key.
  13763. @item delete
  13764. If @code{value} is set, delete only keys that have such value.
  13765. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13766. the frame.
  13767. @item print
  13768. Print key and its value if metadata was found. If @code{key} is not set print all
  13769. metadata values available in frame.
  13770. @end table
  13771. @item key
  13772. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13773. @item value
  13774. Set metadata value which will be used. This option is mandatory for
  13775. @code{modify} and @code{add} mode.
  13776. @item function
  13777. Which function to use when comparing metadata value and @code{value}.
  13778. Can be one of following:
  13779. @table @samp
  13780. @item same_str
  13781. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13782. @item starts_with
  13783. Values are interpreted as strings, returns true if metadata value starts with
  13784. the @code{value} option string.
  13785. @item less
  13786. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13787. @item equal
  13788. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13789. @item greater
  13790. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13791. @item expr
  13792. Values are interpreted as floats, returns true if expression from option @code{expr}
  13793. evaluates to true.
  13794. @end table
  13795. @item expr
  13796. Set expression which is used when @code{function} is set to @code{expr}.
  13797. The expression is evaluated through the eval API and can contain the following
  13798. constants:
  13799. @table @option
  13800. @item VALUE1
  13801. Float representation of @code{value} from metadata key.
  13802. @item VALUE2
  13803. Float representation of @code{value} as supplied by user in @code{value} option.
  13804. @end table
  13805. @item file
  13806. If specified in @code{print} mode, output is written to the named file. Instead of
  13807. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13808. for standard output. If @code{file} option is not set, output is written to the log
  13809. with AV_LOG_INFO loglevel.
  13810. @end table
  13811. @subsection Examples
  13812. @itemize
  13813. @item
  13814. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13815. between 0 and 1.
  13816. @example
  13817. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13818. @end example
  13819. @item
  13820. Print silencedetect output to file @file{metadata.txt}.
  13821. @example
  13822. silencedetect,ametadata=mode=print:file=metadata.txt
  13823. @end example
  13824. @item
  13825. Direct all metadata to a pipe with file descriptor 4.
  13826. @example
  13827. metadata=mode=print:file='pipe\:4'
  13828. @end example
  13829. @end itemize
  13830. @section perms, aperms
  13831. Set read/write permissions for the output frames.
  13832. These filters are mainly aimed at developers to test direct path in the
  13833. following filter in the filtergraph.
  13834. The filters accept the following options:
  13835. @table @option
  13836. @item mode
  13837. Select the permissions mode.
  13838. It accepts the following values:
  13839. @table @samp
  13840. @item none
  13841. Do nothing. This is the default.
  13842. @item ro
  13843. Set all the output frames read-only.
  13844. @item rw
  13845. Set all the output frames directly writable.
  13846. @item toggle
  13847. Make the frame read-only if writable, and writable if read-only.
  13848. @item random
  13849. Set each output frame read-only or writable randomly.
  13850. @end table
  13851. @item seed
  13852. Set the seed for the @var{random} mode, must be an integer included between
  13853. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13854. @code{-1}, the filter will try to use a good random seed on a best effort
  13855. basis.
  13856. @end table
  13857. Note: in case of auto-inserted filter between the permission filter and the
  13858. following one, the permission might not be received as expected in that
  13859. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13860. perms/aperms filter can avoid this problem.
  13861. @section realtime, arealtime
  13862. Slow down filtering to match real time approximately.
  13863. These filters will pause the filtering for a variable amount of time to
  13864. match the output rate with the input timestamps.
  13865. They are similar to the @option{re} option to @code{ffmpeg}.
  13866. They accept the following options:
  13867. @table @option
  13868. @item limit
  13869. Time limit for the pauses. Any pause longer than that will be considered
  13870. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13871. @end table
  13872. @anchor{select}
  13873. @section select, aselect
  13874. Select frames to pass in output.
  13875. This filter accepts the following options:
  13876. @table @option
  13877. @item expr, e
  13878. Set expression, which is evaluated for each input frame.
  13879. If the expression is evaluated to zero, the frame is discarded.
  13880. If the evaluation result is negative or NaN, the frame is sent to the
  13881. first output; otherwise it is sent to the output with index
  13882. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13883. For example a value of @code{1.2} corresponds to the output with index
  13884. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13885. @item outputs, n
  13886. Set the number of outputs. The output to which to send the selected
  13887. frame is based on the result of the evaluation. Default value is 1.
  13888. @end table
  13889. The expression can contain the following constants:
  13890. @table @option
  13891. @item n
  13892. The (sequential) number of the filtered frame, starting from 0.
  13893. @item selected_n
  13894. The (sequential) number of the selected frame, starting from 0.
  13895. @item prev_selected_n
  13896. The sequential number of the last selected frame. It's NAN if undefined.
  13897. @item TB
  13898. The timebase of the input timestamps.
  13899. @item pts
  13900. The PTS (Presentation TimeStamp) of the filtered video frame,
  13901. expressed in @var{TB} units. It's NAN if undefined.
  13902. @item t
  13903. The PTS of the filtered video frame,
  13904. expressed in seconds. It's NAN if undefined.
  13905. @item prev_pts
  13906. The PTS of the previously filtered video frame. It's NAN if undefined.
  13907. @item prev_selected_pts
  13908. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13909. @item prev_selected_t
  13910. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13911. @item start_pts
  13912. The PTS of the first video frame in the video. It's NAN if undefined.
  13913. @item start_t
  13914. The time of the first video frame in the video. It's NAN if undefined.
  13915. @item pict_type @emph{(video only)}
  13916. The type of the filtered frame. It can assume one of the following
  13917. values:
  13918. @table @option
  13919. @item I
  13920. @item P
  13921. @item B
  13922. @item S
  13923. @item SI
  13924. @item SP
  13925. @item BI
  13926. @end table
  13927. @item interlace_type @emph{(video only)}
  13928. The frame interlace type. It can assume one of the following values:
  13929. @table @option
  13930. @item PROGRESSIVE
  13931. The frame is progressive (not interlaced).
  13932. @item TOPFIRST
  13933. The frame is top-field-first.
  13934. @item BOTTOMFIRST
  13935. The frame is bottom-field-first.
  13936. @end table
  13937. @item consumed_sample_n @emph{(audio only)}
  13938. the number of selected samples before the current frame
  13939. @item samples_n @emph{(audio only)}
  13940. the number of samples in the current frame
  13941. @item sample_rate @emph{(audio only)}
  13942. the input sample rate
  13943. @item key
  13944. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13945. @item pos
  13946. the position in the file of the filtered frame, -1 if the information
  13947. is not available (e.g. for synthetic video)
  13948. @item scene @emph{(video only)}
  13949. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13950. probability for the current frame to introduce a new scene, while a higher
  13951. value means the current frame is more likely to be one (see the example below)
  13952. @item concatdec_select
  13953. The concat demuxer can select only part of a concat input file by setting an
  13954. inpoint and an outpoint, but the output packets may not be entirely contained
  13955. in the selected interval. By using this variable, it is possible to skip frames
  13956. generated by the concat demuxer which are not exactly contained in the selected
  13957. interval.
  13958. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13959. and the @var{lavf.concat.duration} packet metadata values which are also
  13960. present in the decoded frames.
  13961. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13962. start_time and either the duration metadata is missing or the frame pts is less
  13963. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13964. missing.
  13965. That basically means that an input frame is selected if its pts is within the
  13966. interval set by the concat demuxer.
  13967. @end table
  13968. The default value of the select expression is "1".
  13969. @subsection Examples
  13970. @itemize
  13971. @item
  13972. Select all frames in input:
  13973. @example
  13974. select
  13975. @end example
  13976. The example above is the same as:
  13977. @example
  13978. select=1
  13979. @end example
  13980. @item
  13981. Skip all frames:
  13982. @example
  13983. select=0
  13984. @end example
  13985. @item
  13986. Select only I-frames:
  13987. @example
  13988. select='eq(pict_type\,I)'
  13989. @end example
  13990. @item
  13991. Select one frame every 100:
  13992. @example
  13993. select='not(mod(n\,100))'
  13994. @end example
  13995. @item
  13996. Select only frames contained in the 10-20 time interval:
  13997. @example
  13998. select=between(t\,10\,20)
  13999. @end example
  14000. @item
  14001. Select only I-frames contained in the 10-20 time interval:
  14002. @example
  14003. select=between(t\,10\,20)*eq(pict_type\,I)
  14004. @end example
  14005. @item
  14006. Select frames with a minimum distance of 10 seconds:
  14007. @example
  14008. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14009. @end example
  14010. @item
  14011. Use aselect to select only audio frames with samples number > 100:
  14012. @example
  14013. aselect='gt(samples_n\,100)'
  14014. @end example
  14015. @item
  14016. Create a mosaic of the first scenes:
  14017. @example
  14018. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14019. @end example
  14020. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14021. choice.
  14022. @item
  14023. Send even and odd frames to separate outputs, and compose them:
  14024. @example
  14025. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14026. @end example
  14027. @item
  14028. Select useful frames from an ffconcat file which is using inpoints and
  14029. outpoints but where the source files are not intra frame only.
  14030. @example
  14031. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14032. @end example
  14033. @end itemize
  14034. @section sendcmd, asendcmd
  14035. Send commands to filters in the filtergraph.
  14036. These filters read commands to be sent to other filters in the
  14037. filtergraph.
  14038. @code{sendcmd} must be inserted between two video filters,
  14039. @code{asendcmd} must be inserted between two audio filters, but apart
  14040. from that they act the same way.
  14041. The specification of commands can be provided in the filter arguments
  14042. with the @var{commands} option, or in a file specified by the
  14043. @var{filename} option.
  14044. These filters accept the following options:
  14045. @table @option
  14046. @item commands, c
  14047. Set the commands to be read and sent to the other filters.
  14048. @item filename, f
  14049. Set the filename of the commands to be read and sent to the other
  14050. filters.
  14051. @end table
  14052. @subsection Commands syntax
  14053. A commands description consists of a sequence of interval
  14054. specifications, comprising a list of commands to be executed when a
  14055. particular event related to that interval occurs. The occurring event
  14056. is typically the current frame time entering or leaving a given time
  14057. interval.
  14058. An interval is specified by the following syntax:
  14059. @example
  14060. @var{START}[-@var{END}] @var{COMMANDS};
  14061. @end example
  14062. The time interval is specified by the @var{START} and @var{END} times.
  14063. @var{END} is optional and defaults to the maximum time.
  14064. The current frame time is considered within the specified interval if
  14065. it is included in the interval [@var{START}, @var{END}), that is when
  14066. the time is greater or equal to @var{START} and is lesser than
  14067. @var{END}.
  14068. @var{COMMANDS} consists of a sequence of one or more command
  14069. specifications, separated by ",", relating to that interval. The
  14070. syntax of a command specification is given by:
  14071. @example
  14072. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14073. @end example
  14074. @var{FLAGS} is optional and specifies the type of events relating to
  14075. the time interval which enable sending the specified command, and must
  14076. be a non-null sequence of identifier flags separated by "+" or "|" and
  14077. enclosed between "[" and "]".
  14078. The following flags are recognized:
  14079. @table @option
  14080. @item enter
  14081. The command is sent when the current frame timestamp enters the
  14082. specified interval. In other words, the command is sent when the
  14083. previous frame timestamp was not in the given interval, and the
  14084. current is.
  14085. @item leave
  14086. The command is sent when the current frame timestamp leaves the
  14087. specified interval. In other words, the command is sent when the
  14088. previous frame timestamp was in the given interval, and the
  14089. current is not.
  14090. @end table
  14091. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14092. assumed.
  14093. @var{TARGET} specifies the target of the command, usually the name of
  14094. the filter class or a specific filter instance name.
  14095. @var{COMMAND} specifies the name of the command for the target filter.
  14096. @var{ARG} is optional and specifies the optional list of argument for
  14097. the given @var{COMMAND}.
  14098. Between one interval specification and another, whitespaces, or
  14099. sequences of characters starting with @code{#} until the end of line,
  14100. are ignored and can be used to annotate comments.
  14101. A simplified BNF description of the commands specification syntax
  14102. follows:
  14103. @example
  14104. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14105. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14106. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14107. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14108. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14109. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14110. @end example
  14111. @subsection Examples
  14112. @itemize
  14113. @item
  14114. Specify audio tempo change at second 4:
  14115. @example
  14116. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14117. @end example
  14118. @item
  14119. Target a specific filter instance:
  14120. @example
  14121. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14122. @end example
  14123. @item
  14124. Specify a list of drawtext and hue commands in a file.
  14125. @example
  14126. # show text in the interval 5-10
  14127. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14128. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14129. # desaturate the image in the interval 15-20
  14130. 15.0-20.0 [enter] hue s 0,
  14131. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14132. [leave] hue s 1,
  14133. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14134. # apply an exponential saturation fade-out effect, starting from time 25
  14135. 25 [enter] hue s exp(25-t)
  14136. @end example
  14137. A filtergraph allowing to read and process the above command list
  14138. stored in a file @file{test.cmd}, can be specified with:
  14139. @example
  14140. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14141. @end example
  14142. @end itemize
  14143. @anchor{setpts}
  14144. @section setpts, asetpts
  14145. Change the PTS (presentation timestamp) of the input frames.
  14146. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14147. This filter accepts the following options:
  14148. @table @option
  14149. @item expr
  14150. The expression which is evaluated for each frame to construct its timestamp.
  14151. @end table
  14152. The expression is evaluated through the eval API and can contain the following
  14153. constants:
  14154. @table @option
  14155. @item FRAME_RATE
  14156. frame rate, only defined for constant frame-rate video
  14157. @item PTS
  14158. The presentation timestamp in input
  14159. @item N
  14160. The count of the input frame for video or the number of consumed samples,
  14161. not including the current frame for audio, starting from 0.
  14162. @item NB_CONSUMED_SAMPLES
  14163. The number of consumed samples, not including the current frame (only
  14164. audio)
  14165. @item NB_SAMPLES, S
  14166. The number of samples in the current frame (only audio)
  14167. @item SAMPLE_RATE, SR
  14168. The audio sample rate.
  14169. @item STARTPTS
  14170. The PTS of the first frame.
  14171. @item STARTT
  14172. the time in seconds of the first frame
  14173. @item INTERLACED
  14174. State whether the current frame is interlaced.
  14175. @item T
  14176. the time in seconds of the current frame
  14177. @item POS
  14178. original position in the file of the frame, or undefined if undefined
  14179. for the current frame
  14180. @item PREV_INPTS
  14181. The previous input PTS.
  14182. @item PREV_INT
  14183. previous input time in seconds
  14184. @item PREV_OUTPTS
  14185. The previous output PTS.
  14186. @item PREV_OUTT
  14187. previous output time in seconds
  14188. @item RTCTIME
  14189. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14190. instead.
  14191. @item RTCSTART
  14192. The wallclock (RTC) time at the start of the movie in microseconds.
  14193. @item TB
  14194. The timebase of the input timestamps.
  14195. @end table
  14196. @subsection Examples
  14197. @itemize
  14198. @item
  14199. Start counting PTS from zero
  14200. @example
  14201. setpts=PTS-STARTPTS
  14202. @end example
  14203. @item
  14204. Apply fast motion effect:
  14205. @example
  14206. setpts=0.5*PTS
  14207. @end example
  14208. @item
  14209. Apply slow motion effect:
  14210. @example
  14211. setpts=2.0*PTS
  14212. @end example
  14213. @item
  14214. Set fixed rate of 25 frames per second:
  14215. @example
  14216. setpts=N/(25*TB)
  14217. @end example
  14218. @item
  14219. Set fixed rate 25 fps with some jitter:
  14220. @example
  14221. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14222. @end example
  14223. @item
  14224. Apply an offset of 10 seconds to the input PTS:
  14225. @example
  14226. setpts=PTS+10/TB
  14227. @end example
  14228. @item
  14229. Generate timestamps from a "live source" and rebase onto the current timebase:
  14230. @example
  14231. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14232. @end example
  14233. @item
  14234. Generate timestamps by counting samples:
  14235. @example
  14236. asetpts=N/SR/TB
  14237. @end example
  14238. @end itemize
  14239. @section setrange
  14240. Force color range for the output video frame.
  14241. The @code{setrange} filter marks the color range property for the
  14242. output frames. It does not change the input frame, but only sets the
  14243. corresponding property, which affects how the frame is treated by
  14244. following filters.
  14245. The filter accepts the following options:
  14246. @table @option
  14247. @item range
  14248. Available values are:
  14249. @table @samp
  14250. @item auto
  14251. Keep the same color range property.
  14252. @item unspecified, unknown
  14253. Set the color range as unspecified.
  14254. @item limited, tv, mpeg
  14255. Set the color range as limited.
  14256. @item full, pc, jpeg
  14257. Set the color range as full.
  14258. @end table
  14259. @end table
  14260. @section settb, asettb
  14261. Set the timebase to use for the output frames timestamps.
  14262. It is mainly useful for testing timebase configuration.
  14263. It accepts the following parameters:
  14264. @table @option
  14265. @item expr, tb
  14266. The expression which is evaluated into the output timebase.
  14267. @end table
  14268. The value for @option{tb} is an arithmetic expression representing a
  14269. rational. The expression can contain the constants "AVTB" (the default
  14270. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14271. audio only). Default value is "intb".
  14272. @subsection Examples
  14273. @itemize
  14274. @item
  14275. Set the timebase to 1/25:
  14276. @example
  14277. settb=expr=1/25
  14278. @end example
  14279. @item
  14280. Set the timebase to 1/10:
  14281. @example
  14282. settb=expr=0.1
  14283. @end example
  14284. @item
  14285. Set the timebase to 1001/1000:
  14286. @example
  14287. settb=1+0.001
  14288. @end example
  14289. @item
  14290. Set the timebase to 2*intb:
  14291. @example
  14292. settb=2*intb
  14293. @end example
  14294. @item
  14295. Set the default timebase value:
  14296. @example
  14297. settb=AVTB
  14298. @end example
  14299. @end itemize
  14300. @section showcqt
  14301. Convert input audio to a video output representing frequency spectrum
  14302. logarithmically using Brown-Puckette constant Q transform algorithm with
  14303. direct frequency domain coefficient calculation (but the transform itself
  14304. is not really constant Q, instead the Q factor is actually variable/clamped),
  14305. with musical tone scale, from E0 to D#10.
  14306. The filter accepts the following options:
  14307. @table @option
  14308. @item size, s
  14309. Specify the video size for the output. It must be even. For the syntax of this option,
  14310. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14311. Default value is @code{1920x1080}.
  14312. @item fps, rate, r
  14313. Set the output frame rate. Default value is @code{25}.
  14314. @item bar_h
  14315. Set the bargraph height. It must be even. Default value is @code{-1} which
  14316. computes the bargraph height automatically.
  14317. @item axis_h
  14318. Set the axis height. It must be even. Default value is @code{-1} which computes
  14319. the axis height automatically.
  14320. @item sono_h
  14321. Set the sonogram height. It must be even. Default value is @code{-1} which
  14322. computes the sonogram height automatically.
  14323. @item fullhd
  14324. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14325. instead. Default value is @code{1}.
  14326. @item sono_v, volume
  14327. Specify the sonogram volume expression. It can contain variables:
  14328. @table @option
  14329. @item bar_v
  14330. the @var{bar_v} evaluated expression
  14331. @item frequency, freq, f
  14332. the frequency where it is evaluated
  14333. @item timeclamp, tc
  14334. the value of @var{timeclamp} option
  14335. @end table
  14336. and functions:
  14337. @table @option
  14338. @item a_weighting(f)
  14339. A-weighting of equal loudness
  14340. @item b_weighting(f)
  14341. B-weighting of equal loudness
  14342. @item c_weighting(f)
  14343. C-weighting of equal loudness.
  14344. @end table
  14345. Default value is @code{16}.
  14346. @item bar_v, volume2
  14347. Specify the bargraph volume expression. It can contain variables:
  14348. @table @option
  14349. @item sono_v
  14350. the @var{sono_v} evaluated expression
  14351. @item frequency, freq, f
  14352. the frequency where it is evaluated
  14353. @item timeclamp, tc
  14354. the value of @var{timeclamp} option
  14355. @end table
  14356. and functions:
  14357. @table @option
  14358. @item a_weighting(f)
  14359. A-weighting of equal loudness
  14360. @item b_weighting(f)
  14361. B-weighting of equal loudness
  14362. @item c_weighting(f)
  14363. C-weighting of equal loudness.
  14364. @end table
  14365. Default value is @code{sono_v}.
  14366. @item sono_g, gamma
  14367. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14368. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14369. Acceptable range is @code{[1, 7]}.
  14370. @item bar_g, gamma2
  14371. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14372. @code{[1, 7]}.
  14373. @item bar_t
  14374. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14375. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14376. @item timeclamp, tc
  14377. Specify the transform timeclamp. At low frequency, there is trade-off between
  14378. accuracy in time domain and frequency domain. If timeclamp is lower,
  14379. event in time domain is represented more accurately (such as fast bass drum),
  14380. otherwise event in frequency domain is represented more accurately
  14381. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14382. @item attack
  14383. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14384. limits future samples by applying asymmetric windowing in time domain, useful
  14385. when low latency is required. Accepted range is @code{[0, 1]}.
  14386. @item basefreq
  14387. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14388. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14389. @item endfreq
  14390. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14391. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14392. @item coeffclamp
  14393. This option is deprecated and ignored.
  14394. @item tlength
  14395. Specify the transform length in time domain. Use this option to control accuracy
  14396. trade-off between time domain and frequency domain at every frequency sample.
  14397. It can contain variables:
  14398. @table @option
  14399. @item frequency, freq, f
  14400. the frequency where it is evaluated
  14401. @item timeclamp, tc
  14402. the value of @var{timeclamp} option.
  14403. @end table
  14404. Default value is @code{384*tc/(384+tc*f)}.
  14405. @item count
  14406. Specify the transform count for every video frame. Default value is @code{6}.
  14407. Acceptable range is @code{[1, 30]}.
  14408. @item fcount
  14409. Specify the transform count for every single pixel. Default value is @code{0},
  14410. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14411. @item fontfile
  14412. Specify font file for use with freetype to draw the axis. If not specified,
  14413. use embedded font. Note that drawing with font file or embedded font is not
  14414. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14415. option instead.
  14416. @item font
  14417. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14418. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14419. @item fontcolor
  14420. Specify font color expression. This is arithmetic expression that should return
  14421. integer value 0xRRGGBB. It can contain variables:
  14422. @table @option
  14423. @item frequency, freq, f
  14424. the frequency where it is evaluated
  14425. @item timeclamp, tc
  14426. the value of @var{timeclamp} option
  14427. @end table
  14428. and functions:
  14429. @table @option
  14430. @item midi(f)
  14431. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14432. @item r(x), g(x), b(x)
  14433. red, green, and blue value of intensity x.
  14434. @end table
  14435. Default value is @code{st(0, (midi(f)-59.5)/12);
  14436. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14437. r(1-ld(1)) + b(ld(1))}.
  14438. @item axisfile
  14439. Specify image file to draw the axis. This option override @var{fontfile} and
  14440. @var{fontcolor} option.
  14441. @item axis, text
  14442. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14443. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14444. Default value is @code{1}.
  14445. @item csp
  14446. Set colorspace. The accepted values are:
  14447. @table @samp
  14448. @item unspecified
  14449. Unspecified (default)
  14450. @item bt709
  14451. BT.709
  14452. @item fcc
  14453. FCC
  14454. @item bt470bg
  14455. BT.470BG or BT.601-6 625
  14456. @item smpte170m
  14457. SMPTE-170M or BT.601-6 525
  14458. @item smpte240m
  14459. SMPTE-240M
  14460. @item bt2020ncl
  14461. BT.2020 with non-constant luminance
  14462. @end table
  14463. @item cscheme
  14464. Set spectrogram color scheme. This is list of floating point values with format
  14465. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14466. The default is @code{1|0.5|0|0|0.5|1}.
  14467. @end table
  14468. @subsection Examples
  14469. @itemize
  14470. @item
  14471. Playing audio while showing the spectrum:
  14472. @example
  14473. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14474. @end example
  14475. @item
  14476. Same as above, but with frame rate 30 fps:
  14477. @example
  14478. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14479. @end example
  14480. @item
  14481. Playing at 1280x720:
  14482. @example
  14483. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14484. @end example
  14485. @item
  14486. Disable sonogram display:
  14487. @example
  14488. sono_h=0
  14489. @end example
  14490. @item
  14491. A1 and its harmonics: A1, A2, (near)E3, A3:
  14492. @example
  14493. 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),
  14494. asplit[a][out1]; [a] showcqt [out0]'
  14495. @end example
  14496. @item
  14497. Same as above, but with more accuracy in frequency domain:
  14498. @example
  14499. 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),
  14500. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14501. @end example
  14502. @item
  14503. Custom volume:
  14504. @example
  14505. bar_v=10:sono_v=bar_v*a_weighting(f)
  14506. @end example
  14507. @item
  14508. Custom gamma, now spectrum is linear to the amplitude.
  14509. @example
  14510. bar_g=2:sono_g=2
  14511. @end example
  14512. @item
  14513. Custom tlength equation:
  14514. @example
  14515. 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)))'
  14516. @end example
  14517. @item
  14518. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14519. @example
  14520. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14521. @end example
  14522. @item
  14523. Custom font using fontconfig:
  14524. @example
  14525. font='Courier New,Monospace,mono|bold'
  14526. @end example
  14527. @item
  14528. Custom frequency range with custom axis using image file:
  14529. @example
  14530. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14531. @end example
  14532. @end itemize
  14533. @section showfreqs
  14534. Convert input audio to video output representing the audio power spectrum.
  14535. Audio amplitude is on Y-axis while frequency is on X-axis.
  14536. The filter accepts the following options:
  14537. @table @option
  14538. @item size, s
  14539. Specify size of video. For the syntax of this option, check the
  14540. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14541. Default is @code{1024x512}.
  14542. @item mode
  14543. Set display mode.
  14544. This set how each frequency bin will be represented.
  14545. It accepts the following values:
  14546. @table @samp
  14547. @item line
  14548. @item bar
  14549. @item dot
  14550. @end table
  14551. Default is @code{bar}.
  14552. @item ascale
  14553. Set amplitude scale.
  14554. It accepts the following values:
  14555. @table @samp
  14556. @item lin
  14557. Linear scale.
  14558. @item sqrt
  14559. Square root scale.
  14560. @item cbrt
  14561. Cubic root scale.
  14562. @item log
  14563. Logarithmic scale.
  14564. @end table
  14565. Default is @code{log}.
  14566. @item fscale
  14567. Set frequency scale.
  14568. It accepts the following values:
  14569. @table @samp
  14570. @item lin
  14571. Linear scale.
  14572. @item log
  14573. Logarithmic scale.
  14574. @item rlog
  14575. Reverse logarithmic scale.
  14576. @end table
  14577. Default is @code{lin}.
  14578. @item win_size
  14579. Set window size.
  14580. It accepts the following values:
  14581. @table @samp
  14582. @item w16
  14583. @item w32
  14584. @item w64
  14585. @item w128
  14586. @item w256
  14587. @item w512
  14588. @item w1024
  14589. @item w2048
  14590. @item w4096
  14591. @item w8192
  14592. @item w16384
  14593. @item w32768
  14594. @item w65536
  14595. @end table
  14596. Default is @code{w2048}
  14597. @item win_func
  14598. Set windowing function.
  14599. It accepts the following values:
  14600. @table @samp
  14601. @item rect
  14602. @item bartlett
  14603. @item hanning
  14604. @item hamming
  14605. @item blackman
  14606. @item welch
  14607. @item flattop
  14608. @item bharris
  14609. @item bnuttall
  14610. @item bhann
  14611. @item sine
  14612. @item nuttall
  14613. @item lanczos
  14614. @item gauss
  14615. @item tukey
  14616. @item dolph
  14617. @item cauchy
  14618. @item parzen
  14619. @item poisson
  14620. @end table
  14621. Default is @code{hanning}.
  14622. @item overlap
  14623. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14624. which means optimal overlap for selected window function will be picked.
  14625. @item averaging
  14626. Set time averaging. Setting this to 0 will display current maximal peaks.
  14627. Default is @code{1}, which means time averaging is disabled.
  14628. @item colors
  14629. Specify list of colors separated by space or by '|' which will be used to
  14630. draw channel frequencies. Unrecognized or missing colors will be replaced
  14631. by white color.
  14632. @item cmode
  14633. Set channel display mode.
  14634. It accepts the following values:
  14635. @table @samp
  14636. @item combined
  14637. @item separate
  14638. @end table
  14639. Default is @code{combined}.
  14640. @item minamp
  14641. Set minimum amplitude used in @code{log} amplitude scaler.
  14642. @end table
  14643. @anchor{showspectrum}
  14644. @section showspectrum
  14645. Convert input audio to a video output, representing the audio frequency
  14646. spectrum.
  14647. The filter accepts the following options:
  14648. @table @option
  14649. @item size, s
  14650. Specify the video size for the output. For the syntax of this option, check the
  14651. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14652. Default value is @code{640x512}.
  14653. @item slide
  14654. Specify how the spectrum should slide along the window.
  14655. It accepts the following values:
  14656. @table @samp
  14657. @item replace
  14658. the samples start again on the left when they reach the right
  14659. @item scroll
  14660. the samples scroll from right to left
  14661. @item fullframe
  14662. frames are only produced when the samples reach the right
  14663. @item rscroll
  14664. the samples scroll from left to right
  14665. @end table
  14666. Default value is @code{replace}.
  14667. @item mode
  14668. Specify display mode.
  14669. It accepts the following values:
  14670. @table @samp
  14671. @item combined
  14672. all channels are displayed in the same row
  14673. @item separate
  14674. all channels are displayed in separate rows
  14675. @end table
  14676. Default value is @samp{combined}.
  14677. @item color
  14678. Specify display color mode.
  14679. It accepts the following values:
  14680. @table @samp
  14681. @item channel
  14682. each channel is displayed in a separate color
  14683. @item intensity
  14684. each channel is displayed using the same color scheme
  14685. @item rainbow
  14686. each channel is displayed using the rainbow color scheme
  14687. @item moreland
  14688. each channel is displayed using the moreland color scheme
  14689. @item nebulae
  14690. each channel is displayed using the nebulae color scheme
  14691. @item fire
  14692. each channel is displayed using the fire color scheme
  14693. @item fiery
  14694. each channel is displayed using the fiery color scheme
  14695. @item fruit
  14696. each channel is displayed using the fruit color scheme
  14697. @item cool
  14698. each channel is displayed using the cool color scheme
  14699. @end table
  14700. Default value is @samp{channel}.
  14701. @item scale
  14702. Specify scale used for calculating intensity color values.
  14703. It accepts the following values:
  14704. @table @samp
  14705. @item lin
  14706. linear
  14707. @item sqrt
  14708. square root, default
  14709. @item cbrt
  14710. cubic root
  14711. @item log
  14712. logarithmic
  14713. @item 4thrt
  14714. 4th root
  14715. @item 5thrt
  14716. 5th root
  14717. @end table
  14718. Default value is @samp{sqrt}.
  14719. @item saturation
  14720. Set saturation modifier for displayed colors. Negative values provide
  14721. alternative color scheme. @code{0} is no saturation at all.
  14722. Saturation must be in [-10.0, 10.0] range.
  14723. Default value is @code{1}.
  14724. @item win_func
  14725. Set window function.
  14726. It accepts the following values:
  14727. @table @samp
  14728. @item rect
  14729. @item bartlett
  14730. @item hann
  14731. @item hanning
  14732. @item hamming
  14733. @item blackman
  14734. @item welch
  14735. @item flattop
  14736. @item bharris
  14737. @item bnuttall
  14738. @item bhann
  14739. @item sine
  14740. @item nuttall
  14741. @item lanczos
  14742. @item gauss
  14743. @item tukey
  14744. @item dolph
  14745. @item cauchy
  14746. @item parzen
  14747. @item poisson
  14748. @end table
  14749. Default value is @code{hann}.
  14750. @item orientation
  14751. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14752. @code{horizontal}. Default is @code{vertical}.
  14753. @item overlap
  14754. Set ratio of overlap window. Default value is @code{0}.
  14755. When value is @code{1} overlap is set to recommended size for specific
  14756. window function currently used.
  14757. @item gain
  14758. Set scale gain for calculating intensity color values.
  14759. Default value is @code{1}.
  14760. @item data
  14761. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14762. @item rotation
  14763. Set color rotation, must be in [-1.0, 1.0] range.
  14764. Default value is @code{0}.
  14765. @end table
  14766. The usage is very similar to the showwaves filter; see the examples in that
  14767. section.
  14768. @subsection Examples
  14769. @itemize
  14770. @item
  14771. Large window with logarithmic color scaling:
  14772. @example
  14773. showspectrum=s=1280x480:scale=log
  14774. @end example
  14775. @item
  14776. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14777. @example
  14778. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14779. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14780. @end example
  14781. @end itemize
  14782. @section showspectrumpic
  14783. Convert input audio to a single video frame, representing the audio frequency
  14784. spectrum.
  14785. The filter accepts the following options:
  14786. @table @option
  14787. @item size, s
  14788. Specify the video size for the output. For the syntax of this option, check the
  14789. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14790. Default value is @code{4096x2048}.
  14791. @item mode
  14792. Specify display mode.
  14793. It accepts the following values:
  14794. @table @samp
  14795. @item combined
  14796. all channels are displayed in the same row
  14797. @item separate
  14798. all channels are displayed in separate rows
  14799. @end table
  14800. Default value is @samp{combined}.
  14801. @item color
  14802. Specify display color mode.
  14803. It accepts the following values:
  14804. @table @samp
  14805. @item channel
  14806. each channel is displayed in a separate color
  14807. @item intensity
  14808. each channel is displayed using the same color scheme
  14809. @item rainbow
  14810. each channel is displayed using the rainbow color scheme
  14811. @item moreland
  14812. each channel is displayed using the moreland color scheme
  14813. @item nebulae
  14814. each channel is displayed using the nebulae color scheme
  14815. @item fire
  14816. each channel is displayed using the fire color scheme
  14817. @item fiery
  14818. each channel is displayed using the fiery color scheme
  14819. @item fruit
  14820. each channel is displayed using the fruit color scheme
  14821. @item cool
  14822. each channel is displayed using the cool color scheme
  14823. @end table
  14824. Default value is @samp{intensity}.
  14825. @item scale
  14826. Specify scale used for calculating intensity color values.
  14827. It accepts the following values:
  14828. @table @samp
  14829. @item lin
  14830. linear
  14831. @item sqrt
  14832. square root, default
  14833. @item cbrt
  14834. cubic root
  14835. @item log
  14836. logarithmic
  14837. @item 4thrt
  14838. 4th root
  14839. @item 5thrt
  14840. 5th root
  14841. @end table
  14842. Default value is @samp{log}.
  14843. @item saturation
  14844. Set saturation modifier for displayed colors. Negative values provide
  14845. alternative color scheme. @code{0} is no saturation at all.
  14846. Saturation must be in [-10.0, 10.0] range.
  14847. Default value is @code{1}.
  14848. @item win_func
  14849. Set window function.
  14850. It accepts the following values:
  14851. @table @samp
  14852. @item rect
  14853. @item bartlett
  14854. @item hann
  14855. @item hanning
  14856. @item hamming
  14857. @item blackman
  14858. @item welch
  14859. @item flattop
  14860. @item bharris
  14861. @item bnuttall
  14862. @item bhann
  14863. @item sine
  14864. @item nuttall
  14865. @item lanczos
  14866. @item gauss
  14867. @item tukey
  14868. @item dolph
  14869. @item cauchy
  14870. @item parzen
  14871. @item poisson
  14872. @end table
  14873. Default value is @code{hann}.
  14874. @item orientation
  14875. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14876. @code{horizontal}. Default is @code{vertical}.
  14877. @item gain
  14878. Set scale gain for calculating intensity color values.
  14879. Default value is @code{1}.
  14880. @item legend
  14881. Draw time and frequency axes and legends. Default is enabled.
  14882. @item rotation
  14883. Set color rotation, must be in [-1.0, 1.0] range.
  14884. Default value is @code{0}.
  14885. @end table
  14886. @subsection Examples
  14887. @itemize
  14888. @item
  14889. Extract an audio spectrogram of a whole audio track
  14890. in a 1024x1024 picture using @command{ffmpeg}:
  14891. @example
  14892. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14893. @end example
  14894. @end itemize
  14895. @section showvolume
  14896. Convert input audio volume to a video output.
  14897. The filter accepts the following options:
  14898. @table @option
  14899. @item rate, r
  14900. Set video rate.
  14901. @item b
  14902. Set border width, allowed range is [0, 5]. Default is 1.
  14903. @item w
  14904. Set channel width, allowed range is [80, 8192]. Default is 400.
  14905. @item h
  14906. Set channel height, allowed range is [1, 900]. Default is 20.
  14907. @item f
  14908. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14909. @item c
  14910. Set volume color expression.
  14911. The expression can use the following variables:
  14912. @table @option
  14913. @item VOLUME
  14914. Current max volume of channel in dB.
  14915. @item PEAK
  14916. Current peak.
  14917. @item CHANNEL
  14918. Current channel number, starting from 0.
  14919. @end table
  14920. @item t
  14921. If set, displays channel names. Default is enabled.
  14922. @item v
  14923. If set, displays volume values. Default is enabled.
  14924. @item o
  14925. Set orientation, can be @code{horizontal} or @code{vertical},
  14926. default is @code{horizontal}.
  14927. @item s
  14928. Set step size, allowed range s [0, 5]. Default is 0, which means
  14929. step is disabled.
  14930. @end table
  14931. @section showwaves
  14932. Convert input audio to a video output, representing the samples waves.
  14933. The filter accepts the following options:
  14934. @table @option
  14935. @item size, s
  14936. Specify the video size for the output. For the syntax of this option, check the
  14937. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14938. Default value is @code{600x240}.
  14939. @item mode
  14940. Set display mode.
  14941. Available values are:
  14942. @table @samp
  14943. @item point
  14944. Draw a point for each sample.
  14945. @item line
  14946. Draw a vertical line for each sample.
  14947. @item p2p
  14948. Draw a point for each sample and a line between them.
  14949. @item cline
  14950. Draw a centered vertical line for each sample.
  14951. @end table
  14952. Default value is @code{point}.
  14953. @item n
  14954. Set the number of samples which are printed on the same column. A
  14955. larger value will decrease the frame rate. Must be a positive
  14956. integer. This option can be set only if the value for @var{rate}
  14957. is not explicitly specified.
  14958. @item rate, r
  14959. Set the (approximate) output frame rate. This is done by setting the
  14960. option @var{n}. Default value is "25".
  14961. @item split_channels
  14962. Set if channels should be drawn separately or overlap. Default value is 0.
  14963. @item colors
  14964. Set colors separated by '|' which are going to be used for drawing of each channel.
  14965. @item scale
  14966. Set amplitude scale.
  14967. Available values are:
  14968. @table @samp
  14969. @item lin
  14970. Linear.
  14971. @item log
  14972. Logarithmic.
  14973. @item sqrt
  14974. Square root.
  14975. @item cbrt
  14976. Cubic root.
  14977. @end table
  14978. Default is linear.
  14979. @end table
  14980. @subsection Examples
  14981. @itemize
  14982. @item
  14983. Output the input file audio and the corresponding video representation
  14984. at the same time:
  14985. @example
  14986. amovie=a.mp3,asplit[out0],showwaves[out1]
  14987. @end example
  14988. @item
  14989. Create a synthetic signal and show it with showwaves, forcing a
  14990. frame rate of 30 frames per second:
  14991. @example
  14992. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14993. @end example
  14994. @end itemize
  14995. @section showwavespic
  14996. Convert input audio to a single video frame, representing the samples waves.
  14997. The filter accepts the following options:
  14998. @table @option
  14999. @item size, s
  15000. Specify the video size for the output. For the syntax of this option, check the
  15001. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15002. Default value is @code{600x240}.
  15003. @item split_channels
  15004. Set if channels should be drawn separately or overlap. Default value is 0.
  15005. @item colors
  15006. Set colors separated by '|' which are going to be used for drawing of each channel.
  15007. @item scale
  15008. Set amplitude scale.
  15009. Available values are:
  15010. @table @samp
  15011. @item lin
  15012. Linear.
  15013. @item log
  15014. Logarithmic.
  15015. @item sqrt
  15016. Square root.
  15017. @item cbrt
  15018. Cubic root.
  15019. @end table
  15020. Default is linear.
  15021. @end table
  15022. @subsection Examples
  15023. @itemize
  15024. @item
  15025. Extract a channel split representation of the wave form of a whole audio track
  15026. in a 1024x800 picture using @command{ffmpeg}:
  15027. @example
  15028. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15029. @end example
  15030. @end itemize
  15031. @section sidedata, asidedata
  15032. Delete frame side data, or select frames based on it.
  15033. This filter accepts the following options:
  15034. @table @option
  15035. @item mode
  15036. Set mode of operation of the filter.
  15037. Can be one of the following:
  15038. @table @samp
  15039. @item select
  15040. Select every frame with side data of @code{type}.
  15041. @item delete
  15042. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15043. data in the frame.
  15044. @end table
  15045. @item type
  15046. Set side data type used with all modes. Must be set for @code{select} mode. For
  15047. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15048. in @file{libavutil/frame.h}. For example, to choose
  15049. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15050. @end table
  15051. @section spectrumsynth
  15052. Sythesize audio from 2 input video spectrums, first input stream represents
  15053. magnitude across time and second represents phase across time.
  15054. The filter will transform from frequency domain as displayed in videos back
  15055. to time domain as presented in audio output.
  15056. This filter is primarily created for reversing processed @ref{showspectrum}
  15057. filter outputs, but can synthesize sound from other spectrograms too.
  15058. But in such case results are going to be poor if the phase data is not
  15059. available, because in such cases phase data need to be recreated, usually
  15060. its just recreated from random noise.
  15061. For best results use gray only output (@code{channel} color mode in
  15062. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15063. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15064. @code{data} option. Inputs videos should generally use @code{fullframe}
  15065. slide mode as that saves resources needed for decoding video.
  15066. The filter accepts the following options:
  15067. @table @option
  15068. @item sample_rate
  15069. Specify sample rate of output audio, the sample rate of audio from which
  15070. spectrum was generated may differ.
  15071. @item channels
  15072. Set number of channels represented in input video spectrums.
  15073. @item scale
  15074. Set scale which was used when generating magnitude input spectrum.
  15075. Can be @code{lin} or @code{log}. Default is @code{log}.
  15076. @item slide
  15077. Set slide which was used when generating inputs spectrums.
  15078. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15079. Default is @code{fullframe}.
  15080. @item win_func
  15081. Set window function used for resynthesis.
  15082. @item overlap
  15083. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15084. which means optimal overlap for selected window function will be picked.
  15085. @item orientation
  15086. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15087. Default is @code{vertical}.
  15088. @end table
  15089. @subsection Examples
  15090. @itemize
  15091. @item
  15092. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15093. then resynthesize videos back to audio with spectrumsynth:
  15094. @example
  15095. 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
  15096. 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
  15097. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15098. @end example
  15099. @end itemize
  15100. @section split, asplit
  15101. Split input into several identical outputs.
  15102. @code{asplit} works with audio input, @code{split} with video.
  15103. The filter accepts a single parameter which specifies the number of outputs. If
  15104. unspecified, it defaults to 2.
  15105. @subsection Examples
  15106. @itemize
  15107. @item
  15108. Create two separate outputs from the same input:
  15109. @example
  15110. [in] split [out0][out1]
  15111. @end example
  15112. @item
  15113. To create 3 or more outputs, you need to specify the number of
  15114. outputs, like in:
  15115. @example
  15116. [in] asplit=3 [out0][out1][out2]
  15117. @end example
  15118. @item
  15119. Create two separate outputs from the same input, one cropped and
  15120. one padded:
  15121. @example
  15122. [in] split [splitout1][splitout2];
  15123. [splitout1] crop=100:100:0:0 [cropout];
  15124. [splitout2] pad=200:200:100:100 [padout];
  15125. @end example
  15126. @item
  15127. Create 5 copies of the input audio with @command{ffmpeg}:
  15128. @example
  15129. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15130. @end example
  15131. @end itemize
  15132. @section zmq, azmq
  15133. Receive commands sent through a libzmq client, and forward them to
  15134. filters in the filtergraph.
  15135. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15136. must be inserted between two video filters, @code{azmq} between two
  15137. audio filters.
  15138. To enable these filters you need to install the libzmq library and
  15139. headers and configure FFmpeg with @code{--enable-libzmq}.
  15140. For more information about libzmq see:
  15141. @url{http://www.zeromq.org/}
  15142. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15143. receives messages sent through a network interface defined by the
  15144. @option{bind_address} option.
  15145. The received message must be in the form:
  15146. @example
  15147. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15148. @end example
  15149. @var{TARGET} specifies the target of the command, usually the name of
  15150. the filter class or a specific filter instance name.
  15151. @var{COMMAND} specifies the name of the command for the target filter.
  15152. @var{ARG} is optional and specifies the optional argument list for the
  15153. given @var{COMMAND}.
  15154. Upon reception, the message is processed and the corresponding command
  15155. is injected into the filtergraph. Depending on the result, the filter
  15156. will send a reply to the client, adopting the format:
  15157. @example
  15158. @var{ERROR_CODE} @var{ERROR_REASON}
  15159. @var{MESSAGE}
  15160. @end example
  15161. @var{MESSAGE} is optional.
  15162. @subsection Examples
  15163. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15164. be used to send commands processed by these filters.
  15165. Consider the following filtergraph generated by @command{ffplay}
  15166. @example
  15167. ffplay -dumpgraph 1 -f lavfi "
  15168. color=s=100x100:c=red [l];
  15169. color=s=100x100:c=blue [r];
  15170. nullsrc=s=200x100, zmq [bg];
  15171. [bg][l] overlay [bg+l];
  15172. [bg+l][r] overlay=x=100 "
  15173. @end example
  15174. To change the color of the left side of the video, the following
  15175. command can be used:
  15176. @example
  15177. echo Parsed_color_0 c yellow | tools/zmqsend
  15178. @end example
  15179. To change the right side:
  15180. @example
  15181. echo Parsed_color_1 c pink | tools/zmqsend
  15182. @end example
  15183. @c man end MULTIMEDIA FILTERS
  15184. @chapter Multimedia Sources
  15185. @c man begin MULTIMEDIA SOURCES
  15186. Below is a description of the currently available multimedia sources.
  15187. @section amovie
  15188. This is the same as @ref{movie} source, except it selects an audio
  15189. stream by default.
  15190. @anchor{movie}
  15191. @section movie
  15192. Read audio and/or video stream(s) from a movie container.
  15193. It accepts the following parameters:
  15194. @table @option
  15195. @item filename
  15196. The name of the resource to read (not necessarily a file; it can also be a
  15197. device or a stream accessed through some protocol).
  15198. @item format_name, f
  15199. Specifies the format assumed for the movie to read, and can be either
  15200. the name of a container or an input device. If not specified, the
  15201. format is guessed from @var{movie_name} or by probing.
  15202. @item seek_point, sp
  15203. Specifies the seek point in seconds. The frames will be output
  15204. starting from this seek point. The parameter is evaluated with
  15205. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15206. postfix. The default value is "0".
  15207. @item streams, s
  15208. Specifies the streams to read. Several streams can be specified,
  15209. separated by "+". The source will then have as many outputs, in the
  15210. same order. The syntax is explained in the ``Stream specifiers''
  15211. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15212. respectively the default (best suited) video and audio stream. Default
  15213. is "dv", or "da" if the filter is called as "amovie".
  15214. @item stream_index, si
  15215. Specifies the index of the video stream to read. If the value is -1,
  15216. the most suitable video stream will be automatically selected. The default
  15217. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15218. audio instead of video.
  15219. @item loop
  15220. Specifies how many times to read the stream in sequence.
  15221. If the value is 0, the stream will be looped infinitely.
  15222. Default value is "1".
  15223. Note that when the movie is looped the source timestamps are not
  15224. changed, so it will generate non monotonically increasing timestamps.
  15225. @item discontinuity
  15226. Specifies the time difference between frames above which the point is
  15227. considered a timestamp discontinuity which is removed by adjusting the later
  15228. timestamps.
  15229. @end table
  15230. It allows overlaying a second video on top of the main input of
  15231. a filtergraph, as shown in this graph:
  15232. @example
  15233. input -----------> deltapts0 --> overlay --> output
  15234. ^
  15235. |
  15236. movie --> scale--> deltapts1 -------+
  15237. @end example
  15238. @subsection Examples
  15239. @itemize
  15240. @item
  15241. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15242. on top of the input labelled "in":
  15243. @example
  15244. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15245. [in] setpts=PTS-STARTPTS [main];
  15246. [main][over] overlay=16:16 [out]
  15247. @end example
  15248. @item
  15249. Read from a video4linux2 device, and overlay it on top of the input
  15250. labelled "in":
  15251. @example
  15252. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15253. [in] setpts=PTS-STARTPTS [main];
  15254. [main][over] overlay=16:16 [out]
  15255. @end example
  15256. @item
  15257. Read the first video stream and the audio stream with id 0x81 from
  15258. dvd.vob; the video is connected to the pad named "video" and the audio is
  15259. connected to the pad named "audio":
  15260. @example
  15261. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15262. @end example
  15263. @end itemize
  15264. @subsection Commands
  15265. Both movie and amovie support the following commands:
  15266. @table @option
  15267. @item seek
  15268. Perform seek using "av_seek_frame".
  15269. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15270. @itemize
  15271. @item
  15272. @var{stream_index}: If stream_index is -1, a default
  15273. stream is selected, and @var{timestamp} is automatically converted
  15274. from AV_TIME_BASE units to the stream specific time_base.
  15275. @item
  15276. @var{timestamp}: Timestamp in AVStream.time_base units
  15277. or, if no stream is specified, in AV_TIME_BASE units.
  15278. @item
  15279. @var{flags}: Flags which select direction and seeking mode.
  15280. @end itemize
  15281. @item get_duration
  15282. Get movie duration in AV_TIME_BASE units.
  15283. @end table
  15284. @c man end MULTIMEDIA SOURCES